Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOOLS-3411 Fix issue where sort order of views was not always preserved on dump #618

Merged
merged 5 commits into from Nov 8, 2023

Conversation

jddubois
Copy link
Collaborator

@jddubois jddubois commented Nov 6, 2023

Fixes an issue where mongodump did not always preserve the order of options for a view or collection. This could result in different sort orders than expected on views. It is easily fixed by moving from the unordered bson.M type to the ordered bson.D type for collection options. Index options are still a bson.M, but the keys are bson.D so they are not affected by this issue.

I tested manually by viewing the metadata JSON files produced by mongodump on both this branch and master. I also verified that the added test succeeds every time on this branch, but fails most of the time on master.

@jddubois jddubois changed the title TOOLS-3411 Fix issue where sort order of views was not always preserved TOOLS-3411 Fix issue where sort order of views was not always preserved on dump Nov 7, 2023
@jddubois jddubois marked this pull request as ready for review November 7, 2023 01:01
{Key: "score", Value: 1},
}}},
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the original bug of reordering is probabilistic, can we shuffle the pipeline in this test to test different orderings?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can make the test reliably fail when there is an issue by just running the body of the test in a loop, which might be a bit easier than trying to shuffle the bson? What do you think about that?

Copy link
Member

@tfogo tfogo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jddubois jddubois requested a review from tdq45gj November 7, 2023 23:21
Copy link
Contributor

@tdq45gj tdq45gj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM

@jddubois jddubois merged commit dc898da into master Nov 8, 2023
5 checks passed
@jddubois jddubois deleted the REP-3411 branch November 8, 2023 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants