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

cloud_storage: Improve stale_reader test #16853

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

Lazin
Copy link
Contributor

@Lazin Lazin commented Mar 4, 2024

The test failed ocasionally when the test suite generated replacement segments with the same size as original. The test replaced segments 1:1. 30 segments were replaced with 30 new randomly generated segments. This caused the test to fail ocasionally when the size of the replacment matced the size of the original segment.

This PR fixes that by replacing and merging segments. Every two old segments are replaced with one new. The manifest allows replacement segments to have any size if they are replacing more than one segment so the test can no longer fail this way.

Fixes #15679

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.3.x
  • v23.2.x

Release Notes

  • none

The test failed ocasionally when the test suite generated replacement
segments with the same size as original. The test replaced segments 1:1.
30 segments were replaced with 30 new randomly generated segments. This
caused the test to fail ocasionally when the size of the replacment
matced the size of the original segment.

This commit fixes that by replacing and merging segments. Every two old
segments are replaced with one new. The manifest allows replacement
segments to have any size if they are replacing more than one segment so
the test can no longer fail this way.
@@ -564,7 +564,6 @@ std::vector<in_memory_segment> replace_segments(
auto bo = s.base_offset;
auto it = manifest.find(bo);
BOOST_REQUIRE(it != manifest.end());
BOOST_REQUIRE(it->size_bytes != s.bytes.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

This change makes sense to me, since the batches generated are random. Out of curiosity, was the switch to replacing with merged_batch_types required also? Was there another failure mode in this test aside from this size check here?

@piyushredpanda
Copy link
Contributor

Given this was flagged, I'll go ahead merge. If there are follow ups, please consider a follow-up PR.

@piyushredpanda piyushredpanda merged commit dd17531 into redpanda-data:dev Mar 5, 2024
17 checks passed
@vbotbuildovich
Copy link
Collaborator

/backport v23.3.x

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