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

(cherry picked from commit c92713dac56da0f836382005d84b577cfeb36a05)
This commit is contained in:
Lei Xu 2015-12-04 18:03:41 -08:00
parent eb7f9901b4
commit ce49ba39d2
7 changed files with 15 additions and 10 deletions

View File

@ -10,6 +10,9 @@ Release 2.9.0 - UNRELEASED
HDFS-9267. TestDiskError should get stored replicas through HDFS-9267. TestDiskError should get stored replicas through
FsDatasetTestUtils. (Lei (Eddy) Xu via Colin P. McCabe) 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 OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -158,10 +158,6 @@ public static FsDatasetSpi<?> getFSDataset(DataNode dn) {
return dn.getFSDataset(); 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 * Fetch a copy of ReplicaInfo from a datanode by block id
* @param dn datanode to retrieve a replicainfo object from * @param dn datanode to retrieve a replicainfo object from

View File

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

View File

@ -400,4 +400,9 @@ public Iterator<Replica> getStoredReplicas(String bpid) throws IOException {
} }
return ret.iterator(); return ret.iterator();
} }
@Override
public long getPendingAsyncDeletions() {
return dataset.asyncDiskService.countPendingDeletions();
}
} }

View File

@ -60,10 +60,6 @@ public static ReplicaInfo fetchReplicaInfo (final FsDatasetSpi<?> fsd,
return ((FsDatasetImpl)fsd).fetchReplicaInfo(bpid, 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, public static Collection<ReplicaInfo> getReplicas(FsDatasetSpi<?> fsd,
String bpid) { String bpid) {
return ((FsDatasetImpl)fsd).volumeMap.replicas(bpid); return ((FsDatasetImpl)fsd).volumeMap.replicas(bpid);

View File

@ -452,7 +452,7 @@ protected final boolean verifyDeletedBlocks(LocatedBlocks locatedBlocks)
triggerBlockReport(); triggerBlockReport();
while( while(
DataNodeTestUtils.getPendingAsyncDeletions(cluster.getDataNodes().get(0)) cluster.getFsDatasetTestUtils(0).getPendingAsyncDeletions()
> 0L){ > 0L){
Thread.sleep(1000); Thread.sleep(1000);
} }

View File

@ -97,7 +97,7 @@ public static void waitForDNDeletions(final MiniDFSCluster cluster)
@Override @Override
public Boolean get() { public Boolean get() {
for (DataNode dn : cluster.getDataNodes()) { for (DataNode dn : cluster.getDataNodes()) {
if (DataNodeTestUtils.getPendingAsyncDeletions(dn) > 0) { if (cluster.getFsDatasetTestUtils(dn).getPendingAsyncDeletions() > 0) {
return false; return false;
} }
} }