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

smengcl 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 c6d79bb01f8 HDDS-16924. Serve SCM checkpoints from the current DB 
store after a checkpoint install (#11595)
c6d79bb01f8 is described below

commit c6d79bb01f8cefef685826241c1a21da2782227a
Author: Siyao Meng <[email protected]>
AuthorDate: Mon Oct 19 21:34:12 2026 -0700

    HDDS-16924. Serve SCM checkpoints from the current DB store after a 
checkpoint install (#11595)
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 .../apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java   | 16 ++++++----------
 .../apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java   |  5 +++++
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java
index 9a472be921c..f419bf0ad11 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java
@@ -28,7 +28,7 @@
 import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.hdds.utils.HAUtils;
 import org.apache.hadoop.hdds.utils.TransactionInfo;
-import org.apache.hadoop.hdds.utils.db.Table;
+import org.apache.hadoop.hdds.utils.db.DBStore;
 import org.apache.ratis.thirdparty.io.grpc.stub.StreamObserver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -44,17 +44,11 @@ public class InterSCMGrpcService extends
 
   private static final int BUFFER_SIZE = 1024 * 1024;
 
-  private final SCMDBCheckpointProvider provider;
-
   private final StorageContainerManager scm;
-  private final Table<String, TransactionInfo> transactionInfoTable;
 
-  InterSCMGrpcService(final StorageContainerManager scm) throws IOException {
+  InterSCMGrpcService(final StorageContainerManager scm) {
     Objects.requireNonNull(scm, "scm");
     this.scm = scm;
-    this.transactionInfoTable = HAUtils.getTransactionInfoTable(
-        scm.getScmMetadataStore().getStore(), SCMDBDefinition.get());
-    this.provider = new 
SCMDBCheckpointProvider(scm.getScmMetadataStore().getStore());
   }
 
   @Override
@@ -62,13 +56,15 @@ public void download(CopyDBCheckpointRequestProto request,
       StreamObserver<CopyDBCheckpointResponseProto> responseObserver) {
     try {
       scm.getScmHAManager().asSCMHADBTransactionBuffer().flush();
+      // Look up the store per request because installing a checkpoint 
replaces it.
+      final DBStore store = scm.getScmMetadataStore().getStore();
       TransactionInfo transactionInfo =
-          transactionInfoTable.get(TRANSACTION_INFO_KEY);
+          HAUtils.getTransactionInfoTable(store, 
SCMDBDefinition.get()).get(TRANSACTION_INFO_KEY);
       Objects.requireNonNull(transactionInfo, "transactionInfo");
       SCMGrpcOutputStream outputStream =
           new SCMGrpcOutputStream(responseObserver, scm.getClusterId(),
               BUFFER_SIZE);
-      provider.writeDBCheckPointToSream(outputStream, request.getFlush());
+      new 
SCMDBCheckpointProvider(store).writeDBCheckPointToSream(outputStream, 
request.getFlush());
 
     } catch (IOException e) {
       LOG.error("Error streaming SCM DB checkpoint", e);
diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java
index 53a2f75af22..b1e88018b67 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/TestSCMInstallSnapshot.java
@@ -165,5 +165,10 @@ public void testInstallCheckPoint() throws Exception {
     assertEquals(100,
         scm.getScmHAManager().asSCMHADBTransactionBuffer().getLatestTrxInfo()
             .getTermIndex().getIndex());
+
+    // The SCM must serve checkpoints of the installed DB, not of the closed 
one.
+    DBCheckpoint served = 
scm.getScmHAManager().getSCMSnapshotProvider().getSCMDBSnapshot("scm1");
+    assertEquals(100, HAUtils.getTrxnInfoFromCheckpoint(conf, 
served.getCheckpointLocation(), SCMDBDefinition.get())
+        .getTransactionIndex());
   }
 }


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

Reply via email to