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 defaults to 1 hour (configurable via
ConfigKeys.CONTROLLER_BACKUP_VERSION_MIN_CLEANUP_DELAY_MS)
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
FieldsFields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStoreBackupVersionCleanupService(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 booleancleanupBackupVersion(Store store, String clusterName) Using a separate function for store cleanup is to make it easy for testing.static voidsetWaitTimeDeleteRepushSourceVersion(long waitTime) booleanvoidprotected static booleanwhetherStoreReadyToBeCleanup(Store store, long defaultBackupVersionRetentionMs, Time time, int currentVersion, long minCleanupDelayMs)
-
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:
startInnerin 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.serviceStatetoAbstractVeniceService.ServiceState.STARTEDupon completion of the async work). - See Also:
-
stopInner
- Specified by:
stopInnerin 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
-