You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/03/23 04:46:56 UTC

[GitHub] [hbase] ddupg commented on a change in pull request #3045: HBASE-24737 Find a way to resolve WALFileLengthProvider#getLogFileSiz…

ddupg commented on a change in pull request #3045:
URL: https://github.com/apache/hbase/pull/3045#discussion_r599267260



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALProvider.java
##########
@@ -130,7 +130,12 @@ void init(WALFactory factory, Configuration conf, String providerId, Abortable s
   void addWALActionsListener(WALActionsListener listener);
 
   default WALFileLengthProvider getWALFileLengthProvider() {
-    return path -> getWALs().stream().map(w -> w.getLogFileSizeIfBeingWritten(path))
-        .filter(o -> o.isPresent()).findAny().orElse(OptionalLong.empty());
+    return path -> getWALs().stream().map(w -> {
+      try {
+        return w.getLogFileSizeIfBeingWritten(path);
+      } catch (IOException e) {
+        return OptionalLong.empty();

Review comment:
       Thanks @Apache9  for reviewing.
   In this PR, I introduce `RemoteWALFileLengthProvider` implementing WALFileLengthProvider, it is hold by ReplicationServer and gets the length of wals from RS through RPC,  it may throw an IOE. So I need declare `WALFileLengthProvider.getLogFileSizeIfBeingWritten` as throwing IOException.
   But this is safe here, `WALProvider` is only used by RS, `getWALs` returns `WAL` that `extents WALFileLengthProvider` and won't throw IOE.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org