Skip to content

Commit

Permalink
tests: wait for the victim node to apply the dirty offset
Browse files Browse the repository at this point in the history
Controller erasure test is supposed to validate if there is a mismatch
between the last appended entry in kvstore and controller max offset. In
order for the test to work correctly we must wait for all the messages
to be committed as we only delete the last segment that contains a
single message (new replicated configuration). In order to make the test
reliable change the condition to wait for the applied offset on the node
where controller log is going to be removed to be equal to the leader
dirty offset.

Fixes: #8217

Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Jun 12, 2023
1 parent ed47391 commit 57fb4c0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tests/rptest/tests/controller_erase_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_erase_controller_log(self, partial):

# Stop the node we will intentionally damage
victim_node = self.redpanda.nodes[1]
bystander_node = self.redpanda.nodes[0]
bystander_node = self.redpanda.controller()

def wait_all_segments():
storage = self.redpanda.node_storage(victim_node)
Expand All @@ -75,20 +75,19 @@ def wait_all_segments():
f"Victim node({victim_node}) does not contain expected segments count({transfers_leadership_count + 1}) for controller log"
)

bystander_node_last_applied_offset = admin.get_controller_status(
bystander_node)["last_applied_offset"]
bystander_node_dirty_offset = admin.get_controller_status(
bystander_node)["dirty_offset"]

def wait_victim_node_apply_segments():
return admin.get_controller_status(victim_node)[
"last_applied_offset"] >= bystander_node_last_applied_offset
"last_applied_offset"] >= bystander_node_dirty_offset

wait_until(
wait_victim_node_apply_segments,
timeout_sec=40,
backoff_sec=1,
err_msg=
f"Victim node did not apply {bystander_node_last_applied_offset} offset"
)
f"Victim node did not apply {bystander_node_dirty_offset} offset")

self.redpanda.stop_node(victim_node)

Expand Down

0 comments on commit 57fb4c0

Please sign in to comment.