Skip to content

Commit

Permalink
Merge pull request #24062 from vbotbuildovich/backport-pr-18567-v24.1…
Browse files Browse the repository at this point in the history
….x-396

[v24.1.x] [CORE-1478] rptest: fix retention value in `archive_retention_test`
  • Loading branch information
michael-redpanda authored Nov 8, 2024
2 parents 0662482 + d58d649 commit afac874
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/rptest/tests/archive_retention_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ def new_manifest_spilled():
# will be deleted (in case of retention.ms)
time.sleep(2)

retention_value = 1000 # 1KiB or 1s
self.logger.debug(f"Setting {retention_type} to {retention_value}")

for part_id in range(0, topic.partition_count):
ntp = NTP(ns='kafka', topic=topic.name, partition=part_id)
summaries = view.segment_summaries(ntp)
if retention_type == 'retention.bytes':
retention_value = max(
min(summaries, key=lambda s: s.size_bytes).size_bytes - 1,
0)
segments_to_delete = len(summaries)
else:
retention_value = 1000 # 1s
Expand All @@ -198,6 +198,8 @@ def new_manifest_spilled():
if s.base_timestamp < (current_time - retention_value)
])

self.logger.debug(f"Setting {retention_type} to {retention_value}")

# Note: altering the topic config will re-init the archiver and
# reset the metric tracking segment deletion. This is why we assign
# to `segments_to_delete` instead of adding.
Expand Down

0 comments on commit afac874

Please sign in to comment.