[SERVER-79889] Issue with FLE2 update (with upsert: true) on sharded_collections_jscore_passthrough. Created: 09/Aug/23  Updated: 21/Aug/23  Resolved: 21/Aug/23

Status: Closed
Project: Core Server
Component/s: Queryable Encryption
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Frederic Vitzikam Assignee: Erwin Pe
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-79520 QE fails with sharded upsert on non-s... Closed
Duplicate
is duplicated by SERVER-79520 QE fails with sharded upsert on non-s... Closed
Assigned Teams:
Server Security
Sprint: Security 2023-09-04
Participants:

 Description   

This comes from a bulkWrite test but still fails when I moved from a bulkWrite update to a normal update like below:

/**
 * Test that bulkWrite update works with FLE2.
 *
 * Some of the tests are incompatible with the transaction overrides since any failure
 * will cause a transaction abortion which will make the overrides infinite loop.
 *
 * The test runs commands that are not allowed with security token: bulkWrite.
 * @tags: [
 *   not_allowed_with_security_token,
 *   command_not_supported_in_serverless,
 *   does_not_support_transactions,
 *   # TODO SERVER-52419 Remove this tag.
 *   featureFlagBulkWriteCommand,
 * ]
 */
import {
	assertIsIndexedEncryptedField,
	assertIsUnindexedEncryptedField,
	EncryptedClient,
	kSafeContentField
} from "jstests/fle2/libs/encrypted_client_util.js";
import {cursorEntryValidator} from "jstests/libs/bulk_write_utils.js";
 
let dbName = 'basic_update';
let dbTest = db.getSiblingDB(dbName);
dbTest.dropDatabase();
 
let client = new EncryptedClient(db.getMongo(), dbName);
 
assert.commandWorked(client.createEncryptionCollection("basic", {
	validator: {$jsonSchema: {required: ["first", "aka"]}},
	encryptedFields: {
		"fields": [
			{"path": "first", "bsonType": "string", "queries": {"queryType": "equality"}},
			{"path": "middle", "bsonType": "string"},
			{"path": "aka", "bsonType": "string", "queries": {"queryType": "equality"}},
		]
	}
}));
 
let edb = client.getDB();
 
let res = assert.commandWorked(edb.runCommand({
	update: "basic",
	updates: [{
		q: {_id: 2},
		u: {$set: {"first": "bob", "middle": "belcher", "aka": "bobs burgers"}},
		upsert: true
	}]
}));

Error is:

2023-08-07T20:23:31.770Z assert: command failed: {
	"nModified" : 0,
	"n" : 0,
	"opTime" : Timestamp(1691439811, 12),
	"writeErrors" : [
		{
			"index" : 0,
			"code" : 2,
			"errmsg" : "Cannot insert a document with field name __safeContent__"
		}
	],
	"ok" : 1,
	"$clusterTime" : {
		"clusterTime" : Timestamp(1691439811, 14),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	},
	"operationTime" : Timestamp(1691439811, 12)
} with original command request: {
	"update" : "basic",
	"updates" : [
		{
			"q" : {
				"_id" : 2
			},
			"u" : {
				"$set" : {
					"first" : "bob",
					"middle" : "belcher",
					"aka" : "bobs burgers"
				}
			},
			"upsert" : true
		}
	],
	"lsid" : {
		"id" : UUID("abff21cc-6b61-4105-b0f3-2bad233a713a")
	},
	"$clusterTime" : {
		"clusterTime" : Timestamp(1691439811, 9),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
} on connection: connection to localhost:20003

The same test has no issue on fle2_sharding.

The original patch failure is here.



 Comments   
Comment by Erwin Pe [ 21/Aug/23 ]

Fixed in SERVER-79520

Comment by Shreyas Kalyan [ 10/Aug/23 ]

As per Mark's comment, will leave this as blocked by SERVER-79520.

Comment by Mark Benvenuto [ 09/Aug/23 ]

Likely dup of SERVER-79520

Comment by Frederic Vitzikam [ 09/Aug/23 ]

It also breaks on sharded_collections_jscore_passthrough_with_config_shard.

Generated at Thu Feb 08 06:42:10 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.