This is an automated email from the ASF dual-hosted git repository.
erose pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 622275f HDDS-5513. Race condition upon dn restart at prefinalization.
(#2471)
622275f is described below
commit 622275f2e53248968f5265c5a9d63504692e8c53
Author: Gui Hecheng <[email protected]>
AuthorDate: Mon Aug 2 12:54:55 2021 +0800
HDDS-5513. Race condition upon dn restart at prefinalization. (#2471)
---
.../ozone/container/common/statemachine/DatanodeStateMachine.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
index 56ab9a6..488c7bc 100644
---
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
+++
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/DatanodeStateMachine.java
@@ -88,7 +88,7 @@ public class DatanodeStateMachine implements Closeable {
private final ReportManager reportManager;
private long commandsHandled;
private final AtomicLong nextHB;
- private Thread stateMachineThread = null;
+ private volatile Thread stateMachineThread = null;
private Thread cmdProcessThread = null;
private final ReplicationSupervisor supervisor;
@@ -476,7 +476,7 @@ public class DatanodeStateMachine implements Closeable {
* be sent by datanode.
*/
public void triggerHeartbeat() {
- if (stateMachineThread != null) {
+ if (stateMachineThread != null && isDaemonStarted()) {
stateMachineThread.interrupt();
}
}
@@ -517,6 +517,10 @@ public class DatanodeStateMachine implements Closeable {
}
}
+ public boolean isDaemonStarted() {
+ return this.getContext().getExecutionCount() > 0;
+ }
+
/**
*
* Check if the datanode state machine daemon is stopped.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]