HDFS-12458. TestReencryptionWithKMS fails regularly. Contributed by Xiao Chen.
This commit is contained in:
parent
28c4957fcc
commit
7c34ceaf4f
@ -28,7 +28,6 @@
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@ -129,11 +128,9 @@ public void setup() throws Exception {
|
||||
conf.setInt(DFSConfigKeys.DFS_LIST_LIMIT, 3);
|
||||
// Adjust configs for re-encrypt test cases
|
||||
conf.setInt(DFSConfigKeys.DFS_NAMENODE_REENCRYPT_BATCH_SIZE_KEY, 5);
|
||||
conf.setTimeDuration(
|
||||
DFSConfigKeys.DFS_NAMENODE_REENCRYPT_SLEEP_INTERVAL_KEY, 1,
|
||||
TimeUnit.SECONDS);
|
||||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build();
|
||||
cluster.waitActive();
|
||||
cluster.waitClusterUp();
|
||||
fs = cluster.getFileSystem();
|
||||
fsn = cluster.getNamesystem();
|
||||
fsWrapper = new FileSystemTestWrapper(fs);
|
||||
@ -1284,6 +1281,7 @@ private void restartClusterDisableReencrypt() throws Exception {
|
||||
fsn = cluster.getNamesystem();
|
||||
getEzManager().pauseReencryptForTesting();
|
||||
cluster.waitActive();
|
||||
cluster.waitClusterUp();
|
||||
}
|
||||
|
||||
private void waitForReencryptedZones(final int expected)
|
||||
@ -1519,6 +1517,7 @@ public void reencryptEncryptedKeys() throws IOException {
|
||||
getEzManager().pauseReencryptForTesting();
|
||||
dfsAdmin.reencryptEncryptionZone(zone, ReencryptAction.START);
|
||||
waitForQueuedZones(1);
|
||||
getEzManager().pauseReencryptUpdaterForTesting();
|
||||
getEzManager().resumeReencryptForTesting();
|
||||
|
||||
LOG.info("Waiting for re-encrypt callables to run");
|
||||
@ -1529,7 +1528,6 @@ public Boolean get() {
|
||||
}
|
||||
}, 100, 10000);
|
||||
|
||||
getEzManager().pauseReencryptUpdaterForTesting();
|
||||
dfsAdmin.reencryptEncryptionZone(zone, ReencryptAction.CANCEL);
|
||||
|
||||
// now resume updater and verify status.
|
||||
@ -1609,7 +1607,7 @@ public void testReencryptionWithoutProvider() throws Exception {
|
||||
cluster.getConfiguration(0)
|
||||
.unset(CommonConfigurationKeysPublic.HADOOP_SECURITY_KEY_PROVIDER_PATH);
|
||||
cluster.restartNameNodes();
|
||||
cluster.waitActive();
|
||||
cluster.waitClusterUp();
|
||||
|
||||
// test re-encrypt should fail
|
||||
try {
|
||||
@ -1673,6 +1671,9 @@ public void testReencryptionNNSafeMode() throws Exception {
|
||||
}
|
||||
|
||||
fs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
|
||||
// trigger the background thread to run, without having to
|
||||
// wait for DFS_NAMENODE_REENCRYPT_SLEEP_INTERVAL_KEY
|
||||
getHandler().notifyNewSubmission();
|
||||
waitForReencryptedFiles(zone.toString(), 10);
|
||||
}
|
||||
|
||||
|
@ -101,9 +101,9 @@ public void testThrottle() throws Exception {
|
||||
final StopWatch sw = new StopWatch().start();
|
||||
rh.throttle();
|
||||
sw.stop();
|
||||
assertTrue("should have throttled for at least 4 second",
|
||||
assertTrue("should have throttled for at least 8 second",
|
||||
sw.now(TimeUnit.MILLISECONDS) > 8000);
|
||||
assertTrue("should have throttled for at most 6 second",
|
||||
assertTrue("should have throttled for at most 12 second",
|
||||
sw.now(TimeUnit.MILLISECONDS) < 12000);
|
||||
}
|
||||
|
||||
@ -191,7 +191,8 @@ public void run() {
|
||||
removeTaskThread.start();
|
||||
rh.throttle();
|
||||
sw.stop();
|
||||
LOG.info("Throttle completed, consumed {}", sw.now(TimeUnit.MILLISECONDS));
|
||||
assertTrue("should have throttled for at least 3 second",
|
||||
sw.now(TimeUnit.MILLISECONDS) > 3000);
|
||||
sw.now(TimeUnit.MILLISECONDS) >= 3000);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user