HADOOP-17208. LoadBalanceKMSClientProvider#deleteKey should invalidateCache via all KMSClientProvider instances. (#2259)

This commit is contained in:
Xiaoyu Yao 2020-09-17 10:39:19 -07:00 committed by GitHub
parent 20a0e6278d
commit 6adf8462ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -502,6 +502,7 @@ public class LoadBalancingKMSClientProvider extends KeyProvider implements
return null;
}
}, nextIdx(), false);
invalidateCache(name);
}
@Override

View File

@ -299,19 +299,18 @@ public class ValueQueue <E> {
* @param keyName the key to drain the Queue for
*/
public void drain(String keyName) {
Runnable e;
while ((e = queue.deleteByName(keyName)) != null) {
executor.remove(e);
}
writeLock(keyName);
try {
Runnable e;
while ((e = queue.deleteByName(keyName)) != null) {
executor.remove(e);
LinkedBlockingQueue kq = keyQueues.getIfPresent(keyName);
if (kq != null) {
kq.clear();
}
writeLock(keyName);
try {
keyQueues.get(keyName).clear();
} finally {
writeUnlock(keyName);
}
} catch (ExecutionException ex) {
//NOP
} finally {
writeUnlock(keyName);
}
}