Procházet zdrojové kódy

HDFS-9491. Tests should get the number of pending async deletes via FsDatasetTestUtils. (Tony Wu via lei)

Lei Xu před 9 roky
rodič
revize
4265a85f6d

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -886,6 +886,9 @@ Release 2.9.0 - UNRELEASED
       HDFS-9267. TestDiskError should get stored replicas through
       FsDatasetTestUtils. (Lei (Eddy) Xu via Colin P. McCabe)
 
+      HDFS-9491. Tests should get the number of pending async delets via
+      FsDatasetTestUtils. (Tony Wu via lei)
+
   OPTIMIZATIONS
 
   BUG FIXES

+ 0 - 4
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/DataNodeTestUtils.java

@@ -158,10 +158,6 @@ public class DataNodeTestUtils {
     return dn.getFSDataset();
   }
 
-  public static long getPendingAsyncDeletions(DataNode dn) {
-    return FsDatasetTestUtil.getPendingAsyncDeletions(dn.getFSDataset());
-  }
-
   /**
    * Fetch a copy of ReplicaInfo from a datanode by block id
    * @param dn datanode to retrieve a replicainfo object from

+ 5 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/FsDatasetTestUtils.java

@@ -255,4 +255,9 @@ public interface FsDatasetTestUtils {
 
   /** Get all stored replicas in the specified block pool. */
   Iterator<Replica> getStoredReplicas(String bpid) throws IOException;
+
+  /**
+   * Get the number of pending async deletions.
+   */
+  long getPendingAsyncDeletions();
 }

+ 5 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImplTestUtils.java

@@ -400,4 +400,9 @@ public class FsDatasetImplTestUtils implements FsDatasetTestUtils {
     }
     return ret.iterator();
   }
+
+  @Override
+  public long getPendingAsyncDeletions() {
+    return dataset.asyncDiskService.countPendingDeletions();
+  }
 }

+ 0 - 4
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetTestUtil.java

@@ -59,10 +59,6 @@ public class FsDatasetTestUtil {
       final String bpid, final long blockId) {
     return ((FsDatasetImpl)fsd).fetchReplicaInfo(bpid, blockId);
   }
-
-  public static long getPendingAsyncDeletions(FsDatasetSpi<?> fsd) {
-    return ((FsDatasetImpl)fsd).asyncDiskService.countPendingDeletions();
-  }
   
   public static Collection<ReplicaInfo> getReplicas(FsDatasetSpi<?> fsd,
       String bpid) {

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/LazyPersistTestCase.java

@@ -452,7 +452,7 @@ public abstract class LazyPersistTestCase {
     triggerBlockReport();
 
     while(
-      DataNodeTestUtils.getPendingAsyncDeletions(cluster.getDataNodes().get(0))
+        cluster.getFsDatasetTestUtils(0).getPendingAsyncDeletions()
         > 0L){
       Thread.sleep(1000);
     }

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/ha/HATestUtil.java

@@ -101,7 +101,7 @@ public abstract class HATestUtil {
       @Override
       public Boolean get() {
         for (DataNode dn : cluster.getDataNodes()) {
-          if (DataNodeTestUtils.getPendingAsyncDeletions(dn) > 0) {
+          if (cluster.getFsDatasetTestUtils(dn).getPendingAsyncDeletions() > 0) {
             return false;
           }
         }