-
Notifications
You must be signed in to change notification settings - Fork 138
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
First-time sync optimized backfill mode #1503
Comments
In addition to filtering deleted/removed out of the set of active revisions, we should also remove them from the set of non-winning leaf revisions returned. |
Proposed change to Couchbase Lite needed to support this would look something like this (using CBL.NET as the example) if (includeConflicts)
{
if (lastSequenceID == null)
{
path.Append("&style=all_active");
}
else
{
path.Append("&style=all_docs");
}
} |
Looks good to me! |
CBL could also add |
Yes - include_docs is implemented by SG, and would work with the proposed style=all_active. |
I noticed a problem with the proposal: If we send Unfortunately we can't do a version check of the server before sending the feed, because (due to recent pull optimizations) As an alternative, I suggest we add a new parameter, something like |
Good point Jens. I agree that we need to have a backwards-compatible approach, and an additional parameter makes that possible without intrusive client changes. I'd suggest that we use the parameter name |
Send "?active_only=true" as a _changes feed parameter when there's no "since" parameter, to tell SG 1.2+ to skip sending deleted (or removed) docs. This can speed up the initial pull quite a lot. Fixes #1052 (see also couchbase/sync_gateway#1503 )
Fixes #1503. If the active_only parameter is set to true on a changes request: - deleted revisions will not be returned - documents removed from all channels visible to the user will not be returned - when using style=all_docs, deleted conflicting revisions will not be included in the set of leaf revisions returned.
Fixes #1503. If the active_only parameter is set to true on a changes request: - deleted revisions will not be returned - documents removed from all channels visible to the user will not be returned - when using style=all_docs, deleted conflicting revisions will not be included in the set of leaf revisions returned.
I compiled this commit from the current master 1444ebc locally and unfortunately, it didn't seem to fix the problem. Basically, http://localhost:4985/default/_changes?style=all_docs&active_only=true returns the exact same results as http://localhost:4985/default/_changes I have some "resolved" conflicts, where all but one leaf nodes were deleted and an unresolved conflict, where there are two leaf nodes, not deleted. The first case works well, all deleted nodes are not shown in the changes feed. In the second case, I would expect both exisiting (conflicting) leaf revisions to appear in http://localhost:4985/default/_changes?style=all_docs&active_only=true Here is an example:
And now for the two revisions:
Neither of these two leaf node has a _deleted: true element |
I took a look at the fix and think I found the issue. At least it now provides correct results on my local data set. Simply a small error in the conditional logic. Making a pull request now, please review it. |
Fixes #1503. If the active_only parameter is set to true on a changes request: - deleted revisions will not be returned - documents removed from all channels visible to the user will not be returned - when using style=all_docs, deleted conflicting revisions will not be included in the set of leaf revisions returned.
Proposal
Add a new option to the
style
parameter of the_changes
endpoint:all_active
. This would be a similar to the existingall_docs
behavior, but would exclude_removed
entries as well as tombstoned documents.Motivations
During a first-time replication, where Couchbase Lite is backfilling up to the current
last_sequence
, currentall_docs
requests will include a number of items unlikely to be of interest, such as deleted documents and_removed
revisions. For a long running database, this can result in more data being transmitted to Couchbase Lite and is desired. This proposal allows a more streamlined, concise first-time backfill.The text was updated successfully, but these errors were encountered: