Copilot commented on code in PR #62060:
URL: https://github.com/apache/doris/pull/62060#discussion_r3028449293


##########
fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java:
##########
@@ -1558,6 +1558,12 @@ private <T extends Writable> void logEdit(short op, 
List<T> entries) throws IOEx
             journal.write(batch);
         }
         txId += entries.size();
+        if (txId >= Config.edit_log_roll_num) {
+            LOG.info("txId {} is equal to or larger than edit_log_roll_num {}, 
will roll edit.",
+                    txId, Config.edit_log_roll_num);
+            rollEditLog();
+            txId = 0;

Review Comment:
   Resetting `txId` to `0` after rolling can drop any remainder when 
`entries.size()` pushes `txId` past the threshold by more than the exact roll 
amount (e.g., `txId` goes from 90 to 190 with roll=100). This can delay the 
next roll because the extra 90 transactions are effectively forgotten. Consider 
preserving the remainder (e.g., `txId %= Config.edit_log_roll_num` or `txId -= 
Config.edit_log_roll_num` in a loop if multiple thresholds can be crossed) so 
rolling behavior is consistent with the configured transaction count.
   ```suggestion
               txId %= Config.edit_log_roll_num;
   ```



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

Reply via email to