-
Notifications
You must be signed in to change notification settings - Fork 73
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
CBL-6597: The proposeChange not include remote revision id for the up… #2200
Conversation
…dated doc when using version vector When makeing a copy of a VectorDocument, we need to make up the effect of flag kSync.
Code Coverage Results:
|
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 change duplicates what's already done in VectorRecord::readRecordExtra.
If for some reason that code isn't doing the job, we should figure out why and fix it.
As I commented in the code, VectorRecord::readRecordExtra does try to get _revisions from extraDoc. However, extraDoc does not the revision. For document that has kSynced flagged, it gets the revision from current and clear the flag. When this VectorRecord (srcRecord) is the source for a new VectorRecord, we encounter the situation whereby
Therefore, VectorRecord::readRecordExtra won't get the revisions. What the PR does is to recognize the possibility that the srcRecord is the result of flag kSynced. |
- Introduce a new flag and move the fix closer to the issue based on the review.
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 isn't the fix I described in Slack yesterday. Let me be more detailed.
- Add
bool VectorRecord::_wasSynced {false};
. You did that. - When detecting and clearing the kSynced flag, set
_wasSynced
to true. - In the
originalRecord()
method, if_wasSynced
is true, set the kSynced flag of the Record being created.
That's it. There's no need to change the copy constructor or any method signature.
I did (1) and (2). The tricky thing is how to parse _wasSync from other to this in the following,
without the new argument, wasSynced, the delegated constructor, VectorRecord(KeyStore, Record). The actual argument if to avoid adding a new flag in Record. That was actual my first implementation. Later I found the flag in Record is no so natural. When will that flag be cleared, for example. Maybe we can assume this is the only occasion for the flag and not worry to reset it. I can do it. Manage of VectorRecord:_wasSynced seems clear: it is set when _kSynced is cleared, on unset whenever setRemoteRevision(1, ?) is called, because if it is called not due to kSynced, we shouldn't apply the logic when kSynced true and cleared afterwards. _wasSynced is transitive. It is only used in the copy constructor. Is the only concern the new argument to the copy constructor? |
…dated doc when using version vector
When makeing a copy of a VectorDocument, we need to make up the effect of flag kSync.