Skip to content

Commit 218470e

Browse files
CBG-4928: Update log messages on changes feed being cancelled (#7880)
Co-authored-by: Tor Colvin <tor.colvin@couchbase.com>
1 parent 91e5466 commit 218470e

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

db/blip_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ func (bh *blipHandler) sendBatchOfChanges(sender *blip.Sender, changeArray [][]a
629629
bh.replicationStats.SendChangesCount.Add(int64(len(changeArray)))
630630
// Spawn a goroutine to await the client's response:
631631
go func(bh *blipHandler, sender *blip.Sender, response *blip.Message, changeArray [][]any, sendTime time.Time, dbCollection *DatabaseCollectionWithUser) {
632-
if err := bh.handleChangesResponse(bh.loggingCtx, sender, response, changeArray, sendTime, dbCollection, bh.collectionIdx); err != nil {
632+
if err := bh.handleChangesResponse(bh.loggingCtx, sender, response, changeArray, sendTime, dbCollection, bh.collectionIdx); err != nil && !errors.Is(err, ErrClosedBLIPSender) {
633633
base.WarnfCtx(bh.loggingCtx, "Error from bh.handleChangesResponse: %v", err)
634634
if bh.fatalErrorCallback != nil {
635635
bh.fatalErrorCallback(err)

db/changes.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,9 @@ func (col *DatabaseCollectionWithUser) SimpleMultiChangesFeed(ctx context.Contex
996996
} else {
997997
// On feed error, send the error and exit changes processing
998998
if current[i].Err == base.ErrChannelFeed {
999-
base.WarnfCtx(ctx, "MultiChangesFeed got error reading changes feed: %v", current[i].Err)
999+
if options.ChangesCtx.Err() == nil {
1000+
base.WarnfCtx(ctx, "MultiChangesFeed got error reading changes feed: %v", current[i].Err)
1001+
}
10001002
select {
10011003
case <-options.ChangesCtx.Done():
10021004
case output <- current[i]:

db/channel_cache_single.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,9 @@ func (c *singleChannelCacheImpl) GetChanges(ctx context.Context, options Changes
410410
return resultFromCache, nil
411411
}
412412

413-
// Check whether the changes process has been terminated while we waited for the view lock, to avoid the view
414-
// overhead in that case (and prevent feedback loop on query backlog)
413+
// Check whether the changes process has been terminated before running a query
415414
if options.ChangesCtx.Err() != nil {
416-
return nil, fmt.Errorf("Changes feed cancelled while waiting for view lock")
415+
return nil, fmt.Errorf("Changes feed cancelled %w", options.ChangesCtx.Err())
417416
}
418417

419418
// Now query the view. We set the max sequence equal to cacheValidFrom, so we'll get one

0 commit comments

Comments
 (0)