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

rptest: tolerate leadership changes in chunk read tests #21344

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
14 changes: 7 additions & 7 deletions tests/rptest/tests/cloud_storage_chunk_read_path_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,6 @@ def __init__(self, redpanda: RedpandaService, topic: str, n_delete=3):
self.n_delete = n_delete
self.deleted_chunks = 0

leader_id = Admin(self.redpanda).get_partition_leader(
namespace='kafka', topic=self.topic, partition=0)
self.leader = self.redpanda.get_node_by_id(leader_id)

def run(self) -> None:
cmd = f"""
find {self.redpanda.DATA_DIR}/cloud_storage_cache -regex '.*kafka/{self.topic}/.*_chunks/[0-9]+' -print0 |\
Expand All @@ -518,11 +514,15 @@ def run(self) -> None:
xargs --no-run-if-empty --null rm -v"""
while not self.stop_requested:
sleep(self.sleep_interval)
if self.leader in self.redpanda.started_nodes():
leader_id = Admin(self.redpanda).get_partition_leader(
namespace='kafka', topic=self.topic, partition=0)
leader_node = self.redpanda.get_node_by_id(leader_id)

if leader_node in self.redpanda.started_nodes():
try:
for row in self.leader.account.ssh_capture(cmd):
for row in leader_node.account.ssh_capture(cmd):
self.redpanda.logger.debug(
f'{self.leader.account.hostname}: {row.strip()}')
f'{leader_node.account.hostname}: {row.strip()}')
self.deleted_chunks += 1
except Exception as ex:
self.redpanda.logger.info(
Expand Down
Loading