-
Notifications
You must be signed in to change notification settings - Fork 140
CBG-4928: Update log messages on changes feed being cancelled #7880
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -480,7 +480,7 @@ func (db *DatabaseCollectionWithUser) changesFeed(ctx context.Context, singleCha | |||||||||||||||||||||
| base.TracefCtx(ctx, base.KeyChanges, "Querying channel %q with options: %+v", base.UD(singleChannelCache.ChannelID().Name), paginationOptions) | ||||||||||||||||||||||
| changes, err := singleChannelCache.GetChanges(ctx, paginationOptions) | ||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||
| base.WarnfCtx(ctx, "Error retrieving changes for channel %q: %v", base.UD(singleChannelCache.ChannelID().Name), err) | ||||||||||||||||||||||
| base.InfofCtx(ctx, base.KeyChanges, "Could not retrieve changes for channel %q: %v", base.UD(singleChannelCache.ChannelID().Name), err) | ||||||||||||||||||||||
|
||||||||||||||||||||||
| base.InfofCtx(ctx, base.KeyChanges, "Could not retrieve changes for channel %q: %v", base.UD(singleChannelCache.ChannelID().Name), err) | |
| if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { | |
| base.InfofCtx(ctx, base.KeyChanges, "Changes feed cancelled for channel %q: %v", base.UD(singleChannelCache.ChannelID().Name), err) | |
| } else { | |
| base.InfofCtx(ctx, base.KeyChanges, "Could not retrieve changes for channel %q: %v", base.UD(singleChannelCache.ChannelID().Name), 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.
Assuming the context cancellation is passed back in the error message:
if !errors.Is(err, context.Canceled) && errors.Is(err, context.DeadlineExceeded) {
base.WarnfCtx(ctx, "Error retrieving changes for channel %q: %v", base.UD(singleChannelCache.ChannelID().Name), err)
}
However, I think to match the behavior of below if we don't always wrap the context error message:
| base.InfofCtx(ctx, base.KeyChanges, "Could not retrieve changes for channel %q: %v", base.UD(singleChannelCache.ChannelID().Name), err) | |
| if options.ChangesCtx.Err() != nil { | |
| base.WarnfCtx(ctx, "Error retrieving changes for channel %q: %v", base.UD(singleChannelCache.ChannelID().Name), 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.
| if current[i].Err == base.ErrChannelFeed { | |
| base.WarnfCtx(ctx, "MultiChangesFeed got error reading changes feed: %v", current[i].Err) | |
| if !options.ChangesCtx.Err() { | |
| base.WarnfCtx(ctx, "MultiChangesFeed got error reading changes feed: %v", current[i].Err) | |
| } |
In this case, it's not clear whether that err from current[i].Err is better than the error returned.
Copilot
AI
Nov 14, 2025
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.
The error message 'Could not read changes feed' is ambiguous and doesn't clearly indicate a cancellation scenario. Consider using 'Changes feed cancelled: %v' or 'Changes feed operation cancelled: %v' for clarity.
| base.InfofCtx(ctx, base.KeyChanges, "Could not read changes feed: %v", current[i].Err) | |
| base.InfofCtx(ctx, base.KeyChanges, "Changes feed cancelled: %v", current[i].Err) |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -413,7 +413,7 @@ func (c *singleChannelCacheImpl) GetChanges(ctx context.Context, options Changes | |||||||
| // Check whether the changes process has been terminated while we waited for the view lock, to avoid the view | ||||||||
| // overhead in that case (and prevent feedback loop on query backlog) | ||||||||
|
Comment on lines
413
to
414
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
| if options.ChangesCtx.Err() != nil { | ||||||||
| return nil, fmt.Errorf("Changes feed cancelled while waiting for view lock") | ||||||||
| return nil, fmt.Errorf("Changes feed cancelled") | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This would tell us in downstream while it was canceled, particularly if we are able to determine a cause, this will make the above easier to reason about I think. |
||||||||
| } | ||||||||
|
|
||||||||
| // Now query the view. We set the max sequence equal to cacheValidFrom, so we'll get one | ||||||||
|
|
||||||||
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.
The error message 'Failed to build channel feed' still implies a failure rather than a cancellation, which contradicts the PR's goal of treating these as non-error scenarios. Consider renaming to 'Channel feed cancelled' or similar to better reflect the intended semantics.
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.
I think we can drop this, because I think this error wouldn't show up if we avoid logging it at all.