This is an automated email from the ASF dual-hosted git repository.

adoroszlai 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 eac80214874 HDDS-17070. Sync container suppression changes from SCM to 
Recon (#11594)
eac80214874 is described below

commit eac802148741197fa26f30cf914f226dcbd76dec
Author: Andy Huang <[email protected]>
AuthorDate: Sat Nov 7 22:57:04 2026 +0800

    HDDS-17070. Sync container suppression changes from SCM to Recon (#11594)
---
 .../StorageContainerLocationInternalInterface.java |  10 ++
 ...inerLocationProtocolClientSideTranslatorPB.java |  18 ++
 .../src/main/proto/ScmAdminProtocol.proto          |  12 ++
 ...inerLocationProtocolServerSideTranslatorPB.java |  29 ++++
 .../hdds/scm/server/SCMClientProtocolServer.java   |  21 +++
 .../org/apache/hadoop/ozone/audit/SCMAction.java   |   1 +
 ...inerLocationProtocolServerSideTranslatorPB.java |  70 ++++++++
 .../scm/server/TestSCMClientProtocolServer.java    |  43 +++++
 .../ozone/recon/fsck/ReconReplicationManager.java  |   6 +-
 .../recon/scm/ReconStorageContainerSyncHelper.java |  42 ++++-
 .../recon/spi/StorageContainerServiceProvider.java |  12 ++
 .../impl/StorageContainerServiceProviderImpl.java  |  19 +++
 .../recon/fsck/TestReconReplicationManager.java    |  46 ++++++
 .../scm/TestReconSCMContainerSyncIntegration.java  | 181 ++++++++++++++++++++-
 .../TestStorageContainerServiceProviderImpl.java   |  14 ++
 15 files changed, 520 insertions(+), 4 deletions(-)

diff --git 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationInternalInterface.java
 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationInternalInterface.java
index a8471d20773..d18037fe269 100644
--- 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationInternalInterface.java
+++ 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationInternalInterface.java
@@ -128,6 +128,16 @@ List<HddsProtos.SCMContainerReplicaProto> 
getContainerReplicas(
   List<ContainerWithPipeline> getContainerWithPipelineBatch(
       Iterable<? extends Long> containerIDs) throws IOException;
 
+  /**
+   * Returns metadata for the requested containers without resolving pipelines.
+   * Missing containers are omitted from the result.
+   *
+   * @param containerIDs IDs of the requested containers
+   * @return metadata for containers that exist in SCM
+   * @throws IOException if the request fails
+   */
+  List<ContainerInfo> getExistingContainersInBatch(List<Long> containerIDs) 
throws IOException;
+
   /**
    * Ask SCM which containers of the given list exist.
    *
diff --git 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java
 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java
index cda4d97cc89..052e7619478 100644
--- 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java
+++ 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/scm/protocolPB/StorageContainerLocationProtocolClientSideTranslatorPB.java
@@ -85,6 +85,7 @@
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetDeletedBlocksTxnSummaryRequestProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetDeletedBlocksTxnSummaryResponseProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistContainerWithPipelinesInBatchRequestProto;
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistingContainersInBatchRequestProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetMetricsRequestProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetMetricsResponseProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetPipelineRequestProto;
@@ -390,6 +391,23 @@ public List<ContainerWithPipeline> 
getContainerWithPipelineBatch(
     return cps;
   }
 
+  @Override
+  public List<ContainerInfo> getExistingContainersInBatch(List<Long> 
containerIDs) throws IOException {
+    for (Long containerID : containerIDs) {
+      Preconditions.checkState(containerID >= 0, "Container ID cannot be 
negative");
+    }
+    GetExistingContainersInBatchRequestProto request = 
GetExistingContainersInBatchRequestProto.newBuilder()
+        .addAllContainerIDs(containerIDs).build();
+    ScmContainerLocationResponse response = 
submitRequest(Type.GetExistingContainersInBatch,
+        builder -> builder.setGetExistingContainersInBatchRequest(request));
+    List<ContainerInfo> containers = new ArrayList<>();
+    for (HddsProtos.ContainerInfoProto container :
+        
response.getGetExistingContainersInBatchResponse().getContainersList()) {
+      containers.add(ContainerInfo.fromProtobuf(container));
+    }
+    return containers;
+  }
+
   /**
    * {@inheritDoc}
    */
diff --git a/hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto 
b/hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto
index 3e721e4fd71..f81f57c7e95 100644
--- a/hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto
+++ b/hadoop-hdds/interface-admin/src/main/proto/ScmAdminProtocol.proto
@@ -90,6 +90,7 @@ message ScmContainerLocationRequest {
   optional SCMListContainerIDsRequestProto scmListContainerIDsRequest = 51;
   optional SuppressContainerRequestProto suppressContainerRequest = 52;
   optional GetPeerUpgradeStatusRequestProto getPeerUpgradeStatusRequest = 53;
+  optional GetExistingContainersInBatchRequestProto 
getExistingContainersInBatchRequest = 54;
 }
 
 message ScmContainerLocationResponse {
@@ -151,6 +152,7 @@ message ScmContainerLocationResponse {
   optional SCMListContainerIDsResponseProto scmListContainerIDsResponse = 51;
   optional SuppressContainerResponseProto suppressContainerResponse = 52;
   optional GetPeerUpgradeStatusResponseProto getPeerUpgradeStatusResponse = 53;
+  optional GetExistingContainersInBatchResponseProto 
getExistingContainersInBatchResponse = 54;
 
   enum Status {
     OK = 1;
@@ -211,6 +213,7 @@ enum Type {
   ListContainerIDs = 47;
   SuppressContainer = 48;
   GetPeerUpgradeStatus = 49;
+  GetExistingContainersInBatch = 50;
 }
 
 /**
@@ -764,3 +767,12 @@ message SuppressContainerResponseProto {
 service StorageContainerLocationProtocolService {
   rpc submitRequest (ScmContainerLocationRequest) returns 
(ScmContainerLocationResponse);
 }
+
+/** Returns metadata for existing containers without resolving their 
pipelines. */
+message GetExistingContainersInBatchRequestProto {
+  repeated int64 containerIDs = 1;
+}
+
+message GetExistingContainersInBatchResponseProto {
+  repeated ContainerInfoProto containers = 1;
+}
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocolServerSideTranslatorPB.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocolServerSideTranslatorPB.java
index e3ba72bf5f2..d4843511311 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocolServerSideTranslatorPB.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/protocol/StorageContainerLocationProtocolServerSideTranslatorPB.java
@@ -25,6 +25,7 @@
 import static 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type.GetContainerWithPipeline;
 import static 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type.GetContainerWithPipelineBatch;
 import static 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type.GetExistContainerWithPipelinesInBatch;
+import static 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type.GetExistingContainersInBatch;
 import static 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type.GetPipeline;
 import static 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type.ListContainer;
 import static 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type.ListPipelines;
@@ -90,6 +91,8 @@
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetDeletedBlocksTxnSummaryResponseProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistContainerWithPipelinesInBatchRequestProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistContainerWithPipelinesInBatchResponseProto;
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistingContainersInBatchRequestProto;
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistingContainersInBatchResponseProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetFailedDeletedBlocksTxnRequestProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetFailedDeletedBlocksTxnResponseProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetMetricsRequestProto;
@@ -232,6 +235,7 @@ public ScmContainerLocationResponse 
submitRequest(RpcController controller,
     boolean checkResponseForECRepConfig = false;
     if 
(!ClientVersion.ERASURE_CODING_SUPPORT.isSupportedBy(request.getVersion())) {
       if (request.getCmdType() == GetContainer
+          || request.getCmdType() == GetExistingContainersInBatch
           || request.getCmdType() == ListContainer
           || request.getCmdType() == GetContainerWithPipeline
           || request.getCmdType() == GetContainerWithPipelineBatch
@@ -251,6 +255,15 @@ public ScmContainerLocationResponse 
submitRequest(RpcController controller,
         case GetContainer:
           disallowECReplicationConfigInGetContainerResponse(response);
           break;
+        case GetExistingContainersInBatch:
+          for (HddsProtos.ContainerInfoProto container :
+              
response.getGetExistingContainersInBatchResponse().getContainersList()) {
+            if (container.hasEcReplicationConfig()) {
+              throw new SCMException(ERROR_LIST_CONTAINS_EC_REPLICATION_CONFIG,
+                  SCMException.ResultCodes.INTERNAL_ERROR);
+            }
+          }
+          break;
         case ListContainer:
           disallowECReplicationConfigInListContainerResponse(response);
           break;
@@ -437,6 +450,13 @@ public ScmContainerLocationResponse processRequest(
             .setGetContainerResponse(
                 getContainer(request.getGetContainerRequest()))
             .build();
+      case GetExistingContainersInBatch:
+        return ScmContainerLocationResponse.newBuilder()
+            .setCmdType(request.getCmdType())
+            .setStatus(Status.OK)
+            .setGetExistingContainersInBatchResponse(
+                
getExistingContainersInBatch(request.getGetExistingContainersInBatchRequest()))
+            .build();
       case GetContainerToken:
         return ScmContainerLocationResponse.newBuilder()
             .setCmdType(request.getCmdType())
@@ -854,6 +874,15 @@ public GetContainerWithPipelineResponseProto 
getContainerWithPipeline(
     return builder.build();
   }
 
+  public GetExistingContainersInBatchResponseProto 
getExistingContainersInBatch(
+      GetExistingContainersInBatchRequestProto request) throws IOException {
+    GetExistingContainersInBatchResponseProto.Builder builder = 
GetExistingContainersInBatchResponseProto.newBuilder();
+    for (ContainerInfo container : 
impl.getExistingContainersInBatch(request.getContainerIDsList())) {
+      builder.addContainers(container.getProtobuf());
+    }
+    return builder.build();
+  }
+
   public GetExistContainerWithPipelinesInBatchResponseProto
       getExistContainerWithPipelinesInBatch(
       GetExistContainerWithPipelinesInBatchRequestProto request,
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
index f59c325ccf2..294d7ed16d2 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
@@ -420,6 +420,27 @@ public List<ContainerWithPipeline> 
getContainerWithPipelineBatch(
     return cpList;
   }
 
+  @Override
+  public List<ContainerInfo> getExistingContainersInBatch(List<Long> 
containerIDs) throws IOException {
+    Map<String, String> auditMap = Collections.singletonMap("containerIDs", 
containerIDs.toString());
+    try {
+      getScm().checkAdminAccess(getRemoteUser(), true);
+      List<ContainerInfo> containers = new ArrayList<>();
+      for (Long containerID : containerIDs) {
+        try {
+          
containers.add(scm.getContainerManager().getContainer(ContainerID.valueOf(containerID)));
+        } catch (ContainerNotFoundException ex) {
+          LOG.debug("Container {} no longer exists in SCM.", containerID);
+        }
+      }
+      
AUDIT.logReadSuccess(buildAuditMessageForSuccess(SCMAction.GET_CONTAINER_BATCH, 
auditMap));
+      return containers;
+    } catch (IOException ex) {
+      
AUDIT.logReadFailure(buildAuditMessageForFailure(SCMAction.GET_CONTAINER_BATCH, 
auditMap, ex));
+      throw ex;
+    }
+  }
+
   @Override
   public List<ContainerWithPipeline> getExistContainerWithPipelinesInBatch(
       List<Long> containerIDs) {
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/ozone/audit/SCMAction.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/ozone/audit/SCMAction.java
index 9790de22331..9ef6c0aa99d 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/ozone/audit/SCMAction.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/ozone/audit/SCMAction.java
@@ -30,6 +30,7 @@ public enum SCMAction implements AuditAction {
   DELETE_KEY_BLOCK,
   ALLOCATE_CONTAINER,
   GET_CONTAINER,
+  GET_CONTAINER_BATCH,
   GET_CONTAINER_WITH_PIPELINE,
   LIST_CONTAINER,
   CREATE_PIPELINE,
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/protocol/TestStorageContainerLocationProtocolServerSideTranslatorPB.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/protocol/TestStorageContainerLocationProtocolServerSideTranslatorPB.java
index 8384f4d70db..45a35394357 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/protocol/TestStorageContainerLocationProtocolServerSideTranslatorPB.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/protocol/TestStorageContainerLocationProtocolServerSideTranslatorPB.java
@@ -28,12 +28,16 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import com.google.protobuf.ServiceException;
+import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import org.apache.hadoop.hdds.HDDSVersion;
+import org.apache.hadoop.hdds.client.ECReplicationConfig;
 import org.apache.hadoop.hdds.client.RatisReplicationConfig;
 import org.apache.hadoop.hdds.client.ReplicationConfig;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
@@ -46,7 +50,11 @@
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineBatchRequestProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetContainerWithPipelineRequestProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistContainerWithPipelinesInBatchRequestProto;
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.GetExistingContainersInBatchRequestProto;
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.ScmContainerLocationRequest;
+import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerLocationProtocolProtos.Type;
 import org.apache.hadoop.hdds.scm.HddsTestUtils;
+import org.apache.hadoop.hdds.scm.container.ContainerInfo;
 import 
org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.exceptions.SCMException;
 import org.apache.hadoop.hdds.scm.node.DatanodeInfo;
@@ -55,8 +63,13 @@
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline.PipelineState;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
+import 
org.apache.hadoop.hdds.scm.protocolPB.StorageContainerLocationProtocolClientSideTranslatorPB;
+import 
org.apache.hadoop.hdds.scm.protocolPB.StorageContainerLocationProtocolPB;
+import 
org.apache.hadoop.hdds.scm.proxy.SCMContainerLocationFailoverProxyProvider;
 import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.hdds.utils.ProtocolMessageMetrics;
+import org.apache.hadoop.io.retry.FailoverProxyProvider;
+import org.apache.hadoop.io_.retry.RetryPolicies;
 import org.apache.hadoop.ozone.ClientVersion;
 import org.apache.hadoop.ozone.container.upgrade.UpgradeUtils;
 import org.junit.jupiter.api.BeforeEach;
@@ -82,6 +95,7 @@ class 
TestStorageContainerLocationProtocolServerSideTranslatorPB {
   void setUp() throws Exception {
     impl = mock(StorageContainerLocationInternalInterface.class);
     StorageContainerManager scm = mock(StorageContainerManager.class);
+    when(scm.checkLeader()).thenReturn(true);
 
     registry = new HashMap<>();
     NodeManager nodeManager = mock(NodeManager.class);
@@ -98,6 +112,62 @@ void setUp() throws Exception {
         mock(ProtocolMessageMetrics.class));
   }
 
+  @Test
+  void testGetExistingContainersInBatchRoundTrip() throws Exception {
+    List<Long> ids = Arrays.asList(1L, 2L);
+    ContainerInfo info = HddsTestUtils.getContainer(LifeCycleState.CLOSED);
+    info.setSuppressed(true);
+    
when(impl.getExistingContainersInBatch(ids)).thenReturn(Collections.singletonList(info));
+    StorageContainerLocationProtocolClientSideTranslatorPB client = 
metadataClient();
+
+    List<ContainerInfo> containers = client.getExistingContainersInBatch(ids);
+
+    assertEquals(1, containers.size());
+    assertEquals(info.getProtobuf(), containers.get(0).getProtobuf());
+    
assertThat(client.getExistingContainersInBatch(Collections.emptyList())).isEmpty();
+    assertThrows(IllegalStateException.class,
+        () -> 
client.getExistingContainersInBatch(Collections.singletonList(-1L)));
+  }
+
+  @Test
+  void testGetExistingContainersInBatchPropagatesFailure() throws Exception {
+    List<Long> ids = Collections.singletonList(1L);
+    when(impl.getExistingContainersInBatch(ids)).thenThrow(new 
IOException("SCM unavailable"));
+    StorageContainerLocationProtocolClientSideTranslatorPB client = 
metadataClient();
+
+    assertThrows(IOException.class, () -> 
client.getExistingContainersInBatch(ids));
+  }
+
+  @Test
+  void testGetExistingContainersInBatchRejectsECForLegacyClient() throws 
Exception {
+    ContainerInfo info = new ContainerInfo.Builder()
+        .setContainerID(1L)
+        .setState(LifeCycleState.CLOSED)
+        .setReplicationConfig(new ECReplicationConfig(3, 2))
+        .setOwner("test")
+        .build();
+    
when(impl.getExistingContainersInBatch(Collections.singletonList(1L))).thenReturn(Collections.singletonList(info));
+    ScmContainerLocationRequest request = 
ScmContainerLocationRequest.newBuilder()
+        .setCmdType(Type.GetExistingContainersInBatch)
+        .setVersion(ClientVersion.DEFAULT_VERSION.serialize())
+        .setGetExistingContainersInBatchRequest(
+            
GetExistingContainersInBatchRequestProto.newBuilder().addContainerIDs(1L))
+        .build();
+
+    assertThrows(ServiceException.class, () -> service.submitRequest(null, 
request));
+  }
+
+  private StorageContainerLocationProtocolClientSideTranslatorPB 
metadataClient() throws Exception {
+    StorageContainerLocationProtocolPB rpc = 
mock(StorageContainerLocationProtocolPB.class);
+    when(rpc.submitRequest(any(), any()))
+        .thenAnswer(inv -> service.submitRequest(inv.getArgument(0), 
inv.getArgument(1)));
+    SCMContainerLocationFailoverProxyProvider provider = 
mock(SCMContainerLocationFailoverProxyProvider.class);
+    
when(provider.getInterface()).thenReturn(StorageContainerLocationProtocolPB.class);
+    when(provider.getProxy()).thenReturn(new 
FailoverProxyProvider.ProxyInfo<>(rpc, "test"));
+    
when(provider.getRetryPolicy()).thenReturn(RetryPolicies.TRY_ONCE_THEN_FAIL);
+    return new 
StorageContainerLocationProtocolClientSideTranslatorPB(provider);
+  }
+
   /**
    * Creates a pipeline member (left at {@link HDDSVersion#SOFTWARE_VERSION}) 
and registers it in the mocked node
    * manager registry with the given live {@code currentVersion}, mirroring 
what a heartbeat records on SCM.
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMClientProtocolServer.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMClientProtocolServer.java
index 45a310adaef..47d5d6c2764 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMClientProtocolServer.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/server/TestSCMClientProtocolServer.java
@@ -26,9 +26,12 @@
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
 import static org.mockito.Mockito.when;
 
 import java.io.File;
@@ -40,6 +43,7 @@
 import java.time.ZoneOffset;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import org.apache.hadoop.hdds.HDDSVersion;
@@ -54,10 +58,12 @@
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.container.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.ContainerManagerImpl;
+import org.apache.hadoop.hdds.scm.container.ContainerNotFoundException;
 import org.apache.hadoop.hdds.scm.ha.SCMContext;
 import org.apache.hadoop.hdds.scm.ha.SCMHAManagerStub;
 import org.apache.hadoop.hdds.scm.ha.SCMNodeDetails;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineManager;
 import 
org.apache.hadoop.hdds.scm.protocol.StorageContainerLocationProtocolServerSideTranslatorPB;
 import org.apache.hadoop.hdds.scm.safemode.SCMSafeModeManager;
 import org.apache.hadoop.hdds.scm.server.upgrade.FinalizationManager;
@@ -190,6 +196,43 @@ public void testScmListContainer() throws Exception {
     }
   }
 
+  @Test
+  public void testGetExistingContainersInBatchWithoutPipelines() throws 
Exception {
+    StorageContainerManager mockScm = mockStorageContainerManager();
+    PipelineManager pipelineManager = mock(PipelineManager.class);
+    when(mockScm.getPipelineManager()).thenReturn(pipelineManager);
+    ContainerInfo info = newContainerInfoForTest();
+    info.setSuppressed(true);
+    
when(mockScm.getContainerManager().getContainer(ContainerID.valueOf(1))).thenReturn(info);
+    when(mockScm.getContainerManager().getContainer(ContainerID.valueOf(2)))
+        .thenThrow(new ContainerNotFoundException(ContainerID.valueOf(2)));
+    SCMClientProtocolServer scmServer = new SCMClientProtocolServer(new 
OzoneConfiguration(),
+        mockScm, mock(ReconfigurationHandler.class));
+    try {
+      assertEquals(Collections.singletonList(info), 
scmServer.getExistingContainersInBatch(Arrays.asList(2L, 1L)));
+      verify(mockScm).checkAdminAccess(any(), eq(true));
+      
assertTrue(scmServer.getExistingContainersInBatch(Collections.emptyList()).isEmpty());
+      verifyNoInteractions(pipelineManager);
+    } finally {
+      scmServer.stop();
+    }
+  }
+
+  @Test
+  public void testGetExistingContainersInBatchChecksAdminAccess() throws 
Exception {
+    StorageContainerManager mockScm = mockStorageContainerManager();
+    SCMClientProtocolServer scmServer = new SCMClientProtocolServer(new 
OzoneConfiguration(),
+        mockScm, mock(ReconfigurationHandler.class));
+    doThrow(new AccessControlException("Access 
denied")).when(mockScm).checkAdminAccess(any(), eq(true));
+    try {
+      assertThrows(AccessControlException.class,
+          () -> scmServer.getExistingContainersInBatch(Arrays.asList(1L, 2L)));
+      verify(mockScm.getContainerManager(), never()).getContainer(any());
+    } finally {
+      scmServer.stop();
+    }
+  }
+
   @Test
   public void testScmGetContainerCount() throws IOException {
     SCMClientProtocolServer scmServer =
diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/fsck/ReconReplicationManager.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/fsck/ReconReplicationManager.java
index 940b91ffc64..1c3b6cc359b 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/fsck/ReconReplicationManager.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/fsck/ReconReplicationManager.java
@@ -310,13 +310,17 @@ public synchronized void processAll() {
         ContainerID cid = container.containerID();
         Set<ContainerReplica> replicas = 
containerManager.getContainerReplicas(cid);
         List<ContainerReplicaOp> pendingOps = getPendingReplicationOps(cid);
+        if (container.isSuppressed()) {
+          // processContainer skips a suppressed container and would leave its 
last health state in place.
+          container.setHealthState(ContainerHealthState.HEALTHY);
+        }
 
         // Call inherited processContainer - this runs SCM's health check chain
         // readOnly=true ensures no commands are generated
         processContainer(container, replicas, pendingOps, nullQueue, report, 
true);
 
         // ADDITIONAL CHECK: Detect REPLICA_MISMATCH (Recon-specific, not in 
SCM)
-        if (hasDataChecksumMismatch(container, replicas)) {
+        if (!container.isSuppressed() && hasDataChecksumMismatch(container, 
replicas)) {
           report.addReplicaMismatchContainer(cid);
           LOG.debug("Container {} has data checksum mismatch across replicas", 
cid);
         }
diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerSyncHelper.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerSyncHelper.java
index 1a7d4e28d00..439f596fbc6 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerSyncHelper.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/scm/ReconStorageContainerSyncHelper.java
@@ -169,7 +169,8 @@ public boolean syncWithSCMContainerInfo() {
     boolean closed =
         syncContainersForState(HddsProtos.LifeCycleState.CLOSED, false);
     boolean deleted = syncDeletedContainers();
-    return open && quasiClosed && closed && deleted;
+    boolean suppressed = syncSuppressedFlags();
+    return open && quasiClosed && closed && deleted && suppressed;
   }
 
   /**
@@ -425,6 +426,45 @@ private boolean syncDeletedContainers() {
     }
   }
 
+  /**
+   * Copies SCM's suppressed flag to the containers Recon already has. Fetching
+   * explicit IDs avoids SCM's full container scan for each filtered list page.
+   *
+   * @return {@code true} if all RPC calls completed without error
+   */
+  private boolean syncSuppressedFlags() {
+    try {
+      int batchSize = safeContainerWithPipelineBatchSize((int) 
getContainerCountPerCall(Integer.MAX_VALUE));
+      ContainerID start = ContainerID.valueOf(1);
+      int updated = 0;
+      while (true) {
+        List<ContainerID> ids = containerManager.getContainerIDs(start, 
batchSize, null, null);
+        if (ids.isEmpty()) {
+          break;
+        }
+        for (ContainerInfo scmContainer : 
scmServiceProvider.getExistingContainersInBatch(ids)) {
+          ContainerID id = scmContainer.containerID();
+          try {
+            ContainerInfo container = containerManager.getContainer(id);
+            if (container.isSuppressed() != scmContainer.isSuppressed()) {
+              containerManager.updateContainerInfo(id,
+                  
container.getProtobuf().toBuilder().setSuppressed(scmContainer.isSuppressed()).build());
+              updated++;
+            }
+          } catch (ContainerNotFoundException e) {
+            LOG.debug("Container {} vanished from Recon during suppressed flag 
sync.", id);
+          }
+        }
+        start = ContainerID.valueOf(ids.get(ids.size() - 1).getId() + 1);
+      }
+      LOG.info("Suppressed flag sync complete, updated {}.", updated);
+      return true;
+    } catch (Exception e) {
+      LOG.error("Suppressed flag sync: unexpected error.", e);
+      return false;
+    }
+  }
+
   private void updateDeletedContainerCountDrift() {
     try {
       long total = scmServiceProvider.getContainerCount(
diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/StorageContainerServiceProvider.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/StorageContainerServiceProvider.java
index 2eca884f798..ddc625a0836 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/StorageContainerServiceProvider.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/StorageContainerServiceProvider.java
@@ -55,6 +55,18 @@ public interface StorageContainerServiceProvider {
   ContainerWithPipeline getContainerWithPipeline(long containerId)
       throws IOException;
 
+  /**
+   * Returns container metadata without requiring a pipeline.
+   * @throws IOException if the SCM RPC call fails
+   */
+  ContainerInfo getContainerInfo(long containerId) throws IOException;
+
+  /**
+   * Returns metadata for existing containers without resolving their 
pipelines.
+   * @throws IOException if the SCM RPC call fails
+   */
+  List<ContainerInfo> getExistingContainersInBatch(List<ContainerID> 
containerIDs) throws IOException;
+
   /**
    * Requests SCM for which containers in given ID list.
    * @param containerIDs containerId list
diff --git 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/StorageContainerServiceProviderImpl.java
 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/StorageContainerServiceProviderImpl.java
index 15c1c5351c4..3e546a08b0a 100644
--- 
a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/StorageContainerServiceProviderImpl.java
+++ 
b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/spi/impl/StorageContainerServiceProviderImpl.java
@@ -58,6 +58,7 @@
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
 import javax.inject.Inject;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
@@ -68,6 +69,7 @@
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.container.ContainerInfo;
+import org.apache.hadoop.hdds.scm.container.ContainerNotFoundException;
 import 
org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.ha.InterSCMGrpcClient;
 import org.apache.hadoop.hdds.scm.ha.SCMSnapshotDownloader;
@@ -78,6 +80,7 @@
 import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
 import org.apache.hadoop.hdds.utils.db.RocksDBCheckpoint;
 import org.apache.hadoop.hdfs.web.URLConnectionFactory;
+import org.apache.hadoop.ipc_.RemoteException;
 import org.apache.hadoop.ozone.ClientVersion;
 import org.apache.hadoop.ozone.ha.ConfUtils;
 import org.apache.hadoop.ozone.recon.ReconContext;
@@ -140,6 +143,21 @@ public ContainerWithPipeline getContainerWithPipeline(long 
containerId)
     return scmClient.getContainerWithPipeline(containerId);
   }
 
+  @Override
+  public ContainerInfo getContainerInfo(long containerId) throws IOException {
+    try {
+      return scmClient.getContainer(containerId);
+    } catch (RemoteException e) {
+      throw e.unwrapRemoteException(ContainerNotFoundException.class);
+    }
+  }
+
+  @Override
+  public List<ContainerInfo> getExistingContainersInBatch(List<ContainerID> 
containerIDs) throws IOException {
+    return 
scmClient.getExistingContainersInBatch(containerIDs.stream().map(ContainerID::getId)
+        .collect(Collectors.toList()));
+  }
+
   @Override
   public List<ContainerWithPipeline> getExistContainerWithPipelinesInBatch(
       List<Long> containerIDs) {
@@ -343,4 +361,5 @@ public List<ContainerInfo> getListOfContainerInfos(
     return scmClient.listContainer(
         startContainerID.getId(), count, state).getContainerInfoList();
   }
+
 }
diff --git 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/fsck/TestReconReplicationManager.java
 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/fsck/TestReconReplicationManager.java
index b803642b3e5..3dc0bbcce68 100644
--- 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/fsck/TestReconReplicationManager.java
+++ 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/fsck/TestReconReplicationManager.java
@@ -17,6 +17,7 @@
 
 package org.apache.hadoop.ozone.recon.fsck;
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -35,6 +36,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
+import org.apache.hadoop.hdds.client.RatisReplicationConfig;
 import org.apache.hadoop.hdds.client.ReplicationConfig;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
@@ -266,6 +268,17 @@ public void 
testReplicaChecksumMismatch(HddsProtos.ReplicationType replicationTy
     assertEquals(1, mismatches.size());
     assertEquals(containerId, mismatches.get(0).getContainerId());
 
+    when(container.isSuppressed()).thenReturn(true);
+    reconRM.processAll();
+    
assertTrue(schemaManagerV2.getUnhealthyContainers(UnHealthyContainerStates.REPLICA_MISMATCH,
 0, 0, 10).isEmpty(),
+        "Suppressed containers should have existing checksum mismatches 
removed");
+
+    when(container.isSuppressed()).thenReturn(false);
+    reconRM.processAll();
+    mismatches = 
schemaManagerV2.getUnhealthyContainers(UnHealthyContainerStates.REPLICA_MISMATCH,
 0, 0, 10);
+    assertEquals(1, mismatches.size());
+    assertEquals(containerId, mismatches.get(0).getContainerId());
+
     when(duplicate.getDataChecksum()).thenReturn(1000L + duplicateIndex);
     reconRM.processAll();
     
assertTrue(schemaManagerV2.getUnhealthyContainers(UnHealthyContainerStates.REPLICA_MISMATCH,
 0, 0, 10).isEmpty(),
@@ -380,6 +393,32 @@ public void 
testProcessAllSkipsUnsupportedScmStateWithoutDbViolation()
         UnHealthyContainerStates.MIS_REPLICATED, 0, 0, 10).size());
   }
 
+  @Test
+  public void testProcessAllFollowsSuppressedFlag() throws Exception {
+    ContainerInfo container = new ContainerInfo.Builder()
+        .setContainerID(1L)
+        .setState(HddsProtos.LifeCycleState.CLOSED)
+        .setNumberOfKeys(10)
+        
.setReplicationConfig(RatisReplicationConfig.getInstance(HddsProtos.ReplicationFactor.THREE))
+        .setOwner("test")
+        .build();
+    
when(containerManager.getContainers()).thenReturn(Collections.singletonList(container));
+    
when(containerManager.getContainer(container.containerID())).thenReturn(container);
+    
when(containerManager.getContainerReplicas(container.containerID())).thenReturn(Collections.emptySet());
+
+    reconRM.processAll();
+    assertThat(missingContainerIds()).containsExactly(1L);
+
+    // The SCM container sync sets the flag on the container Recon already 
holds.
+    container.setSuppressed(true);
+    reconRM.processAll();
+    assertThat(missingContainerIds()).isEmpty();
+
+    container.setSuppressed(false);
+    reconRM.processAll();
+    assertThat(missingContainerIds()).containsExactly(1L);
+  }
+
   @Test
   public void testReconReplicationManagerCreation() {
     // Verify ReconReplicationManager was created successfully
@@ -457,6 +496,13 @@ public void testSchemaManagerIntegration() {
     // No assertion needed - just verify no exceptions thrown
   }
 
+  private List<Long> missingContainerIds() {
+    List<Long> ids = new ArrayList<>();
+    schemaManagerV2.getUnhealthyContainers(UnHealthyContainerStates.MISSING, 
0, 0, 100)
+        .forEach(r -> ids.add(r.getContainerId()));
+    return ids;
+  }
+
   private ContainerInfo mockContainerInfo(long containerId, long numberOfKeys,
       long usedBytes, int requiredNodes) {
     ContainerInfo containerInfo = mock(ContainerInfo.class);
diff --git 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconSCMContainerSyncIntegration.java
 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconSCMContainerSyncIntegration.java
index 004480aa556..0d869f9b755 100644
--- 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconSCMContainerSyncIntegration.java
+++ 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/scm/TestReconSCMContainerSyncIntegration.java
@@ -17,6 +17,7 @@
 
 package org.apache.hadoop.ozone.recon.scm;
 
+import static 
org.apache.hadoop.fs.CommonConfigurationKeys.IPC_MAXIMUM_DATA_LENGTH;
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleEvent.DELETE;
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleEvent.FINALIZE;
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState.CLOSED;
@@ -27,13 +28,17 @@
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleState.QUASI_CLOSED;
 import static 
org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor.ONE;
 import static 
org.apache.hadoop.ozone.recon.ReconServerConfigKeys.OZONE_RECON_SCM_DELETED_CONTAINER_CHECK_BATCH_SIZE;
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.ArgumentMatchers.anyLong;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -50,6 +55,7 @@
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.container.ContainerInfo;
 import 
org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
+import org.apache.hadoop.hdds.scm.ha.SCMHADBTransactionBuffer;
 import org.apache.hadoop.ozone.recon.ReconServerConfigKeys;
 import org.apache.hadoop.ozone.recon.metrics.ReconScmContainerSyncMetrics;
 import org.apache.hadoop.ozone.recon.spi.StorageContainerServiceProvider;
@@ -58,6 +64,8 @@
 import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 
 /**
  * Integration tests for {@link ReconStorageContainerSyncHelper} and
@@ -92,8 +100,31 @@ public class TestReconSCMContainerSyncIntegration
   private ReconStorageContainerSyncHelper syncHelper;
 
   @BeforeEach
-  void setupSyncHelper() {
+  void setupSyncHelper() throws IOException {
     mockScm = mock(StorageContainerServiceProvider.class);
+    
when(mockScm.getExistContainerWithPipelinesInBatch(anyList())).thenAnswer(inv 
-> {
+      List<Long> ids = inv.getArgument(0);
+      List<ContainerWithPipeline> containers = new ArrayList<>();
+      for (long id : ids) {
+        ContainerID containerID = ContainerID.valueOf(id);
+        if (getContainerManager().containerExist(containerID)) {
+          ContainerInfo info = getContainerManager().getContainer(containerID);
+          containers.add(new 
ContainerWithPipeline(ContainerInfo.fromProtobuf(info.getProtobuf()), null));
+        }
+      }
+      return containers;
+    });
+    // Unless a test supplies SCM metadata, leave existing containers' flags 
unchanged.
+    when(mockScm.getExistingContainersInBatch(anyList())).thenAnswer(inv -> {
+      List<ContainerID> ids = inv.getArgument(0);
+      List<ContainerInfo> containers = new ArrayList<>();
+      for (ContainerID id : ids) {
+        if (getContainerManager().containerExist(id)) {
+          
containers.add(ContainerInfo.fromProtobuf(getContainerManager().getContainer(id).getProtobuf()));
+        }
+      }
+      return containers;
+    });
     metrics = ReconScmContainerSyncMetrics.create();
     syncHelper = new ReconStorageContainerSyncHelper(
         mockScm, getConf(), getContainerManager(), metrics);
@@ -742,6 +773,151 @@ void partialDeletedListRetiresPresentAndAddsMissing() 
throws Exception {
     }
   }
 
+  // 
===========================================================================
+  // Suppressed flag sync
+  // 
===========================================================================
+
+  @Nested
+  class SuppressedFlagSyncTests {
+
+    @Test
+    void doesNotFetchPipelinesForSuppressedFlags() throws Exception {
+      addSuppressedToRecon(1L);
+
+      assertTrue(syncHelper.syncWithSCMContainerInfo());
+      assertThat(isSuppressedInRecon(1L)).isTrue();
+      verify(mockScm, 
never()).getExistContainerWithPipelinesInBatch(anyList());
+      verify(mockScm, never()).getContainerInfo(anyLong());
+    }
+
+    @ParameterizedTest
+    @ValueSource(booleans = {false, true})
+    void copiesMixedFlagsAcrossBoundedPages(boolean limitedByRpcSize) throws 
Exception {
+      addSuppressedToRecon(1L);
+      addSuppressedToRecon(2L);
+      addSuppressedToRecon(3L);
+      seedRecon(4, 1, CLOSED);
+      addSuppressedToRecon(5L);
+      
getConf().setLong(ReconServerConfigKeys.OZONE_RECON_SCM_CONTAINER_ID_BATCH_SIZE,
 limitedByRpcSize ? 100 : 2);
+      if (limitedByRpcSize) {
+        getConf().setInt(IPC_MAXIMUM_DATA_LENGTH, 2 * 1024);
+      }
+      ReconContainerManager manager = spy(getContainerManager());
+      syncHelper = new ReconStorageContainerSyncHelper(mockScm, getConf(), 
manager, metrics);
+      // A concurrent unsuppression must not hide the remaining entries in 
this or later pages.
+      when(mockScm.getExistingContainersInBatch(idRange(1, 3)))
+          .thenReturn(Arrays.asList(containerInfo(1L, CLOSED), 
suppressed(2L)));
+      when(mockScm.getExistingContainersInBatch(idRange(3, 5)))
+          .thenReturn(Arrays.asList(suppressed(3L), suppressed(4L)));
+      when(mockScm.getExistingContainersInBatch(idRange(5, 6)))
+          .thenReturn(Collections.singletonList(containerInfo(5L, CLOSED)));
+
+      assertTrue(syncHelper.syncWithSCMContainerInfo());
+      assertThat(isSuppressedInRecon(1L)).isFalse();
+      assertThat(isSuppressedInRecon(2L)).isTrue();
+      assertThat(isSuppressedInRecon(3L)).isTrue();
+      assertThat(isSuppressedInRecon(4L)).isTrue();
+      assertThat(isSuppressedInRecon(5L)).isFalse();
+      ((SCMHADBTransactionBuffer) 
manager.getSCMHAManager().getDBTransactionBuffer()).flush();
+      
assertThat(getContainerTable().get(ContainerID.valueOf(4L)).isSuppressed()).isTrue();
+      
assertThat(getContainerTable().get(ContainerID.valueOf(5L)).isSuppressed()).isFalse();
+      verify(manager, never()).getContainers();
+      verify(manager).getContainerIDs(ContainerID.valueOf(1L), 2, null, null);
+      verify(manager).getContainerIDs(ContainerID.valueOf(3L), 2, null, null);
+      verify(manager).getContainerIDs(ContainerID.valueOf(5L), 2, null, null);
+      verify(manager).getContainerIDs(ContainerID.valueOf(6L), 2, null, null);
+      verify(mockScm, times(3)).getExistingContainersInBatch(anyList());
+      verify(mockScm, 
never()).getExistContainerWithPipelinesInBatch(anyList());
+      verify(mockScm, never()).getContainerInfo(anyLong());
+      verify(mockScm, never()).getListOfContainerInfos(any(), anyInt(), any());
+    }
+
+    @Test
+    void copiesSuppressedFlagFromScmToExistingContainers() throws Exception {
+      seedRecon(1, 1, CLOSED);
+      addSuppressedToRecon(2L);
+      when(mockScm.getExistingContainersInBatch(idRange(1, 3)))
+          .thenReturn(Arrays.asList(suppressed(1L), containerInfo(2L, 
CLOSED)));
+
+      assertTrue(syncHelper.syncWithSCMContainerInfo());
+      assertThat(isSuppressedInRecon(1L)).isTrue();
+      assertThat(isSuppressedInRecon(2L)).isFalse();
+
+      when(mockScm.getExistingContainersInBatch(idRange(1, 3)))
+          .thenReturn(Arrays.asList(containerInfo(1L, CLOSED), 
containerInfo(2L, CLOSED)));
+      assertTrue(syncHelper.syncWithSCMContainerInfo());
+      assertThat(isSuppressedInRecon(1L)).isFalse();
+    }
+
+    @Test
+    void copiesFlagsWithoutResolvablePipeline() throws Exception {
+      seedRecon(1, 1, CLOSED);
+      addSuppressedToRecon(2L);
+      when(mockScm.getExistingContainersInBatch(idRange(1, 3)))
+          .thenReturn(Arrays.asList(suppressed(1L), containerInfo(2L, 
CLOSED)));
+
+      assertTrue(syncHelper.syncWithSCMContainerInfo());
+      assertThat(isSuppressedInRecon(1L)).isTrue();
+      assertThat(isSuppressedInRecon(2L)).isFalse();
+    }
+
+    @Test
+    void keepsFlagsWhenScmFetchFails() throws Exception {
+      addSuppressedToRecon(1L);
+      seedRecon(2, 1, CLOSED);
+      when(mockScm.getExistingContainersInBatch(anyList())).thenThrow(new 
IOException("SCM unavailable"));
+
+      assertThat(syncHelper.syncWithSCMContainerInfo()).isFalse();
+      assertThat(isSuppressedInRecon(1L)).isTrue();
+      assertThat(isSuppressedInRecon(2L)).isFalse();
+    }
+
+    @Test
+    void continuesAfterBatchWithNoExistingContainers() throws Exception {
+      addSuppressedToRecon(1L);
+      addSuppressedToRecon(2L);
+      addSuppressedToRecon(3L);
+      
getConf().setLong(ReconServerConfigKeys.OZONE_RECON_SCM_CONTAINER_ID_BATCH_SIZE,
 2);
+      when(mockScm.getExistingContainersInBatch(idRange(1, 
3))).thenReturn(Collections.emptyList());
+      when(mockScm.getExistingContainersInBatch(idRange(3, 4)))
+          .thenReturn(Collections.singletonList(containerInfo(3L, CLOSED)));
+
+      assertTrue(syncHelper.syncWithSCMContainerInfo());
+      assertThat(isSuppressedInRecon(1L)).isTrue();
+      assertThat(isSuppressedInRecon(2L)).isTrue();
+      assertThat(isSuppressedInRecon(3L)).isFalse();
+      verify(mockScm, times(2)).getExistingContainersInBatch(anyList());
+      verify(mockScm, never()).getContainerInfo(anyLong());
+    }
+
+    @Test
+    void keepsFlagWhenContainerIsAbsentInScm() throws Exception {
+      addSuppressedToRecon(1L);
+      
when(mockScm.getExistingContainersInBatch(anyList())).thenReturn(Collections.emptyList());
+
+      assertTrue(syncHelper.syncWithSCMContainerInfo());
+      assertThat(isSuppressedInRecon(1L)).isTrue();
+    }
+
+    private ContainerWithPipeline withPipeline(ContainerInfo info) {
+      return new ContainerWithPipeline(info, null);
+    }
+
+    private ContainerInfo suppressed(long id) {
+      ContainerInfo info = containerInfo(id, CLOSED);
+      info.setSuppressed(true);
+      return info;
+    }
+
+    private void addSuppressedToRecon(long id) throws IOException {
+      getContainerManager().addNewContainer(withPipeline(suppressed(id)));
+    }
+
+    private boolean isSuppressedInRecon(long id) throws IOException {
+      return 
getContainerManager().getContainer(ContainerID.valueOf(id)).isSuppressed();
+    }
+  }
+
   // 
===========================================================================
   // Large-scale tests (100 k+ containers)
   // 
===========================================================================
@@ -1085,8 +1261,9 @@ void allStateTransitionPathsEndToEnd() throws Exception {
             result.add(containerCwp(id, OPEN));
           } else if (id >= dEnd && id < eEnd) {
             result.add(containerCwp(id, QUASI_CLOSED));
+          } else if (id >= eEnd && id < hEnd) {
+            result.add(containerCwp(id, DELETED));
           }
-          // Groups F, G, H are not requested via this API
         }
         return result;
       });
diff --git 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestStorageContainerServiceProviderImpl.java
 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestStorageContainerServiceProviderImpl.java
index 098092e1cd6..e44ae50c29f 100644
--- 
a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestStorageContainerServiceProviderImpl.java
+++ 
b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/spi/impl/TestStorageContainerServiceProviderImpl.java
@@ -31,6 +31,7 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 import static org.mockito.ArgumentMatchers.any;
@@ -75,6 +76,7 @@
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.ScmInfo;
+import org.apache.hadoop.hdds.scm.container.ContainerNotFoundException;
 import org.apache.hadoop.hdds.scm.ha.InterSCMGrpcClient;
 import org.apache.hadoop.hdds.scm.pipeline.Pipeline;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
@@ -82,6 +84,7 @@
 import org.apache.hadoop.hdds.server.http.HttpConfig;
 import org.apache.hadoop.hdds.utils.HddsServerUtil;
 import org.apache.hadoop.hdds.utils.db.DBCheckpoint;
+import org.apache.hadoop.ipc_.RemoteException;
 import org.apache.hadoop.ozone.recon.ReconContext;
 import org.apache.hadoop.ozone.recon.ReconUtils;
 import org.apache.hadoop.ozone.recon.security.ReconCertificateClient;
@@ -147,6 +150,17 @@ public void testGetPipelines() throws IOException {
     verify(scmClient, times(1)).listPipelines();
   }
 
+  @Test
+  void testGetContainerInfoUnwrapsMissingContainer() throws IOException {
+    StorageContainerServiceProvider scmProvider = 
injector.getInstance(StorageContainerServiceProvider.class);
+    StorageContainerLocationInternalInterface scmClient =
+        injector.getInstance(StorageContainerLocationInternalInterface.class);
+    when(scmClient.getContainer(1L)).thenThrow(
+        new RemoteException(ContainerNotFoundException.class.getName(), 
"Container 1 not found"));
+
+    assertThrows(ContainerNotFoundException.class, () -> 
scmProvider.getContainerInfo(1L));
+  }
+
   @Test
   public void testGetPipeline() throws IOException {
     StorageContainerServiceProvider scmProvider =


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to