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 Void call(KMSClientProvider provider) throws IOException {
return null; return null;
} }
}, nextIdx(), false); }, nextIdx(), false);
invalidateCache(name);
} }
@Override @Override

View File

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