HBASE-19711 TestReplicationAdmin.testConcurrentPeerOperations hangs
Signed-off-by: zhangduo <zhangduo@apache.org>
This commit is contained in:
parent
ec364d0d6c
commit
2d5267331e
|
@ -423,9 +423,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
}
|
}
|
||||||
} else if (proc instanceof PeerProcedureInterface) {
|
} else if (proc instanceof PeerProcedureInterface) {
|
||||||
PeerProcedureInterface iProcPeer = (PeerProcedureInterface) proc;
|
PeerProcedureInterface iProcPeer = (PeerProcedureInterface) proc;
|
||||||
if (iProcPeer.getPeerOperationType() == PeerOperationType.REMOVE) {
|
tryCleanupPeerQueue(iProcPeer.getPeerId(), proc);
|
||||||
removePeerQueue(iProcPeer.getPeerId());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// No cleanup for ServerProcedureInterface types, yet.
|
// No cleanup for ServerProcedureInterface types, yet.
|
||||||
return;
|
return;
|
||||||
|
@ -514,6 +512,23 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
locking.removePeerLock(peerId);
|
locking.removePeerLock(peerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tryCleanupPeerQueue(String peerId, Procedure procedure) {
|
||||||
|
schedLock();
|
||||||
|
try {
|
||||||
|
PeerQueue queue = AvlTree.get(peerMap, peerId, PEER_QUEUE_KEY_COMPARATOR);
|
||||||
|
if (queue == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final LockAndQueue lock = locking.getPeerLock(peerId);
|
||||||
|
if (queue.isEmpty() && lock.tryExclusiveLock(procedure)) {
|
||||||
|
removeFromRunQueue(peerRunQueue, queue);
|
||||||
|
removePeerQueue(peerId);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
schedUnlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean isPeerProcedure(Procedure<?> proc) {
|
private static boolean isPeerProcedure(Procedure<?> proc) {
|
||||||
return proc instanceof PeerProcedureInterface;
|
return proc instanceof PeerProcedureInterface;
|
||||||
|
|
Loading…
Reference in New Issue