[SERVER-82025] A update without shard key that no-ops does not report error about 'c' field being unsupported for non-pipeline updates Created: 09/Oct/23  Updated: 05/Feb/24

Status: Open
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Kaitlin Mahar Assignee: Jason Zhang
Resolution: Unresolved Votes: 0
Labels: sharding-nyc-subteam3
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding NYC
Operating System: ALL
Steps To Reproduce:

Run the following update on an empty collection that is sharded across multiple shards (e.g. in the sharded_collections_jscore_passthrough suite):

var res = db.runCommand({
    update: 'coll',
    updates: [{
        q: {$expr: {$eq: ["$skey", "MongoDB"]}},
        u: {skey: "$$targetKey"},
        c: {targetKey: "MongoDB2"}
    }]
});

We get an ok:1 response but should expect an error "Constant values may only be specified for pipeline updates", like:

{
	"nModified" : 0,
	"n" : 0,
	"writeErrors" : [
		{
			"index" : 0,
			"code" : 51198,
			"errmsg" : "Write results unavailable from failing to target a host in the shard shard-rs0 :: caused by :: Constant values may only be specified for pipeline updates"
		}
	],
	"ok" : 1,
	"$clusterTime" : {
		"clusterTime" : Timestamp(1696889411, 60),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	},
	"operationTime" : Timestamp(1696889411, 58)
}

(That is the error output you get when the update does match document(s) in the collection.)

Sprint: Cluster Scalability 2023-11-13, Cluster Scalability 2023-11-27, Cluster Scalability 2023-12-11, Cluster Scalability 2023-12-25, Cluster Scalability 2024-1-8, Cluster Scalability 2024-1-22, Cluster Scalability 2024-2-5, Cluster Scalability 2024-2-19
Participants:

 Description   

For a non-pipeline update that uses the 'c' field, if we actually end up targeting any shards, we end up getting an error stating that isn't supported. 

However, if the update doesn't end up being sent to any shards because it is a write without shard key and we find no shards to target via the read phase in the two-phase write protocol, then we do not error. 


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