Priority: Major - P3
Resolution: Works as Designed
Affects Version/s: 2.4.3
Fix Version/s: None
We're using 2.4.3.
We have a compound shard key, composed of a 'token' that's represented by an 8-digit int and an _id type field that's a hashed value. To be clear, we are NOT using shard-key hashing.
An example shard key might look like:
With no tag ranges in place the data seems to distribute pretty well. But we want to use tag aware sharding.
Assuming we have shards tagged 'A' and 'B', if we define tag ranges that look like:
All the data ends up on just one shard.
If we define tag ranges that look like:
MongoDB complains (in the log) that the tag ranges are not valid.
If we use MinKey everywhere instead of MaxKey:
The complaints go away but all the data still ends up on one shard.
The token field is constructed in such a way that we can pretty much guarantee that there will never be a token < 11000000 or a token greater than a certain number. We put in rules to handle those cases anyway.
We have plenty of data and there are lots of chunks being created. The chunks seem to be getting split very nicely within the ranges.
Ideally, the first example would work since for the purposes of shard tagging we do not care about the _id value. But it does not.
Either we just can't figure out how to define the tag ranges appropriately, or MongoDB just doesn't respect tag ranges in conjunction with a compound shard key.
Any help would be appreciated.