Skip to content

sql: add is_draining to system.sql_instances table.#126765

Closed
shubhamdhama wants to merge 1 commit intocockroachdb:masterfrom
shubhamdhama:100578-add-is_draining-field
Closed

sql: add is_draining to system.sql_instances table.#126765
shubhamdhama wants to merge 1 commit intocockroachdb:masterfrom
shubhamdhama:100578-add-is_draining-field

Conversation

@shubhamdhama
Copy link
Copy Markdown
Contributor

@shubhamdhama shubhamdhama commented Jul 5, 2024

This is a preliminary commit toward improving the DistSQL to avoid planning on an instance that is draining (#128283). The idea here is to set this column to true as soon as the draining request is received by the server and use that through instance reader in the planner at gateway.

Adding this column requires writing a migration for the upgrade. And since this new column is nullable we don't need to backfill and we are good with just swapping the descriptors.

Informs: #100578
Release note: None

@shubhamdhama shubhamdhama requested review from a team as code owners July 5, 2024 09:03
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@shubhamdhama shubhamdhama force-pushed the 100578-add-is_draining-field branch 2 times, most recently from 886cfdf to 48e7ace Compare July 8, 2024 14:18
@shubhamdhama shubhamdhama force-pushed the 100578-add-is_draining-field branch 2 times, most recently from d855ae0 to d6b7dda Compare July 17, 2024 06:52
@shubhamdhama shubhamdhama force-pushed the 100578-add-is_draining-field branch from d6b7dda to 6f6420e Compare August 4, 2024 18:54
shubhamdhama added a commit to shubhamdhama/cockroach that referenced this pull request Aug 4, 2024
This change would prevent distsql planner to include a draining node in a plan by
leveraging the system.sql_instances table's `is_draining` field added in cockroachdb#126765.

Somewhat related work to avoid planning on an unavailable node: cockroachdb#124986

Fixes: cockroachdb#100578
Epic: CRDB-31575
Release note: None
@stevendanna
Copy link
Copy Markdown
Collaborator

@shubhamdhama Just as a heads up, I believe we have the new versions on master now so this should be good to proceed again.

@rafiss rafiss removed the request for review from a team August 21, 2024 20:22
@shubhamdhama shubhamdhama force-pushed the 100578-add-is_draining-field branch from 6f6420e to d361800 Compare August 26, 2024 05:47
This is a preliminary commit toward improving the DistSQL to avoid planning
on an instance that is draining. The idea here is to set this column to
true as soon as the draining request is received by the server and use that
through instance reader in the planner at gateway.

Adding this column requires writing a migration for the upgrade. And since
this new column is nullable we don't need to backfill and we are good with
just swapping the descriptors.

Informs: cockroachdb#100578
Release note: None

---

Development notes:

To update `pkg/sql/catalog/bootstrap/testdata/testdata` I had to manually
update the hash values for `system`/`tenant` in this file and pass the
`--rewrite` option to do the rest:
```
dev test //pkg/sql/catalog/bootstrap:bootstrap_test --filter=TestInitialValuesToString/testdata --rewrite
```

To update tests in
`pkg/sql/catalog/systemschema_test/testdata/bootstrap_{system,tenant}`
```
dev test //pkg/sql/catalog/systemschema_test:systemschema_test_test --rewrite
```
@shubhamdhama shubhamdhama force-pushed the 100578-add-is_draining-field branch from d361800 to 9133722 Compare August 26, 2024 09:45
shubhamdhama added a commit to shubhamdhama/cockroach that referenced this pull request Aug 26, 2024
This change would prevent distsql planner to include a draining node in a plan by
leveraging the system.sql_instances table's `is_draining` field added in cockroachdb#126765.

Somewhat related work to avoid planning on an unavailable node: cockroachdb#124986

Fixes: cockroachdb#100578
Epic: CRDB-31575
Release note: None
@shubhamdhama
Copy link
Copy Markdown
Contributor Author

I've updated the PR. Please have a look.

@shubhamdhama
Copy link
Copy Markdown
Contributor Author

shubhamdhama commented Aug 28, 2024

Stacking PR doesn't work well with GitHub (I had to update two PRs every time I update the commit in this PR). I'm closing this PR since changes in this PR are closely tied to #128283.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants