Package com.linkedin.venice.controller
Class StoreBackupVersionCleanupService
- java.lang.Object
-
- com.linkedin.venice.service.AbstractVeniceService
-
- com.linkedin.venice.controller.StoreBackupVersionCleanupService
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class StoreBackupVersionCleanupService extends AbstractVeniceService
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 Modifier and Type Field Description static java.lang.String
TYPE_CURRENT_VERSION
-
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
StoreBackupVersionCleanupService(VeniceHelixAdmin admin, VeniceControllerMultiClusterConfig multiClusterConfig, Time time, io.tehuti.metrics.MetricsRepository metricsRepository)
StoreBackupVersionCleanupService(VeniceHelixAdmin admin, VeniceControllerMultiClusterConfig multiClusterConfig, io.tehuti.metrics.MetricsRepository metricsRepository)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
cleanupBackupVersion(Store store, java.lang.String clusterName)
Using a separate function for store cleanup is to make it easy for testing.static void
setWaitTimeDeleteRepushSourceVersion(long waitTime)
boolean
startInner()
void
stopInner()
protected static boolean
whetherStoreReadyToBeCleanup(Store store, long defaultBackupVersionRetentionMs, Time time, int currentVersion)
-
-
-
Field Detail
-
TYPE_CURRENT_VERSION
public static final java.lang.String TYPE_CURRENT_VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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:
AbstractVeniceService.startInner()
-
stopInner
public void stopInner() throws java.io.IOException
- Specified by:
stopInner
in classAbstractVeniceService
- Throws:
java.io.IOException
- See Also:
AbstractVeniceService.stopInner()
-
setWaitTimeDeleteRepushSourceVersion
public static void setWaitTimeDeleteRepushSourceVersion(long waitTime)
-
whetherStoreReadyToBeCleanup
protected static boolean whetherStoreReadyToBeCleanup(Store store, long defaultBackupVersionRetentionMs, Time time, int currentVersion)
-
cleanupBackupVersion
protected boolean cleanupBackupVersion(Store store, java.lang.String clusterName)
Using a separate function for store cleanup is to make it easy for testing.- Returns:
- whether any backup version is removed or not
-
-