Package org.apache.zookeeper.server
Class DatadirCleanupManager
java.lang.Object
org.apache.zookeeper.server.DatadirCleanupManager
This class manages the cleanup of snapshots and corresponding transaction
logs by scheduling the auto purge task with the specified
'autopurge.purgeInterval'. It keeps the most recent
'autopurge.snapRetainCount' number of snapshots and corresponding transaction
logs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Status of the dataDir purge task -
Constructor Summary
ConstructorsConstructorDescriptionDatadirCleanupManager
(File snapDir, File dataLogDir, int snapRetainCount, int purgeInterval) Constructor of DatadirCleanupManager. -
Method Summary
Modifier and TypeMethodDescriptionReturns transaction log directory.int
Returns purge interval in hours.Returns the status of the purge task.Returns the snapshot directory.int
Returns the number of snapshots to be retained after purge.void
shutdown()
Shutdown the purge task.void
start()
Validates the purge configuration and schedules the purge task.
-
Constructor Details
-
DatadirCleanupManager
Constructor of DatadirCleanupManager. It takes the parameters to schedule the purge task.- Parameters:
snapDir
- snapshot directorydataLogDir
- transaction log directorysnapRetainCount
- number of snapshots to be retained after purgepurgeInterval
- purge interval in hours
-
-
Method Details
-
start
public void start()Validates the purge configuration and schedules the purge task. Purge task keeps the most recentsnapRetainCount
number of snapshots and deletes the remaining for everypurgeInterval
hour(s).purgeInterval
of0
ornegative integer
will not schedule the purge task.- See Also:
-
shutdown
public void shutdown()Shutdown the purge task. -
getPurgeTaskStatus
Returns the status of the purge task.- Returns:
- the status of the purge task
-
getSnapDir
Returns the snapshot directory.- Returns:
- the snapshot directory.
-
getDataLogDir
Returns transaction log directory.- Returns:
- the transaction log directory.
-
getPurgeInterval
public int getPurgeInterval()Returns purge interval in hours.- Returns:
- the purge interval in hours.
-
getSnapRetainCount
public int getSnapRetainCount()Returns the number of snapshots to be retained after purge.- Returns:
- the number of snapshots to be retained after purge.
-