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


##########
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:
   the time cost for meta management should be as small as possible, because 
the editlog is shared by the whole cluster, when there are many dbs, tables, 
tablets, it is easy to see poor performance for meta-management



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