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 08c565a3fb HDDS-13086. Block duplicate reconciliation requests for the
same container and datanode within the datanode. (#8905)
08c565a3fb is described below
commit 08c565a3fb68ff192eb3843227dc9e3219c05033
Author: Aswin Shakil Balasubramanian <[email protected]>
AuthorDate: Wed Aug 6 16:25:28 2025 -0700
HDDS-13086. Block duplicate reconciliation requests for the same container
and datanode within the datanode. (#8905)
---
.../commands/ReconcileContainerCommand.java | 5 ++-
.../checksum/TestReconcileContainerTask.java | 4 +--
.../replication/TestReplicationSupervisor.java | 38 ++++++++++++++++++++++
3 files changed, 42 insertions(+), 5 deletions(-)
diff --git
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReconcileContainerCommand.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReconcileContainerCommand.java
index 681e302ced..f7879a3364 100644
---
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReconcileContainerCommand.java
+++
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReconcileContainerCommand.java
@@ -94,12 +94,11 @@ public boolean equals(Object o) {
return false;
}
ReconcileContainerCommand that = (ReconcileContainerCommand) o;
- return getContainerID() == that.getContainerID() &&
- Objects.equals(peerDatanodes, that.peerDatanodes);
+ return getContainerID() == that.getContainerID();
}
@Override
public int hashCode() {
- return Objects.hash(getContainerID(), peerDatanodes);
+ return Objects.hash(getContainerID());
}
}
diff --git
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/checksum/TestReconcileContainerTask.java
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/checksum/TestReconcileContainerTask.java
index 3a5826c21e..28ff135fa2 100644
---
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/checksum/TestReconcileContainerTask.java
+++
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/checksum/TestReconcileContainerTask.java
@@ -88,8 +88,8 @@ public void testEqualityWhenContainerIDsMatch() {
// Same container ID and peers.
assertEquals(peerSet1Task, otherPeerSet1Task);
- // Same container ID, different peers.
- assertNotEquals(peerSet1Task, peerSet2Task);
+ // Same container ID, different peers - should still be equal now.
+ assertEquals(peerSet1Task, peerSet2Task);
}
@Test
diff --git
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java
index f38b4acb8e..f439e6a1d3 100644
---
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java
+++
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestReplicationSupervisor.java
@@ -787,6 +787,44 @@ public void testPriorityOrdering(ContainerLayoutVersion
layout)
supervisor.getInFlightReplications(BlockingTask.class));
}
+ @ContainerLayoutTestInfo.ContainerTest
+ public void testReconcileContainerCommandDeduplication() {
+ ReplicationSupervisor supervisor = ReplicationSupervisor.newBuilder()
+ .stateContext(context)
+ .build();
+
+ try {
+ final long containerID = 10L;
+
+ // Create reconcile commands with the same container ID but different
peers
+ ReconcileContainerCommand command1 = new
ReconcileContainerCommand(containerID, Collections.singleton(
+ MockDatanodeDetails.randomDatanodeDetails()));
+ ReconcileContainerCommand command2 = new
ReconcileContainerCommand(containerID, Collections.singleton(
+ MockDatanodeDetails.randomDatanodeDetails()));
+ assertEquals(command1, command2);
+ ReconcileContainerTask task1 = new ReconcileContainerTask(
+ mock(ContainerController.class),
+ mock(DNContainerOperationClient.class),
+ command1);
+ ReconcileContainerTask task2 = new ReconcileContainerTask(
+ mock(ContainerController.class),
+ mock(DNContainerOperationClient.class),
+ command2);
+
+ // Add first task - should be accepted
+ supervisor.addTask(task1);
+ assertEquals(1, supervisor.getTotalInFlightReplications());
+ assertEquals(1, supervisor.getReplicationQueuedCount());
+
+ // Add second task with same container ID but different peers - should
be deduplicated
+ supervisor.addTask(task2);
+ assertEquals(1, supervisor.getTotalInFlightReplications());
+ assertEquals(1, supervisor.getReplicationQueuedCount());
+ } finally {
+ supervisor.stop();
+ }
+ }
+
private static class BlockingTask extends AbstractReplicationTask {
private final CountDownLatch runningLatch;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]