Skip to content

Commit

Permalink
mma: [dnm] add cluster state message handling
Browse files Browse the repository at this point in the history
TODO(kvoli)...

Informs: #103320
Release note: None
  • Loading branch information
kvoli committed Feb 26, 2025
1 parent 09d4505 commit 8d394bf
Show file tree
Hide file tree
Showing 11 changed files with 1,619 additions and 195 deletions.
7 changes: 7 additions & 0 deletions pkg/kv/kvserver/allocator/mma/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/roachpb",
"//pkg/util/timeutil",
"@com_github_cockroachdb_errors//:errors",
"@com_github_cockroachdb_redact//:redact",
],
)

go_test(
name = "mma_test",
srcs = [
"cluster_state_test.go",
"constraint_matcher_test.go",
"constraint_test.go",
"load_test.go",
Expand All @@ -32,6 +35,10 @@ go_test(
embed = [":mma"],
deps = [
"//pkg/roachpb",
"//pkg/spanconfig/spanconfigtestutils",
"//pkg/testutils/datapathutils",
"//pkg/util/log",
"//pkg/util/timeutil",
"@com_github_cockroachdb_datadriven//:datadriven",
"@com_github_cockroachdb_errors//:errors",
"@com_github_stretchr_testify//require",
Expand Down
5 changes: 3 additions & 2 deletions pkg/kv/kvserver/allocator/mma/allocator_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sync"

"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
)

type allocatorState struct {
Expand All @@ -27,9 +28,9 @@ type allocatorState struct {
changeRangeLimiter *storeChangeRateLimiter
}

func newAllocatorState() *allocatorState {
func newAllocatorState(ts timeutil.TimeSource) *allocatorState {
interner := newStringInterner()
cs := newClusterState(interner)
cs := newClusterState(ts, interner)
return &allocatorState{
cs: cs,
rangesNeedingAttention: map[roachpb.RangeID]struct{}{},
Expand Down
Loading

0 comments on commit 8d394bf

Please sign in to comment.