Info
It's possible for a collection to be sharded for some period of time before the shard knows that the collection is sharded. Because of this, it's possible for insert notifications to be generated without the shard key for a period of time after the collection has been sharded.
When the change stream is resumed, it might be resuming on one of these changes, at a future point when the shard knows that the collection is sharded. When this happens, the resume token will not include the full shard key in the documentKey, but the new generated change which we compare the resume token to will. We should allow resuming in this case if the _ids match. This is safe because there must not have been any chunk migrations up until this point (or the shard would have known the collection was sharded, generating shard keys in the documentKey), so the _id should still be unique.
Top User Comments
xgen-internal-githook commented on Fri, 6 Apr 2018 01:56:04 +0000:
Author:
{'email': 'bernard.gorman@gmail.com', 'name': 'Bernard Gorman', 'username': 'gormanb'}
Message: SERVER-34090 Allow resuming change stream when resume token's document key does not contain the shard key
Branch: master
https://github.com/mongodb/mongo/commit/41084e8f0fa354a9efc28a354321200e94a2fcf6