This is an automated email from the ASF dual-hosted git repository.

shahrs87 pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.5 by this push:
     new d383f09a31b HBASE-28184 Tailing the WAL is very slow if there are 
multiple peers (#5505)
d383f09a31b is described below

commit d383f09a31b238f3b83f58167d0955e23a780c76
Author: Rushabh Shah <[email protected]>
AuthorDate: Tue Nov 7 10:27:55 2023 -0800

    HBASE-28184 Tailing the WAL is very slow if there are multiple peers (#5505)
---
 .../hadoop/hbase/replication/regionserver/WALEntryStream.java     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
index cbaf3c6f6e9..0a778cbb1b8 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/WALEntryStream.java
@@ -258,7 +258,13 @@ class WALEntryStream implements Closeable {
   private boolean readNextEntryAndRecordReaderPosition() throws IOException {
     Entry readEntry = reader.next();
     long readerPos = reader.getPosition();
-    OptionalLong fileLength = 
walFileLengthProvider.getLogFileSizeIfBeingWritten(currentPath);
+    OptionalLong fileLength;
+    if (logQueue.getQueueSize(walGroupId) > 1) {
+      fileLength = OptionalLong.empty();
+    } else {
+      // if there is only one file in queue, check whether it is still being 
written to
+      fileLength = 
walFileLengthProvider.getLogFileSizeIfBeingWritten(currentPath);
+    }
     if (fileLength.isPresent() && readerPos > fileLength.getAsLong()) {
       // See HBASE-14004, for AsyncFSWAL which uses fan-out, it is possible 
that we read uncommitted
       // data, so we need to make sure that we do not read beyond the 
committed file length.

Reply via email to