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

release-23.1: sql: PartitionSpan should only use healthy nodes in mixed-process mode #113171

Merged

Conversation

adityamaru
Copy link
Contributor

@adityamaru adityamaru commented Oct 26, 2023

Backport:

Please see individual PRs for details.

/cc @cockroachdb/release

Release justification: bug fix that allowed unhealthy nodes to be picked for execution in a mixed-process mode

@blathers-crl
Copy link

blathers-crl bot commented Oct 26, 2023

Thanks for opening a backport.

Please check the backport criteria before merging:

  • Patches should only be created for serious issues or test-only changes.
  • Patches should not break backwards-compatibility.
  • Patches should change as little code as possible.
  • Patches should not change on-disk formats or node communication protocols.
  • Patches should not add new functionality.
  • Patches must not add, edit, or otherwise modify cluster versions; or add version gates.
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
  • There is a high priority need for the functionality that cannot wait until the next release and is difficult to address in another way.
  • The new functionality is additive-only and only runs for clusters which have specifically “opted in” to it (e.g. by a cluster setting).
  • New code is protected by a conditional check that is trivial to verify and ensures that it only runs for opt-in clusters.
  • The PM and TL on the team that owns the changed code have signed off that the change obeys the above rules.

Add a brief release justification to the body of your PR to justify this backport.

Some other things to consider:

  • What did we do to ensure that a user that doesn’t know & care about this backport, has no idea that it happened?
  • Will this work in a cluster of mixed patch versions? Did we test that?
  • If a user upgrades a patch version, uses this feature, and then downgrades, what happens?

@blathers-crl blathers-crl bot added the backport Label PR's that are backports to older release branches label Oct 26, 2023
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@adityamaru adityamaru force-pushed the backport23.1-105256-111337 branch 4 times, most recently from 63f73a3 to 2f92222 Compare October 27, 2023 01:35
Previously, when running in mixed-process mode, the DistSQLPlanner's
PartitionSpans method would assume that it could directly assign a
given span to the SQLInstanceID that matches the NodeID of whatever
replica the current replica oracle returned, without regard to whether
the SQL instance was available.

This is different from the system tenant code paths which proactively
check node health and the non-mixed-process MT code paths which would
use an eventually consistent view of healthy nodes.

As a result, processes that use PartitionSpans such as BACKUP may fail
when a node was down.

Here, we have the mixed-process case work more like the separate
process case in which we only use nodes returned by the instance
reader. This list should eventually exclude any down nodes.

An alternative (or perhaps an addition) would be to allow MT planning
to do direct status checks more similar to how they are done for the
system tenant.

Finally, this also adds another error to our list of non-permanent
errors. Namely, if we fail to find a SQL instance, we don't tread that
as permanent.

Fixes cockroachdb#111319

Release note (bug fix): When using a private preview of physical
cluster replication, in some circumstances the source cluster would be
unable to take backups when a source cluster node was unavailable.
@adityamaru adityamaru force-pushed the backport23.1-105256-111337 branch from 2f92222 to 33d0eed Compare October 27, 2023 13:13
@adityamaru adityamaru marked this pull request as ready for review October 27, 2023 13:14
@adityamaru adityamaru requested review from a team as code owners October 27, 2023 13:14
tenantRunner := sqlutils.MakeSQLRunner(tenantDB)
var jobID jobspb.JobID
tenantRunner.QueryRow(t, "BACKUP INTO 'nodelocal://1/worker-failure' WITH detached").Scan(&jobID)
jobutils.WaitForJobToSucceed(t, tenantRunner, jobID)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevendanna I changed the end of this test a little bit because I saw a flake of the form. I don't think it changes the essence of the test, but if that computed timeout was an assertion in itself let me know and I'll try to add it back in.

Screenshot 2023-10-26 at 9 30 18 PM

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like a good change.

@adityamaru
Copy link
Contributor Author

Because we are not backporting #105451 the backport wasn't entirely clean, but the main difference is the signature of makeInstanceResolver

Copy link
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @stevendanna)

Copy link
Collaborator

@stevendanna stevendanna left a comment

Choose a reason for hiding this comment

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

Thanks

tenantRunner := sqlutils.MakeSQLRunner(tenantDB)
var jobID jobspb.JobID
tenantRunner.QueryRow(t, "BACKUP INTO 'nodelocal://1/worker-failure' WITH detached").Scan(&jobID)
jobutils.WaitForJobToSucceed(t, tenantRunner, jobID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like a good change.

@adityamaru adityamaru merged commit 2da3818 into cockroachdb:release-23.1 Oct 30, 2023
2 checks passed
@adityamaru adityamaru deleted the backport23.1-105256-111337 branch October 30, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Label PR's that are backports to older release branches
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants