From 3a8214527e00a1d6e4f52ecbe0c4574634e0fa65 Mon Sep 17 00:00:00 2001 From: rharding6373 Date: Tue, 22 Aug 2023 21:40:59 +0000 Subject: [PATCH] sql: fix expected batch count for edge case in copy test 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 --- pkg/sql/copy/copy_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/sql/copy/copy_test.go b/pkg/sql/copy/copy_test.go index b5b6939a0f1c..3f83a8d68357 100644 --- a/pkg/sql/copy/copy_test.go +++ b/pkg/sql/copy/copy_test.go @@ -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")