Browse files

More efficient index partition state transitions

If a request to make one (or more) partitions active/passive comes
and the partition is still under cleanup, don't block the caller
until the cleanup finishes. Instead reply immediately to caller and
apply the requested state transition later. This new approach
also offers more chances of avoiding unnecessary transitions/IO if
the caller later asks to cleanup the partition that it previously
asked to mark as active/passive and before this later transition
got applied.

This new behaviour, like the old behaviour, also guarantees that if
the caller gets a positive reply, there's no state information loss
if the server crashes after replying to the caller. The pending state
transition is written to the index header and fsync'ed before replying
to the caller.

Change-Id: I0704d66a33856e540e50f2f4f14f623e881acbe7
Tested-by: buildbot <>
Tested-by: Filipe David Borba Manana <>
Reviewed-by: Damien Katz <>
  • Loading branch information...
1 parent 7ef409d commit ad151b0509043cf7e9c462b4a1e24b18e86721d3 @fdmanana fdmanana committed with Damien Katz Apr 11, 2012
@@ -82,7 +82,15 @@
id_btree_state = nil,
view_states = nil,
has_replica = false,
- replicas_on_transfer = []
+ replicas_on_transfer = [],
+ % Pending partition states transition.
+ pending_transition = nil % 'nil' | #set_view_transition{}
+-record(set_view_transition, {
+ active,
+ passive,
+ cleanup
-record(set_view_debug_info, {
Oops, something went wrong.

0 comments on commit ad151b0

Please sign in to comment.