HBASE-21518 TestMasterFailoverWithProcedures is flaky

Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
Peter Somogyi 2018-11-29 18:04:53 +01:00
parent bba29961e0
commit 4ebbfa3d60
1 changed files with 17 additions and 7 deletions

View File

@ -249,14 +249,24 @@ public class JVMClusterUtil {
// Do backups first. // Do backups first.
JVMClusterUtil.MasterThread activeMaster = null; JVMClusterUtil.MasterThread activeMaster = null;
for (JVMClusterUtil.MasterThread t : masters) { for (JVMClusterUtil.MasterThread t : masters) {
// Master was killed but could be still considered as active. Check first if it is stopped.
if (!t.master.isStopped()) {
if (!t.master.isActiveMaster()) { if (!t.master.isActiveMaster()) {
try { try {
t.master.stopMaster(); t.master.stopMaster();
} catch (IOException e) { } catch (IOException e) {
LOG.error("Exception occurred while stopping master", e); LOG.error("Exception occurred while stopping master", e);
} }
LOG.info("Stopped backup Master {} is stopped: {}",
t.master.hashCode(), t.master.isStopped());
} else { } else {
if (activeMaster != null) {
LOG.warn("Found more than 1 active master, hash {}", activeMaster.master.hashCode());
}
activeMaster = t; activeMaster = t;
LOG.debug("Found active master hash={}, stopped={}",
t.master.hashCode(), t.master.isStopped());
}
} }
} }
// Do active after. // Do active after.