-
Notifications
You must be signed in to change notification settings - Fork 140
CBG-4780: basic ISGR push and pull for 4.0 #7668
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements basic Inter-Sync Gateway Replication (ISGR) push and pull functionality for version 4.0 protocol. It focuses on getting ISGR operational with minimal conflict handling support.
Key changes include:
- Addition of new version checking functions for ISGR changes message handling
- Updated test assertions to accommodate different revision ID generation between active and passive nodes
- Temporary skipping of conflict resolution tests until proper ISGR conflict handling is implemented
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
File | Description |
---|---|
rest/utilities_testing.go |
Adds new test utility functions for version comparison and changes assertion logic for ISGR |
rest/replicatortest/replicator_test_helper.go |
Removes unused test helper function |
rest/replicatortest/replicator_test.go |
Updates test assertions and skips conflict-related tests for ISGR compatibility |
rest/blip_api_crud_test.go |
Skips test due to revision tree differences between active and passive nodes |
rest/attachment_test.go |
Removes test function related to attachment handling |
db/utilities_hlv_testing.go |
Adds new function for revision tree equality checking |
db/document.go |
Adds method to extract document version from Document struct |
db/crud.go |
Implements CheckChangeVersion function for ISGR change handling |
db/blip_handler.go |
Updates changes message handling to support version vectors and removes conflict resolver restriction |
db/active_replicator_common.go |
Removes hardcoded BLIP protocol version restriction |
} | ||
|
||
// RequireDocVersionNotEqual calls t.Fail if two document versions are equal. | ||
func RequireDocVersionNotEqual(t *testing.T, expected, actual DocVersion) { | ||
require.False(t, expected.Equal(actual), "Versions match. Version should not be %s", expected) | ||
// CBG-4751: should be able to uncomment this line once cv is included in write response | ||
//require.NotEqual(t, expected.CV.String(), actual.CV.String(), "Versions mismatch. Expected: %v, Actual: %v", expected, actual) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commented-out code contains dev-time logging that should be removed rather than commented out. Either remove the line entirely or replace with appropriate Sync Gateway logging if needed.
Copilot uses AI. Check for mistakes.
@@ -2752,6 +2752,8 @@ func TestBlipInternalPropertiesHandling(t *testing.T) { | |||
// the stat mapping (processRevStats) | |||
func TestProcessRevIncrementsStat(t *testing.T) { | |||
base.RequireNumTestBuckets(t, 2) | |||
base.SetUpTestLogging(t, base.LevelDebug, base.KeyAll) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug logging setup in tests should be removed before production. This appears to be dev-time logging that was left in.
Copilot uses AI. Check for mistakes.
@@ -5921,6 +5959,8 @@ func TestActiveReplicatorPullConflictReadWriteIntlProps(t *testing.T) { | |||
func TestSGR2TombstoneConflictHandling(t *testing.T) { | |||
base.LongRunningTest(t) | |||
base.RequireNumTestBuckets(t, 2) | |||
base.SetUpTestLogging(t, base.LevelDebug, base.KeyAll) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Debug logging setup in tests should be removed before production. This appears to be dev-time logging that was left in.
Copilot uses AI. Check for mistakes.
@@ -740,7 +753,7 @@ func (bh *blipHandler) handleChanges(rq *blip.Message) error { | |||
if collectionCtx.sgr2PullAlreadyKnownSeqsCallback != nil { | |||
seq, err := ParseJSONSequenceID(seqStr(bh.loggingCtx, change[0])) | |||
if err != nil { | |||
base.WarnfCtx(bh.loggingCtx, "Unable to parse known sequence %q for %q / %q: %v", change[0], base.UD(docID), revID, err) | |||
base.WarnfCtx(bh.loggingCtx, "Unable to parse known sequence %q for %q / %q: %v", change[0], base.UD(docID), rev, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of base.UD() to wrap the docID for user data redaction in logging.
Copilot uses AI. Check for mistakes.
@@ -763,9 +776,9 @@ func (bh *blipHandler) handleChanges(rq *blip.Message) error { | |||
seq, err := ParseJSONSequenceID(seqStr(bh.loggingCtx, change[0])) | |||
if err != nil { | |||
// We've already asked for the doc/rev for the sequence so assume we're going to receive it... Just log this and carry on | |||
base.WarnfCtx(bh.loggingCtx, "Unable to parse expected sequence %q for %q / %q: %v", change[0], base.UD(docID), revID, err) | |||
base.WarnfCtx(bh.loggingCtx, "Unable to parse expected sequence %q for %q / %q: %v", change[0], base.UD(docID), rev, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of base.UD() to wrap the docID for user data redaction in logging.
Copilot uses AI. Check for mistakes.
// - Put a doc on a active rest tester | ||
// - Create replication and wait for the doc to be replicated to passive node | ||
// - Assert on the HLV in the metadata of the replicated document | ||
func TestReplicatorUpdateHLVOnPut(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try a REST API PUT with new_edits=false
to ensure we're generating a CV for a rev-ID write.
CBG-4780
proposeChanges
does)Pre-review checklist
fmt.Print
,log.Print
, ...)base.UD(docID)
,base.MD(dbName)
)docs/api
Dependencies (if applicable)
Integration Tests
GSI=true,xattrs=true
https://jenkins.sgwdev.com/job/SyncGateway-Integration/3242/