You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2021/08/26 11:18:16 UTC

[GitHub] [hadoop] steveloughran commented on a change in pull request #3331: HADOOP-17862. ABFS: Fix unchecked cast compiler warning for AbfsListStatusRemoteIterator

steveloughran commented on a change in pull request #3331:
URL: https://github.com/apache/hadoop/pull/3331#discussion_r696528779



##########
File path: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsListStatusRemoteIterator.java
##########
@@ -84,7 +90,7 @@ public void testAbfsIteratorWithHasNext() throws Exception {
         .isEqualTo(TEST_FILES_NUMBER);
     Assertions.assertThat(fileNames.size())

Review comment:
       1. factor out into a new method and use wherever the same test is made
   1. use assertThat(fileNames).hasSize(0) and assertJ will report the full fileNames contents

##########
File path: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsListStatusRemoteIterator.java
##########
@@ -75,7 +79,9 @@ public void testAbfsIteratorWithHasNext() throws Exception {
     while (fsItr.hasNext()) {
       FileStatus fileStatus = fsItr.next();
       String pathStr = fileStatus.getPath().toString();
-      fileNames.remove(pathStr);
+      if (!fileNames.remove(pathStr)) {

Review comment:
       should this be a failure?
   
   And it's also replicated in a lot of places. Can you pull it into its own method

##########
File path: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsListStatusRemoteIterator.java
##########
@@ -113,7 +119,9 @@ public void testAbfsIteratorWithoutHasNext() throws Exception {
     for (int i = 0; i < TEST_FILES_NUMBER; i++) {
       FileStatus fileStatus = fsItr.next();
       String pathStr = fileStatus.getPath().toString();
-      fileNames.remove(pathStr);
+      if (!fileNames.remove(pathStr)) {

Review comment:
       again should this be failed?
   
   

##########
File path: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsListStatusRemoteIterator.java
##########
@@ -113,7 +119,9 @@ public void testAbfsIteratorWithoutHasNext() throws Exception {
     for (int i = 0; i < TEST_FILES_NUMBER; i++) {
       FileStatus fileStatus = fsItr.next();
       String pathStr = fileStatus.getPath().toString();
-      fileNames.remove(pathStr);
+      if (!fileNames.remove(pathStr)) {
+        LOG.debug("Could not remove path string {} from fileNames", pathStr);
+      }
       itrCount++;
     }
     Assertions.assertThatThrownBy(() -> fsItr.next())

Review comment:
       Can we move this to LambdaTestUtils.intercept()...it raises better exceptions on failures, including the result of fsItr.next().toString() in the message

##########
File path: hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/AbfsListResult.java
##########
@@ -0,0 +1,52 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.services;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.apache.hadoop.fs.FileStatus;
+
+public class AbfsListResult {

Review comment:
       nit: javadocs

##########
File path: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAbfsListStatusRemoteIterator.java
##########
@@ -127,7 +135,7 @@ public void testAbfsIteratorWithoutHasNext() throws Exception {
         .isEqualTo(TEST_FILES_NUMBER);
     Assertions.assertThat(fileNames.size())

Review comment:
       see previous assertJ comment. I know, it's existing code, but...

##########
File path: hadoop-tools/hadoop-azure/src/test/resources/log4j.properties
##########
@@ -27,6 +27,10 @@ log4j.logger.org.apache.hadoop.fs.azure.BlockBlobAppendStream=DEBUG
 log4j.logger.org.apache.hadoop.fs.azurebfs.contracts.services.TracingService=TRACE
 log4j.logger.org.apache.hadoop.fs.azurebfs.services.AbfsClient=DEBUG
 
+#to track transient test failure in ITestAbfsListStatusRemoteIterator

Review comment:
       must not go into final patch




-- 
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: common-issues-unsubscribe@hadoop.apache.org

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