Skip to content

Commit d383f09

Browse files
authored
HBASE-28184 Tailing the WAL is very slow if there are multiple peers (#5505)
1 parent 4236b70 commit d383f09

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,13 @@ private void dequeueCurrentLog() throws IOException {
258258
private boolean readNextEntryAndRecordReaderPosition() throws IOException {
259259
Entry readEntry = reader.next();
260260
long readerPos = reader.getPosition();
261-
OptionalLong fileLength = walFileLengthProvider.getLogFileSizeIfBeingWritten(currentPath);
261+
OptionalLong fileLength;
262+
if (logQueue.getQueueSize(walGroupId) > 1) {
263+
fileLength = OptionalLong.empty();
264+
} else {
265+
// if there is only one file in queue, check whether it is still being written to
266+
fileLength = walFileLengthProvider.getLogFileSizeIfBeingWritten(currentPath);
267+
}
262268
if (fileLength.isPresent() && readerPos > fileLength.getAsLong()) {
263269
// See HBASE-14004, for AsyncFSWAL which uses fan-out, it is possible that we read uncommitted
264270
// data, so we need to make sure that we do not read beyond the committed file length.

0 commit comments

Comments
 (0)