hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nkey...@apache.org
Subject svn commit: r1499923 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/regionserver/wal/HLogUtil.java test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
Date Fri, 05 Jul 2013 07:35:00 GMT
Author: nkeywal
Date: Fri Jul  5 07:35:00 2013
New Revision: 1499923

URL: http://svn.apache.org/r1499923
Log:
HBASE-8867  HLogUtils#getServerNameFromHLogDirectoryName does not take into account the -splitting
extension

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogUtil.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogUtil.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogUtil.java?rev=1499923&r1=1499922&r2=1499923&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogUtil.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogUtil.java
Fri Jul  5 07:35:00 2013
@@ -159,14 +159,8 @@ public class HLogUtil {
       return null;
     }
 
-    final String serverName = serverNameAndFile.substring(0,
-        serverNameAndFile.indexOf('/') - 1);
-
-    if (!ServerName.isFullServerName(serverName)) {
-      return null;
-    }
-
-    return ServerName.parseServerName(serverName);
+    Path p = new Path(path);
+    return getServerNameFromHLogDirectoryName(p);
   }
 
   /**

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java?rev=1499923&r1=1499922&r2=1499923&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestHLog.java
Fri Jul  5 07:35:00 2013
@@ -704,24 +704,31 @@ public class TestHLog  {
 
   @Test
   public void testGetServerNameFromHLogDirectoryName() throws IOException {
-    String hl = FSUtils.getRootDir(conf) + "/"+
-        HLogUtil.getHLogDirectoryName(new ServerName("hn", 450, 1398).toString());
+    ServerName sn = new ServerName("hn", 450, 1398);
+    String hl = FSUtils.getRootDir(conf) + "/" + HLogUtil.getHLogDirectoryName(sn.toString());
 
     // Must not throw exception
     Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf, null));
     Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf,
         FSUtils.getRootDir(conf).toUri().toString()));
-    Assert.assertNull( HLogUtil.getServerNameFromHLogDirectoryName(conf, "") );
-    Assert.assertNull( HLogUtil.getServerNameFromHLogDirectoryName(conf, "              
   ") );
-    Assert.assertNull( HLogUtil.getServerNameFromHLogDirectoryName(conf, hl) );
-    Assert.assertNull( HLogUtil.getServerNameFromHLogDirectoryName(conf, hl+"qdf") );
-    Assert.assertNull( HLogUtil.getServerNameFromHLogDirectoryName(conf, "sfqf"+hl+"qdf")
);
-
-    Assert.assertNotNull( HLogUtil.getServerNameFromHLogDirectoryName(conf,
-      FSUtils.getRootDir(conf).toUri().toString() +
-        "/.logs/localhost,32984,1343316388997/localhost%2C32984%2C1343316388997.1343316390417"
-        ));
-    Assert.assertNotNull( HLogUtil.getServerNameFromHLogDirectoryName(conf, hl+"/qdf") );
+    Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf, ""));
+    Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf, "               
  "));
+    Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf, hl));
+    Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf, hl + "qdf"));
+    Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf, "sfqf" + hl + "qdf"));
+
+    ServerName parsed = HLogUtil.getServerNameFromHLogDirectoryName(conf,
+        FSUtils.getRootDir(conf).toUri().toString() +
+            "/.logs/" + sn + "/localhost%2C32984%2C1343316388997.1343316390417");
+    Assert.assertEquals("standard",  sn, parsed);
+
+    parsed = HLogUtil.getServerNameFromHLogDirectoryName(conf, hl + "/qdf");
+    Assert.assertEquals("subdir", sn, parsed);
+
+    parsed = HLogUtil.getServerNameFromHLogDirectoryName(conf,
+        FSUtils.getRootDir(conf).toUri().toString() +
+            "/.logs/" + sn + "-splitting/localhost%3A57020.1340474893931");
+    Assert.assertEquals("split", sn, parsed);
   }
 
   /**



Mime
View raw message