Skip to content

Commit

Permalink
rowinfra: clamp default-batch-bytes-limit under duress
Browse files Browse the repository at this point in the history
This commit adjusts `default-batch-bytes-limit` metamorphic variable to
be clamped when ran under duress (previously we did so only under
stress, but using very small values can lead to slow tests with timeouts
under race too). Additionally, it bumps the minimum clamped value from
1KiB to 10KiB (which was mentioned in the commit message of
246d030 which introduced the clamping
helper).

Release note: None
  • Loading branch information
yuzefovich committed Dec 6, 2024
1 parent b87a3ce commit 755def1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pkg/sql/rowinfra/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ const ProductionKVBatchSize KeyLimit = 100000

// defaultBatchBytesLimit is the maximum number of bytes a scan request can
// return.
var defaultBatchBytesLimit = BytesLimit(skip.ClampMetamorphicConstantUnderStress(
var defaultBatchBytesLimit = BytesLimit(skip.ClampMetamorphicConstantUnderDuress(
metamorphic.ConstantWithTestRange(
"default-batch-bytes-limit",
defaultBatchBytesLimitProductionValue, /* defaultValue */
1, /* min */
64<<10, /* max, 64KiB */
),
1<<10, /* min, 1KiB */
10<<10, /* min, 10KiB */
))

const defaultBatchBytesLimitProductionValue = 10 << 20 /* 10MiB */
Expand Down
8 changes: 4 additions & 4 deletions pkg/testutils/skip/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

package skip

// ClampMetamorphicConstantUnderStress ensures that the given integer constant
// ClampMetamorphicConstantUnderDuress ensures that the given integer constant
// with metamorphic testing range is at least the given minimum value, when the
// process is running under stress.
func ClampMetamorphicConstantUnderStress(val, min int) int {
if Stress() && val < min {
// process is running under duress.
func ClampMetamorphicConstantUnderDuress(val, min int) int {
if Duress() && val < min {
return min
}
return val
Expand Down

0 comments on commit 755def1

Please sign in to comment.