Skip to content

Commit b168254

Browse files
craig[bot]msbutler
andcommitted
Merge #152450
152450: kvserver: estimate AddSStable stats if ComputeStatsDiff assuptions violated r=jeffswenson a=msbutler Previously the request would fail-- now we internally retry the stats computation with estimates. We should further investigate why the ComputeStatsDiff assumptions are violated in the c2c/kv0 test though. Fixes #151979 Release note: none Co-authored-by: Michael Butler <[email protected]>
2 parents f276f1a + e2932fa commit b168254

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

pkg/cmd/roachtest/tests/cluster_to_cluster.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,6 +1987,7 @@ func destClusterSettings(t test.Test, db *sqlutils.SQLRunner, additionalDuration
19871987
`SET CLUSTER SETTING kv.rangefeed.enabled = true;`,
19881988
`SET CLUSTER SETTING kv.lease.reject_on_leader_unknown.enabled = true;`,
19891989
`SET CLUSTER SETTING stream_replication.replan_flow_threshold = 0.1;`,
1990+
`SET CLUSTER SETTING bulkio.ingest.compute_stats_diff_in_stream_batcher.enabled = true;`,
19901991
)
19911992

19921993
if additionalDuration != 0 {

pkg/kv/bulk/sst_batcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ var (
7070
settings.ApplicationLevel,
7171
"bulkio.ingest.compute_stats_diff_in_stream_batcher.enabled",
7272
"if set, kvserver will compute an accurate stats diff for every addsstable request",
73-
metamorphic.ConstantWithTestBool("computeStatsDiffInStreamBatcher", true),
73+
metamorphic.ConstantWithTestBool("computeStatsDiffInStreamBatcher", false),
7474
)
7575

7676
sstBatcherElasticCPUControlEnabled = settings.RegisterBoolSetting(

pkg/kv/kvserver/batcheval/cmd_add_sstable.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,11 @@ func computeSSTStatsDiffWithFallback(
474474
) (enginepb.MVCCStats, error) {
475475
stats, err := storage.ComputeSSTStatsDiff(
476476
ctx, sst, readWriter, nowNanos, start, end)
477-
if errors.Is(err, storage.ComputeSSTStatsDiffReaderHasRangeKeys) {
478-
// Fall back to stats estimates if there are range keys in the engine.
479-
log.VEventf(ctx, 2, "computing SST stats as estimates after detecting range keys in engine")
477+
if errors.IsAny(err, storage.ComputeSSTStatsDiffReaderHasRangeKeys, storage.ComputeStatsDiffViolation) {
478+
log.Warningf(ctx, "computing SST stats as estimates because of ComputeSSTStatsDiff error: %s", err)
480479
sstStats, err := computeSSTStats(ctx, sst, nowNanos)
481480
if err != nil {
482-
return enginepb.MVCCStats{}, errors.Wrap(err, "computing SST stats after detecting range keys in engine")
481+
return enginepb.MVCCStats{}, errors.Wrap(err, "error computing SST stats during fallback")
483482
}
484483
sstStats.ContainsEstimates = 1
485484
return sstStats, nil

0 commit comments

Comments
 (0)