Skip to content

Commit

Permalink
c/archival: fix ntp_archiver::wait bugs
Browse files Browse the repository at this point in the history
this is for ntp archiver to stop getting stuck on leadership change
  • Loading branch information
bashtanov committed Sep 5, 2024
1 parent 549f474 commit 841ecb0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/v/cluster/archival/ntp_archiver_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,15 @@ ss::future<> ntp_archiver::upload_until_abort() {
.handle_exception([this](std::exception_ptr e) {
vlog(_rtclog.error, "upload loop error: {}", e);
});

if (flush_in_progress()) {
vlog(
_rtclog.debug,
"Exited upload_until_term_change() loop, alerting flush "
"waiters.");
_flush_uploads_offset.reset();
_flush_cond.broadcast();
}
}
}

Expand Down Expand Up @@ -2744,7 +2753,9 @@ ss::future<wait_result> ntp_archiver::wait(model::offset o) {
auto wait_issued_term = _start_term;

while (!uploaded_and_clean_past_offset(o)) {
if (!_parent.is_leader() || wait_issued_term != _start_term) {
if (
!_parent.is_leader() || wait_issued_term != _start_term
|| !flush_in_progress()) {
vlog(
_rtclog.debug,
"Leadership was lost during flush operation in ntp_archiver");
Expand Down

0 comments on commit 841ecb0

Please sign in to comment.