Skip to content

Commit

Permalink
Add allowed transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
pr00se committed Jul 16, 2024
1 parent be16d49 commit 7fe050f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ring/lifecycler.go
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,13 @@ func (i *Lifecycler) changeState(ctx context.Context, state InstanceState) error
if !((currState == PENDING && state == JOINING) || // triggered by TransferChunks at the beginning
(currState == JOINING && state == PENDING) || // triggered by TransferChunks on failure
(currState == JOINING && state == ACTIVE) || // triggered by TransferChunks on success
// TODO -- are these TransferChunks transitions still used? Do we need to allow JOINING -> READONLY?
(currState == ACTIVE && state == READONLY) || // triggered by ...?
(currState == READONLY && state == ACTIVE) || // triggered by ...?
(currState == PENDING && state == ACTIVE) || // triggered by autoJoin
(currState == ACTIVE && state == LEAVING)) { // triggered by shutdown
(currState == PENDING && state == READONLY) || // triggered by autoJoin
(currState == ACTIVE && state == LEAVING) || // triggered by shutdown
(currState == READONLY && state == LEAVING)) { // triggered by shutdown
return fmt.Errorf("Changing instance state from %v -> %v is disallowed", currState, state)
}

Expand Down

0 comments on commit 7fe050f

Please sign in to comment.