Skip to content

Conversation

@knz
Copy link
Contributor

@knz knz commented Apr 5, 2023

Fixes #100609.

It is invalid to start a tenant server if the version cluster setting
is not initialized. However, it's fairly easy for test code to forget to
do this, usually by mistakenly using cluster.MakeClusterSettings()
without calling clusterversion.Initialize().

This change adds an assertion that errors out if the version setting
is not set correctly.

Release note: None
Epic: CRDB-23559

For the longest time, we had a comment that suggested we weren't sure
about it. We are now.

Release note: None
@knz knz requested review from a team as code owners April 5, 2023 07:12
@knz knz requested review from smg260 and srosenberg and removed request for a team April 5, 2023 07:12
@blathers-crl
Copy link

blathers-crl bot commented Apr 5, 2023

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

It is invalid to start a tenant server if the version cluster setting
is not initialized. However, it's fairly easy for test code to forget
to do this, usually by mistakenly using
`cluster.MakeClusterSettings()` without calling
`clusterversion.Initialize()`.

This change adds an assertion that errors out if the version setting
is not set correctly.

Release note: None
Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

very useful!

Copy link
Collaborator

@jeffswenson jeffswenson left a comment

Choose a reason for hiding this comment

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

LGTM

//
// TODO(knz): Check if this special initialization can be removed.
// See: https://github.com/cockroachdb/cockroach/issues/90831
// Since we don't know at which binary version the tenant
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a bit pedantic, but I don't agree that assuming an old binary version is the conservative choice. Some versions are one way doors and using an old version after the migration runs is also broken.

The pain point here is we don't have a way to represent "unknown version". The tenant needs an up to date setting before any version gates are checked that make durable decisions.

If anything, picking the oldest version is actually more likely to cause problems than picking the newest version, since most clusters are running with binary version == cluster version. But that is probably a good thing, because it increases the probability we will catch version bugs during initialization.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm going to merge this but we should leave this convo open. I hope that @healthy-pod can weigh in when he's back.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see two questions here:

  1. Can the current state lead to issues?
    Hopefully not, because we won't run any migrations/upgrades or check version gates before starting the settings watcher. When the settings watcher is started in SQLServer.preStart, it will set the right version and we will be good.

  2. Do we need to initialize the version where it gets initialized now? Instead of that we may be able to initialize it in preStart with the right version (tenant logical version).
    I don't have an answer yet. Do you have any thoughts on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we need to initialize the version where it gets initialized now? Instead of that we may be able to initialize it in preStart with the right version (tenant logical version).
I don't have an answer yet. Do you have any thoughts on this?

I think it would be a good thing to investigate. Mind filing an issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

@knz knz added the backport-23.1.x PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only label Apr 6, 2023
@knz
Copy link
Contributor Author

knz commented Apr 6, 2023

bors r=rafiss,JeffSwenson

@craig
Copy link
Contributor

craig bot commented Apr 6, 2023

Build succeeded:

@blathers-crl
Copy link

blathers-crl bot commented Apr 6, 2023

Encountered an error creating backports. Some common things that can go wrong:

  1. The backport branch might have already existed.
  2. There was a merge conflict.
  3. The backport branch contained merge commits.

You might need to create your backport manually using the backport tool.


error setting reviewers, but backport branch blathers/backport-release-23.1-100684 is ready: POST https://api.github.com/repos/cockroachdb/cockroach/pulls/100812/requested_reviewers: 422 Reviews may only be requested from collaborators. One or more of the teams you specified is not a collaborator of the cockroachdb/cockroach repository. []

Backport to branch 23.1.x failed. See errors above.


🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@knz knz deleted the 20230405-tenant-version branch April 8, 2023 08:56
renatolabs pushed a commit to renatolabs/cockroach that referenced this pull request Jul 22, 2024
Previously, shared-process tenants would initialize their view of the
cluster version early and set it to the `MinSupportedVersion` as a
"safe" option. However, that setting can likely be wrong, especially
now that we plan to support skip-version upgrades.

In this commit, we remove that code and rely on the initialization
that happens from storage in `preStart`. This means that we now expose
a non-negligible amount of code to a state where we don't have an
initialized cluster version. However, having that error out is better
than have code assume a potentially wrong version.

A similar discussion and approach happened for separate process
tenants a while ago: see cockroachdb#100684 and cockroachdb#104859.

Fixes: cockroachdb#126754

Release note: None
renatolabs pushed a commit to renatolabs/cockroach that referenced this pull request Jul 30, 2024
Previously, shared-process tenants would initialize their view of the
cluster version early and set it to the `MinSupportedVersion` as a
"safe" option. However, that setting can likely be wrong, especially
now that we plan to support skip-version upgrades.

In this commit, we remove that code and rely on the initialization
that happens from storage in `preStart`. This means that we now expose
a non-negligible amount of code to a state where we don't have an
initialized cluster version. However, having that error out is better
than have code assume a potentially wrong version.

A similar discussion and approach happened for separate process
tenants a while ago: see cockroachdb#100684 and cockroachdb#104859.

Fixes: cockroachdb#126754

Release note: None
craig bot pushed a commit that referenced this pull request Jul 30, 2024
127170: server: do not initialize cluster version to minimum supported r=stevendanna a=renatolabs

Previously, shared-process tenants would initialize their view of the cluster version early and set it to the `MinSupportedVersion` as a "safe" option. However, that setting can likely be wrong, especially now that we plan to support skip-version upgrades.

In this commit, we remove that code and rely on the initialization that happens from storage in `preStart`. This means that we now expose a non-negligible amount of code to a state where we don't have an initialized cluster version. However, having that error out is better than have code assume a potentially wrong version.

A similar discussion and approach happened for separate process tenants a while ago: see #100684 and #104859.

Fixes: #126754

Release note: None

Co-authored-by: Renato Costa <renato@cockroachlabs.com>
blathers-crl bot pushed a commit that referenced this pull request Jul 30, 2024
Previously, shared-process tenants would initialize their view of the
cluster version early and set it to the `MinSupportedVersion` as a
"safe" option. However, that setting can likely be wrong, especially
now that we plan to support skip-version upgrades.

In this commit, we remove that code and rely on the initialization
that happens from storage in `preStart`. This means that we now expose
a non-negligible amount of code to a state where we don't have an
initialized cluster version. However, having that error out is better
than have code assume a potentially wrong version.

A similar discussion and approach happened for separate process
tenants a while ago: see #100684 and #104859.

Fixes: #126754

Release note: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-23.1.x PAST MAINTENANCE SUPPORT: 23.1 patch releases via ER request only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jobs: mixed-version testing reports unable to find job_info

5 participants