Skip to content

Commit

Permalink
c/controller_backend: allow shutdown_partition to fail on app shutdown
Browse files Browse the repository at this point in the history
With `ss::gate_closed_exception` only. This is to untangle a race
condition between partition shutdown and app shutdown. Callers should
consider the operation unsuccessful and will probably retry it, as
`shard_placement_table` is not going to be updated.

While this unsuccessful operation will leave the partition in a somewhat
orphaned state, i.e. without appropriate `shard_table` entries, the rest
of the system should be able to live with it in the same way as it lives
during a successful partition shutdown.

(cherry picked from commit 0bb1be6)
  • Loading branch information
bashtanov authored and vbotbuildovich committed Nov 29, 2024
1 parent 9ec4ce3 commit e09ccea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/v/cluster/controller_backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1924,10 +1924,17 @@ controller_backend::shutdown_partition(ss::lw_shared_ptr<partition> partition) {
ntp, gr, partition->get_log_revision_id());
// shutdown partition
co_return co_await _partition_manager.local().shutdown(ntp);
} catch (const seastar::gate_closed_exception&) {
// let it bubble up and break reconciliation loop
vlog(
clusterlog.debug,
"error shutting down {} partition, app shutting down",
ntp);
throw;
} catch (...) {
/**
* If partition shutdown failed we should crash, this error is
* unrecoverable
* If partition shutdown failed with any other exception we should
* crash, this error is unrecoverable
*/
vassert(
false,
Expand Down
1 change: 1 addition & 0 deletions src/v/cluster/controller_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class controller_backend
ss::future<> remove_from_shard_table(
model::ntp, raft::group_id, model::revision_id log_revision);

/* may fail only with ss::gate_closed_exception */
ss::future<xshard_transfer_state>
shutdown_partition(ss::lw_shared_ptr<partition>);

Expand Down

0 comments on commit e09ccea

Please sign in to comment.