adoroszlai commented on a change in pull request #1542:
URL: https://github.com/apache/ozone/pull/1542#discussion_r521869987



##########
File path: 
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/OzoneClientConfig.java
##########
@@ -0,0 +1,213 @@
+/*
+ * 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.hdds.scm;
+
+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.protocol.datanode.proto.ContainerProtos.ChecksumType;
+import org.apache.hadoop.ozone.OzoneConfigKeys;
+
+import com.google.common.base.Preconditions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Configuration values for Ozone Client.
+ */
+@ConfigGroup(prefix = "ozone.client")
+public class OzoneClientConfig {
+
+  private static final Logger LOG =
+      LoggerFactory.getLogger(OzoneClientConfig.class);
+
+  @Config(key = "stream.buffer.flush.size",
+      defaultValue = "16MB",
+      type = ConfigType.SIZE,
+      description = "Size which determines at what buffer position a partial "
+          + "flush will be initiated during write. It should be a multiple of"
+          + " ozone.client.stream.buffer.size",
+      tags = ConfigTag.CLIENT)
+  private long streamBufferFlushSize = 16 * 1024 * 1024;
+
+  @Config(key = "stream.buffer.size",
+      defaultValue = "4MB",
+      type = ConfigType.SIZE,
+      description = "The size of chunks the client will send to the server",
+      tags = ConfigTag.CLIENT)
+  private int streamBufferSize = 4 * 1024 * 1024;
+
+  @Config(key = "stream.buffer.flush.delay",
+      defaultValue = "true",
+      description = "Default true, when call flush() and determine whether "
+          + "the data in the current buffer is greater than ozone.client"
+          + ".stream.buffer.size, if greater than then send buffer to the "
+          + "datanode. You can  turn this off by setting this configuration "
+          + "to false.", tags = ConfigTag.CLIENT)
+  private boolean streamBufferFlushDelay = true;
+
+  @Config(key = "stream.buffer.max.size",
+      defaultValue = "32MB",
+      type = ConfigType.SIZE,
+      description = "Size which determines at what buffer position write call"
+          + " be blocked till acknowledgement of the first partial flush "
+          + "happens by all servers.",
+      tags = ConfigTag.CLIENT)
+  private long streamBufferMaxSize = 32 * 1024 * 1024;
+
+  @Config(key = "max.retries",
+      defaultValue = "5",
+      description = "Maximum number of retries by Ozone Client on "
+          + "encountering exception while writing a key",
+      tags = ConfigTag.CLIENT)
+  private int maxRetryCount = 5;
+
+  @Config(key = "retry.interval",
+      defaultValue = "0",
+      description =
+          "Indicates the time duration a client will wait before retrying a "
+              + "write key request on encountering an exception. By default "
+              + "there is no wait",
+      tags = ConfigTag.CLIENT)
+  private int retryInterval = 0;
+
+  @Config(key = "checksum.type",
+      defaultValue = "CRC32",
+      description = "The checksum type [NONE/ CRC32/ CRC32C/ SHA256/ MD5] "
+          + "determines which algorithm would be used to compute checksum for "
+          + "chunk data. Default checksum type is CRC32.",
+      tags = ConfigTag.CLIENT)
+  private String checksumType = ChecksumType.CRC32.name();
+
+  @Config(key = "bytes.per.checksum",
+      defaultValue = "1MB",
+      type = ConfigType.SIZE,
+      description = "Checksum will be computed for every bytes per checksum "
+          + "number of bytes and stored sequentially. The minimum value for "
+          + "this config is 256KB.",
+      tags = ConfigTag.CLIENT)
+  private int bytesPerChecksum = 1024 * 1024;
+
+  @Config(key = "verify.checksum",
+      defaultValue = "true",
+      description = "Ozone client to verify checksum of the checksum "
+          + "blocksize data.",
+      tags = ConfigTag.CLIENT)
+  private boolean checksumVerify = true;
+
+  public OzoneClientConfig() {
+  }
+
+  private void validate() {

Review comment:
       Currently `validate()` is unused.  I think it should have 
`@PostConstruct` annotation.

##########
File path: 
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/io/BlockOutputStreamEntry.java
##########
@@ -108,11 +96,12 @@ long getRemaining() {
    */
   private void checkStream() throws IOException {
     if (this.outputStream == null) {
+      if (getToken() != null) {
+        UserGroupInformation.getCurrentUser().addToken(getToken());
+      }

Review comment:
       This was removed on `master` in HDDS-4285.  I don't think it should have 
been restored in the merge.

##########
File path: 
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClient.java
##########
@@ -49,6 +51,7 @@
   @BeforeClass
   public static void init() throws Exception {
     OzoneConfiguration conf = new OzoneConfiguration();
+    conf.setFromObject(new OzoneClientConfig());

Review comment:
       Nit: aren't defaults set automatically without this?

##########
File path: 
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java
##########
@@ -715,7 +666,7 @@ public OzoneOutputStream createKey(
       throws IOException {
     verifyVolumeName(volumeName);
     verifyBucketName(bucketName);
-    if(checkKeyNameEnabled) {
+    if (clientConfig.isStreamBufferFlushDelay()) {

Review comment:
       This condition is not the same as previously.

##########
File path: 
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestBlockOutputStream.java
##########
@@ -85,13 +86,20 @@ public static void init() throws Exception {
     flushSize = 2 * chunkSize;
     maxFlushSize = 2 * flushSize;
     blockSize = 2 * maxFlushSize;
+    OzoneClientConfig config = new OzoneClientConfig();
+    config.setChecksumType(ChecksumType.NONE);
+    conf.setFromObject(config);
+
     conf.setTimeDuration(HDDS_SCM_WATCHER_TIMEOUT, 1000, 
TimeUnit.MILLISECONDS);
     conf.setTimeDuration(OZONE_SCM_STALENODE_INTERVAL, 3, TimeUnit.SECONDS);
-    conf.set(OzoneConfigKeys.OZONE_CLIENT_CHECKSUM_TYPE, "NONE");
     conf.setQuietMode(false);
     conf.setStorageSize(OzoneConfigKeys.OZONE_SCM_BLOCK_SIZE, 4,
         StorageUnit.MB);
-    conf.setBoolean(OZONE_CLIENT_STREAM_BUFFER_FLUSH_DELAY, false);
+
+    OzoneClientConfig clientConfig = conf.getObject(OzoneClientConfig.class);
+    clientConfig.setStreamBufferFlushDelay(false);
+    conf.setFromObject(clientConfig);
+

Review comment:
       Nit: two blocks of `OzoneClientConfig` can be merged:
   
   ```
       OzoneClientConfig clientConfig = conf.getObject(OzoneClientConfig.class);
       clientConfig.setChecksumType(ChecksumType.NONE);
       clientConfig.setStreamBufferFlushDelay(false);
       conf.setFromObject(clientConfig);
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to