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

Fix for CI Failure (Failed bounds check: offset 1823 not consumable) in DeleteRecordsTest.test_delete_records_segment_deletion #14434

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 26 additions & 18 deletions tests/rptest/tests/delete_records_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,19 @@ def delete_records(self, topic, partition, truncate_offset):

def assert_start_partition_boundaries(self, topic_name, truncate_offset):
def check_bound_start(offset):
try:
r = self.rpk.consume(topic_name,
n=1,
offset=f'{offset}-{offset+1}',
quiet=True,
timeout=10)
return r.count('_') == 1
except Exception as _:
return False
retries = 3
while retries > 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use the wait until helper here and in the other place?

def check_bounds():
  r = self.rpk.consume(...)
  return r.count('_') == 1

wait_until(
            check_bounds,
            timeout_sec=5,
            backoff_sec=1,
            err_msg=f"rob's awesome error message here",
            retry_on_exc=True,
        )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think with retry_on_exc we can , sure

try:
r = self.rpk.consume(topic_name,
n=1,
offset=f'{offset}-{offset+1}',
quiet=True,
timeout=10)
return r.count('_') == 1
except Exception as _:
retries = retries - 1
time.sleep(1)
return False

assert check_bound_start(
truncate_offset
Expand All @@ -192,15 +196,19 @@ def assert_new_partition_boundaries(self, topic_name, truncate_offset,
number of remaining records is as expected.
"""
def check_bound_end(offset):
try:
# Not timing out means data was available to read
_ = self.rpk.consume(topic_name,
n=1,
offset=offset,
timeout=10)
except Exception as _:
return False
return True
retries = 3
while retries > 0:
try:
# Not timing out means data was available to read
_ = self.rpk.consume(topic_name,
n=1,
offset=offset,
timeout=10)
return True
except Exception as _:
retries = retries - 1
time.sleep(1)
return False

assert truncate_offset <= high_watermark, f"Test malformed"

Expand Down