adoroszlai commented on code in PR #12021:
URL: https://github.com/apache/ozone/pull/12021#discussion_r4538191827
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerUnit.java:
##########
@@ -142,6 +148,28 @@ public void cleanup() throws Exception {
om.stop();
}
+ @ParameterizedTest
+ @ValueSource(strings = {"ozone.om.compaction.service.run.interval",
"ozone.om.compaction.service.timeout"})
+ void testDisabledCompactionIgnoresInvalidConfiguration(String property) {
+ OzoneConfiguration conf = new OzoneConfiguration();
+ conf.setBoolean("ozone.om.compaction.service.enabled", false);
Review Comment:
Please use `CompactionServiceConfig.Keys.ENABLED` etc. instead of strings
(also elsewhere in this test class and in `TestCompactionServiceConfig`.)
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/CompactDBUtil.java:
##########
@@ -79,17 +78,7 @@ public static CompletableFuture<Void>
compactTableAsync(OMMetadataManager metada
public static ManagedCompactRangeOptions.BottommostLevelCompaction
getBottommostLevelCompaction(
OzoneConfiguration configuration) {
- ManagedCompactRangeOptions.BottommostLevelCompaction blc =
ManagedCompactRangeOptions.BottommostLevelCompaction
-
.valueOf(OMConfigKeys.OZONE_OM_COMPACTION_SERVICE_BOTTOMMOSTLEVELCOMPACTION_DEFAULT);
-
- try {
- blc =
configuration.getEnum(OMConfigKeys.OZONE_OM_COMPACTION_SERVICE_BOTTOMMOSTLEVELCOMPACTION,
blc);
- } catch (IllegalArgumentException e) {
- LOG.warn("Invalid value for bottommost level compaction configuration
'{}'",
-
configuration.get(OMConfigKeys.OZONE_OM_COMPACTION_SERVICE_BOTTOMMOSTLEVELCOMPACTION),
e);
- }
-
- return blc;
+ return
configuration.getObject(CompactionServiceConfig.class).getBottommostLevelCompaction();
Review Comment:
This method can be removed (after changes suggested for `CompactionService`
creation).
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -461,23 +452,12 @@ public void stopSnapshotDefragService() {
}
}
- private void startCompactionService(OzoneConfiguration configuration,
- boolean isCompactionServiceEnabled) {
- if (compactionService == null && isCompactionServiceEnabled) {
- long compactionInterval = configuration.getTimeDuration(
- OZONE_OM_COMPACTION_SERVICE_RUN_INTERVAL,
- OZONE_OM_COMPACTION_SERVICE_RUN_INTERVAL_DEFAULT,
- TimeUnit.MILLISECONDS);
- long serviceTimeout = configuration.getTimeDuration(
- OZONE_OM_COMPACTION_SERVICE_TIMEOUT,
- OZONE_OM_COMPACTION_SERVICE_TIMEOUT_DEFAULT,
- TimeUnit.MILLISECONDS);
- String compactionColumnFamilies = configuration.get(
- OZONE_OM_COMPACTION_SERVICE_COLUMNFAMILIES,
- OZONE_OM_COMPACTION_SERVICE_COLUMNFAMILIES_DEFAULT);
- String[] tables = compactionColumnFamilies.split(",");
+ private void startCompactionService(OzoneConfiguration configuration) {
+ if (compactionService == null &&
configuration.getBoolean(CompactionServiceConfig.Keys.ENABLED, false)) {
+ CompactionServiceConfig config =
configuration.getObject(CompactionServiceConfig.class);
+ String[] tables = config.getColumnFamilies().split(",");
compactionService = new CompactionService(ozoneManager,
TimeUnit.MILLISECONDS,
- compactionInterval, serviceTimeout, Arrays.asList(tables));
+ config.getRunInterval(), config.getTimeout(), Arrays.asList(tables));
Review Comment:
Instead of individual settings, please pass `CompactionServiceConfig config`
to `CompactionService`, which should store it. Then the service can use it to
replace the call to `CompactDBUtil`:
https://github.com/apache/ozone/blob/0eb90f160432c03bd0dee7c4492d33986342d93b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/service/CompactionService.java#L70
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]