Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
98720: roachtest: enable kv/gracefuldraining/nodes=3 r=andrewbaptist a=kvoli

This commit re-enables the `kv/gracefuldraining/nodes=3` roachtest. The
test is still likely to fail occasionally however has produced
interesting findings just in testing to re-enable.

Informs: #59094

Release note: None

101729: streamingccl: don't require TLS certificates r=dt a=stevendanna

Users may want to use password auth to simplify their replication setup. While we may recommend TLS certificate auth, I don't see a strong reason to _require_ it.

Epic: none

Release note: None

102825: kvserver,storepool: misc rebalance logging improvements r=andrewbaptist a=kvoli

The store list string returned the mean leases, ranges and
queries-per-second float values without limiting the number of decimal
places. This led to log lines with needlessly long decimals:

`avg-ranges=40.66666666666667... avg-leases=10.166666666666666...`

This PR updates the store list string formatting to 2 decimal
places for float values.

Previously, the easiest method of determining the current rebalance
objective from logs was to view the cluster setting and check for
logging indicating a mixed version cluster - this was cumbersome.

This PR annotates the ctx in the store rebalancer loop with an
additional tag: `obj`. The `obj` tag indicates the current rebalance
objective, either `cpu` or `qps` currently.

resolves: #102812


Release note: None

Co-authored-by: Austen McClernon <austen@cockroachlabs.com>
Co-authored-by: Steven Danna <danna@cockroachlabs.com>
  • Loading branch information
3 people committed May 9, 2023
4 parents 439c515 + d0120ff + 7d0f283 + 8da1cea commit a961c9d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
10 changes: 0 additions & 10 deletions pkg/ccl/streamingccl/streamingest/stream_ingestion_planning.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,6 @@ func ingestionPlanHook(
if err != nil {
return err
}
q := streamURL.Query()

// Operator should specify a postgres scheme address with cert authentication.
if hasPostgresAuthentication := (q.Get("sslmode") == "verify-full") &&
q.Has("sslrootcert") && q.Has("sslkey") && q.Has("sslcert"); (streamURL.Scheme == "postgres") &&
!hasPostgresAuthentication {
return errors.Errorf(
"stream replication address should have cert authentication if in postgres scheme: %s", streamAddress)
}

streamAddress = streamingccl.StreamAddress(streamURL.String())

// TODO(adityamaru): Add privileges checks. Probably the same as RESTORE.
Expand Down
1 change: 0 additions & 1 deletion pkg/cmd/roachtest/tests/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ func registerKVGracefulDraining(r registry.Registry) {
r.Add(registry.TestSpec{
Name: "kv/gracefuldraining/nodes=3",
Owner: registry.OwnerKV,
Skip: "https://github.com/cockroachdb/cockroach/issues/59094",
Cluster: r.MakeClusterSpec(4),
Run: func(ctx context.Context, t test.Test, c cluster.Cluster) {
nodes := c.Spec().NodeCount - 1
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/allocator/storepool/store_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ func MakeStoreList(descriptors []roachpb.StoreDescriptor) StoreList {
func (sl StoreList) String() string {
var buf bytes.Buffer
fmt.Fprintf(&buf,
" candidate: avg-ranges=%v avg-leases=%v avg-disk-usage=%v avg-queries-per-second=%v avg-store-cpu-per-second=%v",
" candidate: avg-ranges=%.2f avg-leases=%.2f avg-disk-usage=%s avg-queries-per-second=%.2f avg-store-cpu-per-second=%s",
sl.CandidateRanges.Mean,
sl.CandidateLeases.Mean,
humanizeutil.IBytes(int64(sl.candidateLogicalBytes.Mean)),
Expand Down
16 changes: 12 additions & 4 deletions pkg/kv/kvserver/rebalance_objective.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ const (
LBRebalancingCPU
)

// LoadBasedRebalancingObjectiveMap maps the LoadBasedRebalancingObjective enum
// value to a string.
var LoadBasedRebalancingObjectiveMap map[int64]string = map[int64]string{
int64(LBRebalancingQueries): "qps",
int64(LBRebalancingCPU): "cpu",
}

func (lbro LBRebalancingObjective) String() string {
return LoadBasedRebalancingObjectiveMap[int64(lbro)]
}

// LoadBasedRebalancingObjective is a cluster setting that defines the load
// balancing objective of the cluster.
var LoadBasedRebalancingObjective = settings.RegisterEnumSetting(
Expand All @@ -101,10 +112,7 @@ var LoadBasedRebalancingObjective = settings.RegisterEnumSetting(
"the cluster will attempt to balance qps among stores, if set to "+
"`cpu` the cluster will attempt to balance cpu usage among stores",
"cpu",
map[int64]string{
int64(LBRebalancingQueries): "qps",
int64(LBRebalancingCPU): "cpu",
},
LoadBasedRebalancingObjectiveMap,
).WithPublic()

// ToDimension returns the equivalent allocator load dimension of a rebalancing
Expand Down
3 changes: 3 additions & 0 deletions pkg/kv/kvserver/store_rebalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ func (sr *StoreRebalancer) Start(ctx context.Context, stopper *stop.Stopper) {
continue
}
objective := sr.RebalanceObjective()
sr.AddLogTag("obj", objective)
ctx = sr.AnnotateCtx(ctx)

hottestRanges := sr.replicaRankings.TopLoad(objective.ToDimension())
options := sr.scorerOptions(ctx, objective.ToDimension())
rctx := sr.NewRebalanceContext(ctx, options, hottestRanges, mode)
Expand Down

0 comments on commit a961c9d

Please sign in to comment.