Skip to content

CBG-5547 handle topologytest conflicts for matching timestamps#8424

Open
torcolvin wants to merge 1 commit into
mainfrom
CBG-5547
Open

CBG-5547 handle topologytest conflicts for matching timestamps#8424
torcolvin wants to merge 1 commit into
mainfrom
CBG-5547

Conversation

@torcolvin

Copy link
Copy Markdown
Collaborator

CBG-5547 handle topologytest conflicts for matching timestamps

If sourceIDs are different but version element is exaclty the same, the topologytest would fail with unexpected revisions.

Implement tests with existing behavior:

  • XDCR: local wins
  • CBL: remote wins
  • ISGR: local wins

Add some hooks to force the ability to set the clock for these tests so that this behavior doesn't regress.

I appreciate thoughts on:

  • Should I drop the matching timestamps from the conflict tests?
  • Should I move the matching timestamp tests to their own file?
  • Do I need to add separate tests for active replicators being on either side, or do you think this code is covered in both contexts?

In this PR, I don't address whether we want the ISGR resolution to match CBL, the tests are present so we can use them if behavior changes. The XDCR test does run against Couchbase Server so we can see if their behavior is modified. This is so unlikely to happen outside of a CI environment, especially one that isn't using rosmar and a lite memory mock that I don't think it is worth fixing.

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Integration Tests

Copilot AI review requested due to automatic review settings July 6, 2026 13:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR makes multi-actor conflict tests deterministic in the “matching timestamp / version tie” case by adding test hooks to force Hybrid Logical Clock (HLC) timestamps to align across peers, and by codifying expected tie-breaking behavior across replication modes (XDCR, Couchbase Lite mock, ISGR/SGR).

Changes:

  • Added multi-actor conflict test dimensions to explicitly exercise “ClockTie” scenarios by forcing HLC clocks to a fixed value.
  • Updated the Couchbase Lite BLIP test client’s LWW conflict resolution to prefer the incoming (remote) revision on version ties.
  • Added explicit matching-timestamp regression tests for XDCR and Active Replicator (SGR) conflict resolution, plus small test-only HLC clock override hooks.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
xdcr/xdcr_test.go Adds an XDCR regression test for “matching timestamp” tie handling (target/local wins).
topologytest/multi_actor_conflict_test.go Adds a ClockTie subtest dimension to multi-actor conflict tests (create/update/delete/resurrect).
topologytest/multi_actor_conflict_clock_tie_test.go Introduces helper utilities to force HLC clock ties across controllable peers (and rosmar when applicable).
rest/utilities_testing_blip_client.go Makes BLIP tester LWW conflict resolution prefer remote on ties; adds a test hook to override the client HLC clock.
rest/replicatortest/replicator_test.go Adds an Active Replicator (SGR) matching-timestamp tie test asserting local wins with default resolver.
db/utilities_hlv_testing.go Adds a DatabaseContext test hook to override the HLC clock function for deterministic HLV generation.
go.mod Updates sg-bucket and rosmar dependency versions to support clock-for-test functionality.
go.sum Updates dependency checksums corresponding to go.mod changes.

Comment thread topologytest/multi_actor_conflict_test.go
If sourceIDs are different but version element is exaclty the same, the topologytest would fail with unexpected
revisions.

Implement tests with existing behavior:

- XDCR: local wins
- CBL: remote wins
- ISGR: local wins

Add some hooks to force the ability to set the clock for these tests so that this behavior doesn't regress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants