diff --git a/db/crud.go b/db/crud.go index e974e6fe81..8499bb3409 100644 --- a/db/crud.go +++ b/db/crud.go @@ -3318,7 +3318,7 @@ func (db *DatabaseCollectionWithUser) CheckProposedVersion(ctx context.Context, // previousVersion didn't match, but proposed version and server CV have matching source, and proposed version is newer return ProposedRev_OK, "" } else { - // Temporary (CBG-4466): check the full HLV that's being sent by CBL with proposeChanges messages. + // Temporary (CBG-4461): check the full HLV that's being sent by CBL with proposeChanges messages. // If the current server cv is dominated by the incoming HLV (i.e. the incoming HLV has an entry for the same source // with a version that's greater than or equal to the server's cv), then we can accept the proposed version. proposedHLV, _, err := ExtractHLVFromBlipMessage(proposedHLVString) diff --git a/rest/utilities_testing_blip_client.go b/rest/utilities_testing_blip_client.go index 245a61e44f..b13f6fdb5d 100644 --- a/rest/utilities_testing_blip_client.go +++ b/rest/utilities_testing_blip_client.go @@ -1204,14 +1204,20 @@ func (btcc *BlipTesterCollectionClient) sendProposeChanges(ctx context.Context, if i > 0 { proposeChangesRequestBody.WriteString(",") } - proposeChangesRequestBody.WriteString(fmt.Sprintf(`["%s","%s"`, change.docID, change.Rev())) + rev := change.Rev() + if btcc.UseHLV() { + // Until CBG-4461 is implemented the second value in the array is the full HLV. + rev += "," + change.historyStr() + } + fmt.Fprintf(proposeChangesRequestBody, `["%s","%s"`, change.docID, rev) + // write last known server version to support no-conflict mode if serverVersion, ok := btcc.getLastReplicatedRev(change.docID); ok { base.DebugfCtx(ctx, base.KeySGTest, "specifying last known server version for doc %s = %v", change.docID, serverVersion) if btcc.UseHLV() { - proposeChangesRequestBody.WriteString(fmt.Sprintf(`,"%s"`, serverVersion.CV.String())) + fmt.Fprintf(proposeChangesRequestBody, `,"%s"`, serverVersion.CV.String()) } else { - proposeChangesRequestBody.WriteString(fmt.Sprintf(`,"%s"`, serverVersion.RevTreeID)) + fmt.Fprintf(proposeChangesRequestBody, `,"%s"`, serverVersion.RevTreeID) } } proposeChangesRequestBody.WriteString(`]`) @@ -1274,6 +1280,11 @@ func (btcc *BlipTesterCollectionClient) sendRev(ctx context.Context, change prop btcc.sendRev(ctx, change, false) return } + if errorCode == strconv.Itoa(http.StatusConflict) { + // If there is a conflict created between the preceding proposeChanges and this rev message. + // this is not an error. + return + } require.NotContains(btcc.TB(), revResp.Properties, "Error-Domain", "unexpected error response from rev %#v", revResp) base.DebugfCtx(ctx, base.KeySGTest, "peer acked rev %s / %v", change.docID, change.version) btcc.updateLastReplicatedRev(change.docID, change.version, revRequest)