-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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: move tenantcapabilities.IDs
to tenantcapabilitiespb
#141774
multitenant: move tenantcapabilities.IDs
to tenantcapabilitiespb
#141774
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @andyyang890, @angles-n-daemons, @DarrylWong, @golgeek, @kev-cao, and @yuzefovich)
pkg/multitenant/tenantcapabilities/capability.go
line 95 at r3 (raw file):
// EnableAll enables maximum access to services. func EnableAll(t *tenantcapabilitiespb.TenantCapabilities) {
is this function for tests only? if so, let's name it TestingEnableAll
to make that clear.
we use that convention a lot, for example:
cockroach/pkg/ccl/changefeedccl/changefeedbase/settings.go
Lines 33 to 39 in 64f47b4
// TestingSetDefaultMinCheckpointFrequency changes DefaultMinCheckpointFrequency for tests. | |
// Returns function to restore flush frequency to its original value. | |
func TestingSetDefaultMinCheckpointFrequency(f time.Duration) func() { | |
old := DefaultMinCheckpointFrequency | |
DefaultMinCheckpointFrequency = f | |
return func() { DefaultMinCheckpointFrequency = old } | |
} |
(i haven't reviewd the PR closely yet, but the same naming convention should be used for any other testing functions that were introduced here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @andyyang890, @angles-n-daemons, @DarrylWong, @golgeek, @kev-cao, @shubhamdhama, and @yuzefovich)
pkg/multitenant/tenantcapabilities/capability.go
line 95 at r3 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
is this function for tests only? if so, let's name it
TestingEnableAll
to make that clear.we use that convention a lot, for example:
cockroach/pkg/ccl/changefeedccl/changefeedbase/settings.go
Lines 33 to 39 in 64f47b4
// TestingSetDefaultMinCheckpointFrequency changes DefaultMinCheckpointFrequency for tests. // Returns function to restore flush frequency to its original value. func TestingSetDefaultMinCheckpointFrequency(f time.Duration) func() { old := DefaultMinCheckpointFrequency DefaultMinCheckpointFrequency = f return func() { DefaultMinCheckpointFrequency = old } } (i haven't reviewd the PR closely yet, but the same naming convention should be used for any other testing functions that were introduced here)
and also, similar to that example, it's prudent to have these testing functions return a cleanup
function that resets everything back to the previous state, so that cleanup
can be called by a defer
statement.
Previously, rafiss (Rafi Shamim) wrote…
This is just a code relocation: some existing code from |
5373bc4
to
9c5d352
Compare
🟢 Sysbench [SQL, 3node, oltp_read_write]
Reproducebenchdiff binaries: mkdir -p benchdiff/9c5d352/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/9c5d35278925ab275bc3030de676cbd8dc0ee56d/bin/pkg_sql_tests benchdiff/9c5d352/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/9c5d352/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/fbcabe0/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/fbcabe029eb2e1701710d08cebbca6d15089f911/bin/pkg_sql_tests benchdiff/fbcabe0/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/fbcabe0/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests benchdiff command: benchdiff --run=^BenchmarkSysbench/SQL/3node/oltp_read_write$ --old=fbcabe0 --new=9c5d352 ./pkg/sql/tests 🟢 Sysbench [KV, 1node, local, oltp_read_only]
Reproducebenchdiff binaries: mkdir -p benchdiff/9c5d352/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/9c5d35278925ab275bc3030de676cbd8dc0ee56d/bin/pkg_sql_tests benchdiff/9c5d352/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/9c5d352/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/fbcabe0/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/fbcabe029eb2e1701710d08cebbca6d15089f911/bin/pkg_sql_tests benchdiff/fbcabe0/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/fbcabe0/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests benchdiff command: benchdiff --run=^BenchmarkSysbench/KV/1node_local/oltp_read_only$ --old=fbcabe0 --new=9c5d352 ./pkg/sql/tests ⚪ Sysbench [KV, 1node, local, oltp_write_only]
Reproducebenchdiff binaries: mkdir -p benchdiff/9c5d352/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/9c5d35278925ab275bc3030de676cbd8dc0ee56d/bin/pkg_sql_tests benchdiff/9c5d352/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/9c5d352/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
mkdir -p benchdiff/fbcabe0/bin/1058449141
gcloud storage cp gs://cockroach-microbench-ci/builds/fbcabe029eb2e1701710d08cebbca6d15089f911/bin/pkg_sql_tests benchdiff/fbcabe0/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests
chmod +x benchdiff/fbcabe0/bin/1058449141/cockroachdb_cockroach_pkg_sql_tests benchdiff command: benchdiff --run=^BenchmarkSysbench/KV/1node_local/oltp_write_only$ --old=fbcabe0 --new=9c5d352 ./pkg/sql/tests Artifactsdownload: mkdir -p new
gcloud storage cp gs://cockroach-microbench-ci/artifacts/9c5d35278925ab275bc3030de676cbd8dc0ee56d/13457216717-1/\* new/
mkdir -p old
gcloud storage cp gs://cockroach-microbench-ci/artifacts/fbcabe029eb2e1701710d08cebbca6d15089f911/13457216717-1/\* old/ Legend
No regressions detected! built with commit: 9c5d35278925ab275bc3030de676cbd8dc0ee56d |
5b91044
to
226b6e6
Compare
This commit relocates the `tenantcapabilitiespb` directory to the same level as `tenantcapabilities`. This change improves consistency with other similar directories (e.g., `mtinfopb`) and shortens the long package path (`pkg/multitenant/tenantcapabilities`).
This commit moves `tenantcapabilities.IDs` from `pkg/multitenant/tenantcapabilities` to `tenantcapabilitiespb` to resolve a cyclic dependency. `pkg/base` needs to use capability constants/enums, but a direct dependency on `pkg/multitenant/tenantcapabilities` would create a cycle. `tenantcapabilitiespb` has fewer dependencies, making it a more suitable location for these IDs. It also makes sense to keep high-level contracts like these in the `tenantcapabilitiespb` package. Informs: cockroachdb#138912 Epic: CRDB-38970 Release note: None
226b6e6
to
ecca7f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. LGTM!
Thanks for the reviews! bors r=stevendanna,cthumuluru-crdb |
Previously, shubhamdhama (Shubham Dhama) wrote…
@rafiss, it's actually used for non-test code, so I think we are good here: cockroach/pkg/multitenant/mtinfo/info.go Lines 69 to 71 in c68c559
|
Build succeeded: |
multitenant: relocate `tenantcapabilitiespb` directory
This commit relocates the
tenantcapabilitiespb
directory to the samelevel as
tenantcapabilities
. This change improves consistency with othersimilar directories (e.g.,
mtinfopb
) and shortens the long package path(
pkg/multitenant/tenantcapabilities
).multitenant: move `tenantcapabilities.IDs` to `tenantcapabilitiespb`
This commit moves
tenantcapabilities.IDs
frompkg/multitenant/tenantcapabilities
totenantcapabilitiespb
to resolve acyclic dependency.
pkg/base
needs to use capability constants/enums, buta direct dependency on
pkg/multitenant/tenantcapabilities
would create acycle.
tenantcapabilitiespb
has fewer dependencies, making it a moresuitable location for these IDs. It also makes sense to keep high-level
contracts like these in the
tenantcapabilitiespb
package.Informs: #138912
Epic: CRDB-38970
Release note: None