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

Change feature detection for CRDB watch to not require waiting #2205

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

josephschorr
Copy link
Member

Instead, we purposefully give an invalid parameter, which returns an expected error, but only if watch is supported

Instead, we purposefully give an invalid parameter, which returns an expected error, but only if watch is supported
@josephschorr josephschorr requested a review from a team as a code owner January 11, 2025 22:06
@github-actions github-actions bot added the area/datastore Affects the storage system label Jan 11, 2025
// Start a changefeed with an invalid value. If we get back an invalid value error (SQLSTATE 22023)
// then we know that the datastore supports watch. If we get back any other error, then we know that
// the datastore does not support watch emits or there is a permissions issue.
_ = cds.writePool.ExecFunc(ctx, func(ctx context.Context, tag pgconn.CommandTag, err error) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

The changestream does not run through any connection pools based on a recommendation from CRL; why is it being done that way here?

not sure if this runs in a loop or a certain cadence, but that would cause connections to be terminated (because of the error)

Copy link
Member Author

Choose a reason for hiding this comment

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

Because its going to fail either way; the reason to not use a pool is because it can be a long-running operation

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant that it is using a pool and I don't think it should. It could cause connection churn on a pool that is serving write traffic.

Copy link
Member Author

Choose a reason for hiding this comment

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

Its only called on startup, so it should be fine

internal/datastore/crdb/crdb.go Show resolved Hide resolved
@josephschorr josephschorr added this pull request to the merge queue Jan 13, 2025
Merged via the queue into authzed:main with commit 3bbf457 Jan 13, 2025
39 checks passed
@josephschorr josephschorr deleted the crdb-watch-feature-check branch January 13, 2025 22:53
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/datastore Affects the storage system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants