HBASE-8986 Replace hardcoded special file/dir names with the relative HConstant

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1504652 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
mbertozzi 2013-07-18 20:47:38 +00:00
parent ac924da7af
commit 3ea120a69b
10 changed files with 33 additions and 28 deletions

View File

@ -503,7 +503,7 @@ public class HBaseFsck extends Configured implements Tool {
for (FileStatus cf : dirs) { for (FileStatus cf : dirs) {
String cfName= cf.getPath().getName(); String cfName= cf.getPath().getName();
// TODO Figure out what the special dirs are // TODO Figure out what the special dirs are
if (cfName.startsWith(".") || cfName.equals("splitlog")) continue; if (cfName.startsWith(".") || cfName.equals(HConstants.SPLIT_LOGDIR_NAME)) continue;
FileStatus[] hfiles = fs.listStatus(cf.getPath()); FileStatus[] hfiles = fs.listStatus(cf.getPath());
for (FileStatus hfile : hfiles) { for (FileStatus hfile : hfiles) {

View File

@ -394,7 +394,8 @@ public class TestHFileArchiving {
} }
private void clearArchiveDirectory() throws IOException { private void clearArchiveDirectory() throws IOException {
UTIL.getTestFileSystem().delete(new Path(UTIL.getDefaultRootDirPath(), ".archive"), true); UTIL.getTestFileSystem().delete(
new Path(UTIL.getDefaultRootDirPath(), HConstants.HFILE_ARCHIVE_DIRECTORY), true);
} }
/** /**

View File

@ -102,7 +102,8 @@ public class TestSnapshotCloneIndependence {
UTIL.deleteTable(TABLE_NAME); UTIL.deleteTable(TABLE_NAME);
// and cleanup the archive directory // and cleanup the archive directory
try { try {
UTIL.getTestFileSystem().delete(new Path(UTIL.getDefaultRootDirPath(), ".archive"), true); UTIL.getTestFileSystem().delete(
new Path(UTIL.getDefaultRootDirPath(), HConstants.HFILE_ARCHIVE_DIRECTORY), true);
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failure to delete archive directory", e); LOG.warn("Failure to delete archive directory", e);
} }

View File

@ -103,7 +103,8 @@ public class TestSnapshotFromClient {
UTIL.deleteTable(TABLE_NAME); UTIL.deleteTable(TABLE_NAME);
// and cleanup the archive directory // and cleanup the archive directory
try { try {
UTIL.getTestFileSystem().delete(new Path(UTIL.getDefaultRootDirPath(), ".archive"), true); UTIL.getTestFileSystem().delete(
new Path(UTIL.getDefaultRootDirPath(), HConstants.HFILE_ARCHIVE_DIRECTORY), true);
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failure to delete archive directory", e); LOG.warn("Failure to delete archive directory", e);
} }

View File

@ -75,7 +75,7 @@ public class TestSnapshotLogCleaner {
fs.create(new Path(hostSnapshotLogDir, snapshotlogfile)); fs.create(new Path(hostSnapshotLogDir, snapshotlogfile));
// now check to see if that log file would get deleted. // now check to see if that log file would get deleted.
Path oldlogDir = new Path(rootDir, ".oldlogs"); Path oldlogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);
Path logFile = new Path(oldlogDir, snapshotlogfile); Path logFile = new Path(oldlogDir, snapshotlogfile);
fs.create(logFile); fs.create(logFile);

View File

@ -120,7 +120,7 @@ public class TestHLog {
fs = cluster.getFileSystem(); fs = cluster.getFileSystem();
hbaseDir = TEST_UTIL.createRootDir(); hbaseDir = TEST_UTIL.createRootDir();
oldLogDir = new Path(hbaseDir, ".oldlogs"); oldLogDir = new Path(hbaseDir, HConstants.HREGION_OLDLOGDIR_NAME);
dir = new Path(hbaseDir, getName()); dir = new Path(hbaseDir, getName());
} }
@AfterClass @AfterClass

View File

@ -109,7 +109,7 @@ public class TestHLogSplit {
private static final Path HBASEDIR = new Path("/hbase"); private static final Path HBASEDIR = new Path("/hbase");
private static final Path HLOGDIR = new Path(HBASEDIR, "hlog"); private static final Path HLOGDIR = new Path(HBASEDIR, "hlog");
private static final Path OLDLOGDIR = new Path(HBASEDIR, "hlog.old"); private static final Path OLDLOGDIR = new Path(HBASEDIR, "hlog.old");
private static final Path CORRUPTDIR = new Path(HBASEDIR, ".corrupt"); private static final Path CORRUPTDIR = new Path(HBASEDIR, HConstants.CORRUPT_DIR_NAME);
private static final int NUM_WRITERS = 10; private static final int NUM_WRITERS = 10;
private static final int ENTRIES = 10; // entries per writer per region private static final int ENTRIES = 10; // entries per writer per region
@ -1232,7 +1232,7 @@ public class TestHLogSplit {
HLogSplitter.split(HBASEDIR, HLOGDIR, OLDLOGDIR, fs, conf); HLogSplitter.split(HBASEDIR, HLOGDIR, OLDLOGDIR, fs, conf);
final Path corruptDir = new Path(FSUtils.getRootDir(conf), conf.get( final Path corruptDir = new Path(FSUtils.getRootDir(conf), conf.get(
"hbase.regionserver.hlog.splitlog.corrupt.dir", ".corrupt")); "hbase.regionserver.hlog.splitlog.corrupt.dir", HConstants.CORRUPT_DIR_NAME));
assertEquals(1, fs.listStatus(corruptDir).length); assertEquals(1, fs.listStatus(corruptDir).length);
} }

View File

@ -248,7 +248,8 @@ public class TestExportSnapshot {
for (FileStatus fileStatus: rootFiles) { for (FileStatus fileStatus: rootFiles) {
String name = fileStatus.getPath().getName(); String name = fileStatus.getPath().getName();
assertTrue(fileStatus.isDir()); assertTrue(fileStatus.isDir());
assertTrue(name.equals(HConstants.SNAPSHOT_DIR_NAME) || name.equals(".archive")); assertTrue(name.equals(HConstants.SNAPSHOT_DIR_NAME) ||
name.equals(HConstants.HFILE_ARCHIVE_DIRECTORY));
} }
// compare the snapshot metadata and verify the hfiles // compare the snapshot metadata and verify the hfiles

View File

@ -123,7 +123,8 @@ public class TestFlushSnapshotFromClient {
UTIL.deleteTable(TABLE_NAME); UTIL.deleteTable(TABLE_NAME);
// and cleanup the archive directory // and cleanup the archive directory
try { try {
UTIL.getTestFileSystem().delete(new Path(UTIL.getDefaultRootDirPath(), ".archive"), true); UTIL.getTestFileSystem().delete(
new Path(UTIL.getDefaultRootDirPath(), HConstants.HFILE_ARCHIVE_DIRECTORY), true);
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Failure to delete archive directory", e); LOG.warn("Failure to delete archive directory", e);
} }

View File

@ -55,7 +55,7 @@ public class TestWALReferenceTask {
// setup the log dir // setup the log dir
Path testDir = UTIL.getDataTestDir(); Path testDir = UTIL.getDataTestDir();
Set<String> servers = new HashSet<String>(); Set<String> servers = new HashSet<String>();
Path logDir = new Path(testDir, ".logs"); Path logDir = new Path(testDir, HConstants.HREGION_LOGDIR_NAME);
Path server1Dir = new Path(logDir, "Server1"); Path server1Dir = new Path(logDir, "Server1");
servers.add(server1Dir.getName()); servers.add(server1Dir.getName());
Path server2Dir = new Path(logDir, "me.hbase.com,56073,1348618509968"); Path server2Dir = new Path(logDir, "me.hbase.com,56073,1348618509968");