hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hadoop] snvijaya commented on a change in pull request #2344: HADOOP-17265. ABFS: Support for Client Correlation ID
Date Thu, 01 Oct 2020 14:08:27 GMT

snvijaya commented on a change in pull request #2344:
URL: https://github.com/apache/hadoop/pull/2344#discussion_r498266654



##########
File path: hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/utils/TrackingContext.java
##########
@@ -0,0 +1,61 @@
+/**
+ * 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.fs.azurebfs.utils;
+
+import java.util.UUID;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.CLIENT_CORRELATION_ID_PATTERN;
+import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.DEFAULT_FS_AZURE_CLIENT_CORRELATION_ID;
+import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.MAX_CLIENT_CORRELATION_ID_LENGTH;
+
+public class TrackingContext {
+  private String clientCorrelationID;
+  private String clientRequestID;
+  private static final Logger LOG = LoggerFactory.getLogger(
+      org.apache.hadoop.fs.azurebfs.services.AbfsClient.class);
+
+  public TrackingContext(String clientCorrelationID) {
+    //validation
+    if ((clientCorrelationID.length() > MAX_CLIENT_CORRELATION_ID_LENGTH) ||
+        (!clientCorrelationID.matches(CLIENT_CORRELATION_ID_PATTERN))) {
+      this.clientCorrelationID = DEFAULT_FS_AZURE_CLIENT_CORRELATION_ID;
+      LOG.debug("Invalid config provided; correlation id not included in header.");
+    }
+    else if (clientCorrelationID.length() > 0) {
+      this.clientCorrelationID = clientCorrelationID + ":";
+      LOG.debug("Client correlation id has been validated and set successfully.");

Review comment:
       Log usually incur a perf cost so log for failure cases. Success case log can be omitted.


##########
File path: hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/utils/TrackingContext.java
##########
@@ -0,0 +1,61 @@
+/**
+ * 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.fs.azurebfs.utils;
+
+import java.util.UUID;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.CLIENT_CORRELATION_ID_PATTERN;
+import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.DEFAULT_FS_AZURE_CLIENT_CORRELATION_ID;
+import static org.apache.hadoop.fs.azurebfs.constants.FileSystemConfigurations.MAX_CLIENT_CORRELATION_ID_LENGTH;
+
+public class TrackingContext {
+  private String clientCorrelationID;
+  private String clientRequestID;
+  private static final Logger LOG = LoggerFactory.getLogger(
+      org.apache.hadoop.fs.azurebfs.services.AbfsClient.class);
+
+  public TrackingContext(String clientCorrelationID) {
+    //validation
+    if ((clientCorrelationID.length() > MAX_CLIENT_CORRELATION_ID_LENGTH) ||
+        (!clientCorrelationID.matches(CLIENT_CORRELATION_ID_PATTERN))) {
+      this.clientCorrelationID = DEFAULT_FS_AZURE_CLIENT_CORRELATION_ID;
+      LOG.debug("Invalid config provided; correlation id not included in header.");
+    }
+    else if (clientCorrelationID.length() > 0) {
+      this.clientCorrelationID = clientCorrelationID + ":";
+      LOG.debug("Client correlation id has been validated and set successfully.");
+    }
+    else {
+      this.clientCorrelationID = DEFAULT_FS_AZURE_CLIENT_CORRELATION_ID;
+      LOG.debug(

Review comment:
       This config will be not set for most cases. For empty, its ok to avoid the log.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message