Skip to content
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-4027 Treat on-demand import for GET errors as not found #6957

Merged
merged 6 commits into from
Jul 15, 2024

Conversation

adamcfraser
Copy link
Collaborator

@adamcfraser adamcfraser commented Jul 11, 2024

CBG-4027

Ensures that these are correctly handled as norev messages when encountered during replication, as they always represent a case where the requested revision was not available.

Integration Tests

torcolvin
torcolvin previously approved these changes Jul 12, 2024
db/crud.go Outdated
} else if importErr != nil {
return nil, importErr
// Treat any other failure to perform an on-demand import as not found
base.DebugfCtx(ctx, base.KeyImport, "Unable to import doc %q during on demand import for get - will be treated as not found. Reason: %v", base.UD(docid), err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there's an error that would be 503, like gocb.OverloadError, do we want to skip this doc to not be found again?

Or is the assumption that this would be caught by the traditional import feed and then updated after?

return nil, getExpiryErr

or
https://github.com/couchbase/sync_gateway/blob/main/db/crud.go#L1938 should be able to trigger this behavior if there's a leaky datastore that can return 503s?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct, if there's a failure to write the doc for an on-demand import, this will fall back to the feed-based import. In this case clients who had requested the previous rev will get a norev, and will get the current rev when it is imported.

bbrks
bbrks previously requested changes Jul 12, 2024
db/crud.go Outdated
} else if importErr != nil {
return nil, importErr
// Treat any other failure to perform an on-demand import as not found
base.DebugfCtx(ctx, base.KeyImport, "Unable to import doc %q during on demand import for get - will be treated as not found. Reason: %v", base.UD(docid), err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
base.DebugfCtx(ctx, base.KeyImport, "Unable to import doc %q during on demand import for get - will be treated as not found. Reason: %v", base.UD(docid), err)
base.DebugfCtx(ctx, base.KeyImport, "Unable to import doc %q during on demand import for get - will be treated as not found. Reason: %v", base.UD(docid), importErr)

@adamcfraser adamcfraser dismissed bbrks’s stale review July 15, 2024 22:02

Requested change has been made, reviewed/approved by Greg.

@adamcfraser adamcfraser merged commit cbccc27 into main Jul 15, 2024
34 checks passed
@adamcfraser adamcfraser deleted the CBG-4027-update branch July 15, 2024 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants