xiaoyuyao commented on a change in pull request #1969:
URL: https://github.com/apache/ozone/pull/1969#discussion_r583757798



##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java
##########
@@ -58,22 +61,43 @@ public void storeValidCertificate(BigInteger serialID,
     lock.lock();
     try {
       // This makes sure that no certificate IDs are reusable.
-      if ((getCertificateByID(serialID, CertType.VALID_CERTS) == null) &&
-          (getCertificateByID(serialID, CertType.REVOKED_CERTS) == null)) {
-        scmMetadataStore.getValidCertsTable().put(serialID, certificate);
-      } else {
-        throw new SCMSecurityException("Conflicting certificate ID");
-      }
+      checkValidCertID(serialID);
+      scmMetadataStore.getValidCertsTable().put(serialID, certificate);
     } finally {
       lock.unlock();
     }
   }
 
+  @Override
+  public void storeValidScmCertificate(BigInteger serialID,

Review comment:
       Can we add a storeValidCertificate method with a nodeType parameter 
instead of storeValidScmCertificate to avoid adding more interface changes in 
the future?

##########
File path: 
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java
##########
@@ -58,22 +61,43 @@ public void storeValidCertificate(BigInteger serialID,
     lock.lock();
     try {
       // This makes sure that no certificate IDs are reusable.
-      if ((getCertificateByID(serialID, CertType.VALID_CERTS) == null) &&
-          (getCertificateByID(serialID, CertType.REVOKED_CERTS) == null)) {
-        scmMetadataStore.getValidCertsTable().put(serialID, certificate);
-      } else {
-        throw new SCMSecurityException("Conflicting certificate ID");
-      }
+      checkValidCertID(serialID);
+      scmMetadataStore.getValidCertsTable().put(serialID, certificate);
     } finally {
       lock.unlock();
     }
   }
 
+  @Override
+  public void storeValidScmCertificate(BigInteger serialID,

Review comment:
       updated.




----------------------------------------------------------------
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.

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