You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
106414: server: properly check existence of tenant record r=yuzefovich,stevendanna a=knz
PR extracted from cockroachdb#105441.
Informs cockroachdb#83650.
Part of cockroachdb#98431.
Epic: CRDB-26691
Prior to this patch, the API on the tenant info watcher would return
an "undefined" metadata payload if called prior to the tenant record
being created.
This was most visible in the following scenario:
1. new cluster starts. watcher+rangefeed start successfully (tenant
table empty)
2. tenant client connects. At this time there is no metadata for
its tenant ID, so the metadata payload is available but empty.
3. CREATE TENANT is executed for the new tenant.
4. only then (later) the rangefeed introduces the metadata
into the cache.
This is insufficient for use by the KV tenant client RPCs: there we
only want to accept incoming requests from tenant clients after we
actually have seen metadata for them.
This patch improves the situation by checking whether the tenant
record is present before returning bogus data to the SQL tenant
client.
Simultaneously, we add error handling logic in the SQL tenant client
to handle this case gracefully.
In a mixed-version deployment (with and without this patch applied),
the following behaviors will occur if one starts the SQL tenant server
without a tenant record defined:
- Unpatched server: Late startup error in client with "database 1 does not exist".
- Patched server: Client loops forever, waiting for tenant record.
Behavior when the tenant record is created shortly *after* the SQL
tenant server starts up:
- Unpatched server: Inconsistent / non-deterministic behavior.
- Patched server: Clean startup of client after tenant record appears.
Co-authored-by: Raphael 'kena' Poss <[email protected]>
0 commit comments