Class VersionLifecyclePolicy
java.lang.Object
com.linkedin.venice.controller.versionlifecycle.VersionLifecyclePolicy
Pure-decision helpers governing the store-version lifecycle: capacity guards run before
starting a new push, version selection over a store's version history, status aggregation
across child regions, and the small bookkeeping flags (
ttlRepushEnabled) self-managed
via the push id. All methods are deterministic given their inputs and perform no I/O against
the controller's own state (PushMonitor and ReadWriteStoreRepository are passed in
explicitly).-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckBackupVersionCleanupCapacityForNewPush(String clusterName, String storeName, Store store, BackupStrategy backupStrategy, int minNumberOfStoreVersionsToPreserve, long minBackupVersionCleanupDelay, long currentTimeMs) Throws if starting a new push would exceed the store's version budget because existing backup versions are pending deletion but still within the min cleanup delay (e.g., after a rollback).static voidcheckPreConditionForSingleVersionDeletion(String clusterName, String storeName, Store store, int versionNum) Validate thatversionNumcan be individually deleted fromstore.static voidcheckRollbackOriginVersionCapacityForNewPush(String clusterName, String storeName, Store store, long rolledBackVersionRetentionMs, long currentTimeMs) Throws if starting a new push would violate the retention window for a rollback-origin version.static intgetBackupVersionNumber(List<Version> versions, int currentVersion) LargestONLINEversion number strictly less thancurrentVersion, orStore.NON_EXISTING_VERSIONif none.static ExecutionStatusgetFinalReturnStatus(Map<String, ExecutionStatus> statuses, Set<String> childRegions, int numChildRegionsFailedToFetchStatus, StringBuilder currentReturnStatusDetails) Aggregate per-region statuses into one return status usingSTATUS_PRIORITIES.static ExecutionStatusgetOverallPushStatus(ExecutionStatus veniceStatus, ExecutionStatus daVinciStatus) Merge the Venice-server status and the Da Vinci status into a single overall status usingSTATUS_PRIORITIES.static booleanhasFatalDataValidationError(PushMonitor pushMonitor, String topicName) Read the offline push status frompushMonitorand return whether the push reported a fatal Data Integrity Validation error.static booleanisRealTimeTopicRequired(Store store, Version version, boolean isParent) Whether a real-time topic should exist forversionofstore.static voidupdateStoreTTLRepushFlag(String pushJobId, Store store, ReadWriteStoreRepository repository) Self-manages the store'sttlRepushEnabledproperty based on push job id prefix.
-
Method Details
-
checkBackupVersionCleanupCapacityForNewPush
public static void checkBackupVersionCleanupCapacityForNewPush(String clusterName, String storeName, Store store, BackupStrategy backupStrategy, int minNumberOfStoreVersionsToPreserve, long minBackupVersionCleanupDelay, long currentTimeMs) Throws if starting a new push would exceed the store's version budget because existing backup versions are pending deletion but still within the min cleanup delay (e.g., after a rollback). Preserve count isN-1forDELETE_ON_NEW_PUSH_START,Notherwise. Clamps to 1 becauseStore.retrieveVersionsToDelete(int)rejects values below 1. -
checkRollbackOriginVersionCapacityForNewPush
public static void checkRollbackOriginVersionCapacityForNewPush(String clusterName, String storeName, Store store, long rolledBackVersionRetentionMs, long currentTimeMs) Throws if starting a new push would violate the retention window for a rollback-origin version. Blocks when aROLLED_BACKorPARTIALLY_ONLINEversion sits strictly above the current version — the rollback-origin invariant, since rollback decrements currentVersion below the rolled-back-from version's number on both parent and child controllers. Stale entries lingering below currentVersion (e.g., after a subsequent push promoted higher) are skipped. The block also lifts oncelatestVersionPromoteToCurrentTimestamp + rolledBackVersionRetentionMselapses; past that point, the version will be swept on the next SOP deletion pass. -
getBackupVersionNumber
LargestONLINEversion number strictly less thancurrentVersion, orStore.NON_EXISTING_VERSIONif none. Mutatesversions(sort by number desc). -
getFinalReturnStatus
public static ExecutionStatus getFinalReturnStatus(Map<String, ExecutionStatus> statuses, Set<String> childRegions, int numChildRegionsFailedToFetchStatus, StringBuilder currentReturnStatusDetails) Aggregate per-region statuses into one return status usingSTATUS_PRIORITIES. If fewer than a strict majority ofchildRegionsreported successfully, downgrades toPROGRESSso the caller keeps polling. If the aggregate is terminal but any region failed to report, downgrades toERRORand appends a "{n}/{total} DCs unreachable" note tocurrentReturnStatusDetailsso VPJ reports failure even when the push succeeds asynchronously in the reachable DCs. -
getOverallPushStatus
public static ExecutionStatus getOverallPushStatus(ExecutionStatus veniceStatus, ExecutionStatus daVinciStatus) Merge the Venice-server status and the Da Vinci status into a single overall status usingSTATUS_PRIORITIES. Used to roll up the two replica families into the push status a client polls. -
hasFatalDataValidationError
Read the offline push status frompushMonitorand return whether the push reported a fatal Data Integrity Validation error. Returnsfalsewhen the push entry no longer exists (logged at WARN). -
updateStoreTTLRepushFlag
public static void updateStoreTTLRepushFlag(String pushJobId, Store store, ReadWriteStoreRepository repository) Self-manages the store'sttlRepushEnabledproperty based on push job id prefix.- TTL repush (
venice_ttl_re_push_*) sets the flag totrue. - Regular push with TTL repush (
venice_regular_push_with_ttl_re_push_*) sets the flag tofalse. - Other push types (including compliance push) do not affect this flag.
ReadWriteStoreRepository.updateStore(Store)only when the flag is actually changing. - TTL repush (
-
isRealTimeTopicRequired
Whether a real-time topic should exist forversionofstore. True iff both the store and the version are hybrid and this controller is not a parent — only child regions host RT topics; parent regions route writes through them via the child fabrics. -
checkPreConditionForSingleVersionDeletion
public static void checkPreConditionForSingleVersionDeletion(String clusterName, String storeName, Store store, int versionNum) Validate thatversionNumcan be individually deleted fromstore. ThrowsVeniceNoStoreExceptionif the store is missing, orVeniceUnsupportedOperationExceptionifversionNumis the current version of a non-system store (system stores are exempt because their current-version delete is part of the tear-down path).
-