-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Schema migration to ensure sentinel rows exist #1911
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
Conversation
Note that I've moved sentinel row encoding and decoding on |
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
*/ | ||
const LevelDbMigrations::SchemaVersion kSchemaVersion = 3; | ||
const LevelDbMigrations::SchemaVersion kSchemaVersion = 4; |
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.
Is it worth attempting to keep the migration numbers in sync with the other clients?
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.
We would have to implement held-write-acks removal before this, which I don't think is a worthwhile delay.
* Given an encoded sentinel row, return the sequence number. | ||
*/ | ||
static model::ListenSequenceNumber DecodeSentinel( | ||
const absl::string_view& slice); |
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.
absl::string_view
is intended to be passed by value (it's just a pointer and a size, which is cheaper to just copy rather than take a reference).
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.
Ensures that we have a sequence number written down for each document in the remote document cache. We already have the code to sequence numbers for new documents (via target updates, mutations, and limbo resolutions). However, we have never gone back to make sure existing documents have sequence numbers.
This migration will stamp the highest sequence number observed onto each remote document which does not yet have a sentinel row.