Skip to content

blip tester: pass full history to proposeChanges #7656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion db/crud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 14 additions & 3 deletions rest/utilities_testing_blip_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(`]`)
Expand Down Expand Up @@ -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)
Expand Down
Loading