Skip to content

Commit 6526e9a

Browse files
committed
tidy up
1 parent a677fa5 commit 6526e9a

File tree

5 files changed

+3
-139
lines changed

5 files changed

+3
-139
lines changed

db/active_replicator_common.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ func newActiveReplicatorCommon(ctx context.Context, config *ActiveReplicatorConf
123123
statusKey: metakeys.ReplicationStatusKey(checkpointID),
124124
direction: direction,
125125
}
126-
// CBG-4780: WIll hard code to use < 4 protocols for now, as the ISGR doesn't support 4+ protocols.
127-
//arc.config.SupportedBLIPProtocols = []string{CBMobileReplicationV3.SubprotocolString(), CBMobileReplicationV2.SubprotocolString()}
128126

129127
if config.CollectionsEnabled {
130128
arc.namedCollections = make(map[base.ScopeAndCollectionName]*activeReplicatorCollection)

db/blip_handler.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,10 +1015,6 @@ func (bh *blipHandler) processRev(rq *blip.Message, stats *processRevStats) (err
10151015
}
10161016
}
10171017

1018-
//if bh.useHLV() && bh.conflictResolver != nil {
1019-
// return base.HTTPErrorf(http.StatusNotImplemented, "conflict resolver handling (ISGR) not yet implemented for v4 protocol")
1020-
//}
1021-
10221018
// throttle concurrent revs
10231019
if cap(bh.inFlightRevsThrottle) > 0 {
10241020
select {

db/crud.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3131,12 +3131,12 @@ func (db *DatabaseCollectionWithUser) CheckChangeVersion(ctx context.Context, do
31313131
doc, err := db.GetDocSyncDataNoImport(ctx, docid, DocUnmarshalSync)
31323132
if err != nil {
31333133
if !base.IsDocNotFoundError(err) && !base.IsXattrNotFoundError(err) {
3134-
base.WarnfCtx(ctx, "RevDiff(%q) --> %T %v", base.UD(docid), err, err)
3134+
base.WarnfCtx(ctx, "Error fetching doc %s during changes handling: %v", base.UD(docid), err)
31353135
}
31363136
missing = append(missing, rev)
31373137
return
31383138
}
3139-
// parse in coming version, if it's not know to local doc hlv then it is missing, if it is and is a new version
3139+
// parse in coming version, if it's not known to local doc hlv then it is marked as missing, if it is and is a newer version
31403140
// then it is also marked as missing
31413141
cvValue, err := ParseVersion(rev)
31423142
if err != nil {

rest/replicatortest/replicator_test.go

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -4384,136 +4384,6 @@ func TestActiveReplicatorPushAndPullConflict(t *testing.T) {
43844384
}
43854385
}
43864386

4387-
func TestPushNewDoc(t *testing.T) {
4388-
base.RequireNumTestBuckets(t, 2)
4389-
base.SetUpTestLogging(t, base.LevelDebug, base.KeyAll)
4390-
4391-
// Passive
4392-
rt2 := rest.NewRestTester(t, nil)
4393-
defer rt2.Close()
4394-
username := "alice"
4395-
rt2.CreateUser(username, []string{username})
4396-
4397-
// Active
4398-
rt1 := rest.NewRestTester(t, &rest.RestTesterConfig{
4399-
SyncFn: channels.DocChannelsSyncFunction,
4400-
})
4401-
defer rt1.Close()
4402-
ctx1 := rt1.Context()
4403-
4404-
docID := t.Name() + "rt1doc1"
4405-
version := rt1.PutDocDirectly(docID, rest.JsonToMap(t, `{"source":"rt1","channels":["alice"]}`))
4406-
4407-
// Make rt2 listen on an actual HTTP port, so it can receive the blipsync request from rt1.
4408-
srv := httptest.NewTLSServer(rt2.TestPublicHandler())
4409-
defer srv.Close()
4410-
4411-
passiveDBURL, err := url.Parse(srv.URL + "/db")
4412-
require.NoError(t, err)
4413-
4414-
// Add basic auth creds to target db URL
4415-
passiveDBURL.User = url.UserPassword(username, rest.RestTesterDefaultUserPassword)
4416-
stats, err := base.SyncGatewayStats.NewDBStats(t.Name(), false, false, false, nil, nil)
4417-
require.NoError(t, err)
4418-
dbstats, err := stats.DBReplicatorStats(t.Name())
4419-
require.NoError(t, err)
4420-
4421-
ar, err := db.NewActiveReplicator(ctx1, &db.ActiveReplicatorConfig{
4422-
ID: t.Name(),
4423-
Direction: db.ActiveReplicatorTypePush,
4424-
RemoteDBURL: passiveDBURL,
4425-
ActiveDB: &db.Database{
4426-
DatabaseContext: rt1.GetDatabase(),
4427-
},
4428-
ChangesBatchSize: 200,
4429-
InsecureSkipVerify: true,
4430-
ReplicationStatsMap: dbstats,
4431-
CollectionsEnabled: !rt1.GetDatabase().OnlyDefaultCollection(),
4432-
SupportedBLIPProtocols: []string{db.CBMobileReplicationV4.SubprotocolString()},
4433-
})
4434-
require.NoError(t, err)
4435-
defer func() { assert.NoError(t, ar.Stop()) }()
4436-
4437-
// Start the replicator (implicit connect)
4438-
require.NoError(t, ar.Start(ctx1))
4439-
4440-
// wait for the document originally written to rt1 to arrive at rt2
4441-
changesResults := rt2.WaitForChanges(1, "/{{.keyspace}}/_changes?since=0", "", true)
4442-
assert.Equal(t, docID, changesResults.Results[0].ID)
4443-
4444-
rt1collection, rt1ctx := rt1.GetSingleTestDatabaseCollection()
4445-
doc, err := rt1collection.GetDocument(rt1ctx, docID, db.DocUnmarshalAll)
4446-
assert.NoError(t, err)
4447-
4448-
rest.RequireDocVersionEqual(t, version, doc.ExtractDocVersion())
4449-
}
4450-
4451-
func TestBasicPull(t *testing.T) {
4452-
base.RequireNumTestBuckets(t, 2)
4453-
base.SetUpTestLogging(t, base.LevelDebug, base.KeyAll)
4454-
4455-
// Passive
4456-
rt2 := rest.NewRestTester(t, &rest.RestTesterConfig{
4457-
SyncFn: channels.DocChannelsSyncFunction,
4458-
})
4459-
defer rt2.Close()
4460-
username := "alice"
4461-
rt2.CreateUser(username, []string{username})
4462-
4463-
// Active
4464-
rt1 := rest.NewRestTester(t, &rest.RestTesterConfig{
4465-
SyncFn: channels.DocChannelsSyncFunction,
4466-
})
4467-
defer rt1.Close()
4468-
ctx1 := rt1.Context()
4469-
4470-
docID := t.Name() + "rt1doc1"
4471-
version := rt2.PutDocDirectly(docID, rest.JsonToMap(t, `{"source":"rt1","channels":["alice"]}`))
4472-
4473-
// Make rt2 listen on an actual HTTP port, so it can receive the blipsync request from rt1.
4474-
srv := httptest.NewTLSServer(rt2.TestPublicHandler())
4475-
defer srv.Close()
4476-
4477-
passiveDBURL, err := url.Parse(srv.URL + "/db")
4478-
require.NoError(t, err)
4479-
4480-
// Add basic auth creds to target db URL
4481-
passiveDBURL.User = url.UserPassword(username, rest.RestTesterDefaultUserPassword)
4482-
stats, err := base.SyncGatewayStats.NewDBStats(t.Name(), false, false, false, nil, nil)
4483-
require.NoError(t, err)
4484-
dbstats, err := stats.DBReplicatorStats(t.Name())
4485-
require.NoError(t, err)
4486-
4487-
ar, err := db.NewActiveReplicator(ctx1, &db.ActiveReplicatorConfig{
4488-
ID: t.Name(),
4489-
Direction: db.ActiveReplicatorTypePull,
4490-
RemoteDBURL: passiveDBURL,
4491-
ActiveDB: &db.Database{
4492-
DatabaseContext: rt1.GetDatabase(),
4493-
},
4494-
ChangesBatchSize: 200,
4495-
InsecureSkipVerify: true,
4496-
ReplicationStatsMap: dbstats,
4497-
CollectionsEnabled: !rt1.GetDatabase().OnlyDefaultCollection(),
4498-
SupportedBLIPProtocols: []string{db.CBMobileReplicationV4.SubprotocolString()},
4499-
})
4500-
require.NoError(t, err)
4501-
defer func() { assert.NoError(t, ar.Stop()) }()
4502-
4503-
// Start the replicator (implicit connect)
4504-
require.NoError(t, ar.Start(ctx1))
4505-
4506-
// wait for the document originally written to rt1 to arrive at rt2
4507-
changesResults := rt1.WaitForChanges(1, "/{{.keyspace}}/_changes?since=0", "", true)
4508-
assert.Equal(t, docID, changesResults.Results[0].ID)
4509-
4510-
rt2collection, rt2ctx := rt2.GetSingleTestDatabaseCollection()
4511-
doc, err := rt2collection.GetDocument(rt2ctx, docID, db.DocUnmarshalAll)
4512-
assert.NoError(t, err)
4513-
4514-
rest.RequireDocVersionEqual(t, version, doc.ExtractDocVersion())
4515-
}
4516-
45174387
// TestActiveReplicatorPushBasicWithInsecureSkipVerify:
45184388
// - Starts 2 RestTesters, one active (with InsecureSkipVerify), and one passive
45194389
// - Creates a document on rt1 which can be pushed by the replicator to rt2.

rest/utilities_testing.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2409,7 +2409,7 @@ func RequireDocRevTreeEqual(t *testing.T, expected, actual DocVersion) {
24092409

24102410
// RequireDocVersionNotEqual calls t.Fail if two document versions are equal.
24112411
func RequireDocVersionNotEqual(t *testing.T, expected, actual DocVersion) {
2412-
// CBG-4751: should be able to uncomment this lien once cv is included in write response
2412+
// CBG-4751: should be able to uncomment this line once cv is included in write response
24132413
//require.NotEqual(t, expected.CV.String(), actual.CV.String(), "Versions mismatch. Expected: %v, Actual: %v", expected, actual)
24142414
require.NotEqual(t, expected.RevTreeID, actual.RevTreeID, "Versions mismatch. Expected: %v, Actual: %v", expected.RevTreeID, actual.RevTreeID)
24152415
}

0 commit comments

Comments
 (0)