Skip to content

Commit

Permalink
allocator/storepool: carve out package from kvserver
Browse files Browse the repository at this point in the history
This commit tries to pave the way for the allocator itself to be carved
out (storepool probably being a direct dependency, but ideally through
an interface). This commit shamelessly exports any and everything needed
in order for StorePool to sit outside the kvserver package boundary.
It's unfortunate how tangled up this component is, including in tests
(some of which reach deep into inner mutexes and mutate state). We're
not doing anything to improve the status quo other than moving it and
maybe pointing to the awkwardness.

Release note: None
  • Loading branch information
irfansharif committed Apr 18, 2022
1 parent 6c91da4 commit a582830
Show file tree
Hide file tree
Showing 41 changed files with 1,259 additions and 1,058 deletions.
1 change: 1 addition & 0 deletions pkg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ ALL_TESTS = [
"//pkg/kv/kvnemesis:kvnemesis_test",
"//pkg/kv/kvprober:kvprober_test",
"//pkg/kv/kvserver/abortspan:abortspan_test",
"//pkg/kv/kvserver/allocator/storepool:storepool_test",
"//pkg/kv/kvserver/apply:apply_test",
"//pkg/kv/kvserver/asim:asim_test",
"//pkg/kv/kvserver/batcheval/result:result_test",
Expand Down
1 change: 1 addition & 0 deletions pkg/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ go_test(
"//pkg/keys",
"//pkg/kv",
"//pkg/kv/kvserver",
"//pkg/kv/kvserver/allocator/storepool",
"//pkg/kv/kvserver/liveness/livenesspb",
"//pkg/kv/kvserver/loqrecovery/loqrecoverypb",
"//pkg/kv/kvserver/stateloader",
Expand Down
3 changes: 2 additions & 1 deletion pkg/cli/zip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/base"
"github.com/cockroachdb/cockroach/pkg/jobs/jobspb"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/allocator/storepool"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/security"
"github.com/cockroachdb/cockroach/pkg/server"
Expand Down Expand Up @@ -439,7 +440,7 @@ func TestPartialZip(t *testing.T) {
// is no risk to see the override bumped due to a gossip update
// because this setting is not otherwise set in the test cluster.
s := tc.Server(0)
kvserver.TimeUntilStoreDead.Override(ctx, &s.ClusterSettings().SV, kvserver.TestTimeUntilStoreDead)
storepool.TimeUntilStoreDead.Override(ctx, &s.ClusterSettings().SV, storepool.TestTimeUntilStoreDead)

// This last case may take a little while to converge. To make this work with datadriven and at the same
// time retain the ability to use the `-rewrite` flag, we use a retry loop within that already checks the
Expand Down
7 changes: 5 additions & 2 deletions pkg/kv/kvserver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ go_library(
"store_create_replica.go",
"store_init.go",
"store_merge.go",
"store_pool.go",
"store_raft.go",
"store_rebalancer.go",
"store_remove_replica.go",
Expand Down Expand Up @@ -117,6 +116,8 @@ go_library(
"//pkg/kv/kvbase",
"//pkg/kv/kvclient/rangecache",
"//pkg/kv/kvserver/abortspan",
"//pkg/kv/kvserver/allocator",
"//pkg/kv/kvserver/allocator/storepool",
"//pkg/kv/kvserver/apply",
"//pkg/kv/kvserver/batcheval",
"//pkg/kv/kvserver/batcheval/result",
Expand Down Expand Up @@ -234,6 +235,7 @@ go_test(
"client_split_burst_test.go",
"client_split_test.go",
"client_status_test.go",
"client_store_pool_test.go",
"client_store_test.go",
"client_tenant_test.go",
"client_test.go",
Expand Down Expand Up @@ -296,7 +298,6 @@ go_test(
"split_queue_test.go",
"split_trigger_helper_test.go",
"stats_test.go",
"store_pool_test.go",
"store_rebalancer_test.go",
"store_replica_btree_test.go",
"store_test.go",
Expand All @@ -322,6 +323,8 @@ go_test(
"//pkg/kv/kvclient/kvcoord",
"//pkg/kv/kvclient/rangefeed/rangefeedcache",
"//pkg/kv/kvserver/abortspan",
"//pkg/kv/kvserver/allocator",
"//pkg/kv/kvserver/allocator/storepool",
"//pkg/kv/kvserver/apply",
"//pkg/kv/kvserver/batcheval",
"//pkg/kv/kvserver/batcheval/result",
Expand Down
Loading

0 comments on commit a582830

Please sign in to comment.