HBASE-8867 HLogUtils#getServerNameFromHLogDirectoryName does not take into account the -splitting extension
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1499923 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b12a1c3e1b
commit
2f6599ef01
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -704,8 +704,8 @@ 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));
|
||||
|
@ -717,11 +717,18 @@ public class TestHLog {
|
|||
Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf, hl + "qdf"));
|
||||
Assert.assertNull(HLogUtil.getServerNameFromHLogDirectoryName(conf, "sfqf" + hl + "qdf"));
|
||||
|
||||
Assert.assertNotNull( HLogUtil.getServerNameFromHLogDirectoryName(conf,
|
||||
ServerName parsed = HLogUtil.getServerNameFromHLogDirectoryName(conf,
|
||||
FSUtils.getRootDir(conf).toUri().toString() +
|
||||
"/.logs/localhost,32984,1343316388997/localhost%2C32984%2C1343316388997.1343316390417"
|
||||
));
|
||||
Assert.assertNotNull( HLogUtil.getServerNameFromHLogDirectoryName(conf, hl+"/qdf") );
|
||||
"/.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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue