-
Notifications
You must be signed in to change notification settings - Fork 138
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
CBG-4370 create a cancel context inside BlipSyncContext #7201
Conversation
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.
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.
A few comments/questions.
@@ -34,7 +34,10 @@ const ( | |||
|
|||
var ErrClosedBLIPSender = errors.New("use of closed BLIP sender") | |||
|
|||
func NewBlipSyncContext(ctx context.Context, bc *blip.Context, db *Database, contextID string, replicationStats *BlipSyncStats) *BlipSyncContext { | |||
func NewBlipSyncContext(ctx context.Context, bc *blip.Context, db *Database, contextID string, replicationStats *BlipSyncStats, ctxCancelFunc context.CancelFunc) (*BlipSyncContext, error) { | |||
if ctxCancelFunc == nil { |
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.
Is this required for cases where the BlipSyncContext is for an active peer (ISGR)? Closing the connection in that case feels like a different problem than the passive peer case.
rest/blip_api_crud_test.go
Outdated
|
||
base.SetUpTestLogging(t, base.LevelInfo, base.KeyHTTP, base.KeySync, base.KeySyncMsg, base.KeyChanges, base.KeyCache) | ||
btcRunner := NewBlipTesterClientRunner(t) | ||
var shouldChanenlQueryError atomic.Bool |
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.
var shouldChanenlQueryError atomic.Bool | |
var shouldChannelQueryError atomic.Bool |
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.
LGTM - thanks for the additional ISGR push test, that was informative.
* 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
* 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
…ext (#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
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.
This leverages 6317f19
I added some leaky bucket code to be able to trigger the error.
Pre-review checklist
fmt.Print
,log.Print
, ...)base.UD(docID)
,base.MD(dbName)
)docs/api
Integration Tests
GSI=true,xattrs=true
https://jenkins.sgwdev.com/job/SyncGateway-Integration/2826/