Package com.linkedin.venice.controller
Class StoreBackupVersionCleanupService
java.lang.Object
com.linkedin.venice.service.AbstractVeniceService
com.linkedin.venice.controller.StoreBackupVersionCleanupService
- All Implemented Interfaces:
Closeable
,AutoCloseable
This service is in charge of cleaning up backup versions based on retention policy defined on store basis.
If it is not specified, the retention policy will be controlled by config:
ConfigKeys.CONTROLLER_BACKUP_VERSION_DEFAULT_RETENTION_MS
.
The backup versions will become eligible for removal if the latest current version has been promoted for more
than configured retention time period.
If the specified retention time is 0, this service won't delete the backup version right after the latest version is
promoted to the new current version since there could be a delay before Routers receive the new version promotion notification.
Currently, the minimal retention time is hard-coded as 1 hour here: MINIMAL_BACKUP_VERSION_CLEANUP_DELAY
to accommodate the delay between Controller and Router.-
Nested Class Summary
Nested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceService
AbstractVeniceService.ServiceState
-
Field Summary
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState
-
Constructor Summary
ModifierConstructorDescriptionprotected
StoreBackupVersionCleanupService
(VeniceHelixAdmin admin, VeniceControllerMultiClusterConfig multiClusterConfig, Time time, io.tehuti.metrics.MetricsRepository metricsRepository) StoreBackupVersionCleanupService
(VeniceHelixAdmin admin, VeniceControllerMultiClusterConfig multiClusterConfig, io.tehuti.metrics.MetricsRepository metricsRepository) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
cleanupBackupVersion
(Store store, String clusterName) Using a separate function for store cleanup is to make it easy for testing.static void
setWaitTimeDeleteRepushSourceVersion
(long waitTime) boolean
void
protected static boolean
whetherStoreReadyToBeCleanup
(Store store, long defaultBackupVersionRetentionMs, Time time, int currentVersion)
-
Field Details
-
TYPE_CURRENT_VERSION
- See Also:
-
-
Constructor Details
-
StoreBackupVersionCleanupService
public StoreBackupVersionCleanupService(VeniceHelixAdmin admin, VeniceControllerMultiClusterConfig multiClusterConfig, io.tehuti.metrics.MetricsRepository metricsRepository) -
StoreBackupVersionCleanupService
protected StoreBackupVersionCleanupService(VeniceHelixAdmin admin, VeniceControllerMultiClusterConfig multiClusterConfig, Time time, io.tehuti.metrics.MetricsRepository metricsRepository)
-
-
Method Details
-
startInner
public boolean startInner()- Specified by:
startInner
in classAbstractVeniceService
- Returns:
- true if the service is completely started,
false if it is still starting asynchronously (in this case, it is the implementer's
responsibility to set
AbstractVeniceService.serviceState
toAbstractVeniceService.ServiceState.STARTED
upon completion of the async work). - See Also:
-
stopInner
- Specified by:
stopInner
in classAbstractVeniceService
- Throws:
IOException
- See Also:
-
setWaitTimeDeleteRepushSourceVersion
public static void setWaitTimeDeleteRepushSourceVersion(long waitTime) -
whetherStoreReadyToBeCleanup
-
cleanupBackupVersion
Using a separate function for store cleanup is to make it easy for testing.- Returns:
- whether any backup version is removed or not
-