-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
release-23.2: server: option to wait for default_target_cluster on connect #113933
release-23.2: server: option to wait for default_target_cluster on connect #113933
Conversation
Virtual cluster startup is asynchronous. As a result, it can be hard to orchestrate bringing a virtual cluster up since the client needs to retry until the cluster is available. This makes it a little easier by optionally allowing connections to the default_target_cluster to be held until the cluster is online. As a result, a user who does: ALTER VIRTUAL CLUSTER app START SERVICE SHARED SET CLUSTER SETTING server.controller.default_target_cluster = 'app' Should be able to immediately connect to the same node without having to handle retries while the virtual cluster starts up. Note that in future PRs we can extend this to wait for _any_ tenant. The restriction on only waiting on the default_target_cluster is that we need to thread a little state into the server controller in order to avoid pitfalls such as holding a lot of connections open for longer than needed for a tenant that will never become available because it doesn't exist. Informs #111637 Release note: None
Using singleflight avoids having a large number of connections polling for the tenant to start up. Release note: none
Rather than polling, this uses a channel to notify us when the set of tenants has changed or when the tenant's state has changed. Release note: None
We call getServer on every new connection. It seem prudent that we wouldn't want concurrent connections to contend over a mutex when most of the time nothing is writing to the data protected by this mutex. Release note: None
We can use a zero-wait time to indicate no waiting, saving a cluster setting. Epic: none Release note: None
Release note: None
a0aaca0
to
aeffaed
Compare
aeffaed
to
ba28b36
Compare
7261c15
to
cb7634f
Compare
Thanks for opening a backport. Please check the backport criteria before merging:
If your backport adds new functionality, please ensure that the following additional criteria are satisfied:
Also, please add a brief release justification to the body of your PR to justify this |
This does add new functionality. But:
It is likely not the minimal change; however, I'm wary of having different versions of this on master vs 23.2. If we are unhappy with the size of this change, I recommend we simply forgo the backport and live with the orchestration problem. |
Backport 6/6 commits from #113687 on behalf of @stevendanna.
/cc @cockroachdb/release
Virtual cluster startup is asynchronous. As a result, it can be hard to
orchestrate bringing a virtual cluster up since the client needs to
retry until the cluster is available.
This makes it a little easier by optionally allowing connections to
the default_target_cluster to be held until the cluster is online.
As a result, a user who does:
Should be able to immediately connect to the same node without having
to handle retries while the virtual cluster starts up.
Note that we can extend this to wait for any
tenant. The restriction on only waiting on the default_target_cluster
is that we need to thread a little state into the server controller in
order to avoid pitfalls such as holding a lot of connections open for
longer than needed for a tenant that will never become available
because it doesn't exist.
In a future PR, we will set this option by default in the replication-source and replication-target
configuration profiles.
Built on #113666
Informs #111637
Release note: None
Release justification: Usability fix for physical replication, making orchestration mistakes less likely.