HDFS-9691. TestBlockManagerSafeMode#testCheckSafeMode fails intermittently. Contributed by Mingliang Liu.

This commit is contained in:
Akira Ajisaka 2016-02-15 14:00:09 +09:00
parent 1c48e50ce7
commit ac5da11399
2 changed files with 7 additions and 4 deletions

View File

@ -1015,6 +1015,9 @@ Release 2.9.0 - UNRELEASED
HDFS-9621. getListing wrongly associates Erasure Coding policy to pre-existing HDFS-9621. getListing wrongly associates Erasure Coding policy to pre-existing
replicated files under an EC directory. (jing9) replicated files under an EC directory. (jing9)
HDFS-9691. TestBlockManagerSafeMode#testCheckSafeMode fails intermittently.
(Mingliang Liu via aajisaka)
Release 2.8.0 - UNRELEASED Release 2.8.0 - UNRELEASED
NEW FEATURES NEW FEATURES

View File

@ -137,30 +137,30 @@ public class TestBlockManagerSafeMode {
} }
// PENDING_THRESHOLD -> EXTENSION // PENDING_THRESHOLD -> EXTENSION
Whitebox.setInternalState(bmSafeMode, "extension", Integer.MAX_VALUE);
setSafeModeStatus(BMSafeModeStatus.PENDING_THRESHOLD); setSafeModeStatus(BMSafeModeStatus.PENDING_THRESHOLD);
setBlockSafe(BLOCK_THRESHOLD); setBlockSafe(BLOCK_THRESHOLD);
bmSafeMode.checkSafeMode(); bmSafeMode.checkSafeMode();
assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus()); assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus());
Whitebox.setInternalState(bmSafeMode, "smmthread", null);
// PENDING_THRESHOLD -> OFF // PENDING_THRESHOLD -> OFF
Whitebox.setInternalState(bmSafeMode, "extension", 0);
setSafeModeStatus(BMSafeModeStatus.PENDING_THRESHOLD); setSafeModeStatus(BMSafeModeStatus.PENDING_THRESHOLD);
setBlockSafe(BLOCK_THRESHOLD); setBlockSafe(BLOCK_THRESHOLD);
Whitebox.setInternalState(bmSafeMode, "extension", 0);
bmSafeMode.checkSafeMode(); bmSafeMode.checkSafeMode();
assertEquals(BMSafeModeStatus.OFF, getSafeModeStatus()); assertEquals(BMSafeModeStatus.OFF, getSafeModeStatus());
// stays in EXTENSION // stays in EXTENSION
setSafeModeStatus(BMSafeModeStatus.EXTENSION);
setBlockSafe(0); setBlockSafe(0);
setSafeModeStatus(BMSafeModeStatus.EXTENSION);
Whitebox.setInternalState(bmSafeMode, "extension", 0); Whitebox.setInternalState(bmSafeMode, "extension", 0);
bmSafeMode.checkSafeMode(); bmSafeMode.checkSafeMode();
assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus()); assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus());
// stays in EXTENSION: pending extension period // stays in EXTENSION: pending extension period
Whitebox.setInternalState(bmSafeMode, "extension", Integer.MAX_VALUE);
setSafeModeStatus(BMSafeModeStatus.EXTENSION); setSafeModeStatus(BMSafeModeStatus.EXTENSION);
setBlockSafe(BLOCK_THRESHOLD); setBlockSafe(BLOCK_THRESHOLD);
Whitebox.setInternalState(bmSafeMode, "extension", Integer.MAX_VALUE);
bmSafeMode.checkSafeMode(); bmSafeMode.checkSafeMode();
assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus()); assertEquals(BMSafeModeStatus.EXTENSION, getSafeModeStatus());
} }