Skip to content

Commit ecd2de0

Browse files
HDDS-12409. Log an error before increasing the sequence id of a CLOSED container in SCM (apache#7964)
1 parent 978e4a7 commit ecd2de0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/AbstractContainerReportHandler.java

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.apache.hadoop.hdds.scm.container;
1919

2020
import com.google.common.base.Preconditions;
21+
import com.google.protobuf.TextFormat;
2122
import java.io.IOException;
2223
import java.util.ArrayList;
2324
import java.util.List;
@@ -132,6 +133,14 @@ private void updateContainerStats(final DatanodeDetails datanodeDetails,
132133
final ContainerInfo containerInfo,
133134
final ContainerReplicaProto replicaProto)
134135
throws ContainerNotFoundException {
136+
if (containerInfo.getState() == HddsProtos.LifeCycleState.CLOSED && containerInfo.getSequenceId() <
137+
replicaProto.getBlockCommitSequenceId()) {
138+
logger.error(
139+
"There is a CLOSED container with lower sequence ID than a replica. Container: {}, Container's " +
140+
"sequence ID: {}, Replica: {}, Replica's sequence ID: {}, Datanode: {}.", containerInfo,
141+
containerInfo.getSequenceId(), TextFormat.shortDebugString(replicaProto),
142+
replicaProto.getBlockCommitSequenceId(), datanodeDetails);
143+
}
135144

136145
if (isHealthy(replicaProto::getState)) {
137146
if (containerInfo.getSequenceId() <

0 commit comments

Comments
 (0)