HDFS-10516. Fix bug when warming up EDEK cache of more than one encryption zone. Contributed by Xiao Chen.
(cherry picked from commit 709a814fe0153e86a37806796ea27c8252d9c6d1) (cherry picked from commit ff4466fe15c338e56bab2e4afd61c46b634843b3)
This commit is contained in:
parent
08ff8d7482
commit
56e29d2711
@ -417,7 +417,7 @@ String[] getKeyNames() {
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
for (Map.Entry<Long, EncryptionZoneInt> entry : encryptionZones
|
for (Map.Entry<Long, EncryptionZoneInt> entry : encryptionZones
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
ret[index] = entry.getValue().getKeyName();
|
ret[index++] = entry.getValue().getKeyName();
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -370,6 +370,9 @@ public void run() {
|
|||||||
} else {
|
} else {
|
||||||
NameNode.LOG.debug("Failed to warm up EDEKs.", ioe);
|
NameNode.LOG.debug("Failed to warm up EDEKs.", ioe);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
NameNode.LOG.error("Cannot warm up EDEKs.", e);
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(retryInterval);
|
Thread.sleep(retryInterval);
|
||||||
|
@ -100,9 +100,14 @@ public void testDelegationToken() throws Exception {
|
|||||||
|
|
||||||
@Test(timeout = 120000)
|
@Test(timeout = 120000)
|
||||||
public void testWarmupEDEKCacheOnStartup() throws Exception {
|
public void testWarmupEDEKCacheOnStartup() throws Exception {
|
||||||
final Path zonePath = new Path("/TestEncryptionZone");
|
Path zonePath = new Path("/TestEncryptionZone");
|
||||||
fsWrapper.mkdir(zonePath, FsPermission.getDirDefault(), false);
|
fsWrapper.mkdir(zonePath, FsPermission.getDirDefault(), false);
|
||||||
dfsAdmin.createEncryptionZone(zonePath, TEST_KEY, NO_TRASH);
|
dfsAdmin.createEncryptionZone(zonePath, TEST_KEY, NO_TRASH);
|
||||||
|
final String anotherKey = "k2";
|
||||||
|
zonePath = new Path("/TestEncryptionZone2");
|
||||||
|
DFSTestUtil.createKey(anotherKey, cluster, conf);
|
||||||
|
fsWrapper.mkdir(zonePath, FsPermission.getDirDefault(), false);
|
||||||
|
dfsAdmin.createEncryptionZone(zonePath, anotherKey, NO_TRASH);
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
KMSClientProvider spy = (KMSClientProvider) Whitebox
|
KMSClientProvider spy = (KMSClientProvider) Whitebox
|
||||||
|
Loading…
x
Reference in New Issue
Block a user