Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-82025

A update without shard key that no-ops does not report error about 'c' field being unsupported for non-pipeline updates

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Cluster Scalability
    • ALL
    • Hide

      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.)

      Show
      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.)
    • 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, Cluster Scalability 2024-3-4, Cluster Scalability 2024-3-18, Cluster Scalability 2024-4-1, Cluster Scalability 2024-4-15, Cluster Scalability 2024-4-29, Cluster Scalability 2024-5-13

      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. 

            Assignee:
            jason.zhang@mongodb.com Jason Zhang
            Reporter:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: