szetszwo commented on code in PR #10211:
URL: https://github.com/apache/ozone/pull/10211#discussion_r3210641284
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SequenceIdGenerator.java:
##########
@@ -128,18 +128,18 @@ public long getNextId(String sequenceIdName) throws
SCMException {
Preconditions.checkArgument(Long.MAX_VALUE - batch.lastId >=
batchSize);
long nextLastId = batch.lastId +
- ((sequenceIdName.equals(CERTIFICATE_ID)) ? 1 : batchSize);
+ (idType == SequenceIdType.CERTIFICATE_ID ? 1 : batchSize);
- if (stateManager.allocateBatch(sequenceIdName,
+ if (stateManager.allocateBatch(idType.getDbKey(),
prevLastId, nextLastId)) {
batch.lastId = nextLastId;
LOG.info("Allocate a batch for {}, change lastId from {} to {}.",
- sequenceIdName, prevLastId, batch.lastId);
+ idType, prevLastId, batch.lastId);
break;
}
// reload lastId from RocksDB.
- batch.lastId = stateManager.getLastId(sequenceIdName);
+ batch.lastId = stateManager.getLastId(idType.getDbKey());
Review Comment:
- Change the parameter to SequenceIdType
- Change StateManagerImpl.sequenceIdToLastIdMap key to SequenceIdType
--
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]