Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: fix expected batch count for edge case in copy test #109292

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

rharding6373
Copy link
Collaborator

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

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: cockroachdb#109134

Release note: None
@rharding6373 rharding6373 requested a review from cucaroach August 22, 2023 22:04
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator Author

@rharding6373 rharding6373 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @cucaroach)


pkg/sql/copy/copy_test.go line 605 at r1 (raw file):

	// 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.

An alternative approach I tried is to move the call to the test hook TestingKnobs.BeforeCopyFromInsert below where we check the number of rows to insert in insertRowsInternal so that we don't call it if there are 0 rows (as is the case in the final batch), but counting the empty batch may be more accurate. Let me know if you think that approach would be better. Either way, this is a test only change.

Copy link
Contributor

@cucaroach cucaroach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Thanks for fixing this!

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @rharding6373)


pkg/sql/copy/copy_test.go line 605 at r1 (raw file):

Previously, rharding6373 (Rachael Harding) wrote…

An alternative approach I tried is to move the call to the test hook TestingKnobs.BeforeCopyFromInsert below where we check the number of rows to insert in insertRowsInternal so that we don't call it if there are 0 rows (as is the case in the final batch), but counting the empty batch may be more accurate. Let me know if you think that approach would be better. Either way, this is a test only change.

This is fine I think.

@rharding6373
Copy link
Collaborator Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 23, 2023

👎 Rejected by too few approved reviews

@rharding6373
Copy link
Collaborator Author

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 23, 2023

This PR was included in a batch that was canceled, it will be automatically retried

@craig craig bot merged commit 44f66d4 into cockroachdb:master Aug 23, 2023
@craig
Copy link
Contributor

craig bot commented Aug 23, 2023

Build succeeded:

@yuzefovich
Copy link
Member

blathers backport 23.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pkg/sql/copy/copy_test: TestLargeDynamicRows failed
4 participants