Class MetadataCleanupDuty
java.lang.Object
org.apache.druid.server.coordinator.duty.MetadataCleanupDuty
- All Implemented Interfaces:
CoordinatorDuty
- Direct Known Subclasses:
KillAuditLog,KillCompactionConfig,KillDatasourceMetadata,KillRules,KillSupervisors,KillUnreferencedSegmentSchema
Performs cleanup of stale metadata entries created before a configured retain duration.
In every invocation of run(org.apache.druid.server.coordinator.DruidCoordinatorRuntimeParams), the duty checks if the cleanupPeriod
has elapsed since the lastCleanupTime. If it has, then the method
cleanupEntriesCreatedBefore(DateTime) is invoked. Otherwise, the duty
completes immediately without making any changes.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMetadataCleanupDuty(String entryType, MetadataCleanupConfig cleanupConfig, CoordinatorStat cleanupCountStat) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract intcleanupEntriesCreatedBefore(org.joda.time.DateTime minCreatedTime) Cleans up metadata entries created before theminCreatedTime.protected org.joda.time.DateTimerun(DruidCoordinatorRuntimeParams params) Implementations of this method run various activities performed by the coordinator.
-
Constructor Details
-
MetadataCleanupDuty
protected MetadataCleanupDuty(String entryType, MetadataCleanupConfig cleanupConfig, CoordinatorStat cleanupCountStat)
-
-
Method Details
-
run
Description copied from interface:CoordinatorDutyImplementations of this method run various activities performed by the coordinator. Input params can be used and modified. The returned DruidCoordinatorRuntimeParams is passed to the next duty.- Specified by:
runin interfaceCoordinatorDuty- Returns:
- same as input or a modified value to be used by next duty. Null return
values will prevent subsequent CoordinatorDuty objects (see the order in the lists passed into the constructor of
DruidCoordinator.DutiesRunnable) from running until the next cycle.
-
cleanupEntriesCreatedBefore
protected abstract int cleanupEntriesCreatedBefore(org.joda.time.DateTime minCreatedTime) Cleans up metadata entries created before theminCreatedTime.This method is not invoked if the
cleanupPeriodhas not elapsed since thelastCleanupTime.- Returns:
- Number of deleted metadata entries
-
getCurrentTime
protected org.joda.time.DateTime getCurrentTime()
-