@@ -61,7 +61,7 @@ func waitForVersionAndBody(t *testing.T, dsName base.ScopeAndCollectionName, doc
61
61
}
62
62
63
63
// waitForCVAndBody waits for a document to reach a specific cv on all peers.
64
- // This is used for scenarios where it's valid for the full HLV to not converge. This includes cases where
64
+ // This is used for scenarios where it's valid for the full HLV to not converge. This includes cases where
65
65
// CBL conflict resolution results in additional history in the CBL version of the HLV that may not be pushed
66
66
// to CBS (e.g. remote wins)
67
67
//
@@ -108,10 +108,16 @@ func waitForCVAndBody(t *testing.T, dsName base.ScopeAndCollectionName, docID st
108
108
}
109
109
}
110
110
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 .
113
113
//
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:
115
121
//
116
122
// +- - - - - - -+ +- - - - - - -+
117
123
// ' cluster A ' ' cluster B '
@@ -148,7 +154,6 @@ func waitForConvergingTombstones(t *testing.T, dsName base.ScopeAndCollectionNam
148
154
t .Logf ("waiting for converging tombstones" )
149
155
require .EventuallyWithT (t , func (c * assert.CollectT ) {
150
156
nonCBLVersions := make (map [string ]DocMetadata )
151
- CBLVersions := make (map [string ]DocMetadata )
152
157
for peerName , peer := range topology .SortedPeers () {
153
158
meta , body , exists := peer .GetDocumentIfExists (dsName , docID )
154
159
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
157
162
if ! assert .Nil (c , body , "expected tombstone for doc %s on peer %s" , docID , peer ) {
158
163
return
159
164
}
160
- switch peer .Type () {
161
- case PeerTypeCouchbaseLite :
162
- CBLVersions [peerName ] = meta
163
- default :
165
+ if peer .Type () != PeerTypeCouchbaseLite {
164
166
nonCBLVersions [peerName ] = meta
165
167
}
166
168
}
@@ -172,7 +174,6 @@ func waitForConvergingTombstones(t *testing.T, dsName base.ScopeAndCollectionNam
172
174
}
173
175
assertHLVEqual (c , dsName , docID , peer , version , nil , * nonCBLVersion , topology )
174
176
}
175
- // Is there a way to do any assertion on the CBL tombstone versions?
176
177
}, totalWaitTime , pollInterval )
177
178
}
178
179
0 commit comments