Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pkg/sql/importer/import_stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,12 @@ func setupTestImportCSVStmt(
skip.UnderShort(t)
skip.UnderRace(t, "takes >1min under race")

// The test isn't validating these batch sizes, but extreme metamorphic
// values (e.g. 1) cause the package to time out. Raise them to a floor that
// still exercises batching code paths.
t.Cleanup(row.TestingSetDatumRowConverterBatchSize(10))
t.Cleanup(row.TestingRaiseDefaultKVBatchSize(10))

const nodes = 3

numFiles = nodes + 2
Expand Down
15 changes: 15 additions & 0 deletions pkg/sql/row/kv_batch_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ var defaultKVBatchSize = rowinfra.KeyLimit(metamorphic.ConstantWithTestValue(
1, /* metamorphicValue */
))

// TestingRaiseDefaultKVBatchSize raises defaultKVBatchSize to minSize if it is
// currently lower; otherwise it leaves the value untouched. The returned
// function restores the previous value. This is useful for tests that should
// not run with extremely small metamorphic batch sizes.
func TestingRaiseDefaultKVBatchSize(minSize int) func() {
if defaultKVBatchSize >= rowinfra.KeyLimit(minSize) {
return func() {}
}
prev := defaultKVBatchSize
defaultKVBatchSize = rowinfra.KeyLimit(minSize)
return func() {
defaultKVBatchSize = prev
}
}

// elasticCPUDurationPerLowPriReadResponse controls how many CPU tokens are allotted
// each time we seek admission for response handling during internally submitted
// low priority reads (like row-level TTL selects).
Expand Down
Loading