hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject hbase git commit: HBASE-17677 ServerName parsing from directory name should be more robust to errors from guava's HostAndPort
Date Thu, 23 Feb 2017 03:03:24 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 0285cb8c4 -> 040b2f186


HBASE-17677 ServerName parsing from directory name should be more robust to errors from guava's
HostAndPort

Signed-off-by: Michael Stack <stack@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/040b2f18
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/040b2f18
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/040b2f18

Branch: refs/heads/master
Commit: 040b2f186a08222fc0a0b3bd5c97ccef9cf45368
Parents: 0285cb8
Author: Sean Busbey <busbey@apache.org>
Authored: Wed Feb 22 13:31:51 2017 -0600
Committer: Sean Busbey <busbey@apache.org>
Committed: Wed Feb 22 20:53:57 2017 -0600

----------------------------------------------------------------------
 .../hadoop/hbase/wal/AbstractFSWALProvider.java      |  2 +-
 .../org/apache/hadoop/hbase/wal/TestWALMethods.java  | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/040b2f18/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractFSWALProvider.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractFSWALProvider.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractFSWALProvider.java
index 35a1176..bdd319d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractFSWALProvider.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractFSWALProvider.java
@@ -346,7 +346,7 @@ public abstract class AbstractFSWALProvider<T extends AbstractFSWAL<?>>
implemen
     }
     try {
       serverName = ServerName.parseServerName(logDirName);
-    } catch (IllegalArgumentException ex) {
+    } catch (IllegalArgumentException|IllegalStateException ex) {
       serverName = null;
       LOG.warn("Cannot parse a server name from path=" + logFile + "; " + ex.getMessage());
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/040b2f18/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALMethods.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALMethods.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALMethods.java
index f45da75..1cacc74 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALMethods.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestWALMethods.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.KeyValueTestUtil;
+import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 // imports for things that haven't moved from regionserver.wal yet.
 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
@@ -58,6 +59,20 @@ public class TestWALMethods {
 
   private final HBaseTestingUtility util = new HBaseTestingUtility();
 
+  @Test
+  public void testServerNameFromWAL() throws Exception {
+    Path walPath = new Path("/hbase/WALs/regionserver-2.example.com,22101,1487767381290",
"regionserver-2.example.com%2C22101%2C1487767381290.null0.1487785392316");
+    ServerName name = AbstractFSWALProvider.getServerNameFromWALDirectoryName(walPath);
+    assertEquals(ServerName.valueOf("regionserver-2.example.com", 22101, 1487767381290L),
name);
+  }
+
+  @Test
+  public void testServerNameFromTestWAL() throws Exception {
+    Path walPath = new Path("/user/example/test-data/12ff1404-68c6-4715-a4b9-775e763842bc/WALs/TestWALRecordReader",
"TestWALRecordReader.default.1487787939118");
+    ServerName name = AbstractFSWALProvider.getServerNameFromWALDirectoryName(walPath);
+    assertNull(name);
+  }
+
   /**
    * Assert that getSplitEditFilesSorted returns files in expected order and
    * that it skips moved-aside files.


Mime
View raw message