-
Notifications
You must be signed in to change notification settings - Fork 137
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
SERVER-98272 Create remediation for if the timestamp embedded in the bucket's ID does not match the control.min timestamp #144
base: master
Are you sure you want to change the base?
Conversation
print( | ||
'Validating that there are no buckets that have a mismatched embedded bucket id timestamp and control.min timestamp ...\n'); | ||
db.getMongo().setReadPref('secondaryPreferred'); | ||
const validateRes = coll.validate(); |
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.
Should this use {background:true}
for the validation step? Considering this will run on live customer clusters and will take time to execute.
} | ||
|
||
print( | ||
'\nScript successfully fixed have a mismatched embedded bucket id timestamp and control.min timestamp!'); |
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.
Remove have
here (I think). This log line also implies (semantically) that it only fixed a single bucket.
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.
Overall, the script worked for me, although I had difficulty validating exactly what changed. My feedback for the script at a high level would be to make the logged output more meaningful, and slightly less noisy if possible. Perhaps only logging when we detect an actual mismatch.
// b) Insert the measurements back into the collection. These will go into | ||
// new buckets. | ||
// c) Delete the mismatched embedded bucket id timestamp and |
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.
[nit] If we update the wording in the README, we should also update it here.
Thanks for the feedback! Deleted some redundant log lines and changed the validate to be with |
const oidTimestamp = bucket._id.getTimestamp(); | ||
const controlMinTimestamp = bucket.control.min.t | ||
|
||
if (oidTimestamp != controlMinTimestamp) { |
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.
This should take extended range dates into account. We shouldn't reinsert all data with extended range.
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.
Done, and tested using extended range docs from timeseries_filter_extended_range.js and ensuring that they don't get overwritten.
// Prior to v8.1, buckets that have a mismatched embedded bucket id timestamp | ||
// and control.min timestamp will lead to a warning during validation. | ||
// | ||
if (validateRes.errors.length != 0 || validateRes.warnings.length != 0) { |
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.
Can we compare the actual error/warning output? I don't want unrelated warnings to report that there still exist buckets with mismatched _id
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.
Added checking for the correct log id for bucket version mismatch as well.
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.
The script itself looks good to me! Nice work Stephanie
|
||
// If this collection has extended-range measurements, we cannot assert that | ||
// the minTimestamp matches the embedded timestamp. | ||
print(controlMinTimestamp == oidTimestamp) |
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.
If we want to keep this log in for each measurement, should we maybe add more detail to it? More-so than just True/False.
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.
Sorry, this was a debugging print I forgot to remove 😅 . Thanks for pointing it out!
…specific log id in errors/warnings
Tested on the following cases:
Additional improvements:
{background: true}
during validation.