heesung-sn commented on code in PR #19546: URL: https://github.com/apache/pulsar/pull/19546#discussion_r1111608808
########## pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitState.java: ########## @@ -24,55 +24,37 @@ /** * Defines the possible states for service units. * - * The following diagram defines the valid state changes - * - * ┌───────────┐ - * ┌──────────┤ released │◄────────┐ - * │own └───────────┘ │release - * │ │ - * │ │ - * ▼ │ - * ┌────────┐ assign(transfer) ┌─────┴────┐ - * │ ├───────────────────►│ │ - * │ owned │ │ assigned │ - * │ │◄───────────────────┤ │ - * └──┬─────┤ own └──────────┘ - * │ ▲ │ ▲ - * │ │ │ │ - * │ │ └──────────────┐ │ - * │ │ │ │ - * │ │ unload │ │ assign(assignment) - * split │ │ │ │ - * │ │ │ │ - * │ │ create(child) │ │ - * │ │ │ │ - * ▼ │ │ │ - * ┌─────┴─────┐ └─────►┌───┴──────┐ - * │ │ │ │ - * │ splitting ├────────────────► │ free │ - * │ │ discard(parent)│ │ - * └───────────┘ └──────────┘ + * Refer to Service Unit State Channel in https://github.com/apache/pulsar/issues/16691 for additional details. */ public enum ServiceUnitState { - Free, // not owned by any broker (terminal state) + Init, // initializing the state. no previous state(terminal state) + + Disabled, // disabled by the owner broker + + Free, // not owned by any broker (semi-terminal state) Owned, // owned by a broker (terminal state) Assigned, // the ownership is assigned(but the assigned broker has not been notified the ownership yet) Released, // the source broker's ownership has been released (e.g. the topic connections are closed) - Splitting; // the service unit(e.g. bundle) is in the process of splitting. + Splitting, // the service unit(e.g. bundle) is in the process of splitting. + + Deleted; // deleted in the system (semi-terminal state) private static Map<ServiceUnitState, Set<ServiceUnitState>> validTransitions = Map.of( - // (Free -> Released | Splitting) transitions are required - // when the topic is compacted in the middle of transfer or split. - Free, Set.of(Owned, Assigned, Released, Splitting), - Owned, Set.of(Assigned, Splitting, Free), - Assigned, Set.of(Owned, Released, Free), - Released, Set.of(Owned, Free), - Splitting, Set.of(Free) + // (Init -> all states) transitions are required + // when the topic is compacted in the middle of assign, transfer or split. + Init, Set.of(Disabled, Owned, Assigned, Released, Splitting, Deleted, Init), + Disabled, Set.of(Free, Init), Review Comment: We decided to replace `disabled` with `released`. updated. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
