Class VersionLifecyclePolicy
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, String regionName, List<Version> versions, int currentVersion, int storeNumVersionsToPreserve, boolean isMigrating, BackupStrategy backupStrategy, int minNumberOfStoreVersionsToPreserve, long latestVersionPromoteToCurrentTimestamp, 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.static voidcheckPreConditionForSingleVersionDeletion(String clusterName, String storeName, Store store, int versionNum) Validate thatversionNumcan be individually deleted fromstore.static voidcheckRollbackOriginVersionCapacityForNewPush(String clusterName, String storeName, String regionName, List<Version> versions, int currentVersion, long latestVersionPromoteToCurrentTimestamp, long rolledBackVersionRetentionMs, long currentTimeMs) Throws if a new push would violate the retention window for a rolled-back version in a single child region.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, String regionName, List<Version> versions, int currentVersion, int storeNumVersionsToPreserve, boolean isMigrating, BackupStrategy backupStrategy, int minNumberOfStoreVersionsToPreserve, long latestVersionPromoteToCurrentTimestamp, 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 killed push). Preserve count isN-1forDELETE_ON_NEW_PUSH_START,Notherwise, clamped to 1 becauseAbstractStore.computeVersionsToDelete(java.util.List<com.linkedin.venice.meta.Version>, int, int, int, boolean)rejects values below 1.The parent drives this from LIVE child snapshots (see
VeniceParentHelixAdmin.checkNewPushCapacityFromChildren), not its own metadata which can go stale. It runs only on the parent — a throw during child admin-message consumption (VeniceHelixAdmin.addVersion) would wedge the admin channel.Takes raw fields so callers can pass a child
StoreInfo(not aStore) directly.regionNameenriches the rejection message; passnullto omit it. -
checkRollbackOriginVersionCapacityForNewPush
public static void checkRollbackOriginVersionCapacityForNewPush(String clusterName, String storeName, String regionName, List<Version> versions, int currentVersion, long latestVersionPromoteToCurrentTimestamp, long rolledBackVersionRetentionMs, long currentTimeMs) Throws if a new push would violate the retention window for a rolled-back version in a single child region. Blocks aROLLED_BACKversion above currentVersion (rollback decrements currentVersion, so number > currentVersion is the rollback-origin invariant); entries below currentVersion are stale and skipped. The block lifts oncelatestVersionPromoteToCurrentTimestamp + rolledBackVersionRetentionMselapses.The parent drives this from LIVE child snapshots, not its own metadata (see
VeniceParentHelixAdmin.checkNewPushCapacityFromChildren), which can go stale and falsely block for the whole window. It runs only on the parent — a throw during child admin-message consumption would wedge the admin channel.Only
ROLLED_BACKcounts: a per-region rollback is binary, so a child is never rollback-PARTIALLY_ONLINE(that is a parent-only aggregate). A childPARTIALLY_ONLINEis a degraded-mode forward push and must not block.Takes raw fields so callers can pass a child
StoreInfo(not aStore) directly.regionNameenriches the rejection message; passnullto omit it. -
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).
-