Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
txId = 0;
txId %= Config.edit_log_roll_num;

Copilot uses AI. Check for mistakes.
}
}

/**
Expand Down
Loading