Skip to content

Commit

Permalink
kvserver: remove deprecated last split qps
Browse files Browse the repository at this point in the history
This patch removes the deprecated 'lastSplitQPS' value throughout the
split/merge code. This field was deprecated in 22.1 in favor or
`maxSplitQPS` and stopped being consulted in 22.2.

Now only `maxSplitQPS` is consulted and set in `RangeStatsResponse`.

Release note: None
  • Loading branch information
kvoli committed Jan 17, 2023
1 parent b9b2b6f commit b0f1559
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 54 deletions.
2 changes: 2 additions & 0 deletions docs/generated/settings/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@
<tr><td><div id="setting-jobs-retention-time" class="anchored"><code>jobs.retention_time</code></div></td><td>duration</td><td><code>336h0m0s</code></td><td>the amount of time to retain records for completed jobs before</td></tr>
<tr><td><div id="setting-kv-allocator-load-based-lease-rebalancing-enabled" class="anchored"><code>kv.allocator.load_based_lease_rebalancing.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>set to enable rebalancing of range leases based on load and latency</td></tr>
<tr><td><div id="setting-kv-allocator-load-based-rebalancing" class="anchored"><code>kv.allocator.load_based_rebalancing</code></div></td><td>enumeration</td><td><code>leases and replicas</code></td><td>whether to rebalance based on the distribution of load across stores [off = 0, leases = 1, leases and replicas = 2]</td></tr>
<tr><td><div id="setting-kv-allocator-load-based-rebalancing-dimension" class="anchored"><code>kv.allocator.load_based_rebalancing_dimension</code></div></td><td>enumeration</td><td><code>store_cpu</code></td><td>what dimension of load does rebalancing consider [qps = 0, store_cpu = 1]</td></tr>
<tr><td><div id="setting-kv-allocator-load-based-rebalancing-interval" class="anchored"><code>kv.allocator.load_based_rebalancing_interval</code></div></td><td>duration</td><td><code>1m0s</code></td><td>the rough interval at which each store will check for load-based lease / replica rebalancing opportunities</td></tr>
<tr><td><div id="setting-kv-allocator-qps-rebalance-threshold" class="anchored"><code>kv.allocator.qps_rebalance_threshold</code></div></td><td>float</td><td><code>0.1</code></td><td>minimum fraction away from the mean a store&#39;s QPS (such as queries per second) can be before it is considered overfull or underfull</td></tr>
<tr><td><div id="setting-kv-allocator-range-rebalance-threshold" class="anchored"><code>kv.allocator.range_rebalance_threshold</code></div></td><td>float</td><td><code>0.05</code></td><td>minimum fraction away from the mean a store&#39;s range count can be before it is considered overfull or underfull</td></tr>
<tr><td><div id="setting-kv-allocator-store-cpu-rebalance-threshold" class="anchored"><code>kv.allocator.store_cpu_rebalance_threshold</code></div></td><td>float</td><td><code>0.1</code></td><td>minimum fraction away from the mean a store&#39;s cpu usage can be before it is considered overfull or underfull</td></tr>
<tr><td><div id="setting-kv-bulk-io-write-max-rate" class="anchored"><code>kv.bulk_io_write.max_rate</code></div></td><td>byte size</td><td><code>1.0 TiB</code></td><td>the rate limit (bytes/sec) to use for writes to disk on behalf of bulk io ops</td></tr>
<tr><td><div id="setting-kv-bulk-sst-max-allowed-overage" class="anchored"><code>kv.bulk_sst.max_allowed_overage</code></div></td><td>byte size</td><td><code>64 MiB</code></td><td>if positive, allowed size in excess of target size for SSTs from export requests; export requests (i.e. BACKUP) may buffer up to the sum of kv.bulk_sst.target_size and kv.bulk_sst.max_allowed_overage in memory</td></tr>
<tr><td><div id="setting-kv-bulk-sst-target-size" class="anchored"><code>kv.bulk_sst.target_size</code></div></td><td>byte size</td><td><code>16 MiB</code></td><td>target size for SSTs emitted from export requests; export requests (i.e. BACKUP) may buffer up to the sum of kv.bulk_sst.target_size and kv.bulk_sst.max_allowed_overage in memory</td></tr>
Expand Down
2 changes: 0 additions & 2 deletions pkg/kv/kvserver/batcheval/cmd_range_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ func RangeStats(
) (result.Result, error) {
reply := resp.(*roachpb.RangeStatsResponse)
reply.MVCCStats = cArgs.EvalCtx.GetMVCCStats()
reply.DeprecatedLastQueriesPerSecond = cArgs.EvalCtx.GetLastSplitQPS(ctx)
if qps, ok := cArgs.EvalCtx.GetMaxSplitQPS(ctx); ok {
reply.MaxQueriesPerSecond = qps
} else {
// See comment on MaxQueriesPerSecond. -1 means !ok.
reply.MaxQueriesPerSecond = -1
}
reply.MaxQueriesPerSecondSet = true
reply.RangeInfo = cArgs.EvalCtx.GetRangeInfo(ctx)
return result.Result{}, nil
}
11 changes: 0 additions & 11 deletions pkg/kv/kvserver/batcheval/eval_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,6 @@ type EvalContext interface {
// is disabled.
GetMaxSplitQPS(context.Context) (float64, bool)

// GetLastSplitQPS returns the Replica's most recent queries/s request rate.
//
// NOTE: This should not be used when the load based splitting cluster setting
// is disabled.
//
// TODO(nvanbenschoten): remove this method in v22.1.
GetLastSplitQPS(context.Context) float64

GetGCThreshold() hlc.Timestamp
ExcludeDataFromBackup() bool
GetLastReplicaGCTimestamp(context.Context) (hlc.Timestamp, error)
Expand Down Expand Up @@ -242,9 +234,6 @@ func (m *mockEvalCtxImpl) GetMVCCStats() enginepb.MVCCStats {
func (m *mockEvalCtxImpl) GetMaxSplitQPS(context.Context) (float64, bool) {
return m.QPS, true
}
func (m *mockEvalCtxImpl) GetLastSplitQPS(context.Context) float64 {
return m.QPS
}
func (m *mockEvalCtxImpl) CanCreateTxnRecord(
context.Context, uuid.UUID, []byte, hlc.Timestamp,
) (bool, hlc.Timestamp, roachpb.TransactionAbortedReason) {
Expand Down
9 changes: 2 additions & 7 deletions pkg/kv/kvserver/merge_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,8 @@ func (mq *mergeQueue) requestRangeStats(

desc = &res.RangeInfo.Desc
stats = res.MVCCStats
if res.MaxQueriesPerSecondSet {
qps = res.MaxQueriesPerSecond
qpsOK = qps >= 0
} else {
qps = res.DeprecatedLastQueriesPerSecond
qpsOK = true
}
qps = res.MaxQueriesPerSecond
qpsOK = qps >= 0
return desc, stats, qps, qpsOK, nil
}

Expand Down
10 changes: 0 additions & 10 deletions pkg/kv/kvserver/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -1123,16 +1123,6 @@ func (r *Replica) GetMaxSplitQPS(ctx context.Context) (float64, bool) {
return r.loadBasedSplitter.MaxQPS(ctx, r.Clock().PhysicalTime())
}

// GetLastSplitQPS returns the Replica's most recent queries/s request rate.
//
// NOTE: This should only be used for load based splitting, only
// works when the load based splitting cluster setting is enabled.
//
// Use QueriesPerSecond() for current QPS stats for all other purposes.
func (r *Replica) GetLastSplitQPS(ctx context.Context) float64 {
return r.loadBasedSplitter.LastQPS(ctx, r.Clock().PhysicalTime())
}

// ContainsKey returns whether this range contains the specified key.
//
// TODO(bdarnell): This is not the same as RangeDescriptor.ContainsKey.
Expand Down
6 changes: 0 additions & 6 deletions pkg/kv/kvserver/replica_eval_context_span.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,6 @@ func (rec SpanSetReplicaEvalContext) GetMaxSplitQPS(ctx context.Context) (float6
return rec.i.GetMaxSplitQPS(ctx)
}

// GetLastSplitQPS returns the Replica's most recent queries/s rate for
// splitting and merging purposes.
func (rec SpanSetReplicaEvalContext) GetLastSplitQPS(ctx context.Context) float64 {
return rec.i.GetLastSplitQPS(ctx)
}

// CanCreateTxnRecord determines whether a transaction record can be created
// for the provided transaction information. See Replica.CanCreateTxnRecord
// for details about its arguments, return values, and preconditions.
Expand Down
1 change: 1 addition & 0 deletions pkg/kv/kvserver/split_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ func (sq *splitQueue) processAttempt(
batchHandledQPS := loadStats.QueriesPerSecond
raftAppliedQPS := loadStats.WriteKeysPerSecond
splitQPS := r.loadBasedSplitter.LastQPS(ctx, now)

reason := fmt.Sprintf(
"load at key %s (%.2f splitQPS, %.2f batches/sec, %.2f raft mutations/sec)",
splitByLoadKey,
Expand Down
21 changes: 3 additions & 18 deletions pkg/roachpb/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2083,13 +2083,6 @@ message RangeStatsResponse {
(gogoproto.customname) = "MVCCStats"
];

// DeprecatedLastQueriesPerSecond is the most recent rate of request/s or QPS
// for the range. The field is deprecated in favor of MaxQueriesPerSecond.
//
// TODO(nvanbenschoten): remove this field in v22.1 when all nodes in the
// cluster are guaranteed to return MaxQueriesPerSecond.
double deprecated_last_queries_per_second = 3;

// MaxQueriesPerSecond is the maximum rate of request/s or QPS that the range
// has served over a configured measurement period. Set to -1 if the replica
// serving the RangeStats request has not been the leaseholder long enough to
Expand All @@ -2098,19 +2091,11 @@ message RangeStatsResponse {
// base important decisions off of.
double max_queries_per_second = 5;

// MaxQueriesPerSecondSet indicates that the MaxQueriesPerSecond field is set
// by the server. Used to distinguish 0 qps set by a new server from the field
// not being set at all by an old server.
//
// TODO(nvanbenschoten): stop consulting this field on the receiver in v22.1
// when all nodes in the cluster are guaranteed to return MaxQueriesPerSecond.
//
// TODO(nvanbenschoten): stop setting this field and remove it in v22.2 when
// no nodes in the cluster consult this field.
bool max_queries_per_second_set = 6;

// range_info contains descriptor and lease information.
RangeInfo range_info = 4 [(gogoproto.nullable) = false];

reserved 3;
reserved 6;
}

// MigrateRequest is used instruct all ranges overlapping with it to exercise
Expand Down

0 comments on commit b0f1559

Please sign in to comment.