Package org.apache.zookeeper.server
Class DatadirCleanupManager
- java.lang.Object
- 
- org.apache.zookeeper.server.DatadirCleanupManager
 
- 
 public class DatadirCleanupManager extends Object 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 SummaryNested Classes Modifier and Type Class Description static classDatadirCleanupManager.PurgeTaskStatusStatus of the dataDir purge task
 - 
Constructor SummaryConstructors Constructor Description DatadirCleanupManager(File snapDir, File dataLogDir, int snapRetainCount, int purgeInterval)Constructor of DatadirCleanupManager.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description FilegetDataLogDir()Returns transaction log directory.intgetPurgeInterval()Returns purge interval in hours.DatadirCleanupManager.PurgeTaskStatusgetPurgeTaskStatus()Returns the status of the purge task.FilegetSnapDir()Returns the snapshot directory.intgetSnapRetainCount()Returns the number of snapshots to be retained after purge.voidshutdown()Shutdown the purge task.voidstart()Validates the purge configuration and schedules the purge task.
 
- 
- 
- 
Constructor Detail- 
DatadirCleanupManagerpublic DatadirCleanupManager(File snapDir, File dataLogDir, int snapRetainCount, int purgeInterval) Constructor of DatadirCleanupManager. It takes the parameters to schedule the purge task.- Parameters:
- snapDir- snapshot directory
- dataLogDir- transaction log directory
- snapRetainCount- number of snapshots to be retained after purge
- purgeInterval- purge interval in hours
 
 
- 
 - 
Method Detail- 
startpublic void start() Validates the purge configuration and schedules the purge task. Purge task keeps the most recentsnapRetainCountnumber of snapshots and deletes the remaining for everypurgeIntervalhour(s).purgeIntervalof0ornegative integerwill not schedule the purge task.- See Also:
- PurgeTxnLog.purge(File, File, int)
 
 - 
shutdownpublic void shutdown() Shutdown the purge task.
 - 
getPurgeTaskStatuspublic DatadirCleanupManager.PurgeTaskStatus getPurgeTaskStatus() Returns the status of the purge task.- Returns:
- the status of the purge task
 
 - 
getSnapDirpublic File getSnapDir() Returns the snapshot directory.- Returns:
- the snapshot directory.
 
 - 
getDataLogDirpublic File getDataLogDir() Returns transaction log directory.- Returns:
- the transaction log directory.
 
 - 
getPurgeIntervalpublic int getPurgeInterval() Returns purge interval in hours.- Returns:
- the purge interval in hours.
 
 - 
getSnapRetainCountpublic int getSnapRetainCount() Returns the number of snapshots to be retained after purge.- Returns:
- the number of snapshots to be retained after purge.
 
 
- 
 
-