-
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
Changes from 1 commit
0d33616
dd83197
ae24539
51e442e
b028e25
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) | |
| } |
Outdated
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.
A few tests were not being passed because the Querytimeout would just throw an error and no context will be cancelled
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.
Outdated
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) | ||||||||
|
||||||||
| // 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) | |
| // Check whether the changes process has been terminated before running a query |
Outdated
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.
| return nil, fmt.Errorf("Changes feed cancelled") | |
| return nil, fmt.Errorf("Changes feed cancelled %w", options.ChangesCtx.Err()) |
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.
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.
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 cannot remove this, as its being used in multiple other places
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 meant, we don't need to change the message. I think "Failure" and "Error" are roughly equivalent in severity and I think there's value to leaving the messages the same to track across releases for supportability.
It is worth changing a message if it downgrades it from an issue that customers/support has to look at, or provides additional clarity.