ss77892 commented on code in PR #10916:
URL: https://github.com/apache/ozone/pull/10916#discussion_r3709291065


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SequenceIdGenerator.java:
##########
@@ -180,6 +180,44 @@ public void reinitialize(Table<SequenceIdType, Long> 
sequenceIdTable)
     }
   }
 
+  /**
+   * Allocate the next CertificateId directly against the CertificateId row
+   * of {@link SCMMetadataStore#getSequenceIdTable()}, bypassing Ratis. This
+   * is used for leaderless bootstrap certificate signing, where no Ratis
+   * leader is available yet.
+   *
+   * The live StateManager cache and any un-exhausted batch are refreshed
+   * under the same lock, so that a later Ratis-based allocation of
+   * CertificateId (e.g. after a leader election) cannot CAS a stale cached
+   * lastId and reissue the value handed out here.
+   *
+   * @param scmMetadataStore : the SCMMetadataStore to allocate against.
+   * @return the newly allocated CertificateId.
+   */
+  public long getNextCertificateIdWithoutRatis(SCMMetadataStore 
scmMetadataStore)
+      throws IOException {
+    lock.lock();
+    try {
+      // Re-derive the CertificateId row from existing certificates if missing.
+      upgradeToCertificateSequenceId(scmMetadataStore, false);
+
+      Table<SequenceIdType, Long> sequenceIdTable = 
scmMetadataStore.getSequenceIdTable();
+      Long lastId = sequenceIdTable.get(SequenceIdType.CertificateId);

Review Comment:
   Well, the expectation is that it's the first time certificates are issued. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to