This is an automated email from the ASF dual-hosted git repository.
ChenSammi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new f3f692e9eb0 HDDS-17515. Move KeyLifecycleService properties to a
reconfigurable config group (#11912)
f3f692e9eb0 is described below
commit f3f692e9eb065959316381134c9e3b41905081fc
Author: Priyesh Karatha <[email protected]>
AuthorDate: Tue Nov 10 09:45:50 2026 +0530
HDDS-17515. Move KeyLifecycleService properties to a reconfigurable config
group (#11912)
---
.../common/src/main/resources/ozone-default.xml | 72 -------
.../hdds/conf/ConfigurationReflectionUtil.java | 4 +-
.../hadoop/hdds/conf/TestReconfigurableConfig.java | 11 ++
.../org/apache/hadoop/ozone/om/OMConfigKeys.java | 41 ----
.../hadoop/ozone/s3/awssdk/OzoneS3SDKTests.java | 6 +-
.../ozone/reconfig/TestOmReconfiguration.java | 62 +++---
.../hadoop/ozone/shell/TestOzoneShellHA.java | 3 +-
.../org/apache/hadoop/ozone/om/KeyManagerImpl.java | 16 +-
.../org/apache/hadoop/ozone/om/OzoneManager.java | 34 ++--
.../ozone/om/service/KeyLifecycleService.java | 187 ++++--------------
.../om/service/KeyLifecycleServiceConfig.java | 220 +++++++++++++++++++++
.../ozone/om/service/TestKeyLifecycleService.java | 40 ++--
12 files changed, 332 insertions(+), 364 deletions(-)
diff --git a/hadoop-hdds/common/src/main/resources/ozone-default.xml
b/hadoop-hdds/common/src/main/resources/ozone-default.xml
index 4247dac0578..9935cfd7aa9 100644
--- a/hadoop-hdds/common/src/main/resources/ozone-default.xml
+++ b/hadoop-hdds/common/src/main/resources/ozone-default.xml
@@ -5443,76 +5443,4 @@
<tag>OM</tag>
<description>If OM is unfinalized, how frequently it should poll SCM to
trigger finalization</description>
</property>
- <property>
- <name>ozone.lifecycle.service.enabled</name>
- <value>false</value>
- <tag>OZONE</tag>
- <description>It specifies whether to enable lifecycle management
service.</description>
- </property>
- <property>
- <name>ozone.lifecycle.service.move.to.trash.enabled</name>
- <value>true</value>
- <tag>OZONE</tag>
- <description>When enabled KeyLifecycleService will move expired keys/dirs
to trash if trash is available.
- When disabled, it will delete them directly.
- </description>
- </property>
- <property>
- <name>ozone.lifecycle.service.delete.batch-size</name>
- <value>1000</value>
- <tag>OZONE</tag>
- <description>Max numbers of objects allowed for deletion in a batch for a
lifecycle evaluating task.</description>
- </property>
- <property>
- <name>ozone.lifecycle.service.interval</name>
- <value>24h</value>
- <tag>OZONE</tag>
- <description>Interval at which key lifecycle management service will
run.</description>
- </property>
- <property>
- <name>ozone.lifecycle.service.timeout</name>
- <value>2h</value>
- <tag>OZONE</tag>
- <description>Timeout for task of key lifecycle management
service.</description>
- </property>
- <property>
- <name>ozone.lifecycle.service.workers</name>
- <value>5</value>
- <tag>OZONE</tag>
- <description>Number of workers executed of key lifecycle management
service. This
- configuration should be set to greater than 0.</description>
- </property>
- <property>
- <name>ozone.lifecycle.service.delete.cached.directory.max-count</name>
- <value>1000000</value>
- <tag>OZONE</tag>
- <description>Max numbers of directory objects held in memory stack for
recursive FSO bucket evaluating for
- a lifecycle evaluating task. Once the cached directory objects exceeds
this limit, the evaluation of the involved
- directories will abort.
- </description>
- </property>
- <property>
- <name>ozone.lifecycle.service.mpu.abort.limit.per.task</name>
- <value>1000</value>
- <tag>OZONE</tag>
- <description>Maximum number of multipart upload parts (rounded up to
complete uploads)
- to abort in a single task when processing AbortIncompleteMultipartUpload
- lifecycle rules.
- </description>
- </property>
- <property>
- <name>ozone.lifecycle.service.state.save.interval.ms</name>
- <value>300000</value>
- <tag>OZONE</tag>
- <description>The interval of bucket scan task saves its pointer to DB.
Default is 5 mins.</description>
- </property>
- <property>
- <name>ozone.lifecycle.service.state.save.keys.processed</name>
- <value>100000</value>
- <tag>OZONE</tag>
- <description>Bucket scan task will save its pointer to DB by default every
100000 keys are scanned. Bucket scan
- pointer save will happen when either
ozone.lifecycle.service.state.save.interval.ms or
- ozone.lifecycle.service.state.save.keys.processed is satisfied.
- </description>
- </property>
</configuration>
diff --git
a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigurationReflectionUtil.java
b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigurationReflectionUtil.java
index 89fe6c5b03e..3eb5d8c5fe3 100644
---
a/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigurationReflectionUtil.java
+++
b/hadoop-hdds/config/src/main/java/org/apache/hadoop/hdds/conf/ConfigurationReflectionUtil.java
@@ -87,7 +87,9 @@ public static <T> void reconfigureProperty(T configuration,
Field field,
try {
final Object oldValue = forcedFieldGet(field, configuration);
- setField(klass, configuration, field, configAnnotation, key, value);
+ // null means the property was unset, which restores its default value
+ final String newValue = value != null ? value :
configAnnotation.defaultValue();
+ setField(klass, configuration, field, configAnnotation, key, newValue);
try {
callPostConstruct(configuration);
} catch (Exception e) {
diff --git
a/hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/TestReconfigurableConfig.java
b/hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/TestReconfigurableConfig.java
index dfa707c31b9..7effedd5275 100644
---
a/hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/TestReconfigurableConfig.java
+++
b/hadoop-hdds/config/src/test/java/org/apache/hadoop/hdds/conf/TestReconfigurableConfig.java
@@ -35,4 +35,15 @@ void testReconfigureProperty() {
assertEquals("updated", subject.getDynamic());
}
+
+ @Test
+ void testUnsetPropertyRestoresDefault() {
+ ConfigurationExample subject = new InMemoryConfigurationForTesting()
+ .getObject(ConfigurationExample.class);
+ subject.reconfigureProperty("ozone.test.config.dynamic", "updated");
+
+ subject.reconfigureProperty("ozone.test.config.dynamic", null);
+
+ assertEquals("original", subject.getDynamic());
+ }
}
diff --git
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMConfigKeys.java
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMConfigKeys.java
index 7436ae4dcac..26c9d50d773 100644
---
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMConfigKeys.java
+++
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/OMConfigKeys.java
@@ -171,47 +171,6 @@ public final class OMConfigKeys {
"ozone.om.snapshot.directory.metrics.update.interval";
public static final String
OZONE_OM_SNAPSHOT_DIRECTORY_METRICS_UPDATE_INTERVAL_DEFAULT = "5m";
- /**
- * Properties for Key/Object Lifecycle feature.
- */
- public static final String OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL =
- "ozone.lifecycle.service.interval";
- public static final String
- OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL_DEFAULT = "24h";
- public static final String OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT =
- "ozone.lifecycle.service.timeout";
- public static final String OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT_DEFAULT
- = "2h";
- public static final String OZONE_KEY_LIFECYCLE_SERVICE_WORKERS =
- "ozone.lifecycle.service.workers";
- public static final int OZONE_KEY_LIFECYCLE_SERVICE_WORKERS_DEFAULT
- = 5;
- public static final String OZONE_KEY_LIFECYCLE_SERVICE_ENABLED =
- "ozone.lifecycle.service.enabled";
- public static final boolean OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT =
false;
- public static final String OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE =
- "ozone.lifecycle.service.delete.batch-size";
- public static final int
OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE_DEFAULT = 1000;
- // Batch limit for aborting incomplete multipart uploads, based on total
part count
- public static final String
OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK =
- "ozone.lifecycle.service.mpu.abort.limit.per.task";
- public static final int
OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK_DEFAULT = 1000;
- public static final String
OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT =
- "ozone.lifecycle.service.delete.cached.directory.max-count";
- public static final long
OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT_DEFAULT = 1000000;
-
- public static final String
OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS =
- "ozone.lifecycle.service.state.save.interval.ms";
- public static final long
OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS_DEFAULT = 5 * 60 * 1000;
- public static final String
OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED =
- "ozone.lifecycle.service.state.save.keys.processed";
- public static final long
OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED_DEFAULT = 100000;
-
- public static final String OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED
=
- "ozone.lifecycle.service.move.to.trash.enabled";
- public static final boolean
- OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED_DEFAULT = true;
-
/**
* OM Ratis related configurations.
*/
diff --git
a/hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/OzoneS3SDKTests.java
b/hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/OzoneS3SDKTests.java
index 908e0b462fe..6a1e0cc05fc 100644
---
a/hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/OzoneS3SDKTests.java
+++
b/hadoop-ozone/integration-test-s3/src/test/java/org/apache/hadoop/ozone/s3/awssdk/OzoneS3SDKTests.java
@@ -20,7 +20,7 @@
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.ozone.MiniOzoneCluster;
-import org.apache.hadoop.ozone.om.OMConfigKeys;
+import org.apache.hadoop.ozone.om.service.KeyLifecycleServiceConfig;
import org.apache.hadoop.ozone.s3.MultiS3GatewayService;
import org.apache.hadoop.ozone.s3.S3GatewayService;
import org.apache.hadoop.ozone.s3.awssdk.v2.AbstractS3SDKV2Tests;
@@ -46,8 +46,8 @@ void afterAll() {
@Override
protected OzoneConfiguration createOzoneConfig() {
OzoneConfiguration conf = createBaseConfiguration();
- conf.setBoolean(OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED, true);
- conf.setTimeDuration(OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL, 1,
TimeUnit.SECONDS);
+ conf.setBoolean(KeyLifecycleServiceConfig.Keys.ENABLED, true);
+ conf.setTimeDuration(KeyLifecycleServiceConfig.Keys.INTERVAL, 1,
TimeUnit.SECONDS);
return conf;
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/reconfig/TestOmReconfiguration.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/reconfig/TestOmReconfiguration.java
index c2a657e2970..f2d9f083517 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/reconfig/TestOmReconfiguration.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/reconfig/TestOmReconfiguration.java
@@ -26,13 +26,6 @@
import static
org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_READ_BLACKLIST_USERS;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_DELETING_LIMIT_PER_TASK;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_WORKERS;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_WORKERS_DEFAULT;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_SNAPSHOT_SST_FILTERING_SERVICE_INTERVAL;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_SNAPSHOT_SST_FILTERING_SERVICE_INTERVAL_DEFAULT;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_THREAD_NUMBER_DIR_DELETION;
@@ -54,6 +47,7 @@
import org.apache.hadoop.ozone.om.OmConfig;
import org.apache.hadoop.ozone.om.OzoneManager;
import org.apache.hadoop.ozone.om.service.KeyLifecycleService;
+import org.apache.hadoop.ozone.om.service.KeyLifecycleServiceConfig;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@@ -83,7 +77,7 @@ void reconfigurableProperties() {
.add(OZONE_BLACKLIST_GROUPS)
.add(OZONE_READ_BLACKLIST_USERS)
.add(OZONE_READ_BLACKLIST_GROUPS)
- .addAll(KeyLifecycleService.OZONE_KEY_LIFECYCLE_PROPERTIES)
+ .addAll(new KeyLifecycleServiceConfig().reconfigurableProperties())
.build();
assertProperties(getSubject(), expected);
@@ -275,16 +269,16 @@ void keyLifecycleService() throws
ReconfigurationException {
final OzoneManager om = cluster().getOzoneManager();
final KeyLifecycleService service =
om.getKeyManager().getKeyLifecycleService();
final boolean originalEnabled = service.status().getIsEnabled();
- final String originalEnabledValue =
om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED);
- final String originalInterval =
om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL);
- final String originalWorkers =
om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS);
+ final String originalEnabledValue =
om.getConfiguration().get(KeyLifecycleServiceConfig.Keys.ENABLED);
+ final String originalInterval =
om.getConfiguration().get(KeyLifecycleServiceConfig.Keys.INTERVAL);
+ final String originalWorkers =
om.getConfiguration().get(KeyLifecycleServiceConfig.Keys.WORKERS);
// All changed properties are applied together once reconfiguration
completes
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
String.valueOf(!originalEnabled));
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
"30s");
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS, "3");
- assertEquals("30s",
om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL));
- service.reconfigure(om.getConfiguration());
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.ENABLED,
String.valueOf(!originalEnabled));
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.INTERVAL,
"30s");
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.WORKERS,
"3");
+ assertEquals("30s",
om.getConfiguration().get(KeyLifecycleServiceConfig.Keys.INTERVAL));
+ service.reconfigure(om.getKeyLifecycleServiceConfig());
assertEquals(!originalEnabled, service.status().getIsEnabled());
assertEquals(!originalEnabled,
om.getLifecycleServiceStatus().getIsEnabled());
assertEquals(30000, service.getIntervalMillis());
@@ -292,28 +286,28 @@ void keyLifecycleService() throws
ReconfigurationException {
// Invalid values are rejected and the configuration is left unchanged
assertThrows(ReconfigurationException.class,
- () ->
getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE,
"0"));
+ () ->
getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.DELETE_BATCH_SIZE,
"0"));
assertThrows(ReconfigurationException.class,
- () ->
getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL, "-1"));
- assertEquals("30s",
om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL));
- service.reconfigure(om.getConfiguration());
+ () ->
getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.INTERVAL,
"-1"));
+ assertEquals("30s",
om.getConfiguration().get(KeyLifecycleServiceConfig.Keys.INTERVAL));
+ service.reconfigure(om.getKeyLifecycleServiceConfig());
assertEquals(30000, service.getIntervalMillis());
// Unset properties fall back to their defaults
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
null);
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
null);
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS,
null);
-
assertNull(om.getConfiguration().get(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL));
- service.reconfigure(om.getConfiguration());
- assertEquals(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT,
service.status().getIsEnabled());
-
assertEquals(om.getConfiguration().getTimeDuration(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
- OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL_DEFAULT, MILLISECONDS),
service.getIntervalMillis());
- assertEquals(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS_DEFAULT,
service.getExecutorService().getCorePoolSize());
-
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
originalEnabledValue);
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
originalInterval);
- getSubject().reconfigureProperty(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS,
originalWorkers);
- service.reconfigure(om.getConfiguration());
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.ENABLED,
null);
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.INTERVAL,
null);
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.WORKERS,
null);
+
assertNull(om.getConfiguration().get(KeyLifecycleServiceConfig.Keys.INTERVAL));
+ service.reconfigure(om.getKeyLifecycleServiceConfig());
+ assertEquals(KeyLifecycleServiceConfig.Defaults.ENABLED,
service.status().getIsEnabled());
+
assertEquals(om.getConfiguration().getObject(KeyLifecycleServiceConfig.class).getIntervalMs(),
+ service.getIntervalMillis());
+ assertEquals(KeyLifecycleServiceConfig.Defaults.WORKERS,
service.getExecutorService().getCorePoolSize());
+
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.ENABLED,
originalEnabledValue);
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.INTERVAL,
originalInterval);
+ getSubject().reconfigureProperty(KeyLifecycleServiceConfig.Keys.WORKERS,
originalWorkers);
+ service.reconfigure(om.getKeyLifecycleServiceConfig());
assertEquals(originalEnabled, service.status().getIsEnabled());
}
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
index 412e2814dfd..2580b2881c7 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
@@ -99,6 +99,7 @@
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatus;
import org.apache.hadoop.ozone.om.ratis.OzoneManagerRatisServerConfig;
+import org.apache.hadoop.ozone.om.service.KeyLifecycleServiceConfig;
import org.apache.hadoop.ozone.om.service.OpenKeyCleanupService;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.ToolRunner;
@@ -195,7 +196,7 @@ static MiniOzoneHAClusterImpl startCluster(boolean
followerReadEnabled) throws E
conf.setInt(OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL, 10);
conf.setBoolean(OMConfigKeys.OZONE_OM_ENABLE_FILESYSTEM_PATHS, true);
conf.setInt(ScmConfigKeys.OZONE_SCM_CONTAINER_LIST_MAX_COUNT, 1);
- conf.setBoolean(OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED, true);
+ conf.setBoolean(KeyLifecycleServiceConfig.Keys.ENABLED, true);
conf.setBoolean("ozone.om.allow.leader.skip.linearizable.read",
followerReadEnabled);
conf.setBoolean("ozone.client.follower.read.enabled", followerReadEnabled);
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
index 445160972d8..4547f53f380 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
@@ -42,12 +42,6 @@
import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_WORKERS;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_WORKERS_DEFAULT;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_COMPACTION_SERVICE_COLUMNFAMILIES;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_COMPACTION_SERVICE_COLUMNFAMILIES_DEFAULT;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_COMPACTION_SERVICE_ENABLED;
@@ -366,14 +360,8 @@ public void start(OzoneConfiguration configuration) {
}
if (keyLifecycleService == null) {
- long lifecycleServiceInterval =
configuration.getTimeDuration(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
- OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL_DEFAULT, TimeUnit.MILLISECONDS);
- long lifecycleServiceTimeout =
configuration.getTimeDuration(OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT,
- OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT_DEFAULT, TimeUnit.MILLISECONDS);
- int lifecycleServiceWorkerSize =
configuration.getInt(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS,
- OZONE_KEY_LIFECYCLE_SERVICE_WORKERS_DEFAULT);
- keyLifecycleService = new KeyLifecycleService(ozoneManager, this,
lifecycleServiceInterval,
- lifecycleServiceTimeout, lifecycleServiceWorkerSize, configuration);
+ keyLifecycleService = new KeyLifecycleService(ozoneManager, this,
ozoneManager.getKeyLifecycleServiceConfig(),
+ configuration);
keyLifecycleService.start();
}
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
index 217bb934a9a..970f0c714cc 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
@@ -61,8 +61,6 @@
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT_DEFAULT;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DIR_DELETING_SERVICE_INTERVAL;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_DELETING_LIMIT_PER_TASK;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_ADDRESS_KEY;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_BOOTSTRAP_CHECKPOINT_HEADROOM_RATIO_KEY;
import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_BOOTSTRAP_MIN_SPACE_KEY;
@@ -319,6 +317,7 @@
import org.apache.hadoop.ozone.om.service.CompactDBUtil;
import org.apache.hadoop.ozone.om.service.DirectoryDeletingService;
import org.apache.hadoop.ozone.om.service.KeyLifecycleService;
+import org.apache.hadoop.ozone.om.service.KeyLifecycleServiceConfig;
import org.apache.hadoop.ozone.om.service.OMRangerBGSyncService;
import org.apache.hadoop.ozone.om.service.QuotaRepairTask;
import org.apache.hadoop.ozone.om.service.RevokedSTSTokenCleanupService;
@@ -434,6 +433,7 @@ public final class OzoneManager extends
ServiceRuntimeInfoImpl
private final Text omRpcAddressTxt;
private OzoneConfiguration configuration;
private OmConfig config;
+ private KeyLifecycleServiceConfig keyLifecycleServiceConfig;
private RPC.Server omRpcServer;
private GrpcOzoneManagerServer omS3gGrpcServer;
private final InetSocketAddress omRpcAddress;
@@ -595,9 +595,8 @@ private OzoneManager(OzoneConfiguration conf, StartupOption
startupOption)
.register(OZONE_BLACKLIST_GROUPS, this::reconfOzoneBlacklistGroups)
.register(OZONE_READ_BLACKLIST_USERS,
this::reconfOzoneReadBlacklistUsers)
.register(OZONE_READ_BLACKLIST_GROUPS,
this::reconfOzoneReadBlacklistGroups);
- KeyLifecycleService.OZONE_KEY_LIFECYCLE_PROPERTIES.forEach(property ->
- reconfigurationHandler.register(property, newVal ->
validateKeyLifecycleProperty(property, newVal)));
-
reconfigurationHandler.registerCompleteCallback(this::reconfKeyLifecycleService);
+ reconfigurationHandler.register(keyLifecycleServiceConfig)
+ .registerCompleteCallback(this::reconfKeyLifecycleService);
// Allow dynamic SCM node/address reconfiguration without restarting OM.
// Address keys use prefix matching to discover new nodes added after
startup.
@@ -3708,8 +3707,7 @@ public GetLifecycleServiceStatusResponse
getLifecycleServiceStatus() {
KeyLifecycleService keyLifecycleService =
keyManager.getKeyLifecycleService();
if (keyLifecycleService == null) {
return GetLifecycleServiceStatusResponse.newBuilder()
-
.setIsEnabled(getConfiguration().getBoolean(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
- OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT))
+ .setIsEnabled(keyLifecycleServiceConfig.isEnabled())
.build();
}
return keyLifecycleService.status();
@@ -5157,10 +5155,15 @@ public OmConfig getConfig() {
return config;
}
+ public KeyLifecycleServiceConfig getKeyLifecycleServiceConfig() {
+ return keyLifecycleServiceConfig;
+ }
+
@VisibleForTesting
public void setConfiguration(OzoneConfiguration conf) {
this.configuration = conf;
config = conf.getObject(OmConfig.class);
+ keyLifecycleServiceConfig =
conf.getObject(KeyLifecycleServiceConfig.class);
}
public OzoneConfiguration reloadConfiguration() {
@@ -6293,27 +6296,16 @@ private String
reconfOzoneThreadNumberDirDeletion(String newVal) {
return newVal;
}
- private String validateKeyLifecycleProperty(String property, String newVal) {
- OzoneConfiguration newConf = new OzoneConfiguration(getConfiguration());
- if (newVal == null) {
- newConf.unset(property);
- } else {
- newConf.set(property, newVal);
- }
- KeyLifecycleService.validate(newConf);
- return newVal;
- }
-
/**
* Apply all changed KeyLifecycleService properties at once, after each of
them is validated and stored
- * in the OM configuration.
+ * in {@link KeyLifecycleServiceConfig}.
*/
private void reconfKeyLifecycleService(Map<String, Boolean> changedKeys,
Configuration newConf) {
KeyLifecycleService keyLifecycleService =
getKeyManager().getKeyLifecycleService();
// If the service is not running, the new values are picked up from the
configuration when it is started.
if (keyLifecycleService != null
- &&
changedKeys.keySet().stream().anyMatch(KeyLifecycleService.OZONE_KEY_LIFECYCLE_PROPERTIES::contains))
{
- keyLifecycleService.reconfigure(getConfiguration());
+ &&
changedKeys.keySet().stream().anyMatch(keyLifecycleServiceConfig.reconfigurableProperties()::contains))
{
+ keyLifecycleService.reconfigure(keyLifecycleServiceConfig);
}
}
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java
index 07c66576f7e..174110ffd6c 100644
---
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleService.java
@@ -20,31 +20,9 @@
import static org.apache.hadoop.fs.FileSystem.TRASH_PREFIX;
import static org.apache.hadoop.fs.ozone.OzoneTrashPolicy.CURRENT;
import static org.apache.hadoop.ozone.OzoneConsts.OM_KEY_PREFIX;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_WORKERS;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_WORKERS_DEFAULT;
import static org.apache.hadoop.ozone.om.helpers.BucketLayout.OBJECT_STORE;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
import com.google.protobuf.ServiceException;
import jakarta.annotation.Nullable;
import java.io.IOException;
@@ -127,21 +105,6 @@ public class KeyLifecycleService extends BackgroundService
{
public static final Logger LOG =
LoggerFactory.getLogger(KeyLifecycleService.class);
- /**
- * Properties that can be changed at runtime via OM reconfiguration, see
{@link #reconfigure}.
- */
- public static final Set<String> OZONE_KEY_LIFECYCLE_PROPERTIES =
ImmutableSet.of(
- OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
- OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
- OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT,
- OZONE_KEY_LIFECYCLE_SERVICE_WORKERS,
- OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE,
- OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK,
- OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED,
- OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED);
-
private final OzoneManager ozoneManager;
private volatile int keyDeleteBatchSize;
private volatile int mpuAbortLimitPerTask;
@@ -165,45 +128,20 @@ public class KeyLifecycleService extends
BackgroundService {
private static boolean test = false;
private static List<RuleListWithDirectoryList> consolidatedRuleList;
- public KeyLifecycleService(OzoneManager ozoneManager,
- KeyManager manager, long serviceInterval,
- long serviceTimeout, int poolSize,
- ConfigurationSource conf) {
- super(KeyLifecycleService.class.getSimpleName(), serviceInterval,
TimeUnit.MILLISECONDS,
- poolSize, serviceTimeout, ozoneManager.getThreadNamePrefix());
+ public KeyLifecycleService(OzoneManager ozoneManager, KeyManager manager,
KeyLifecycleServiceConfig lifecycleConfig,
+ ConfigurationSource conf) {
+ super(KeyLifecycleService.class.getSimpleName(),
lifecycleConfig.getIntervalMs(), TimeUnit.MILLISECONDS,
+ lifecycleConfig.getWorkers(), lifecycleConfig.getTimeoutMs(),
ozoneManager.getThreadNamePrefix());
this.ozoneManager = ozoneManager;
- this.keyDeleteBatchSize =
conf.getInt(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE,
- OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE_DEFAULT);
- Preconditions.checkArgument(keyDeleteBatchSize > 0,
- OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE + " should be a positive
value.");
- this.mpuAbortLimitPerTask =
conf.getInt(OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK,
- OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK_DEFAULT);
- Preconditions.checkArgument(mpuAbortLimitPerTask > 0,
- OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK + " should be a
positive value.");
- this.cachedDirMaxCount =
conf.getLong(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT,
- OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT_DEFAULT);
+ this.keyDeleteBatchSize = lifecycleConfig.getDeleteBatchSize();
+ this.mpuAbortLimitPerTask = lifecycleConfig.getMpuAbortLimitPerTask();
+ this.cachedDirMaxCount = lifecycleConfig.getCachedDirMaxCount();
this.suspended = new AtomicBoolean(false);
this.metrics = KeyLifecycleServiceMetrics.create();
- this.isServiceEnabled = new
AtomicBoolean(conf.getBoolean(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
- OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT));
- this.moveToTrashEnabled = new
AtomicBoolean(conf.getBoolean(OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED,
- OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED_DEFAULT));
- this.stateSaveIntervalMs =
conf.getLong(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS_DEFAULT);
- if (!test && stateSaveIntervalMs <= 0) {
- LOG.warn("Illegal value {} for Property {}. Set {} to {}",
stateSaveIntervalMs,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS,
OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS_DEFAULT);
- stateSaveIntervalMs =
OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS_DEFAULT;
- }
- this.maxKeysProcessedPerState =
conf.getLong(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED_DEFAULT);
- if (!test && maxKeysProcessedPerState <= 0) {
- LOG.warn("Illegal value {} for Property {}. Set {} to {}",
maxKeysProcessedPerState,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED,
OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED_DEFAULT);
- maxKeysProcessedPerState =
OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED_DEFAULT;
- }
+ this.isServiceEnabled = new AtomicBoolean(lifecycleConfig.isEnabled());
+ this.moveToTrashEnabled = new
AtomicBoolean(lifecycleConfig.isMoveToTrashEnabled());
+ this.stateSaveIntervalMs = lifecycleConfig.getStateSaveIntervalMs();
+ this.maxKeysProcessedPerState =
lifecycleConfig.getMaxKeysProcessedPerState();
LOG.info("stateSaveIntervalMs = {}, maxKeysProcessedPerState = {}",
stateSaveIntervalMs, maxKeysProcessedPerState);
this.inFlight = new ConcurrentHashMap();
this.omMetadataManager = ozoneManager.getMetadataManager();
@@ -266,41 +204,31 @@ private boolean shouldRun() {
}
/**
- * Validate the values of {@link #OZONE_KEY_LIFECYCLE_PROPERTIES} in the
given configuration.
- * @throws IllegalArgumentException if any value is invalid
+ * Apply the values of the given {@link KeyLifecycleServiceConfig} at once
without restarting OM.
+ * All changes except the interval take effect immediately, running tasks
pick them up on their next batch scan.
+ * A new interval, or enabling a disabled service, restarts the service,
running tasks stop at their next
+ * checkpoint and resume from the saved scan state in the next run.
+ * @param lifecycleConfig validated configuration holding the new values
*/
- public static void validate(ConfigurationSource conf) {
- new ReconfigurableSettings(conf);
- }
-
- /**
- * Apply the values of all {@link #OZONE_KEY_LIFECYCLE_PROPERTIES} at once
without restarting OM.
- * Properties not set in the configuration fall back to their defaults. All
changes except the interval take
- * effect immediately, running tasks pick them up on their next batch scan.
A new interval, or enabling a
- * disabled service, restarts the service, running tasks stop at their next
checkpoint and resume from the
- * saved scan state in the next run.
- * @param conf configuration holding the new values
- * @throws IllegalArgumentException if any value is invalid, in which case
nothing is changed
- */
- public void reconfigure(ConfigurationSource conf) {
- ReconfigurableSettings settings = new ReconfigurableSettings(conf);
- keyDeleteBatchSize = settings.keyDeleteBatchSize;
- mpuAbortLimitPerTask = settings.mpuAbortLimitPerTask;
- cachedDirMaxCount = settings.cachedDirMaxCount;
- stateSaveIntervalMs = settings.stateSaveIntervalMs;
- maxKeysProcessedPerState = settings.maxKeysProcessedPerState;
- moveToTrashEnabled.set(settings.moveToTrashEnabled);
- setServiceTimeoutInNanos(settings.timeoutNanos);
- setPoolSize(settings.workers);
- boolean wasEnabled = isServiceEnabled.getAndSet(settings.enabled);
- LOG.info("Reconfigured KeyLifecycleService: enabled = {}, interval = {}
ms, timeout = {} ns, workers = {}, " +
+ public void reconfigure(KeyLifecycleServiceConfig lifecycleConfig) {
+ keyDeleteBatchSize = lifecycleConfig.getDeleteBatchSize();
+ mpuAbortLimitPerTask = lifecycleConfig.getMpuAbortLimitPerTask();
+ cachedDirMaxCount = lifecycleConfig.getCachedDirMaxCount();
+ stateSaveIntervalMs = lifecycleConfig.getStateSaveIntervalMs();
+ maxKeysProcessedPerState = lifecycleConfig.getMaxKeysProcessedPerState();
+ moveToTrashEnabled.set(lifecycleConfig.isMoveToTrashEnabled());
+
setServiceTimeoutInNanos(TimeUnit.MILLISECONDS.toNanos(lifecycleConfig.getTimeoutMs()));
+ setPoolSize(lifecycleConfig.getWorkers());
+ boolean enabled = lifecycleConfig.isEnabled();
+ boolean wasEnabled = isServiceEnabled.getAndSet(enabled);
+ long intervalMs = lifecycleConfig.getIntervalMs();
+ LOG.info("Reconfigured KeyLifecycleService: enabled = {}, interval = {}
ms, timeout = {} ms, workers = {}, " +
"deleteBatchSize = {}, mpuAbortLimitPerTask = {},
cachedDirMaxCount = {}, stateSaveIntervalMs = {}, " +
- "maxKeysProcessedPerState = {}, moveToTrashEnabled = {}",
settings.enabled, settings.intervalMs,
- settings.timeoutNanos, settings.workers, settings.keyDeleteBatchSize,
settings.mpuAbortLimitPerTask,
- settings.cachedDirMaxCount, settings.stateSaveIntervalMs,
settings.maxKeysProcessedPerState,
- settings.moveToTrashEnabled);
- if (settings.intervalMs != getIntervalMillis() || (settings.enabled &&
!wasEnabled)) {
- restart(settings.intervalMs);
+ "maxKeysProcessedPerState = {}, moveToTrashEnabled = {}", enabled,
intervalMs,
+ lifecycleConfig.getTimeoutMs(), lifecycleConfig.getWorkers(),
keyDeleteBatchSize, mpuAbortLimitPerTask,
+ cachedDirMaxCount, stateSaveIntervalMs, maxKeysProcessedPerState,
moveToTrashEnabled.get());
+ if (intervalMs != getIntervalMillis() || (enabled && !wasEnabled)) {
+ restart(intervalMs);
}
}
@@ -322,53 +250,6 @@ private void restart(long newIntervalMs) {
}
}
- /**
- * Validated values of {@link #OZONE_KEY_LIFECYCLE_PROPERTIES}.
- */
- private static final class ReconfigurableSettings {
- private final boolean enabled;
- private final long intervalMs;
- private final long timeoutNanos;
- private final int workers;
- private final int keyDeleteBatchSize;
- private final int mpuAbortLimitPerTask;
- private final long cachedDirMaxCount;
- private final long stateSaveIntervalMs;
- private final long maxKeysProcessedPerState;
- private final boolean moveToTrashEnabled;
-
- private ReconfigurableSettings(ConfigurationSource conf) {
- enabled = conf.getBoolean(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED,
OZONE_KEY_LIFECYCLE_SERVICE_ENABLED_DEFAULT);
- intervalMs = checkPositive(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
conf.getTimeDuration(
- OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL_DEFAULT, TimeUnit.MILLISECONDS));
- timeoutNanos = checkPositive(OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT,
conf.getTimeDuration(
- OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT,
OZONE_KEY_LIFECYCLE_SERVICE_TIMEOUT_DEFAULT, TimeUnit.NANOSECONDS));
- workers = (int) checkPositive(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS,
- conf.getInt(OZONE_KEY_LIFECYCLE_SERVICE_WORKERS,
OZONE_KEY_LIFECYCLE_SERVICE_WORKERS_DEFAULT));
- keyDeleteBatchSize = (int)
checkPositive(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE, conf.getInt(
- OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE,
OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE_DEFAULT));
- mpuAbortLimitPerTask = (int)
checkPositive(OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK,
- conf.getInt(OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK,
- OZONE_KEY_LIFECYCLE_SERVICE_MPU_ABORT_LIMIT_PER_TASK_DEFAULT));
- cachedDirMaxCount =
checkPositive(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT,
-
conf.getLong(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT,
-
OZONE_KEY_LIFECYCLE_SERVICE_DELETE_CACHED_DIRECTORY_MAX_COUNT_DEFAULT));
- stateSaveIntervalMs =
checkPositive(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS,
- conf.getLong(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS_DEFAULT));
- maxKeysProcessedPerState =
checkPositive(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED,
- conf.getLong(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED_DEFAULT));
- moveToTrashEnabled =
conf.getBoolean(OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED,
- OZONE_KEY_LIFECYCLE_SERVICE_MOVE_TO_TRASH_ENABLED_DEFAULT);
- }
-
- private static long checkPositive(String property, long value) {
- Preconditions.checkArgument(value > 0, property + " should be a positive
value.");
- return value;
- }
- }
-
public KeyLifecycleServiceMetrics getMetrics() {
return metrics;
}
diff --git
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleServiceConfig.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleServiceConfig.java
new file mode 100644
index 00000000000..603e6071f1b
--- /dev/null
+++
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/KeyLifecycleServiceConfig.java
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om.service;
+
+import com.google.common.base.Preconditions;
+import java.util.concurrent.TimeUnit;
+import org.apache.hadoop.hdds.conf.Config;
+import org.apache.hadoop.hdds.conf.ConfigGroup;
+import org.apache.hadoop.hdds.conf.ConfigTag;
+import org.apache.hadoop.hdds.conf.ConfigType;
+import org.apache.hadoop.hdds.conf.PostConstruct;
+import org.apache.hadoop.hdds.conf.ReconfigurableConfig;
+
+/**
+ * Configuration of {@link KeyLifecycleService}. All properties can be changed
at runtime via OM reconfiguration.
+ */
+@ConfigGroup(prefix = "ozone.lifecycle.service")
+public class KeyLifecycleServiceConfig extends ReconfigurableConfig {
+
+ @Config(key = Keys.ENABLED,
+ defaultValue = "false",
+ type = ConfigType.BOOLEAN,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "It specifies whether to enable lifecycle management
service."
+ )
+ private boolean enabled = Defaults.ENABLED;
+
+ @Config(key = Keys.INTERVAL,
+ defaultValue = "24h",
+ type = ConfigType.TIME,
+ timeUnit = TimeUnit.MILLISECONDS,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "Interval at which key lifecycle management service will
run."
+ )
+ private long intervalMs = TimeUnit.HOURS.toMillis(24);
+
+ @Config(key = Keys.TIMEOUT,
+ defaultValue = "2h",
+ type = ConfigType.TIME,
+ timeUnit = TimeUnit.MILLISECONDS,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "Timeout for task of key lifecycle management service."
+ )
+ private long timeoutMs = TimeUnit.HOURS.toMillis(2);
+
+ @Config(key = Keys.WORKERS,
+ defaultValue = "5",
+ type = ConfigType.INT,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "Number of workers executed of key lifecycle management
service. " +
+ "This configuration should be set to greater than 0."
+ )
+ private int workers = Defaults.WORKERS;
+
+ @Config(key = Keys.DELETE_BATCH_SIZE,
+ defaultValue = "1000",
+ type = ConfigType.INT,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "Max numbers of objects allowed for deletion in a batch
for a lifecycle evaluating task."
+ )
+ private int deleteBatchSize = Defaults.DELETE_BATCH_SIZE;
+
+ @Config(key = Keys.MPU_ABORT_LIMIT_PER_TASK,
+ defaultValue = "1000",
+ type = ConfigType.INT,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "Maximum number of multipart upload parts (rounded up to
complete uploads) to abort in a " +
+ "single task when processing AbortIncompleteMultipartUpload
lifecycle rules."
+ )
+ private int mpuAbortLimitPerTask = Defaults.MPU_ABORT_LIMIT_PER_TASK;
+
+ @Config(key = Keys.DELETE_CACHED_DIRECTORY_MAX_COUNT,
+ defaultValue = "1000000",
+ type = ConfigType.LONG,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "Max numbers of directory objects held in memory stack for
recursive FSO bucket evaluating " +
+ "for a lifecycle evaluating task. Once the cached directory objects
exceeds this limit, the evaluation " +
+ "of the involved directories will abort."
+ )
+ private long cachedDirMaxCount = Defaults.DELETE_CACHED_DIRECTORY_MAX_COUNT;
+
+ @Config(key = Keys.STATE_SAVE_INTERVAL_MS,
+ defaultValue = "300000",
+ type = ConfigType.LONG,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "The interval of bucket scan task saves its pointer to DB.
Default is 5 mins."
+ )
+ private long stateSaveIntervalMs = Defaults.STATE_SAVE_INTERVAL_MS;
+
+ @Config(key = Keys.STATE_SAVE_KEYS_PROCESSED,
+ defaultValue = "100000",
+ type = ConfigType.LONG,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "Bucket scan task will save its pointer to DB by default
every 100000 keys are scanned. " +
+ "Bucket scan pointer save will happen when either " +
Keys.STATE_SAVE_INTERVAL_MS + " or " +
+ Keys.STATE_SAVE_KEYS_PROCESSED + " is satisfied."
+ )
+ private long maxKeysProcessedPerState = Defaults.STATE_SAVE_KEYS_PROCESSED;
+
+ @Config(key = Keys.MOVE_TO_TRASH_ENABLED,
+ defaultValue = "true",
+ type = ConfigType.BOOLEAN,
+ reconfigurable = true,
+ tags = {ConfigTag.OM, ConfigTag.OZONE},
+ description = "When enabled KeyLifecycleService will move expired
keys/dirs to trash if trash is available. " +
+ "When disabled, it will delete them directly."
+ )
+ private boolean moveToTrashEnabled = Defaults.MOVE_TO_TRASH_ENABLED;
+
+ @PostConstruct
+ public void validate() {
+ checkPositive(Keys.INTERVAL, intervalMs);
+ checkPositive(Keys.TIMEOUT, timeoutMs);
+ checkPositive(Keys.WORKERS, workers);
+ checkPositive(Keys.DELETE_BATCH_SIZE, deleteBatchSize);
+ checkPositive(Keys.MPU_ABORT_LIMIT_PER_TASK, mpuAbortLimitPerTask);
+ checkPositive(Keys.DELETE_CACHED_DIRECTORY_MAX_COUNT, cachedDirMaxCount);
+ checkPositive(Keys.STATE_SAVE_INTERVAL_MS, stateSaveIntervalMs);
+ checkPositive(Keys.STATE_SAVE_KEYS_PROCESSED, maxKeysProcessedPerState);
+ }
+
+ private static void checkPositive(String property, long value) {
+ Preconditions.checkArgument(value > 0, property + " should be a positive
value.");
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public long getIntervalMs() {
+ return intervalMs;
+ }
+
+ public long getTimeoutMs() {
+ return timeoutMs;
+ }
+
+ public int getWorkers() {
+ return workers;
+ }
+
+ public int getDeleteBatchSize() {
+ return deleteBatchSize;
+ }
+
+ public int getMpuAbortLimitPerTask() {
+ return mpuAbortLimitPerTask;
+ }
+
+ public long getCachedDirMaxCount() {
+ return cachedDirMaxCount;
+ }
+
+ public long getStateSaveIntervalMs() {
+ return stateSaveIntervalMs;
+ }
+
+ public long getMaxKeysProcessedPerState() {
+ return maxKeysProcessedPerState;
+ }
+
+ public boolean isMoveToTrashEnabled() {
+ return moveToTrashEnabled;
+ }
+
+ /**
+ * String keys for tests and grep.
+ */
+ public static final class Keys {
+ public static final String ENABLED = "ozone.lifecycle.service.enabled";
+ public static final String INTERVAL = "ozone.lifecycle.service.interval";
+ public static final String TIMEOUT = "ozone.lifecycle.service.timeout";
+ public static final String WORKERS = "ozone.lifecycle.service.workers";
+ public static final String DELETE_BATCH_SIZE =
"ozone.lifecycle.service.delete.batch-size";
+ public static final String MPU_ABORT_LIMIT_PER_TASK =
"ozone.lifecycle.service.mpu.abort.limit.per.task";
+ public static final String DELETE_CACHED_DIRECTORY_MAX_COUNT =
+ "ozone.lifecycle.service.delete.cached.directory.max-count";
+ public static final String STATE_SAVE_INTERVAL_MS =
"ozone.lifecycle.service.state.save.interval.ms";
+ public static final String STATE_SAVE_KEYS_PROCESSED =
"ozone.lifecycle.service.state.save.keys.processed";
+ public static final String MOVE_TO_TRASH_ENABLED =
"ozone.lifecycle.service.move.to.trash.enabled";
+ }
+
+ /**
+ * Default values for tests.
+ */
+ public static final class Defaults {
+ public static final boolean ENABLED = false;
+ public static final int WORKERS = 5;
+ public static final int DELETE_BATCH_SIZE = 1000;
+ public static final int MPU_ABORT_LIMIT_PER_TASK = 1000;
+ public static final long DELETE_CACHED_DIRECTORY_MAX_COUNT = 1000000;
+ public static final long STATE_SAVE_INTERVAL_MS = 5 * 60 * 1000;
+ public static final long STATE_SAVE_KEYS_PROCESSED = 100000;
+ public static final boolean MOVE_TO_TRASH_ENABLED = true;
+ }
+}
diff --git
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java
index 285cac5be9e..4e8a5e40221 100644
---
a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java
+++
b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestKeyLifecycleService.java
@@ -31,14 +31,6 @@
import static
org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_ADMINISTRATORS_WILDCARD;
import static org.apache.hadoop.ozone.OzoneConsts.ETAG;
import static org.apache.hadoop.ozone.OzoneConsts.OM_KEY_PREFIX;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_ENABLED;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS_DEFAULT;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED;
-import static
org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED_DEFAULT;
import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_OM_DB_DIRS;
import static org.apache.hadoop.ozone.om.OmConfig.Keys.ENABLE_FILESYSTEM_PATHS;
import static
org.apache.hadoop.ozone.om.exceptions.OMException.ResultCodes.INVALID_REQUEST;
@@ -223,9 +215,9 @@ class TestKeyLifecycleService extends OzoneTestBase {
static Stream<Arguments> stateSaveConfiguration() {
return Stream.of(
- Arguments.of(-1, -1),
-
Arguments.of(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS_DEFAULT,
- OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED_DEFAULT)
+ Arguments.of(1, 1),
+ Arguments.of(KeyLifecycleServiceConfig.Defaults.STATE_SAVE_INTERVAL_MS,
+ KeyLifecycleServiceConfig.Defaults.STATE_SAVE_KEYS_PROCESSED)
);
}
@@ -240,13 +232,13 @@ private void createConfig(File testDir) {
ServerUtils.setOzoneMetaDirPath(conf, testDir.toString());
conf.setTimeDuration(HDDS_CONTAINER_REPORT_INTERVAL,
200, TimeUnit.MILLISECONDS);
- conf.setBoolean(OZONE_KEY_LIFECYCLE_SERVICE_ENABLED, true);
- conf.setTimeDuration(OZONE_KEY_LIFECYCLE_SERVICE_INTERVAL,
SERVICE_INTERVAL, TimeUnit.MILLISECONDS);
- conf.setInt(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE, 50);
+ conf.setBoolean(KeyLifecycleServiceConfig.Keys.ENABLED, true);
+ conf.setTimeDuration(KeyLifecycleServiceConfig.Keys.INTERVAL,
SERVICE_INTERVAL, TimeUnit.MILLISECONDS);
+ conf.setInt(KeyLifecycleServiceConfig.Keys.DELETE_BATCH_SIZE, 50);
conf.setQuietMode(false);
conf.setBoolean(ENABLE_FILESYSTEM_PATHS, false);
- conf.setLong(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_INTERVAL_MS,
stateSaveInternal);
- conf.setLong(OZONE_KEY_LIFECYCLE_SERVICE_STATE_SAVE_KEYS_PROCESSED,
maxKeysProcessedPerState);
+ conf.setLong(KeyLifecycleServiceConfig.Keys.STATE_SAVE_INTERVAL_MS,
stateSaveInternal);
+ conf.setLong(KeyLifecycleServiceConfig.Keys.STATE_SAVE_KEYS_PROCESSED,
maxKeysProcessedPerState);
OmLCExpiration.setTest(true);
KeyLifecycleService.setTest(true);
}
@@ -478,8 +470,8 @@ void testPeriodicStateSave(BucketLayout bucketLayout)
throws Exception {
String bucketKey = metadataManager.getBucketKey(volumeName,
bucketName);
- if (stateSaveInternal == -1) {
- // With 5 keys and stateSaveIntervalMs = -1, it should save on every
key iteration.
+ if (maxKeysProcessedPerState == 1) {
+ // With 5 keys and maxKeysProcessedPerState = 1, it should save on
every key iteration.
// It will save at least 5 times (one for each key).
verify(spyTable, atLeast(5))
.addCacheEntry(argThat(k -> k.getCacheKey().equals(bucketKey)),
any());
@@ -947,7 +939,7 @@ void testNestedFSODirectoryScanResume(BucketLayout
bucketLayout, int maxSize) th
}, WAIT_CHECK_INTERVAL, 10000);
OmLifecycleScanState scanState =
metadataManager.getLifecycleScanStateTable().get(bucketKey);
- if (stateSaveInternal != -1) {
+ if (maxKeysProcessedPerState != 1) {
if (maxSize == 2) {
if (bucketLayout == FILE_SYSTEM_OPTIMIZED) {
assertEquals("dir3/dir6/dir9", scanState.getLastScannedDir());
@@ -2195,7 +2187,7 @@ void testOneRuleDisabledOneRuleEnabled(BucketLayout
bucketLayout)
@ValueSource(strings = {"FILE_SYSTEM_OPTIMIZED", "OBJECT_STORE"})
void testKeyUpdatedShouldNotGetDeleted(BucketLayout bucketLayout)
throws IOException, InterruptedException, TimeoutException {
- assumeTrue(stateSaveInternal != -1);
+ assumeTrue(maxKeysProcessedPerState != 1);
final String volumeName = getTestName();
final String bucketName = uniqueObjectName("bucket");
GenericTestUtils.LogCapturer log =
@@ -2470,7 +2462,7 @@ void testListMaxSize(BucketLayout bucketLayout, boolean
enableTrash) throws IOEx
(getDeletedKeyCount() - initialDeletedKeyCount) == keyCount,
WAIT_CHECK_INTERVAL, 5000);
assertEquals(0, getKeyCount(bucketLayout) - initialKeyCount);
}
- if (stateSaveInternal != -1) {
+ if (maxKeysProcessedPerState != 1) {
GenericTestUtils.waitFor(() ->
log.getOutput().contains("LimitedSizeList has reached maximum
size " + maxListSize),
WAIT_CHECK_INTERVAL, 5000);
@@ -3338,7 +3330,7 @@ public Stream<Arguments> parameters1() {
@MethodSource("parameters1")
void testKeyDeletedOrRenamed(BucketLayout bucketLayout, boolean deleted)
throws IOException, InterruptedException, TimeoutException {
- assumeTrue(stateSaveInternal != -1);
+ assumeTrue(maxKeysProcessedPerState != 1);
final String volumeName = getTestName();
final String bucketName = uniqueObjectName("bucket");
GenericTestUtils.LogCapturer log =
@@ -3626,8 +3618,8 @@ private void cleanUpService() throws Exception {
KeyLifecycleService.setInjectors(null);
keyLifecycleService.setOzoneTrash(null);
keyLifecycleService.setMoveToTrashEnabled(true);
-
keyLifecycleService.setKeyDeleteBatchSize(conf.getInt(OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE,
- OZONE_KEY_LIFECYCLE_SERVICE_DELETE_BATCH_SIZE_DEFAULT));
+
keyLifecycleService.setKeyDeleteBatchSize(conf.getInt(KeyLifecycleServiceConfig.Keys.DELETE_BATCH_SIZE,
+ KeyLifecycleServiceConfig.Defaults.DELETE_BATCH_SIZE));
keyLifecycleService.resume();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]