HDFS-10960. TestDataNodeHotSwapVolumes#testRemoveVolumeBeingWritten fails at disk error verification after volume remove. (Manoj Govindassamy via lei)
(cherry picked from commit 78cb79fa91
)
This commit is contained in:
parent
15b1d522ee
commit
b9fdbd7107
|
@ -646,8 +646,6 @@ public class TestDataNodeHotSwapVolumes {
|
||||||
final DataNode dn = cluster.getDataNodes().get(dataNodeIdx);
|
final DataNode dn = cluster.getDataNodes().get(dataNodeIdx);
|
||||||
final FileSystem fs = cluster.getFileSystem();
|
final FileSystem fs = cluster.getFileSystem();
|
||||||
final Path testFile = new Path("/test");
|
final Path testFile = new Path("/test");
|
||||||
final long lastTimeDiskErrorCheck = dn.getLastDiskErrorCheck();
|
|
||||||
|
|
||||||
FSDataOutputStream out = fs.create(testFile, REPLICATION);
|
FSDataOutputStream out = fs.create(testFile, REPLICATION);
|
||||||
|
|
||||||
Random rb = new Random(0);
|
Random rb = new Random(0);
|
||||||
|
@ -703,17 +701,23 @@ public class TestDataNodeHotSwapVolumes {
|
||||||
|
|
||||||
reconfigThread.join();
|
reconfigThread.join();
|
||||||
|
|
||||||
|
// Verify if the data directory reconfigure was successful
|
||||||
|
FsDatasetSpi<? extends FsVolumeSpi> fsDatasetSpi = dn.getFSDataset();
|
||||||
|
try (FsDatasetSpi.FsVolumeReferences fsVolumeReferences = fsDatasetSpi
|
||||||
|
.getFsVolumeReferences()) {
|
||||||
|
for (int i =0; i < fsVolumeReferences.size(); i++) {
|
||||||
|
System.out.println("Vol: " + fsVolumeReferences.get(i).getBasePath());
|
||||||
|
}
|
||||||
|
assertEquals("Volume remove wasn't successful.",
|
||||||
|
1, fsVolumeReferences.size());
|
||||||
|
}
|
||||||
|
|
||||||
// Verify the file has sufficient replications.
|
// Verify the file has sufficient replications.
|
||||||
DFSTestUtil.waitReplication(fs, testFile, REPLICATION);
|
DFSTestUtil.waitReplication(fs, testFile, REPLICATION);
|
||||||
// Read the content back
|
// Read the content back
|
||||||
byte[] content = DFSTestUtil.readFileBuffer(fs, testFile);
|
byte[] content = DFSTestUtil.readFileBuffer(fs, testFile);
|
||||||
assertEquals(BLOCK_SIZE, content.length);
|
assertEquals(BLOCK_SIZE, content.length);
|
||||||
|
|
||||||
// If an IOException thrown from BlockReceiver#run, it triggers
|
|
||||||
// DataNode#checkDiskError(). So we can test whether checkDiskError() is called,
|
|
||||||
// to see whether there is IOException in BlockReceiver#run().
|
|
||||||
assertEquals(lastTimeDiskErrorCheck, dn.getLastDiskErrorCheck());
|
|
||||||
|
|
||||||
if (!exceptions.isEmpty()) {
|
if (!exceptions.isEmpty()) {
|
||||||
throw new IOException(exceptions.get(0).getCause());
|
throw new IOException(exceptions.get(0).getCause());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue