You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[3.2.2 backport] CBG-4446 create a cancel context inside BlipSyncContext (#7314)
* CBG-4370 preqreq deduplicate active replicator pull changes (#7211)
* CBG-4370 create a cancel context inside BlipSyncContext (#7201)
* CBG-4370 create a cancel context inside BlipSyncContext
This cancel context allows a forceable closure of the underlying blip
connection.
In the case there is a continuous pull replication and there is an error
on the changes feed, the only way to stop the pull replication is to
shut down the connection. CBL clients do not listen to unsolicited error
messages.
* Avoid refactoring with the change
* pass lint
* test active replicator reconnection
* test fixup
* lint correctly
* PR comments
* Acquire read lock to present data race
* switch query to use all docs index
* fix lint issue
Copy file name to clipboardExpand all lines: db/active_replicator_common.go
+12-2Lines changed: 12 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,7 @@ import (
15
15
"errors"
16
16
"expvar"
17
17
"sync"
18
+
"sync/atomic"
18
19
"testing"
19
20
"time"
20
21
@@ -52,7 +53,7 @@ type activeReplicatorCommon struct {
52
53
ctxCancel context.CancelFunc
53
54
reconnectActive base.AtomicBool// Tracks whether reconnect goroutine is active
54
55
replicatorConnectFnfunc() error// the function called inside reconnectLoop.
55
-
activeSendChangesbase.AtomicBool// Tracks whether sendChanges goroutine is active.
56
+
activeSendChangesatomic.Int32// Tracks whether sendChanges goroutines are active, there is one per collection.
56
57
namedCollectionsmap[base.ScopeAndCollectionName]*activeReplicatorCollection// set only if the replicator is running with collections - access with forEachCollection
57
58
defaultCollection*activeReplicatorCollection// set only if the replicator is not running with collections - access with forEachCollection
58
59
}
@@ -312,8 +313,9 @@ func (a *activeReplicatorCommon) getState() string {
// _startSendingChanges starts a changes feed for a given collection in a goroutine and starts sending changes to the passive peer from a starting sequence value.
// sendChanges will start a changes feed and send changes. Returns bool to indicate whether the changes feed finished and all changes were sent. The error value is only used to indicate a fatal error, where the blip connection should be terminated. If the blip connection is disconnected by the client, the error will be nil, but the boolean parameter will be false.
0 commit comments