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

sql: version compat between SQL tenant and KV backend #47919

Closed
tbg opened this issue Apr 22, 2020 · 3 comments
Closed

sql: version compat between SQL tenant and KV backend #47919

tbg opened this issue Apr 22, 2020 · 3 comments
Labels
A-multitenancy Related to multi-tenancy

Comments

@tbg
Copy link
Member

tbg commented Apr 22, 2020

Background

With the introduction of SQL tenant servers, we need a story around upgrades. Initially, this story will be that of the KV layer: adjacent versions can run together as long as the upgrade has not been finalized yet.

However, upgrade finalization at the time of writing uses Gossip, which won't be available to a SQL tenant. Instead, when a tenant server starts, it is told what version to use. This could either happen via configuration (i.e. the supervisor tells it) or by reaching out to the KV layer early in the boot sequence (i.e. before the active version matters), similar to how the KV layer might stop relying on Gossip using #32574.

An upgrade will thus first upgrade the KV layer, finalize that upgrade, and then restart all SQL tenants.

cc @irfansharif for the connection to long-running migrations, where this approach could cause some problems (since I think we are planning to remove the asynchronous component, which makes it illegal to have old SQL servers around while the KV layer is already upgraded).

@tbg
Copy link
Member Author

tbg commented May 8, 2020

Actually, for safety we should do the following instead:

  • roll kv layer into new binary (don't finalize)
  • roll tenants into new binary (use new version)
  • finalize update at KV layer

This basically "pretends" that we start the version bump earlier than we actually do, and all tenants receive it before any nodes in the KV layer do.

With long-running migrations, the semantics are going to be more complicated as there's no single "finalize" step. There are two steps, the first of which synchronously tells all (KV) nodes that the new version shall now be used (but which won't have a way to do the same for tenants), after which point any long-running migrations are run; once this is completed the upgrade is finalized (i.e. nodes can theoretically refuse any legacy behaviors, if this is desired).

I suppose it's all the same though, as the first step corresponds to the only step in today's mechanism: before initiating the upgrade, we can roll the tenants into the new version and then start the KV upgrade process. In doing so, we are essentially "pretending" that the KV layer moves the tenants into the new version first, before contacting the rest of the KV layer.

@irfansharif
Copy link
Contributor

irfansharif commented May 12, 2020

+cc @ajwerner, following our discussions around this area. #48436 will also be of interest.

@tbg
Copy link
Member Author

tbg commented Nov 24, 2020

Closing for #48436.

@tbg tbg closed this as completed Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-multitenancy Related to multi-tenancy
Projects
None yet
Development

No branches or pull requests

2 participants