You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by sh...@apache.org on 2023/11/07 19:54:24 UTC

(hbase) branch branch-2.4 updated: HBASE-28184 Tailing the WAL is very slow if there are multiple peers (#5505)

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

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


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

commit 4227452f269a6726a8f2b791e050820df0b2d26f
Author: Rushabh Shah <sh...@apache.org>
AuthorDate: Tue Nov 7 10:27:55 2023 -0800

    HBASE-28184 Tailing the WAL is very slow if there are multiple peers (#5505)
    
    (cherry picked from commit d383f09a31b238f3b83f58167d0955e23a780c76)
---
 .../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.