Skip to content

Commit

Permalink
sql: fix expected batch count for edge case in copy test
Browse files Browse the repository at this point in the history
In TestLargeDynamicRows we test that 4 rows of data can fit in a batch
size of at least 4 rows given default memory sizes. However, when we set
the batch row size to the minimum value of 4, the test hook that counts
batches counts an extra empty batch. This PR changes adjusts the minimum
row size to 5 for the purposes of this test.

Epic: None
Fixes: #109134

Release note: None
  • Loading branch information
rharding6373 committed Aug 22, 2023
1 parent 7394fc6 commit 3a82145
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/sql/copy/copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,10 @@ func TestLargeDynamicRows(t *testing.T) {
err = conn.Exec(ctx, "RESET CLUSTER SETTING kv.raft.command.max_size")
require.NoError(t, err)

// This won't work if the batch size gets set to less than 4.
if sql.CopyBatchRowSize < 4 {
sql.SetCopyFromBatchSize(4)
// This won't work if the batch size gets set to less than 5. When the batch
// size is 4, the test hook will count an extra empty batch.
if sql.CopyBatchRowSize < 5 {
sql.SetCopyFromBatchSize(5)
}

_, err = conn.GetDriverConn().CopyFrom(ctx, strings.NewReader(sb.String()), "COPY t FROM STDIN")
Expand Down

0 comments on commit 3a82145

Please sign in to comment.