in hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java [241:380]
public void start(OzoneConfiguration configuration) {
boolean isCompactionEnabled = configuration.getBoolean(OZONE_OM_COMPACTION_SERVICE_ENABLED,
OZONE_OM_COMPACTION_SERVICE_ENABLED_DEFAULT);
startCompactionService(configuration, isCompactionEnabled);
boolean isSnapshotDeepCleaningEnabled = configuration.getBoolean(OZONE_SNAPSHOT_DEEP_CLEANING_ENABLED,
OZONE_SNAPSHOT_DEEP_CLEANING_ENABLED_DEFAULT);
if (keyDeletingService == null) {
long blockDeleteInterval = configuration.getTimeDuration(
OZONE_BLOCK_DELETING_SERVICE_INTERVAL,
OZONE_BLOCK_DELETING_SERVICE_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
long serviceTimeout = configuration.getTimeDuration(
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT,
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
keyDeletingService = new KeyDeletingService(ozoneManager,
scmClient.getBlockClient(), this, blockDeleteInterval,
serviceTimeout, configuration, isSnapshotDeepCleaningEnabled);
keyDeletingService.start();
}
// Start directory deletion service for FSO buckets.
if (dirDeletingService == null) {
long dirDeleteInterval = configuration.getTimeDuration(
OZONE_DIR_DELETING_SERVICE_INTERVAL,
OZONE_DIR_DELETING_SERVICE_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
long serviceTimeout = configuration.getTimeDuration(
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT,
OZONE_BLOCK_DELETING_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
int dirDeletingServiceCorePoolSize =
configuration.getInt(OZONE_THREAD_NUMBER_DIR_DELETION,
OZONE_THREAD_NUMBER_DIR_DELETION_DEFAULT);
if (dirDeletingServiceCorePoolSize <= 0) {
dirDeletingServiceCorePoolSize = 1;
}
dirDeletingService =
new DirectoryDeletingService(dirDeleteInterval, TimeUnit.MILLISECONDS,
serviceTimeout, ozoneManager, configuration,
dirDeletingServiceCorePoolSize);
dirDeletingService.start();
}
if (openKeyCleanupService == null) {
long serviceInterval = configuration.getTimeDuration(
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL,
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
long serviceTimeout = configuration.getTimeDuration(
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT,
OZONE_OM_OPEN_KEY_CLEANUP_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
openKeyCleanupService = new OpenKeyCleanupService(serviceInterval,
TimeUnit.MILLISECONDS, serviceTimeout, ozoneManager, configuration);
openKeyCleanupService.start();
}
if (snapshotSstFilteringService == null &&
ozoneManager.isFilesystemSnapshotEnabled()) {
long serviceInterval = configuration.getTimeDuration(
OZONE_SNAPSHOT_SST_FILTERING_SERVICE_INTERVAL,
OZONE_SNAPSHOT_SST_FILTERING_SERVICE_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
long serviceTimeout = configuration.getTimeDuration(
OZONE_SNAPSHOT_SST_FILTERING_SERVICE_TIMEOUT,
OZONE_SNAPSHOT_SST_FILTERING_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
if (isSstFilteringSvcEnabled()) {
snapshotSstFilteringService =
new SstFilteringService(serviceInterval, TimeUnit.MILLISECONDS,
serviceTimeout, ozoneManager, configuration);
snapshotSstFilteringService.start();
}
}
if (snapshotDeletingService == null &&
ozoneManager.isFilesystemSnapshotEnabled()) {
long snapshotServiceInterval = configuration.getTimeDuration(
OZONE_SNAPSHOT_DELETING_SERVICE_INTERVAL,
OZONE_SNAPSHOT_DELETING_SERVICE_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
long snapshotServiceTimeout = configuration.getTimeDuration(
OZONE_SNAPSHOT_DELETING_SERVICE_TIMEOUT,
OZONE_SNAPSHOT_DELETING_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
try {
snapshotDeletingService = new SnapshotDeletingService(
snapshotServiceInterval, snapshotServiceTimeout,
ozoneManager);
snapshotDeletingService.start();
} catch (IOException e) {
LOG.error("Error starting Snapshot Deleting Service", e);
}
}
if (isSnapshotDeepCleaningEnabled && snapshotDirectoryCleaningService == null &&
ozoneManager.isFilesystemSnapshotEnabled()) {
long dirDeleteInterval = configuration.getTimeDuration(
OZONE_SNAPSHOT_DIRECTORY_SERVICE_INTERVAL,
OZONE_SNAPSHOT_DIRECTORY_SERVICE_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
long serviceTimeout = configuration.getTimeDuration(
OZONE_SNAPSHOT_DIRECTORY_SERVICE_TIMEOUT,
OZONE_SNAPSHOT_DIRECTORY_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
snapshotDirectoryCleaningService = new SnapshotDirectoryCleaningService(
dirDeleteInterval, TimeUnit.MILLISECONDS, serviceTimeout,
ozoneManager, scmClient.getBlockClient());
snapshotDirectoryCleaningService.start();
}
if (multipartUploadCleanupService == null) {
long serviceInterval = configuration.getTimeDuration(
OZONE_OM_MPU_CLEANUP_SERVICE_INTERVAL,
OZONE_OM_MPU_CLEANUP_SERVICE_INTERVAL_DEFAULT,
TimeUnit.MILLISECONDS);
long serviceTimeout = configuration.getTimeDuration(
OZONE_OM_MPU_CLEANUP_SERVICE_TIMEOUT,
OZONE_OM_MPU_CLEANUP_SERVICE_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
multipartUploadCleanupService = new MultipartUploadCleanupService(
serviceInterval, TimeUnit.MILLISECONDS, serviceTimeout,
ozoneManager, configuration);
multipartUploadCleanupService.start();
}
Class<? extends DNSToSwitchMapping> dnsToSwitchMappingClass =
configuration.getClass(
ScmConfigKeys.NET_TOPOLOGY_NODE_SWITCH_MAPPING_IMPL_KEY,
TableMapping.class, DNSToSwitchMapping.class);
DNSToSwitchMapping newInstance = ReflectionUtils.newInstance(
dnsToSwitchMappingClass, configuration);
dnsToSwitchMapping =
((newInstance instanceof CachedDNSToSwitchMapping) ? newInstance
: new CachedDNSToSwitchMapping(newInstance));
}