Skip to content

Conversation

timvisee
Copy link
Member

@timvisee timvisee commented Mar 20, 2025

Similar to #6210.

Shard key mappings were not applied properly in some places when using a consensus snapshot. This fixes the issue.

Some key places that were forgotten:

  • we have two fields for shard key mappings, one being the inverse - we only updated one of those fields
  • replica sets also have a shard key field, we did not set it at all
  • shard key mappings are sometimes known during collection creation, set it right away

A proper test for this is implemented in #6213.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

@timvisee timvisee requested review from generall, ffuugoo and coszio March 20, 2025 16:53
@timvisee timvisee marked this pull request as ready for review March 20, 2025 16:53

This comment was marked as resolved.

@timvisee timvisee merged commit 5aead9c into dev Mar 21, 2025
17 checks passed
@timvisee timvisee deleted the fix-consensus-snapshot-shard-key-application branch March 21, 2025 08:33
timvisee added a commit that referenced this pull request Mar 21, 2025
* Propagate shard key mapping wrapper deeper

* Also bump reverse shard mapping when applying shard keys from snapshot

* Also apply new shard key mappings to existing replicas

* Apply shard key to replica set through apply_state directly

* Set both new shard key mappings through utility function

* Set shard key mappings directly during directory creation

* Rename get_key to key

* Update comment
@timvisee timvisee mentioned this pull request Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants