Package com.linkedin.davinci.helix
Class AbstractPartitionStateModel
- java.lang.Object
-
- org.apache.helix.participant.statemachine.StateModel
-
- com.linkedin.davinci.helix.AbstractPartitionStateModel
-
- Direct Known Subclasses:
LeaderFollowerPartitionStateModel
public abstract class AbstractPartitionStateModel extends org.apache.helix.participant.statemachine.StateModel
An abstraction of Helix State model behavior registry that defines how participants (Storage node) fetch data from Kafka. Helix state model is state machine defined by "states" and transitions (edges from one state to the other). In order to make Helix state machine work, 2 parts are required. 1. A model definition that defines all available states and transitions. 2. A behavior registry that defines what participant should do during transitions before moving to next state. Currently, we support LeaderStandbyModel participant model. Check outLeaderStandbySMD
for model definition andLeaderFollowerPartitionStateModel
for behavior registry.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.logging.log4j.Logger
logger
protected static long
WAIT_DROP_PARTITION_TIME_OUT_MS
-
Constructor Summary
Constructors Constructor Description AbstractPartitionStateModel(IngestionBackend ingestionBackend, ReadOnlyStoreRepository storeRepository, VeniceStoreVersionConfig storeAndServerConfigs, int partition, java.util.concurrent.CompletableFuture<HelixPartitionStatusAccessor> accessorFuture, java.lang.String instanceName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
executeStateTransition(org.apache.helix.model.Message message, org.apache.helix.NotificationContext context, java.lang.Runnable handler)
protected void
executeStateTransition(org.apache.helix.model.Message message, org.apache.helix.NotificationContext context, java.lang.Runnable handler, boolean rollback)
protected IngestionBackend
getIngestionBackend()
protected int
getPartition()
protected VeniceStoreVersionConfig
getStoreAndServerConfigs()
protected StoreIngestionService
getStoreIngestionService()
java.lang.String
getStorePartitionDescription()
protected ReadOnlyStoreRepository
getStoreRepo()
void
onBecomeDroppedFromError(org.apache.helix.model.Message message, org.apache.helix.NotificationContext context)
Handles ERROR->DROPPED transition.protected void
removeCustomizedState()
remove customized state for this partition if there is oneprotected java.util.concurrent.CompletableFuture<java.lang.Void>
removePartitionFromStoreGracefully()
void
reset()
void
rollbackOnError(org.apache.helix.model.Message message, org.apache.helix.NotificationContext context, org.apache.helix.participant.statemachine.StateTransitionError error)
Stop the consumption once a replica become ERROR.protected void
setupNewStorePartition()
set up a new store partition and start the ingestionprotected void
stopConsumption(boolean dropCVState)
protected void
waitConsumptionCompleted(java.lang.String resourceName, StateModelIngestionProgressNotifier notifier)
-
-
-
Constructor Detail
-
AbstractPartitionStateModel
public AbstractPartitionStateModel(IngestionBackend ingestionBackend, ReadOnlyStoreRepository storeRepository, VeniceStoreVersionConfig storeAndServerConfigs, int partition, java.util.concurrent.CompletableFuture<HelixPartitionStatusAccessor> accessorFuture, java.lang.String instanceName)
-
-
Method Detail
-
executeStateTransition
protected void executeStateTransition(org.apache.helix.model.Message message, org.apache.helix.NotificationContext context, java.lang.Runnable handler)
-
executeStateTransition
protected void executeStateTransition(org.apache.helix.model.Message message, org.apache.helix.NotificationContext context, java.lang.Runnable handler, boolean rollback)
-
rollbackOnError
public void rollbackOnError(org.apache.helix.model.Message message, org.apache.helix.NotificationContext context, org.apache.helix.participant.statemachine.StateTransitionError error)
Stop the consumption once a replica become ERROR. This function only does clean up when any state transition fails, and it won't retry any state transition.- Overrides:
rollbackOnError
in classorg.apache.helix.participant.statemachine.StateModel
-
onBecomeDroppedFromError
public void onBecomeDroppedFromError(org.apache.helix.model.Message message, org.apache.helix.NotificationContext context)
Handles ERROR->DROPPED transition. Unexpected Transition. Unsubscribe the partition, removes partition's data from local storage and clears the committed offset.- Overrides:
onBecomeDroppedFromError
in classorg.apache.helix.participant.statemachine.StateModel
-
reset
public void reset()
- Overrides:
reset
in classorg.apache.helix.participant.statemachine.StateModel
-
setupNewStorePartition
protected void setupNewStorePartition()
set up a new store partition and start the ingestion
-
removePartitionFromStoreGracefully
protected java.util.concurrent.CompletableFuture<java.lang.Void> removePartitionFromStoreGracefully()
-
removeCustomizedState
protected void removeCustomizedState()
remove customized state for this partition if there is one
-
waitConsumptionCompleted
protected void waitConsumptionCompleted(java.lang.String resourceName, StateModelIngestionProgressNotifier notifier)
-
stopConsumption
protected void stopConsumption(boolean dropCVState)
-
getIngestionBackend
protected IngestionBackend getIngestionBackend()
-
getStoreIngestionService
protected StoreIngestionService getStoreIngestionService()
-
getStoreRepo
protected ReadOnlyStoreRepository getStoreRepo()
-
getStoreAndServerConfigs
protected VeniceStoreVersionConfig getStoreAndServerConfigs()
-
getPartition
protected int getPartition()
-
getStorePartitionDescription
public java.lang.String getStorePartitionDescription()
-
-