stalary commented on code in PR #11479:
URL: https://github.com/apache/doris/pull/11479#discussion_r937236862


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/MetaIdGenerator.java:
##########
@@ -41,16 +43,27 @@ public void setEditLog(EditLog editLog) {
 
     // performance is more quickly
     public synchronized long getNextId() {
-        if (nextId < batchEndId) {
-            return nextId++;
-        } else {
+        if (nextId >= batchEndId) {
             batchEndId = batchEndId + BATCH_ID_INTERVAL;
             if (editLog != null) {
                 // add this check just for unit test
                 editLog.logSaveNextId(batchEndId);
             }
-            return nextId++;
         }
+        return nextId++;
+    }
+
+    public synchronized IdGeneratorBuffer getIdGeneratorBuffer(long 
bufferSize) {
+        Preconditions.checkState(bufferSize > 0);
+        IdGeneratorBuffer idGeneratorBuffer = new IdGeneratorBuffer(nextId, 
nextId + bufferSize - 1);

Review Comment:
   I'm a little confused, It looks like we're getting ids in batches, Is the 
number of Editlog calls the same as before?The reason for the improvement is 
that getNextId no longer requires synchronized or reduce the number of Editlog 
calls?



##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalDataSource.java:
##########
@@ -2073,7 +2082,6 @@ private void createOdbcTable(Database db, CreateTableStmt 
stmt) throws DdlExcept
             ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, 
tableName);
         }
         LOG.info("successfully create table[{}-{}]", tableName, tableId);
-        return;
     }
 
     private Table createEsTable(Database db, CreateTableStmt stmt) throws 
DdlException {

Review Comment:
   createEsTable return Table seems not used, Maybe delete it, too.



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to