Skip to content

Commit b07aea7

Browse files
committed
improve comments
1 parent 1953efc commit b07aea7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

topologytest/hlv_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,16 @@ func waitForCVAndBody(t *testing.T, dsName base.ScopeAndCollectionName, docID st
108108
}
109109
}
110110

111-
// waitForConvergingTombstones waits for all peers to have a tombstone document for a given doc ID. A matching HLV import (
112-
// guaranteed for all Couchbase Server / Sync Gateway versions, but not CBL versions.
111+
// waitForConvergingTombstones waits for all peers to have a tombstone document for a given doc ID. This is the
112+
// equivalent function to waitForCVAndBody if the expected document is a tombstone.
113113
//
114-
// See following example:
114+
// Couchbase Server and Sync Gateway peers will have matching HLVs due XDCR conflict resolution always overwriting
115+
// HLVs. However, it is possible that XDCR will replicate a tombstone from one Couchbase Server to antoher Couchbase
116+
// Server and update its HLV. Since tombstones are not imported by Sync Gateway, this CV will not be replicated to
117+
// Couchbase Server.
118+
//
119+
// In this case, all peers will have a tombstone for this document, but no assertions can be made on Couchbase Lite
120+
// peers. See following example:
115121
//
116122
// +- - - - - - -+ +- - - - - - -+
117123
// ' cluster A ' ' cluster B '
@@ -148,7 +154,6 @@ func waitForConvergingTombstones(t *testing.T, dsName base.ScopeAndCollectionNam
148154
t.Logf("waiting for converging tombstones")
149155
require.EventuallyWithT(t, func(c *assert.CollectT) {
150156
nonCBLVersions := make(map[string]DocMetadata)
151-
CBLVersions := make(map[string]DocMetadata)
152157
for peerName, peer := range topology.SortedPeers() {
153158
meta, body, exists := peer.GetDocumentIfExists(dsName, docID)
154159
if !assert.True(c, exists, "doc %s does not exist on peer %s", docID, peer) {
@@ -157,10 +162,7 @@ func waitForConvergingTombstones(t *testing.T, dsName base.ScopeAndCollectionNam
157162
if !assert.Nil(c, body, "expected tombstone for doc %s on peer %s", docID, peer) {
158163
return
159164
}
160-
switch peer.Type() {
161-
case PeerTypeCouchbaseLite:
162-
CBLVersions[peerName] = meta
163-
default:
165+
if peer.Type() != PeerTypeCouchbaseLite {
164166
nonCBLVersions[peerName] = meta
165167
}
166168
}
@@ -172,7 +174,6 @@ func waitForConvergingTombstones(t *testing.T, dsName base.ScopeAndCollectionNam
172174
}
173175
assertHLVEqual(c, dsName, docID, peer, version, nil, *nonCBLVersion, topology)
174176
}
175-
// Is there a way to do any assertion on the CBL tombstone versions?
176177
}, totalWaitTime, pollInterval)
177178
}
178179

topologytest/multi_actor_conflict_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ func TestMultiActorConflictDelete(t *testing.T) {
9090
// 1. create document on each peer with different contents
9191
// 2. start replications
9292
// 3. wait for documents to exist with hlv sources equal to the number of active peers and the document body is
93-
// equivalent to the last write. The assertion is presently only on CV for Couchbase Lite peers, and full HLV
94-
// for other peer types.
93+
// equivalent to the last write.
9594
// 4. stop replications
9695
// 5. delete documents on all peers
9796
// 6. start replications

0 commit comments

Comments
 (0)