[GitHub] [hadoop] mehakmeet commented on a change in pull request #1991: HADOOP-17016. Adding Common Counters in ABFS

2020-06-02 Thread GitBox


mehakmeet commented on a change in pull request #1991:
URL: https://github.com/apache/hadoop/pull/1991#discussion_r434262848



##
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStatistics.java
##
@@ -202,16 +182,13 @@ public void testOpenAppendRenameExists() throws 
IOException {
 fs.create(createFilePath);
 fs.open(createFilePath);
 fs.append(createFilePath);
-fs.rename(createFilePath, destCreateFilePath);
+assertTrue(fs.rename(createFilePath, destCreateFilePath));

Review comment:
   I'll make sure to use that going forward.





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: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] mehakmeet commented on a change in pull request #1991: HADOOP-17016. Adding Common Counters in ABFS

2020-05-19 Thread GitBox


mehakmeet commented on a change in pull request #1991:
URL: https://github.com/apache/hadoop/pull/1991#discussion_r427058316



##
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/TestAbfsStatistics.java
##
@@ -34,33 +41,24 @@ public TestAbfsStatistics() throws Exception {
* Tests for op_get_delegation_token and error_ignore counter values.
*/
   @Test
-  public void testInitialiseStats() throws IOException {
+  public void testInitializeStats() throws IOException {
 describe("Testing the counter values after Abfs is initialised");
 
 AbfsInstrumentation instrumentation =
 new AbfsInstrumentation(getFileSystem().getUri());
-Map metricMap = instrumentation.toMap();
-
-System.out.println(metricMap);
-
-//Testing the statistics values at initial stage.
-assertEquals("Mismatch in op_get_delegation_token", 0,

Review comment:
   outdated code.





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: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] mehakmeet commented on a change in pull request #1991: HADOOP-17016. Adding Common Counters in ABFS

2020-05-19 Thread GitBox


mehakmeet commented on a change in pull request #1991:
URL: https://github.com/apache/hadoop/pull/1991#discussion_r427058232



##
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStatistics.java
##
@@ -133,59 +159,48 @@ public void testDeleteStatistics() throws IOException {
 + "in Abfs");
 AzureBlobFileSystem fs = getFileSystem();
 /*
- This directory path needs to be root for triggering the
- directories_deleted counter.
+This directory path needs to be root for triggering the
+directories_deleted counter.
  */
 Path createDirectoryPath = path("/");
 Path createFilePath = path(getMethodName());
 
-Map metricMap = fs.getInstrumentation().toMap();
-//Test for initial statistic values before deleting any directory or files

Review comment:
   This is outdated code, I have moved all initial values into a single 
method.





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: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] mehakmeet commented on a change in pull request #1991: HADOOP-17016. Adding Common Counters in ABFS

2020-05-19 Thread GitBox


mehakmeet commented on a change in pull request #1991:
URL: https://github.com/apache/hadoop/pull/1991#discussion_r427058041



##
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStatistics.java
##
@@ -32,10 +32,54 @@
 public class ITestAbfsStatistics extends AbstractAbfsIntegrationTest {
 
   private static final int NUMBER_OF_OPS = 10;
+  private String createOp =

Review comment:
   Since I was using these values, again and again, I thought to localize 
them and also increase the readability of the code. This is was just simply for 
better readability and have fewer lines of code.





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: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] mehakmeet commented on a change in pull request #1991: HADOOP-17016. Adding Common Counters in ABFS

2020-04-30 Thread GitBox


mehakmeet commented on a change in pull request #1991:
URL: https://github.com/apache/hadoop/pull/1991#discussion_r418149950



##
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStatistics.java
##
@@ -0,0 +1,309 @@
+/**
+ * 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;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.junit.Test;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
+
+/**
+ * Tests AzureBlobFileSystem Statistics.
+ */
+public class ITestAbfsStatistics extends AbstractAbfsIntegrationTest {
+
+  private static final int NUMBER_OF_OPS = 10;
+
+  public ITestAbfsStatistics() throws Exception {
+  }
+
+  /**
+   * Testing statistics by creating files and directories.
+   */
+  @Test
+  public void testCreateStatistics() throws IOException {
+describe("Testing counter values got by creating directories and files in"
++ " Abfs");
+
+AzureBlobFileSystem fs = getFileSystem();
+Path createFilePath = path(getMethodName());
+Path createDirectoryPath = path(getMethodName() + "Dir");
+
+Map metricMap = fs.getInstrumentation().toMap();
+
+/*
+ Test for initial values of create statistics ; getFileStatus is called
+ 1 time after Abfs initialisation.
+ */
+assertEquals("Mismatch in op_create", 0,
+(long) metricMap.get("op_create"));
+assertEquals("Mismatch in op_create_non_recursive", 0,
+(long) metricMap.get("op_create_non_recursive"));
+assertEquals("Mismatch in files_created", 0,
+(long) metricMap.get("files_created"));
+assertEquals("Mismatch in directories_created", 0,
+(long) metricMap.get("directories_created"));
+assertEquals("Mismatch in op_mkdirs", 0,
+(long) metricMap.get("op_mkdirs"));
+assertEquals("Mismatch in op_get_file_status", 1,
+(long) metricMap.get("op_get_file_status"));
+
+try {
+
+  fs.mkdirs(createDirectoryPath);
+  fs.createNonRecursive(createFilePath, FsPermission
+  .getDefault(), false, 1024, (short) 1, 1024, null);
+
+  metricMap = fs.getInstrumentation().toMap();
+  /*
+   Test of statistic values after creating a directory and a file ;
+   getFileStatus is called 1 time after creating file and 1 time at
+   time of initialising.
+   */
+  assertEquals("Mismatch in op_create", 1,
+  (long) metricMap.get("op_create"));
+  assertEquals("Mismatch in op_create_non_recursive", 1,
+  (long) metricMap.get("op_create_non_recursive"));
+  assertEquals("Mismatch in files_created", 1,
+  (long) metricMap.get("files_created"));
+  assertEquals("Mismatch in directories_created", 1,
+  (long) metricMap.get("directories_created"));
+  assertEquals("Mismatch in op_mkdirs", 1,
+  (long) metricMap.get("op_mkdirs"));
+  assertEquals("Mismatch in op_get_file_status", 2,
+  (long) metricMap.get("op_get_file_status"));
+
+} finally {
+  fs.close();

Review comment:
   Realized after committing that teardown is already doing this.





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: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] mehakmeet commented on a change in pull request #1991: HADOOP-17016. Adding Common Counters in ABFS

2020-04-30 Thread GitBox


mehakmeet commented on a change in pull request #1991:
URL: https://github.com/apache/hadoop/pull/1991#discussion_r418142478



##
File path: 
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystem.java
##
@@ -926,11 +962,23 @@ public void access(final Path path, final FsAction mode) 
throws IOException {
 }
   }
 
+  /**
+   * Incrementing exists() calls from superclass for Statistic collection.
+   * @param f source path
+   * @return true if the path exists

Review comment:
   '.' in the end.





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: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org



[GitHub] [hadoop] mehakmeet commented on a change in pull request #1991: HADOOP-17016. Adding Common Counters in ABFS

2020-04-30 Thread GitBox


mehakmeet commented on a change in pull request #1991:
URL: https://github.com/apache/hadoop/pull/1991#discussion_r418142248



##
File path: 
hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsStatistics.java
##
@@ -0,0 +1,309 @@
+/**
+ * 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;
+
+import java.io.IOException;
+import java.util.Map;
+
+import org.junit.Test;
+
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.permission.FsPermission;
+
+/**
+ * Tests AzureBlobFileSystem Statistics.
+ */
+public class ITestAbfsStatistics extends AbstractAbfsIntegrationTest {
+
+  private static final int NUMBER_OF_OPS = 10;
+
+  public ITestAbfsStatistics() throws Exception {
+  }
+
+  /**
+   * Testing statistics by creating files and directories.
+   */
+  @Test
+  public void testCreateStatistics() throws IOException {
+describe("Testing counter values got by creating directories and files in"
++ " Abfs");
+
+AzureBlobFileSystem fs = getFileSystem();
+Path createFilePath = path(getMethodName());
+Path createDirectoryPath = path(getMethodName() + "Dir");
+
+Map metricMap = fs.getInstrumentation().toMap();
+
+/*
+ Test for initial values of create statistics ; getFileStatus is called
+ 1 time after Abfs initialisation.
+ */
+assertEquals("Mismatch in op_create", 0,
+(long) metricMap.get("op_create"));
+assertEquals("Mismatch in op_create_non_recursive", 0,
+(long) metricMap.get("op_create_non_recursive"));
+assertEquals("Mismatch in files_created", 0,
+(long) metricMap.get("files_created"));
+assertEquals("Mismatch in directories_created", 0,
+(long) metricMap.get("directories_created"));
+assertEquals("Mismatch in op_mkdirs", 0,
+(long) metricMap.get("op_mkdirs"));
+assertEquals("Mismatch in op_get_file_status", 1,
+(long) metricMap.get("op_get_file_status"));
+
+try {
+
+  fs.mkdirs(createDirectoryPath);
+  fs.createNonRecursive(createFilePath, FsPermission
+  .getDefault(), false, 1024, (short) 1, 1024, null);
+
+  metricMap = fs.getInstrumentation().toMap();
+  /*
+   Test of statistic values after creating a directory and a file ;
+   getFileStatus is called 1 time after creating file and 1 time at
+   time of initialising.
+   */
+  assertEquals("Mismatch in op_create", 1,
+  (long) metricMap.get("op_create"));
+  assertEquals("Mismatch in op_create_non_recursive", 1,
+  (long) metricMap.get("op_create_non_recursive"));
+  assertEquals("Mismatch in files_created", 1,
+  (long) metricMap.get("files_created"));
+  assertEquals("Mismatch in directories_created", 1,
+  (long) metricMap.get("directories_created"));
+  assertEquals("Mismatch in op_mkdirs", 1,
+  (long) metricMap.get("op_mkdirs"));
+  assertEquals("Mismatch in op_get_file_status", 2,
+  (long) metricMap.get("op_get_file_status"));
+
+} finally {
+  fs.close();
+}
+
+//re-initialising Abfs to reset statistic values.
+fs.initialize(fs.getUri(), fs.getConf());
+
+try {
+  /*Creating 10 directories and files; Directories and files can't
+   be created with same name, hence  + i to give unique names.
+   */
+  for (int i = 0; i < NUMBER_OF_OPS; i++) {
+fs.mkdirs(path(getMethodName() + "Dir" + i));
+fs.createNonRecursive(path(getMethodName() + i),
+FsPermission.getDefault(), false, 1024, (short) 1,
+1024, null);
+  }
+
+  metricMap = fs.getInstrumentation().toMap();
+  /*
+   Test of statistics values after creating 10 directories and files;
+   getFileStatus is called 1 time at initialise() plus number of
+   times file is created.
+   */
+  assertEquals("Mismatch in op_create", NUMBER_OF_OPS,
+  (long) metricMap.get("op_create"));
+  assertEquals("Mismatch in op_create_non_recursive", NUMBER_OF_OPS,
+  (long) metricMap.get("op_create_non_recursive"));
+  assertEquals("Mismatch in files_created", NUMBER_OF_OPS,
+  (long)