This is an automated email from the ASF dual-hosted git repository.
sodonnell 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 0dad32fc6d HDDS-9602. Backport HDDS-9550 to legacy RM (missing
containers which are empty) (#5527)
0dad32fc6d is described below
commit 0dad32fc6d247ce3f7f18ba77c2b300f6a639278
Author: Stephen O'Donnell <[email protected]>
AuthorDate: Thu Nov 2 21:37:43 2023 +0000
HDDS-9602. Backport HDDS-9550 to legacy RM (missing containers which are
empty) (#5527)
---
.../container/replication/LegacyReplicationManager.java | 16 ++++++++++++++++
.../replication/TestLegacyReplicationManager.java | 13 +++++++++++++
2 files changed, 29 insertions(+)
diff --git
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/LegacyReplicationManager.java
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/LegacyReplicationManager.java
index 7c51acafb9..2679f026cd 100644
---
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/LegacyReplicationManager.java
+++
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/LegacyReplicationManager.java
@@ -499,6 +499,22 @@ public class LegacyReplicationManager {
return;
}
+ // If the container is empty and has no replicas, it is possible it was
+ // a container which stuck in the closing state which never got any
+ // replicas created on the datanodes. In this case, we don't have
enough
+ // information to delete the container, so we just log it as EMPTY,
+ // leaving it as CLOSED and return true, otherwise, it will end up
+ // marked as missing by the under replication handling.
+ if (replicas.isEmpty()
+ && container.getState() == LifeCycleState.CLOSED
+ && container.getNumberOfKeys() == 0) {
+ LOG.debug("Container {} appears empty and is closed, but cannot be "
+
+ "deleted because it has no replicas. Marking as EMPTY.",
+ container);
+ report.incrementAndSample(HealthState.EMPTY,
container.containerID());
+ return;
+ }
+
/*
* Check if the container is under replicated and take appropriate
* action.
diff --git
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestLegacyReplicationManager.java
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestLegacyReplicationManager.java
index 577acc662c..1dad5e6497 100644
---
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestLegacyReplicationManager.java
+++
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/replication/TestLegacyReplicationManager.java
@@ -513,6 +513,19 @@ public class TestLegacyReplicationManager {
return null;
}
+ @Test
+ public void testEmptyContainerWithNoReplicas() throws Exception {
+ final ContainerInfo container = createContainer(
+ LifeCycleState.CLOSED, 0, 0);
+ // No replicas
+ replicationManager.processAll();
+ eventQueue.processAll(1000);
+ ReplicationManagerReport report =
replicationManager.getContainerReport();
+ Assertions.assertEquals(1,
+ report.getStat(ReplicationManagerReport.HealthState.EMPTY));
+ Assertions.assertEquals(LifeCycleState.CLOSED, container.getState());
+ }
+
@Test
public void testDeletionLimit() throws Exception {
runTestLimit(0, 2, 0, 1,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]