[SERVER-44454] updateZoneKeyRange is inconsistent with updating and deleting tags when tag ranges are prefix for shard key Created: 06/Nov/19  Updated: 06/Dec/22  Resolved: 06/Nov/19

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

Type: Bug Priority: Major - P3
Reporter: Arun Banala Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-44283 Change removeKeyRangeFromZone to use ... Closed
Assigned Teams:
Sharding
Operating System: ALL
Steps To Reproduce:

mongos> sh.shardCollection("test.c" , {a: 1, b: 1})
{
    "collectionsharded" : "test.c",
    "collectionUUID" : UUID("5c33de36-7f4a-4cc0-bdf1-b8101a7d34b1"),
    "ok" : 1,
    "operationTime" : Timestamp(1573048485, 13),
    "$clusterTime" : {
        "clusterTime" : Timestamp(1573048485, 13),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    }
}
mongos> use admin
mongos> sh.addShardToZone("shard01", "zone1")
{
    "ok" : 1,
    "operationTime" : Timestamp(1573048597, 1),
    "$clusterTime" : {
        "clusterTime" : Timestamp(1573048597, 1),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    }
}
mongos> db.runCommand({updateZoneKeyRange: "test.c" , min : {a: 1}, max: {a: 2}, zone: "zone1"}) 
{
    "ok" : 1,
    "operationTime" : Timestamp(1573048606, 8),
    "$clusterTime" : {
        "clusterTime" : Timestamp(1573048606, 8),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    }
}
 
mongos> db.runCommand({updateZoneKeyRange: "test.c" , min : {a: 1}, max: {a: 2}, zone: null}) // Command succeeds but doesn't delete the tag range.
{
    "ok" : 1,
    "operationTime" : Timestamp(1573049199, 1),
    "$clusterTime" : {
        "clusterTime" : Timestamp(1573049199, 1),
        "signature" : {
            "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
            "keyId" : NumberLong(0)
        }
    }
}
mongos> db.getSiblingDB("config").tags.find()
{ "_id" : ObjectId("5dc2d11e8bc365c6f4466713"), "ns" : "test.c", "min" : { "a" : 1, "b" : { "$minKey" : 1 } }, "max" : { "a" : 2, "b" : { "$minKey" : 1 } }, "tag" : "zone1" }
mongos> db.runCommand({updateZoneKeyRange: "test.c" , min : {a: 1, b: MinKey}, max: {a: 2, b: MinKey}, zone: null}) // Deletes the tag range.
{
	"ok" : 1,
	"operationTime" : Timestamp(1573049663, 1),
	"$clusterTime" : {
		"clusterTime" : Timestamp(1573049663, 1),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	}
}
mongos> db.getSiblingDB("config").tags.find({min: {a: 1, b : MinKey}})
mongos>

Participants:

 Description   

If we define a tag range based prefix of a shard key, the updateZoneKeyRange command fills in 'MinKey' for all the missing shard key fields when updating a tag range. But it doesn't do that when deleting. Users would have to specify the full shard key by adding in 'MinKey' for the missing fields.

It would be helpful if the docs for updateZoneKeyRange also mentions this.



 Comments   
Comment by Blake Oler [ 06/Nov/19 ]

Good catch arun.banala, closing as a duplicate of a ticket created a short while ago.

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