Skip to content
Merged
Changes from 2 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 @@ -470,7 +470,12 @@ private Pair<WALTailingReader.State, Boolean> readNextEntryAndRecordReaderPositi
// in the future, if we want to optimize the logic here, for example, do not call this method
// every time, or do not acquire rollWriteLock in the implementation of this method, we need to
// carefully review the optimized implementation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: now that we have comments for both if and else, maybe good to remove from here?

OptionalLong fileLength = walFileLengthProvider.getLogFileSizeIfBeingWritten(currentPath);
OptionalLong fileLength = OptionalLong.empty();
if (logQueue.getQueueSize(walGroupId) == 1) {
// Get the size of log file only if there is 1 log file in the queue. If there are
// more than 1 log file in the queue, then the head will never be the current WAL file.
fileLength = walFileLengthProvider.getLogFileSizeIfBeingWritten(currentPath);
}
WALTailingReader.Result readResult = reader.next(fileLength.orElse(-1));
long readerPos = readResult.getEntryEndPos();
Entry readEntry = readResult.getEntry();
Expand Down