Skip to content

Commit 7cf8e92

Browse files
committed
rowexec: remove a couple testing knobs from processor protos
This commit removes TableReaderSpec.BatchBytesLimit and JoinReaderSpec.LookupBatchBytesLimit that are only used in tests. Given that we have access to the testing knobs on each node that creates the necessary processor, we can just consult that directly. This removal avoids the possible confusion for how and when these fields are used. Release note: None
1 parent a22fc4e commit 7cf8e92

File tree

5 files changed

+15
-52
lines changed

5 files changed

+15
-52
lines changed

pkg/sql/colfetcher/colbatch_scan.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,14 @@ func newColBatchScanBase(
169169
s.MakeSpansCopy()
170170
}
171171

172-
if spec.LimitHint > 0 || spec.BatchBytesLimit > 0 {
172+
if spec.LimitHint > 0 {
173173
// Parallelize shouldn't be set when there's a limit hint, but double-check
174174
// just in case.
175175
spec.Parallelize = false
176176
}
177177
var batchBytesLimit rowinfra.BytesLimit
178178
if !spec.Parallelize {
179-
batchBytesLimit = rowinfra.BytesLimit(spec.BatchBytesLimit)
179+
batchBytesLimit = rowinfra.BytesLimit(flowCtx.Cfg.TestingKnobs.TableReaderBatchBytesLimit)
180180
if batchBytesLimit == 0 {
181181
batchBytesLimit = rowinfra.GetDefaultBatchBytesLimit(flowCtx.EvalCtx.TestingKnobs.ForceProductionValues)
182182
}

pkg/sql/distsql_physical_planner.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,9 +2467,6 @@ func (dsp *DistSQLPlanner) planTableReaders(
24672467
}
24682468

24692469
tr.Parallelize = info.parallelize
2470-
if !tr.Parallelize {
2471-
tr.BatchBytesLimit = dsp.distSQLSrv.TestingKnobs.TableReaderBatchBytesLimit
2472-
}
24732470
tr.IgnoreMisplannedRanges = ignoreMisplannedRanges
24742471
p.TotalEstimatedScannedRows += info.estimatedRowCount
24752472

@@ -3444,7 +3441,6 @@ func (dsp *DistSQLPlanner) planLookupJoin(
34443441
MaintainLookupOrdering: maintainLookupOrdering,
34453442
LeftJoinWithPairedJoiner: planInfo.isSecondJoinInPairedJoiner,
34463443
OutputGroupContinuationForLeftRow: planInfo.isFirstJoinInPairedJoiner,
3447-
LookupBatchBytesLimit: dsp.distSQLSrv.TestingKnobs.JoinReaderBatchBytesLimit,
34483444
LimitHint: planInfo.limitHint,
34493445
RemoteOnlyLookups: planInfo.remoteOnlyLookups,
34503446
ReverseScans: planInfo.reverseScans,

pkg/sql/execinfrapb/processors_sql.proto

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ message TableReaderSpec {
7474
// limit hint.
7575
optional bool parallelize = 12 [(gogoproto.nullable) = false];
7676

77-
// batch_bytes_limit, if non-zero, controls the TargetBytes limits that the
78-
// TableReader will use for its scans. If zero, then the server-side default
79-
// is used. If parallelize is set, this cannot be set.
80-
optional int64 batch_bytes_limit = 17 [(gogoproto.nullable) = false];
81-
8277
// If non-zero, this enables inconsistent historical scanning where different
8378
// batches can be read with different timestamps. This is used for
8479
// long-running table statistics which may outlive the TTL. Using this setting
@@ -124,7 +119,7 @@ message TableReaderSpec {
124119
// leaseholder of the beginning of the key spans to be scanned).
125120
optional bool ignore_misplanned_ranges = 22 [(gogoproto.nullable) = false];
126121

127-
reserved 1, 2, 4, 6, 7, 8, 13, 14, 15, 16, 19;
122+
reserved 1, 2, 4, 6, 7, 8, 13, 14, 15, 16, 17, 19;
128123
}
129124

130125
// FiltererSpec is the specification for a processor that filters input rows
@@ -303,18 +298,10 @@ message JoinReaderSpec {
303298
// variables @(N+1) to @(N+M) refer to fetched columns.
304299
optional Expression on_expr = 4 [(gogoproto.nullable) = false];
305300

306-
// This used to be used for an extra index filter expression. It was removed
307-
// in DistSQL version 24.
308-
reserved 5;
309-
310301
// For lookup joins. Only JoinType_INNER and JoinType_LEFT_OUTER are
311302
// supported.
312303
optional sqlbase.JoinType type = 6 [(gogoproto.nullable) = false];
313304

314-
// This field used to be a visibility level of the columns that should be
315-
// produced. We now produce the columns in the FetchSpec.
316-
reserved 7;
317-
318305
// Indicates the row-level locking strength to be used by the join. If set to
319306
// FOR_NONE, no row-level locking should be performed.
320307
optional sqlbase.ScanLockingStrength locking_strength = 9 [(gogoproto.nullable) = false];
@@ -335,8 +322,6 @@ message JoinReaderSpec {
335322
// optimizations.
336323
optional bool maintain_ordering = 11 [(gogoproto.nullable) = false];
337324

338-
reserved 12, 13;
339-
340325
// LeftJoinWithPairedJoiner is used when a left {outer,anti,semi} join is
341326
// being achieved by pairing two joins, and this is the second join. See
342327
// the comment above.
@@ -349,13 +334,6 @@ message JoinReaderSpec {
349334
// be true.
350335
optional bool output_group_continuation_for_left_row = 15 [(gogoproto.nullable) = false];
351336

352-
// lookup_batch_bytes_limit, if non-zero, controls the TargetBytes limits that
353-
// the joiner will use for its lookups. If zero, then the server-side default
354-
// is used. Note that, regardless of this setting, bytes limits are not always
355-
// used for lookups - it depends on whether the joiner decides it wants
356-
// DistSender-parallelism or not.
357-
optional int64 lookup_batch_bytes_limit = 18 [(gogoproto.nullable) = false];
358-
359337
// A hint for how many rows the consumer of the join reader output might
360338
// need. This is used to size the initial batches of input rows to try to
361339
// avoid reading many more rows than needed by the processor receiving the
@@ -384,6 +362,8 @@ message JoinReaderSpec {
384362
// reverse order. This is only useful if a lookup can return more than one
385363
// row.
386364
optional bool reverse_scans = 25 [(gogoproto.nullable) = false];
365+
366+
reserved 5, 7, 12, 13, 18;
387367
}
388368

389369
// SorterSpec is the specification for a "sorting aggregator". A sorting

pkg/sql/rowexec/joinreader.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,6 @@ type joinReader struct {
238238
// and requires that the spec has MaintainOrdering set to true.
239239
outputGroupContinuationForLeftRow bool
240240

241-
// lookupBatchBytesLimit controls the TargetBytes of lookup requests. If 0, a
242-
// default will be used. Regardless of this value, bytes limits aren't always
243-
// used.
244-
lookupBatchBytesLimit rowinfra.BytesLimit
245-
246241
// limitHintHelper is used in limiting batches of input rows in the presence
247242
// of hard and soft limits.
248243
limitHintHelper execinfra.LimitHintHelper
@@ -363,7 +358,6 @@ func newJoinReader(
363358
readerType: readerType,
364359
txn: txn,
365360
usesStreamer: useStreamer,
366-
lookupBatchBytesLimit: rowinfra.BytesLimit(spec.LookupBatchBytesLimit),
367361
limitHintHelper: execinfra.MakeLimitHintHelper(spec.LimitHint, post),
368362
errorOnLookup: errorOnLookup,
369363
allowEnforceHomeRegionFollowerReads: flowCtx.EvalCtx.SessionData().EnforceHomeRegionFollowerReadsEnabled,
@@ -873,11 +867,10 @@ func (jr *joinReader) getBatchBytesLimit() rowinfra.BytesLimit {
873867
// DistSender-level parallelism.
874868
return rowinfra.NoBytesLimit
875869
}
876-
bytesLimit := jr.lookupBatchBytesLimit
877-
if bytesLimit == 0 {
878-
bytesLimit = rowinfra.GetDefaultBatchBytesLimit(jr.FlowCtx.EvalCtx.TestingKnobs.ForceProductionValues)
870+
if testingLimit := jr.FlowCtx.Cfg.TestingKnobs.JoinReaderBatchBytesLimit; testingLimit != 0 {
871+
return rowinfra.BytesLimit(testingLimit)
879872
}
880-
return bytesLimit
873+
return rowinfra.GetDefaultBatchBytesLimit(jr.FlowCtx.EvalCtx.TestingKnobs.ForceProductionValues)
881874
}
882875

883876
// readInput reads the next batch of input rows and starts an index scan, which

pkg/sql/rowexec/tablereader.go

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ type tableReader struct {
3434
execinfra.ProcessorBase
3535
execinfra.SpansWithCopy
3636

37-
limitHint rowinfra.RowLimit
38-
parallelize bool
39-
batchBytesLimit rowinfra.BytesLimit
37+
limitHint rowinfra.RowLimit
38+
parallelize bool
4039

4140
scanStarted bool
4241

@@ -83,24 +82,16 @@ func newTableReader(
8382
return nil, errors.AssertionFailedf("attempting to create a tableReader with uninitialized NodeID")
8483
}
8584

86-
if spec.LimitHint > 0 || spec.BatchBytesLimit > 0 {
85+
if spec.LimitHint > 0 {
8786
// Parallelize shouldn't be set when there's a limit hint, but double-check
8887
// just in case.
8988
spec.Parallelize = false
9089
}
91-
var batchBytesLimit rowinfra.BytesLimit
92-
if !spec.Parallelize {
93-
batchBytesLimit = rowinfra.BytesLimit(spec.BatchBytesLimit)
94-
if batchBytesLimit == 0 {
95-
batchBytesLimit = rowinfra.GetDefaultBatchBytesLimit(flowCtx.EvalCtx.TestingKnobs.ForceProductionValues)
96-
}
97-
}
9890

9991
tr := trPool.Get().(*tableReader)
10092

10193
tr.limitHint = rowinfra.RowLimit(execinfra.LimitHint(spec.LimitHint, post))
10294
tr.parallelize = spec.Parallelize
103-
tr.batchBytesLimit = batchBytesLimit
10495
tr.maxTimestampAge = time.Duration(spec.MaxTimestampAgeNanos)
10596

10697
// Make sure the key column types are hydrated. The fetched column types
@@ -213,7 +204,10 @@ func (tr *tableReader) startScan(ctx context.Context) error {
213204
if !limitBatches {
214205
bytesLimit = rowinfra.NoBytesLimit
215206
} else {
216-
bytesLimit = tr.batchBytesLimit
207+
bytesLimit = rowinfra.BytesLimit(tr.FlowCtx.Cfg.TestingKnobs.TableReaderBatchBytesLimit)
208+
if bytesLimit == 0 {
209+
bytesLimit = rowinfra.GetDefaultBatchBytesLimit(tr.FlowCtx.EvalCtx.TestingKnobs.ForceProductionValues)
210+
}
217211
}
218212
log.VEventf(ctx, 1, "starting scan with limitBatches %t", limitBatches)
219213
var err error

0 commit comments

Comments
 (0)