bharatviswa504 commented on a change in pull request #1969:
URL: https://github.com/apache/ozone/pull/1969#discussion_r584462461
##########
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:
Done
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java
##########
@@ -122,19 +150,16 @@ public X509Certificate getCertificateByID(BigInteger
serialID,
public List<X509Certificate> listCertificate(HddsProtos.NodeType role,
Review comment:
Added tests.
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java
##########
@@ -122,19 +150,16 @@ public X509Certificate getCertificateByID(BigInteger
serialID,
public List<X509Certificate> listCertificate(HddsProtos.NodeType role,
BigInteger startSerialID, int count, CertType certType)
throws IOException {
- // TODO: Filter by role
List<? extends Table.KeyValue<BigInteger, X509Certificate>> certs;
+
if (startSerialID.longValue() == 0) {
startSerialID = null;
}
- if (certType == CertType.VALID_CERTS) {
- certs = scmMetadataStore.getValidCertsTable().getRangeKVs(
- startSerialID, count);
- } else {
- certs = scmMetadataStore.getRevokedCertsTable().getRangeKVs(
- startSerialID, count);
- }
+
+ certs = getCertTableList(role, certType, startSerialID, count);
+
List<X509Certificate> results = new ArrayList<>(certs.size());
+
for (Table.KeyValue<BigInteger, X509Certificate> kv : certs) {
try {
X509Certificate cert = kv.getValue();
Review comment:
Removed it.
----------------------------------------------------------------
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]