Package com.linkedin.venice.controller
Class StoreLifecycleHooksCache
java.lang.Object
com.linkedin.venice.controller.StoreLifecycleHooksCache
Instantiates and caches
StoreLifecycleHooks by class name, and dispatches
StoreLifecycleHooks.postStoreVersionSwap(java.lang.String, java.lang.String, int, int, java.lang.String, com.linkedin.venice.utils.lazy.Lazy<com.linkedin.venice.controllerapi.JobStatusQueryResponse>, com.linkedin.venice.utils.VeniceProperties) for all hooks registered on a store.
Shared across DeferredVersionSwapService, VeniceHelixAdmin, and
AbstractPushMonitor so hook instantiation and
invocation logic is not duplicated.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetOrInstantiateHook(String className) Returns a cached (or freshly constructed)StoreLifecycleHooksinstance for the given fully-qualified class name.invokePostVersionSwapHooks(String clusterName, Store store, int versionNumber, int previousVersion, String regionName, Lazy<JobStatusQueryResponse> jobStatus)
-
Constructor Details
-
StoreLifecycleHooksCache
-
-
Method Details
-
getOrInstantiateHook
Returns a cached (or freshly constructed)StoreLifecycleHooksinstance for the given fully-qualified class name. Returnsnulland logs a warning if the class cannot be loaded or instantiated.Null or blank class names return
nullimmediately. The name is trimmed before lookup so whitespace variants do not create separate cache entries.Failed instantiations are cached in
failedClassesso that a bad class name is only attempted once; subsequent calls returnnullimmediately without re-attempting reflection. -
invokePostVersionSwapHooks
public StoreVersionLifecycleEventOutcome invokePostVersionSwapHooks(String clusterName, Store store, int versionNumber, int previousVersion, String regionName, @Nullable Lazy<JobStatusQueryResponse> jobStatus) InvokesStoreLifecycleHooks.postStoreVersionSwap(java.lang.String, java.lang.String, int, int, java.lang.String, com.linkedin.venice.utils.lazy.Lazy<com.linkedin.venice.controllerapi.JobStatusQueryResponse>, com.linkedin.venice.utils.VeniceProperties)for every hook registered onstore. ReturnsStoreVersionLifecycleEventOutcome.ROLLBACKorStoreVersionLifecycleEventOutcome.ABORTimmediately if any hook requests it (short-circuit — remaining hooks are not called). ReturnsStoreVersionLifecycleEventOutcome.WAITif any hook requested it and none requested rollback/abort. ReturnsStoreVersionLifecycleEventOutcome.PROCEEDotherwise.Null or malformed
LifecycleHooksRecords are skipped. Any exception thrown by a hook is caught, logged, and the hook is skipped without affecting the outcome.
-