diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java index 873f6f673486..5426bbc49817 100644 --- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java +++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java @@ -247,28 +247,49 @@ public enum ChecksumCombineMode { tags = ConfigTag.CLIENT) private String fsDefaultBucketLayout = "FILE_SYSTEM_OPTIMIZED"; + // ozone.client.hbase.enhancements.allowed + @Config(key = "hbase.enhancements.allowed", + defaultValue = "false", + description = "When set to false, client-side HBase enhancement-related Ozone (experimental) features " + + "are disabled (not allowed to be enabled) regardless of whether those configs are set.\n" + + "\n" + + "Here is the list of configs and values overridden when this config is set to false:\n" + + "1. ozone.fs.hsync.enabled = false\n" + + "2. ozone.client.incremental.chunk.list = false\n" + + "3. ozone.client.stream.putblock.piggybacking = false\n" + + "4. ozone.client.key.write.concurrency = 1\n" + + "\n" + + "A warning message will be printed if any of the above configs are overridden by this.", + tags = ConfigTag.CLIENT) + private boolean hbaseEnhancementsAllowed = false; + + // ozone.client.incremental.chunk.list @Config(key = "incremental.chunk.list", - defaultValue = "true", + defaultValue = "false", type = ConfigType.BOOLEAN, description = "Client PutBlock request can choose incremental chunk " + "list rather than full chunk list to optimize performance. " + - "Critical to HBase. EC does not support this feature.", + "Critical to HBase. EC does not support this feature. " + + "Can be enabled only when ozone.client.hbase.enhancements.allowed = true", tags = ConfigTag.CLIENT) - private boolean incrementalChunkList = true; + private boolean incrementalChunkList = false; + // ozone.client.stream.putblock.piggybacking @Config(key = "stream.putblock.piggybacking", - defaultValue = "true", + defaultValue = "false", type = ConfigType.BOOLEAN, - description = "Allow PutBlock to be piggybacked in WriteChunk " + - "requests if the chunk is small.", + description = "Allow PutBlock to be piggybacked in WriteChunk requests if the chunk is small. " + + "Can be enabled only when ozone.client.hbase.enhancements.allowed = true", tags = ConfigTag.CLIENT) - private boolean enablePutblockPiggybacking = true; + private boolean enablePutblockPiggybacking = false; + // ozone.client.key.write.concurrency @Config(key = "key.write.concurrency", defaultValue = "1", description = "Maximum concurrent writes allowed on each key. " + "Defaults to 1 which matches the behavior before HDDS-9844. " + - "For unlimited write concurrency, set this to -1 or any negative integer value.", + "For unlimited write concurrency, set this to -1 or any negative integer value. " + + "Any value other than 1 is effective only when ozone.client.hbase.enhancements.allowed = true", tags = ConfigTag.CLIENT) private int maxConcurrentWritePerKey = 1; @@ -298,6 +319,34 @@ public void validate() { OzoneConfigKeys.OZONE_CLIENT_BYTES_PER_CHECKSUM_MIN_SIZE; } + // Verify client configs related to HBase enhancements + // Enforce check on ozone.client.hbase.enhancements.allowed + if (!hbaseEnhancementsAllowed) { + // ozone.client.hbase.enhancements.allowed = false + if (incrementalChunkList) { + LOG.warn("Ignoring ozone.client.incremental.chunk.list = true " + + "because HBase enhancements are disallowed. " + + "To enable it, set ozone.client.hbase.enhancements.allowed = true."); + incrementalChunkList = false; + LOG.debug("Final ozone.client.incremental.chunk.list = {}", incrementalChunkList); + } + if (enablePutblockPiggybacking) { + LOG.warn("Ignoring ozone.client.stream.putblock.piggybacking = true " + + "because HBase enhancements are disallowed. " + + "To enable it, set ozone.client.hbase.enhancements.allowed = true."); + enablePutblockPiggybacking = false; + LOG.debug("Final ozone.client.stream.putblock.piggybacking = {}", enablePutblockPiggybacking); + } + if (maxConcurrentWritePerKey != 1) { + LOG.warn("Ignoring ozone.client.key.write.concurrency = {} " + + "because HBase enhancements are disallowed. " + + "To enable it, set ozone.client.hbase.enhancements.allowed = true.", + maxConcurrentWritePerKey); + maxConcurrentWritePerKey = 1; + LOG.debug("Final ozone.client.key.write.concurrency = {}", maxConcurrentWritePerKey); + } + // Note: ozone.fs.hsync.enabled is enforced by OzoneFSUtils#canEnableHsync, not here + } } public long getStreamBufferFlushSize() { @@ -486,6 +535,14 @@ public void setDatastreamPipelineMode(boolean datastreamPipelineMode) { this.datastreamPipelineMode = datastreamPipelineMode; } + public void setHBaseEnhancementsAllowed(boolean isHBaseEnhancementsEnabled) { + this.hbaseEnhancementsAllowed = isHBaseEnhancementsEnabled; + } + + public boolean getHBaseEnhancementsAllowed() { + return this.hbaseEnhancementsAllowed; + } + public void setIncrementalChunkList(boolean enable) { this.incrementalChunkList = enable; } diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java index ca3e4e53743e..59795dd0f051 100644 --- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java +++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/storage/BlockOutputStream.java @@ -198,9 +198,7 @@ public BlockOutputStream( blkIDBuilder.build()).addMetadata(keyValue); this.pipeline = pipeline; // tell DataNode I will send incremental chunk list - // EC does not support incremental chunk list. - this.supportIncrementalChunkList = config.getIncrementalChunkList() && - this instanceof RatisBlockOutputStream && allDataNodesSupportPiggybacking(); + this.supportIncrementalChunkList = canEnableIncrementalChunkList(); LOG.debug("incrementalChunkList is {}", supportIncrementalChunkList); if (supportIncrementalChunkList) { this.containerBlockData.addMetadata(INCREMENTAL_CHUNK_LIST_KV); @@ -237,11 +235,51 @@ public BlockOutputStream( config.getBytesPerChecksum()); this.clientMetrics = clientMetrics; this.streamBufferArgs = streamBufferArgs; - this.allowPutBlockPiggybacking = config.getEnablePutblockPiggybacking() && - allDataNodesSupportPiggybacking(); + this.allowPutBlockPiggybacking = canEnablePutblockPiggybacking(); LOG.debug("PutBlock piggybacking is {}", allowPutBlockPiggybacking); } + /** + * Helper method to check if incremental chunk list can be enabled. + * Prints debug messages if it cannot be enabled. + */ + private boolean canEnableIncrementalChunkList() { + boolean confEnableIncrementalChunkList = config.getIncrementalChunkList(); + if (!confEnableIncrementalChunkList) { + return false; + } + + if (!(this instanceof RatisBlockOutputStream)) { + // Note: EC does not support incremental chunk list + LOG.debug("Unable to enable incrementalChunkList because BlockOutputStream is not a RatisBlockOutputStream"); + return false; + } + if (!allDataNodesSupportPiggybacking()) { + // Not all datanodes support piggybacking and incremental chunk list. + LOG.debug("Unable to enable incrementalChunkList because not all datanodes support piggybacking"); + return false; + } + return confEnableIncrementalChunkList; + } + + /** + * Helper method to check if PutBlock piggybacking can be enabled. + * Prints debug message if it cannot be enabled. + */ + private boolean canEnablePutblockPiggybacking() { + boolean confEnablePutblockPiggybacking = config.getEnablePutblockPiggybacking(); + if (!confEnablePutblockPiggybacking) { + return false; + } + + if (!allDataNodesSupportPiggybacking()) { + // Not all datanodes support piggybacking and incremental chunk list. + LOG.debug("Unable to enable PutBlock piggybacking because not all datanodes support piggybacking"); + return false; + } + return confEnablePutblockPiggybacking; + } + private boolean allDataNodesSupportPiggybacking() { // return true only if all DataNodes in the pipeline are on a version // that supports PutBlock piggybacking. diff --git a/hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/TestOzoneClientConfig.java b/hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/TestOzoneClientConfig.java index 0dd29cb50a45..920d1e19e1bd 100644 --- a/hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/TestOzoneClientConfig.java +++ b/hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/TestOzoneClientConfig.java @@ -22,6 +22,8 @@ import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_CLIENT_BYTES_PER_CHECKSUM_MIN_SIZE; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; class TestOzoneClientConfig { @@ -36,4 +38,42 @@ void missingSizeSuffix() { assertEquals(OZONE_CLIENT_BYTES_PER_CHECKSUM_MIN_SIZE, subject.getBytesPerChecksum()); } + + @Test + void testClientHBaseEnhancementsAllowedTrue() { + // When ozone.client.hbase.enhancements.allowed = true, + // related client configs should be effective as-is. + OzoneConfiguration conf = new OzoneConfiguration(); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); + + // Note: ozone.fs.hsync.enabled is checked by OzoneFSUtils.canEnableHsync(), thus not checked here + conf.setBoolean("ozone.client.incremental.chunk.list", true); + conf.setBoolean("ozone.client.stream.putblock.piggybacking", true); + conf.setInt("ozone.client.key.write.concurrency", -1); + + OzoneClientConfig subject = conf.getObject(OzoneClientConfig.class); + + assertTrue(subject.getIncrementalChunkList()); + assertTrue(subject.getEnablePutblockPiggybacking()); + assertEquals(-1, subject.getMaxConcurrentWritePerKey()); + } + + @Test + void testClientHBaseEnhancementsAllowedFalse() { + // When ozone.client.hbase.enhancements.allowed = false, + // related client configs should be reverted back to default. + OzoneConfiguration conf = new OzoneConfiguration(); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", false); + + // Note: ozone.fs.hsync.enabled is checked by OzoneFSUtils.canEnableHsync(), thus not checked here + conf.setBoolean("ozone.client.incremental.chunk.list", true); + conf.setBoolean("ozone.client.stream.putblock.piggybacking", true); + conf.setInt("ozone.client.key.write.concurrency", -1); + + OzoneClientConfig subject = conf.getObject(OzoneClientConfig.class); + + assertFalse(subject.getIncrementalChunkList()); + assertFalse(subject.getEnablePutblockPiggybacking()); + assertEquals(1, subject.getMaxConcurrentWritePerKey()); + } } diff --git a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java index c2cdb4d0d847..df0fdc59a4ae 100644 --- a/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java +++ b/hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/OzoneConfigKeys.java @@ -120,6 +120,14 @@ public final class OzoneConfigKeys { public static final String OZONE_FS_DATASTREAM_AUTO_THRESHOLD_DEFAULT = "4MB"; + /** + * Flag to allow server-side HBase-related features and enhancements to be enabled. + */ + public static final String OZONE_HBASE_ENHANCEMENTS_ALLOWED + = "ozone.hbase.enhancements.allowed"; + public static final boolean OZONE_HBASE_ENHANCEMENTS_ALLOWED_DEFAULT + = false; + /** * Flag to enable hsync/hflush. */ diff --git a/hadoop-hdds/common/src/main/resources/ozone-default.xml b/hadoop-hdds/common/src/main/resources/ozone-default.xml index e72b718e9f5e..3b845bfe9202 100644 --- a/hadoop-hdds/common/src/main/resources/ozone-default.xml +++ b/hadoop-hdds/common/src/main/resources/ozone-default.xml @@ -4216,12 +4216,27 @@ + + ozone.hbase.enhancements.allowed + false + OZONE, OM + + When set to false, server-side HBase enhancement-related Ozone (experimental) features + are disabled (not allowed to be enabled) regardless of whether those configs are set. + + Here is the list of configs and values overridden when this config is set to false: + 1. ozone.fs.hsync.enabled = false + + A warning message will be printed if any of the above configs are overridden by this. + + ozone.fs.hsync.enabled false - OZONE, CLIENT + OZONE, CLIENT, OM - Enable hsync/hflush. By default they are disabled. + Enable hsync/hflush on the Ozone Manager and/or client side. Disabled by default. + Can be enabled only when ozone.hbase.enhancements.allowed = true diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStreamSemaphore.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStreamSemaphore.java index 36031a9cf4df..dc85fffe1ca4 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStreamSemaphore.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/KeyOutputStreamSemaphore.java @@ -32,7 +32,7 @@ public class KeyOutputStreamSemaphore { private final Semaphore requestSemaphore; KeyOutputStreamSemaphore(int maxConcurrentWritePerKey) { - LOG.info("Initializing semaphore with maxConcurrentWritePerKey = {}", maxConcurrentWritePerKey); + LOG.debug("Initializing semaphore with maxConcurrentWritePerKey = {}", maxConcurrentWritePerKey); if (maxConcurrentWritePerKey > 0) { requestSemaphore = new Semaphore(maxConcurrentWritePerKey); } else if (maxConcurrentWritePerKey == 0) { diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java index 35db51b3e4de..15babfde69db 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java @@ -34,6 +34,7 @@ import org.apache.hadoop.crypto.key.KeyProvider; import org.apache.hadoop.fs.FileEncryptionInfo; import org.apache.hadoop.fs.Syncable; +import org.apache.hadoop.ozone.om.helpers.OzoneFSUtils; import org.apache.hadoop.util.Time; import org.apache.hadoop.hdds.client.DefaultReplicationConfig; import org.apache.hadoop.hdds.client.ECReplicationConfig; @@ -2489,9 +2490,7 @@ private OzoneOutputStream createOutputStream(OpenKeySession openKey) private OzoneOutputStream createOutputStream(OpenKeySession openKey, KeyOutputStream keyOutputStream) throws IOException { - boolean enableHsync = conf.getBoolean( - OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, - OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED_DEFAULT); + boolean enableHsync = OzoneFSUtils.canEnableHsync(conf, true); keyOutputStream .addPreallocateBlocks(openKey.getKeyInfo().getLatestVersionLocations(), openKey.getOpenVersion()); @@ -2503,9 +2502,7 @@ private OzoneOutputStream createOutputStream(OpenKeySession openKey, private OzoneOutputStream createSecureOutputStream(OpenKeySession openKey, OutputStream keyOutputStream, Syncable syncable) throws IOException { - boolean enableHsync = conf.getBoolean( - OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, - OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED_DEFAULT); + boolean enableHsync = OzoneFSUtils.canEnableHsync(conf, true); final FileEncryptionInfo feInfo = openKey.getKeyInfo().getFileEncryptionInfo(); if (feInfo != null) { diff --git a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestBlockOutputStreamIncrementalPutBlock.java b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestBlockOutputStreamIncrementalPutBlock.java index 5f2b80bdef6c..361dcb1fd0a2 100644 --- a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestBlockOutputStreamIncrementalPutBlock.java +++ b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestBlockOutputStreamIncrementalPutBlock.java @@ -71,6 +71,8 @@ private void init(boolean incrementalChunkList) throws IOException { ((InMemoryConfiguration)config).setFromObject(clientConfig); + ((InMemoryConfiguration) config).setBoolean( + OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); ((InMemoryConfiguration) config).setBoolean( OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFSUtils.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFSUtils.java index 74effbd80a38..aa7d06e2a9f2 100644 --- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFSUtils.java +++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneFSUtils.java @@ -18,10 +18,15 @@ package org.apache.hadoop.ozone.om.helpers; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hdds.conf.ConfigurationSource; +import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.util.Time; import jakarta.annotation.Nonnull; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.nio.file.Paths; import java.util.UUID; @@ -32,6 +37,7 @@ * Utility class for OzoneFileSystem. */ public final class OzoneFSUtils { + static final Logger LOG = LoggerFactory.getLogger(OzoneFSUtils.class); private OzoneFSUtils() { } @@ -292,4 +298,29 @@ public static Path trimPathToDepth(Path path, int maxDepth) { } return res; } + + /** + * Helper method to return whether Hsync can be enabled. + * And print warning when the config is ignored. + */ + public static boolean canEnableHsync(ConfigurationSource conf, boolean isClient) { + final String confKey = isClient ? + "ozone.client.hbase.enhancements.allowed" : + OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED; + + boolean confHBaseEnhancementsAllowed = conf.getBoolean( + confKey, OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED_DEFAULT); + + boolean confHsyncEnabled = conf.getBoolean( + OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED_DEFAULT); + + if (confHBaseEnhancementsAllowed) { + return confHsyncEnabled; + } else { + LOG.warn("Ignoring {} = {} because HBase enhancements are disallowed. To enable it, set {} = true as well.", + OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, confHsyncEnabled, + confKey); + return false; + } + } } diff --git a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestOzoneFsUtils.java b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestOzoneFsUtils.java index 84ad208cf93a..f8363af37511 100644 --- a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestOzoneFsUtils.java +++ b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/helpers/TestOzoneFsUtils.java @@ -18,8 +18,13 @@ package org.apache.hadoop.ozone.om.helpers; +import org.apache.hadoop.hdds.conf.OzoneConfiguration; +import org.apache.hadoop.ozone.OzoneConfigKeys; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertFalse; @@ -38,4 +43,29 @@ public void testPaths() { assertFalse(OzoneFSUtils.isValidName("/a:/b")); assertFalse(OzoneFSUtils.isValidName("/a//b")); } + + /** + * In these scenarios below, OzoneFSUtils.canEnableHsync() should return false: + * 1. ozone.hbase.enhancements.allowed = false, ozone.fs.hsync.enabled = false + * 2. ozone.hbase.enhancements.allowed = false, ozone.fs.hsync.enabled = true + * 3. ozone.hbase.enhancements.allowed = true, ozone.fs.hsync.enabled = false + *

+ * The only case where OzoneFSUtils.canEnableHsync() would return true: + * 4. ozone.hbase.enhancements.allowed = true, ozone.fs.hsync.enabled = true + */ + @ParameterizedTest + @CsvSource({"false,false,false,false", "false,false,true,false", "false,true,false,false", "true,true,true,false", + "false,false,false,true", "false,false,true,true", "false,true,false,true", "true,true,true,true"}) + void testCanEnableHsync(boolean canEnableHsync, + boolean hbaseEnhancementsEnabled, boolean fsHsyncEnabled, + boolean isClient) { + OzoneConfiguration conf = new OzoneConfiguration(); + final String confKey = isClient ? + "ozone.client.hbase.enhancements.allowed" : + OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED; + conf.setBoolean(confKey, hbaseEnhancementsEnabled); + conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, fsHsyncEnabled); + + assertEquals(canEnableHsync, OzoneFSUtils.canEnableHsync(conf, isClient)); + } } diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java index 78b67f99f1e9..69242d2b1f0e 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java @@ -187,6 +187,8 @@ void init() throws Exception { conf.setBoolean(OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY, omRatisEnabled); conf.setBoolean(OZONE_ACL_ENABLED, true); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); conf.set(OzoneConfigKeys.OZONE_OM_LEASE_SOFT_LIMIT, "0s"); if (!bucketLayout.equals(FILE_SYSTEM_OPTIMIZED)) { diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractRootedOzoneFileSystemTest.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractRootedOzoneFileSystemTest.java index 32a785a95a91..cfc9029019a9 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractRootedOzoneFileSystemTest.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractRootedOzoneFileSystemTest.java @@ -237,6 +237,8 @@ void initClusterAndEnv() throws IOException, InterruptedException, TimeoutExcept conf.setFloat(FS_TRASH_INTERVAL_KEY, TRASH_INTERVAL); conf.setFloat(FS_TRASH_CHECKPOINT_INTERVAL_KEY, TRASH_INTERVAL / 2); conf.setBoolean(OMConfigKeys.OZONE_OM_RATIS_ENABLE_KEY, omRatisEnabled); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); conf.set(OzoneConfigKeys.OZONE_OM_LEASE_SOFT_LIMIT, "0s"); if (bucketLayout == BucketLayout.FILE_SYSTEM_OPTIMIZED) { diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java index 49b515d53c57..58977cb02c6e 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSync.java @@ -177,6 +177,8 @@ public static void init() throws Exception { CONF.setBoolean(OZONE_OM_RATIS_ENABLE_KEY, false); CONF.set(OZONE_DEFAULT_BUCKET_LAYOUT, layout.name()); + CONF.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + CONF.setBoolean("ozone.client.hbase.enhancements.allowed", true); CONF.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); CONF.setInt(OZONE_SCM_RATIS_PIPELINE_LIMIT, 10); // Reduce KeyDeletingService interval diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSyncUpgrade.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSyncUpgrade.java index 917ce57fe7d8..624b5e02c146 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSyncUpgrade.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestHSyncUpgrade.java @@ -107,6 +107,8 @@ public void init() throws Exception { conf.setBoolean(OZONE_OM_RATIS_ENABLE_KEY, false); conf.set(OZONE_DEFAULT_BUCKET_LAYOUT, layout.name()); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); conf.setInt(OZONE_SCM_RATIS_PIPELINE_LIMIT, 10); // Reduce KeyDeletingService interval diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestLeaseRecovery.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestLeaseRecovery.java index a4a9bcff4704..6a3a0eb5b672 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestLeaseRecovery.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/TestLeaseRecovery.java @@ -120,6 +120,8 @@ public void init() throws IOException, InterruptedException, final BucketLayout layout = BucketLayout.FILE_SYSTEM_OPTIMIZED; conf.setBoolean(OZONE_OM_RATIS_ENABLE_KEY, false); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); conf.set(OZONE_DEFAULT_BUCKET_LAYOUT, layout.name()); conf.setInt(OZONE_SCM_RATIS_PIPELINE_LIMIT, 10); diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContractTest.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContractTest.java index b79c9a870e4e..bce962518735 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContractTest.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/contract/AbstractOzoneContractTest.java @@ -47,6 +47,7 @@ import static org.apache.hadoop.fs.contract.ContractTestUtils.cleanup; import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED; +import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED; import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OFS_URI_SCHEME; import static org.apache.hadoop.ozone.om.OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT; import static org.assertj.core.api.Assumptions.assumeThat; @@ -93,6 +94,8 @@ protected static OzoneConfiguration createBaseConfiguration() { conf.addResource(CONTRACT_XML); + conf.setBoolean(OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OZONE_FS_HSYNC_ENABLED, true); return conf; diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/AbstractTestECKeyOutputStream.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/AbstractTestECKeyOutputStream.java index 766ed09bccd5..3063e2587e48 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/AbstractTestECKeyOutputStream.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/AbstractTestECKeyOutputStream.java @@ -126,6 +126,8 @@ protected static void init(boolean zeroCopyEnabled) throws Exception { zeroCopyEnabled); conf.setInt(ScmConfigKeys.OZONE_SCM_RATIS_PIPELINE_LIMIT, 10); // "Enable" hsync to verify that hsync would be blocked by ECKeyOutputStream + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); ClientConfigForTesting.newBuilder(StorageUnit.BYTES) diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestBlockOutputStream.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestBlockOutputStream.java index 4c978683de1e..eb3709c9a85f 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestBlockOutputStream.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestBlockOutputStream.java @@ -41,6 +41,7 @@ import org.apache.hadoop.hdds.scm.storage.RatisBlockOutputStream; import org.apache.hadoop.ozone.ClientConfigForTesting; import org.apache.hadoop.ozone.MiniOzoneCluster; +import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.client.ObjectStore; import org.apache.hadoop.ozone.client.OzoneClient; import org.apache.hadoop.ozone.client.OzoneClientFactory; @@ -95,6 +96,9 @@ static MiniOzoneCluster createCluster() throws IOException, conf.setStorageSize(OZONE_SCM_BLOCK_SIZE, 4, StorageUnit.MB); conf.setInt(OZONE_DATANODE_PIPELINE_LIMIT, 3); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); + DatanodeRatisServerConfig ratisServerConfig = conf.getObject(DatanodeRatisServerConfig.class); ratisServerConfig.setRequestTimeOut(Duration.ofSeconds(3)); diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java index 958a37380cff..b2766599ae44 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestSecureOzoneRpcClient.java @@ -121,6 +121,8 @@ public static void init() throws Exception { // constructed. conf.set(OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT, OMConfigKeys.OZONE_BUCKET_LAYOUT_OBJECT_STORE); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_PROVIDER_PATH, keyProviderUri); diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/debug/TestLeaseRecoverer.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/debug/TestLeaseRecoverer.java index c24cf748ddb1..29f91821ebd8 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/debug/TestLeaseRecoverer.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/debug/TestLeaseRecoverer.java @@ -70,6 +70,8 @@ public class TestLeaseRecoverer { @BeforeAll public static void init() throws Exception { conf = new OzoneConfiguration(); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); conf.set(OzoneConfigKeys.OZONE_OM_LEASE_SOFT_LIMIT, "0s"); OzoneClientConfig clientConfig = conf.getObject(OzoneClientConfig.class); 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 89f068cdedfa..4c5325edab10 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 @@ -82,6 +82,7 @@ import static org.apache.hadoop.fs.FileSystem.TRASH_PREFIX; import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED; import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_FS_LISTING_PAGE_SIZE; +import static org.apache.hadoop.ozone.OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED; import static org.apache.hadoop.ozone.OzoneConsts.OM_KEY_PREFIX; import static org.apache.hadoop.ozone.OzoneConsts.OZONE_OFS_URI_SCHEME; import static org.apache.hadoop.ozone.OzoneConsts.OZONE_URI_DELIMITER; @@ -163,6 +164,7 @@ public class TestOzoneShellHA { @BeforeAll public static void init() throws Exception { OzoneConfiguration conf = new OzoneConfiguration(); + conf.setBoolean(OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); conf.setBoolean(OZONE_FS_HSYNC_ENABLED, true); startKMS(); startCluster(conf); @@ -590,6 +592,7 @@ public void testAdminCmdListOpenFiles() final String hostPrefix = OZONE_OFS_URI_SCHEME + "://" + omServiceId; OzoneConfiguration clientConf = getClientConfForOFS(hostPrefix, conf); + clientConf.setBoolean("ozone.client.hbase.enhancements.allowed", true); clientConf.setBoolean(OZONE_FS_HSYNC_ENABLED, true); FileSystem fs = FileSystem.get(clientConf); @@ -709,6 +712,7 @@ public void testAdminCmdListOpenFilesWithDeletedKeys() final String hostPrefix = OZONE_OFS_URI_SCHEME + "://" + omServiceId; OzoneConfiguration clientConf = getClientConfForOFS(hostPrefix, conf); + clientConf.setBoolean("ozone.client.hbase.enhancements.allowed", true); clientConf.setBoolean(OZONE_FS_HSYNC_ENABLED, true); FileSystem fs = FileSystem.get(clientConf); @@ -825,6 +829,7 @@ public void testAdminCmdListOpenFilesWithOverwrittenKeys() final String hostPrefix = OZONE_OFS_URI_SCHEME + "://" + omServiceId; OzoneConfiguration clientConf = getClientConfForOFS(hostPrefix, conf); + clientConf.setBoolean("ozone.client.hbase.enhancements.allowed", true); clientConf.setBoolean(OZONE_FS_HSYNC_ENABLED, true); FileSystem fs = FileSystem.get(clientConf); diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHAWithFSO.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHAWithFSO.java index a0ad35500caf..b1dcbc0576ea 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHAWithFSO.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHAWithFSO.java @@ -38,6 +38,8 @@ public static void init() throws Exception { OzoneConfiguration conf = new OzoneConfiguration(); conf.set(OMConfigKeys.OZONE_DEFAULT_BUCKET_LAYOUT, OMConfigKeys.OZONE_BUCKET_LAYOUT_FILE_SYSTEM_OPTIMIZED); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); startKMS(); startCluster(conf); diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java index 8a21fdfa3773..963e58ada0fa 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyCommitRequest.java @@ -31,7 +31,6 @@ import org.apache.hadoop.ozone.OzoneManagerVersion; import org.apache.ratis.server.protocol.TermIndex; import org.apache.hadoop.ozone.OmUtils; -import org.apache.hadoop.ozone.OzoneConfigKeys; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.om.OMConfigKeys; import org.apache.hadoop.ozone.om.helpers.KeyValueUtil; @@ -111,9 +110,7 @@ public OMRequest preExecute(OzoneManager ozoneManager) throws IOException { } boolean isHsync = commitKeyRequest.hasHsync() && commitKeyRequest.getHsync(); boolean isRecovery = commitKeyRequest.hasRecovery() && commitKeyRequest.getRecovery(); - boolean enableHsync = ozoneManager.getConfiguration().getBoolean( - OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, - OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED_DEFAULT); + boolean enableHsync = OzoneFSUtils.canEnableHsync(ozoneManager.getConfiguration(), false); // If hsynced is called for a file, then this file is hsynced, otherwise it's not hsynced. // Currently, file lease recovery by design only supports recover hsynced file diff --git a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyCommitRequest.java b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyCommitRequest.java index 13f0191b29a8..1fc0cb6ebad4 100644 --- a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyCommitRequest.java +++ b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyCommitRequest.java @@ -56,6 +56,8 @@ import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyArgs; import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.KeyLocation; import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.KEY_NOT_FOUND; import static org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status.OK; @@ -375,10 +377,19 @@ public void testValidateAndUpdateCacheWithUncommittedBlocks() } - @Test - public void testRejectHsyncIfNotEnabled() throws Exception { + /** + * In these scenarios below, OM should reject key commit with HSync requested from a client: + * 1. ozone.hbase.enhancements.allowed = false, ozone.fs.hsync.enabled = false + * 2. ozone.hbase.enhancements.allowed = false, ozone.fs.hsync.enabled = true + * 3. ozone.hbase.enhancements.allowed = true, ozone.fs.hsync.enabled = false + */ + @ParameterizedTest + @CsvSource({"false,false", "false,true", "true,false"}) + public void testRejectHsyncIfNotEnabled(boolean hbaseEnhancementsEnabled, boolean fsHsyncEnabled) throws Exception { OzoneConfiguration conf = ozoneManager.getConfiguration(); - conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, false); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, hbaseEnhancementsEnabled); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); + conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, fsHsyncEnabled); BucketLayout bucketLayout = getBucketLayout(); OMRequestTestUtils.addVolumeAndBucketToDB(volumeName, bucketName, @@ -392,6 +403,9 @@ public void testRejectHsyncIfNotEnabled() throws Exception { // Regular key commit should still work doKeyCommit(false, allocatedKeyLocationList.subList(0, 5)); + // Restore config after this test run + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); } diff --git a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyRequest.java b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyRequest.java index c1b0e45e6d60..f636152c35c6 100644 --- a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyRequest.java +++ b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/request/key/TestOMKeyRequest.java @@ -132,6 +132,7 @@ public void setup() throws Exception { folder.toAbsolutePath().toString()); ozoneConfiguration.set(OzoneConfigKeys.OZONE_METADATA_DIRS, folder.toAbsolutePath().toString()); + ozoneConfiguration.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); ozoneConfiguration.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); omMetadataManager = new OmMetadataManagerImpl(ozoneConfiguration, ozoneManager); diff --git a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestOpenKeyCleanupService.java b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestOpenKeyCleanupService.java index eeb6f2c71ead..014865f919fe 100644 --- a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestOpenKeyCleanupService.java +++ b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/service/TestOpenKeyCleanupService.java @@ -118,6 +118,8 @@ void setup(@TempDir Path tempDir) throws Exception { conf.setTimeDuration(OZONE_OM_LEASE_HARD_LIMIT, EXPIRE_THRESHOLD_MS, TimeUnit.MILLISECONDS); conf.set(OzoneConfigKeys.OZONE_OM_LEASE_SOFT_LIMIT, "0s"); + conf.setBoolean(OzoneConfigKeys.OZONE_HBASE_ENHANCEMENTS_ALLOWED, true); + conf.setBoolean("ozone.client.hbase.enhancements.allowed", true); conf.setBoolean(OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, true); conf.setQuietMode(false); OmTestManagers omTestManagers = new OmTestManagers(conf); diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java index f25d9011475a..ed5574af32b2 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneFileSystem.java @@ -147,9 +147,6 @@ public void initialize(URI name, Configuration conf) throws IOException { OzoneConfigKeys.OZONE_FS_DATASTREAM_AUTO_THRESHOLD, OzoneConfigKeys.OZONE_FS_DATASTREAM_AUTO_THRESHOLD_DEFAULT, StorageUnit.BYTES); - hsyncEnabled = conf.getBoolean( - OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, - OZONE_FS_HSYNC_ENABLED_DEFAULT); setConf(conf); Preconditions.checkNotNull(name.getScheme(), "No scheme provided in %s", name); @@ -197,6 +194,8 @@ public void initialize(URI name, Configuration conf) throws IOException { LOG.trace("Ozone URI for ozfs initialization is {}", uri); ConfigurationSource source = getConfSource(); + this.hsyncEnabled = OzoneFSUtils.canEnableHsync(source, true); + LOG.debug("hsyncEnabled = {}", hsyncEnabled); this.adapter = createAdapter(source, bucketStr, volumeStr, omHost, omPort); diff --git a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java index eb346b5edc59..3e0a37306278 100644 --- a/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java +++ b/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneFileSystem.java @@ -153,9 +153,6 @@ public void initialize(URI name, Configuration conf) throws IOException { OzoneConfigKeys.OZONE_FS_DATASTREAM_AUTO_THRESHOLD, OzoneConfigKeys.OZONE_FS_DATASTREAM_AUTO_THRESHOLD_DEFAULT, StorageUnit.BYTES); - hsyncEnabled = conf.getBoolean( - OzoneConfigKeys.OZONE_FS_HSYNC_ENABLED, - OZONE_FS_HSYNC_ENABLED_DEFAULT); setConf(conf); Preconditions.checkNotNull(name.getScheme(), "No scheme provided in %s", name); @@ -192,6 +189,8 @@ public void initialize(URI name, Configuration conf) throws IOException { LOG.trace("Ozone URI for OFS initialization is " + uri); ConfigurationSource source = getConfSource(); + this.hsyncEnabled = OzoneFSUtils.canEnableHsync(source, true); + LOG.debug("hsyncEnabled = {}", hsyncEnabled); this.adapter = createAdapter(source, omHostOrServiceId, omPort); this.adapterImpl = (BasicRootedOzoneClientAdapterImpl) this.adapter;