Skip to content

Commit

Permalink
Allow BlipTesterClient conflict resolution to resolve a server tombst…
Browse files Browse the repository at this point in the history
…one in conflict to a non-deletion client doc
  • Loading branch information
bbrks committed Jan 14, 2025
1 parent 3753595 commit 2aa683e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rest/utilities_testing_blip_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ func (btr *BlipTesterReplicator) initHandlers(btc *BlipTesterClient) {
var incomingVersion DocVersion
var versionToWrite DocVersion
var hlv db.HybridLogicalVector
isDelete := true
if btc.UseHLV() {
var incomingHLV *db.HybridLogicalVector
if revHistory != "" {
Expand Down Expand Up @@ -619,8 +620,9 @@ func (btr *BlipTesterReplicator) initHandlers(btc *BlipTesterClient) {
btc.TB().Logf("Detected conflict on pull of doc %q (clientCV:%v - incomingCV:%v incomingHLV:%#v)", docID, clientCV, incomingCV, incomingHLV)
switch btc.BlipTesterClientOpts.ConflictResolver {
case ConflictResolverLastWriteWins:
// local wins so write the local body back as a new resolved version (based on incoming HLV) to push
// local wins so write the local back as a new resolved version (based on incoming HLV) to push
body = latestClientRev.body
isDelete = latestClientRev.isDelete
v := db.Version{SourceID: fmt.Sprintf("btc-%d", btc.id), Value: uint64(time.Now().UnixNano())}
require.NoError(btc.TB(), hlv.AddVersion(v), "couldn't add incoming HLV into client HLV")
versionToWrite = DocVersion{CV: v}
Expand All @@ -647,7 +649,7 @@ func (btr *BlipTesterReplicator) initHandlers(btc *BlipTesterClient) {
version: versionToWrite,
body: body,
HLV: hlv,
isDelete: true,
isDelete: isDelete,
message: msg,
}

Expand Down

0 comments on commit 2aa683e

Please sign in to comment.