PCSM-200: Set simple collation for bulk writes on sharded collections for target below 8.0 #152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
In replication PCSM is collecting all CRUD events in memory and then sending them in bulk to the target cluster. For a sharded collection that has a non-default collation for MongoDB versions below 8, when performing a bulk write operation it fails with:
In order to solve this, bulk write operation for this case has to hold collation specified to
locale:simple, something like thisSolution
Update the catalog so that it holds a
shardedfield for sharded collection so PCSM knows from the catalog that it is a sharded collection. This will most likely be used in the future when working on improving sharding support.Besides this field now, based on the target version,
collectionBulkWriteandcliendBulkWritestructs will hold auseSimpleCollationflag.With these two new fields, now when we read some CRUD event, we can determine to add a collation
locale:simpleoption to the bulk write command.