-
Notifications
You must be signed in to change notification settings - Fork 15
REP-5274 Compare full index specs rather than just a subset. #50
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
REP-5274 Compare full index specs rather than just a subset. #50
Conversation
tdq45gj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| Field: "ExpireAfterSeconds", | ||
| Details: Mismatch + fmt.Sprintf(" : src: %s, dst: %s", nilableToString(srcSpec.ExpireAfterSeconds), nilableToString(dstSpec.ExpireAfterSeconds))}) | ||
| // Next check to see if the only differences are type differences. | ||
| // If we didn’t support pre-v5 servers we could use a $documents aggregation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can reasonably limit the metadata cluster to post-v5 versions, but probably doesn't worth to do only for $document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahhh, right! I’d overlooked that this is the metadata cluster. Totally worth it, then, IMO.
Co-authored-by: Jian Guan <[email protected]>
…ion-verifier into REP-5274-index-comparison
Previously migration-verifier only checked the parts of index specs that go in a mongo.IndexSpecification. That struct is incomplete, though; it doesn’t, for example, include partial index filters. Thus, migration-verifier didn’t compare those parts of an index specification.
This changeset alters the index-checking logic to check full index specifications. Note that this comparison is rather “coarse” and may flag some specifications as mismatching when they actually produce the same index. For example,
{foo: 1}and{foo: 2}actually produce the same index, but migration-verifier will flag them as mismatches. Eventually we hope to fix that, but for now false positives are safer than incomplete checks.This also replaces use of mongo.CollectionSpecification with a struct that allows detection of unrecognized fields. Thus we’ll avoid a similar problem for collection specifications.
This also copies over mongosync’s Option implementation.