Skip to content

Commit 896b473

Browse files
authored
HBASE-22486 Fix flaky test TestLockManager
1 parent 325bb00 commit 896b473

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ public final class LockProcedure extends Procedure<MasterProcedureEnv>
9090
// DEFAULT_LOCAL_MASTER_LOCKS_TIMEOUT_MS (10 min) so that there is no need to heartbeat.
9191
private final CountDownLatch lockAcquireLatch;
9292

93+
private volatile boolean suspended = false;
94+
9395
@Override
9496
public TableName getTableName() {
9597
return tableName;
@@ -219,9 +221,10 @@ public void unlock(final MasterProcedureEnv env) {
219221
locked.set(false);
220222
// Maybe timeout already awakened the event and the procedure has finished.
221223
synchronized (event) {
222-
if (!event.isReady()) {
224+
if (!event.isReady() && suspended) {
223225
setState(ProcedureProtos.ProcedureState.RUNNABLE);
224226
event.wake(env.getProcedureScheduler());
227+
suspended = false;
225228
}
226229
}
227230
}
@@ -244,6 +247,7 @@ protected Procedure<MasterProcedureEnv>[] execute(final MasterProcedureEnv env)
244247
event.suspend();
245248
event.suspendIfNotReady(this);
246249
setState(ProcedureProtos.ProcedureState.WAITING_TIMEOUT);
250+
suspended = true;
247251
}
248252
throw new ProcedureSuspendedException();
249253
}

0 commit comments

Comments
 (0)