Skip to content
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-6592: active pusher should always send proposeChanges regardless … #2199

Merged
merged 2 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Replicator/ChangesFeed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ namespace litecore::repl {
return false; // fail the rev: error getting doc
}

if ( !C4Document::equalRevIDs(doc->revID(), rev->revID) )
if ( !C4Document::equalRevIDs(doc->getSelectedRevIDGlobalForm(), _db.convertVersionToAbsolute(rev->revID)) )
return false; // skip rev: there's a newer one already

if ( needRemoteRevID ) {
Expand Down
4 changes: 1 addition & 3 deletions Replicator/Pusher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ namespace litecore::repl {
, _changesFeed(*this, _options, *_db, &checkpointer)
, _checkpointer(checkpointer) {
setParentObjectRef(replicator->getObjectRef());
if ( _options->push(collectionIndex()) <= kC4Passive
// Always use "changes" with version vectors
|| _db->usingVersionVectors() ) {
if ( _options->push(collectionIndex()) <= kC4Passive ) {
_proposeChanges = false;
_proposeChangesKnown = true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions Replicator/RevFinder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ namespace litecore::repl {
if ( !changes && req->body() != "null"_sl ) {
warn("Invalid body of 'changes' message");
req->respondWithError({"BLIP"_sl, 400, "Invalid JSON body"_sl});
} else if ( (!proposed && _mustBeProposed) || (proposed && _db->usingVersionVectors()) ) {
} else if ( !proposed && _mustBeProposed ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete "But with version vectors, always use "changes"." on line 98

// In conflict-free mode plus rev-trees the protocol requires the pusher send
// "proposeChanges" instead. But with version vectors, always use "changes".
// "proposeChanges" instead.
req->respondWithError({"BLIP"_sl, 409});
} else if ( nChanges == 0 ) {
// Empty array indicates we've caught up. (This may have been sent no-reply)
Expand Down
3 changes: 3 additions & 0 deletions Replicator/tests/ReplicatorVVUpgradeTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ class ReplicatorVVUpgradeTest : public ReplicatorLoopbackTest {
}
};

#if 0
// Disabled, c.f. https://jira.issues.couchbase.com/browse/CBL-6593
TEST_CASE_METHOD(ReplicatorVVUpgradeTest, "Push After VV Upgrade", "[Push]") {
//- db pushes docs to db2. Both are still on rev-trees.
//- db and db2 both upgrade to version vectors.
Expand All @@ -74,6 +76,7 @@ TEST_CASE_METHOD(ReplicatorVVUpgradeTest, "Push After VV Upgrade", "[Push]") {
compareDatabases();
validateCheckpoints(db, db2, "{\"local\":103}");
}
#endif

TEST_CASE_METHOD(ReplicatorVVUpgradeTest, "Pull After VV Upgrade", "[Pull]") {
//- db pushes docs to db2. Both are still on rev-trees.
Expand Down
Loading