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

multitenant: add AdminUnsplitRequest capability #97717

Merged
merged 4 commits into from
Mar 9, 2023
Merged

multitenant: add AdminUnsplitRequest capability #97717

merged 4 commits into from
Mar 9, 2023

Conversation

ecwall
Copy link
Contributor

@ecwall ecwall commented Feb 27, 2023

Fixes #97716

  1. Add a new tenantcapabilitiespb.CanAdminUnsplit capability.
  2. Check capability in Authorizer.HasCapabilityForBatch.
  3. Remove ExecutorConfig.RequireSystemTenant call from
    execFactory.ConstructAlterTableUnsplit,
    execFactory.ConstructAlterTableUnsplitAll.

Release note: None

@ecwall ecwall requested review from a team as code owners February 27, 2023 15:49
@ecwall ecwall requested a review from mgartner February 27, 2023 15:49
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@arulajmani arulajmani left a comment

Choose a reason for hiding this comment

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

As we're adding new capabilities, we should continue to add tests for them in the tenantcapabilities package. For this one, I think all you need is to add more tests to the Authorizer's datadriven tests.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz, @mgartner, and @rafiss)

@ecwall ecwall requested a review from a team as a code owner March 6, 2023 13:37
@ecwall ecwall requested a review from a team March 6, 2023 13:37
Copy link
Contributor Author

@ecwall ecwall left a comment

Choose a reason for hiding this comment

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

To make adding those tests easier, can I replace the request method aliases (split, scan, cput) with the actual method names (AdminSplit, Scan, ConditionalPut)?

This will prevent new cases from needing to be added to this switch for each method:

switch z {
  case "split":
    ba.Add(&kvpb.AdminSplitRequest{})
  case "scan":
    ba.Add(&kvpb.ScanRequest{})
  case "cput":
    ba.Add(&kvpb.ConditionalPutRequest{})
  default:
    t.Fatalf("unsupported request type: %s", z)
}

I would like to minimize the overhead of using DSLs everywhere for what could be go tests.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @knz, @mgartner, and @rafiss)

@ecwall ecwall requested a review from a team March 9, 2023 18:59
Remove `TestGCTenant`'s reliance on `TenantCapabilities` struct
field names to reduce code churn.

Release note: None
Filter out non-target capabilities from output of capabilites_test.go testdata.

Release note: None
@ecwall ecwall requested a review from a team as a code owner March 9, 2023 20:22
@ecwall ecwall requested review from msbutler and removed request for a team March 9, 2023 20:22
@ecwall ecwall requested a review from a team as a code owner March 9, 2023 20:54
@ecwall ecwall requested review from arulajmani and removed request for a team, mgartner and msbutler March 9, 2023 21:16
Copy link
Contributor

@knz knz left a comment

Choose a reason for hiding this comment

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

nice.

Reviewed 18 of 18 files at r3, 1 of 1 files at r4, 8 of 8 files at r5, 25 of 25 files at r6, all commit messages.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @arulajmani and @rafiss)

Use request methods instead of aliases to avoid needing to maintain
alias -> request method mapping.

Release note: None
Fixes #97716

1) Add a new `tenantcapabilitiespb.CanAdminUnsplit` capability.
2) Check capability in `Authorizer.HasCapabilityForBatch`.
3) Remove `ExecutorConfig.RequireSystemTenant` call from
   `execFactory.ConstructAlterTableUnsplit`,
   `execFactory.ConstructAlterTableUnsplitAll`.

Release note: None
@ecwall
Copy link
Contributor Author

ecwall commented Mar 9, 2023

bors r=knz

@craig
Copy link
Contributor

craig bot commented Mar 9, 2023

Build succeeded:

@craig craig bot merged commit 62eb4b8 into cockroachdb:master Mar 9, 2023
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.

multitenant: add AdminUnsplitRequest capability
4 participants