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:
parent
ac924da7af
commit
3ea120a69b
|
@ -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) {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +145,7 @@ public class TestSnapshotFromClient {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test HBaseAdmin#deleteSnapshots(String) which deletes snapshots whose names match the parameter
|
* Test HBaseAdmin#deleteSnapshots(String) which deletes snapshots whose names match the parameter
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
@ -157,15 +158,15 @@ public class TestSnapshotFromClient {
|
||||||
HTable table = new HTable(UTIL.getConfiguration(), TABLE_NAME);
|
HTable table = new HTable(UTIL.getConfiguration(), TABLE_NAME);
|
||||||
UTIL.loadTable(table, TEST_FAM);
|
UTIL.loadTable(table, TEST_FAM);
|
||||||
table.close();
|
table.close();
|
||||||
|
|
||||||
byte[] snapshot1 = Bytes.toBytes("TableSnapshot1");
|
byte[] snapshot1 = Bytes.toBytes("TableSnapshot1");
|
||||||
admin.snapshot(snapshot1, TABLE_NAME);
|
admin.snapshot(snapshot1, TABLE_NAME);
|
||||||
LOG.debug("Snapshot1 completed.");
|
LOG.debug("Snapshot1 completed.");
|
||||||
|
|
||||||
byte[] snapshot2 = Bytes.toBytes("TableSnapshot2");
|
byte[] snapshot2 = Bytes.toBytes("TableSnapshot2");
|
||||||
admin.snapshot(snapshot2, TABLE_NAME);
|
admin.snapshot(snapshot2, TABLE_NAME);
|
||||||
LOG.debug("Snapshot2 completed.");
|
LOG.debug("Snapshot2 completed.");
|
||||||
|
|
||||||
String snapshot3 = "3rdTableSnapshot";
|
String snapshot3 = "3rdTableSnapshot";
|
||||||
admin.snapshot(Bytes.toBytes(snapshot3), TABLE_NAME);
|
admin.snapshot(Bytes.toBytes(snapshot3), TABLE_NAME);
|
||||||
LOG.debug(snapshot3 + " completed.");
|
LOG.debug(snapshot3 + " completed.");
|
||||||
|
@ -175,7 +176,7 @@ public class TestSnapshotFromClient {
|
||||||
List<SnapshotDescription> snapshots = admin.listSnapshots();
|
List<SnapshotDescription> snapshots = admin.listSnapshots();
|
||||||
assertEquals(1, snapshots.size());
|
assertEquals(1, snapshots.size());
|
||||||
assertEquals(snapshots.get(0).getName(), snapshot3);
|
assertEquals(snapshots.get(0).getName(), snapshot3);
|
||||||
|
|
||||||
admin.deleteSnapshot(snapshot3);
|
admin.deleteSnapshot(snapshot3);
|
||||||
admin.close();
|
admin.close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class TestHLog {
|
||||||
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||||
private static Path hbaseDir;
|
private static Path hbaseDir;
|
||||||
private static Path oldLogDir;
|
private static Path oldLogDir;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -159,7 +159,7 @@ public class TestHLog {
|
||||||
final byte [] tableName = Bytes.toBytes(getName());
|
final byte [] tableName = Bytes.toBytes(getName());
|
||||||
final byte [] rowName = tableName;
|
final byte [] rowName = tableName;
|
||||||
Path logdir = new Path(hbaseDir, HConstants.HREGION_LOGDIR_NAME);
|
Path logdir = new Path(hbaseDir, HConstants.HREGION_LOGDIR_NAME);
|
||||||
HLog log = HLogFactory.createHLog(fs, hbaseDir,
|
HLog log = HLogFactory.createHLog(fs, hbaseDir,
|
||||||
HConstants.HREGION_LOGDIR_NAME, conf);
|
HConstants.HREGION_LOGDIR_NAME, conf);
|
||||||
final int howmany = 3;
|
final int howmany = 3;
|
||||||
HRegionInfo[] infos = new HRegionInfo[3];
|
HRegionInfo[] infos = new HRegionInfo[3];
|
||||||
|
@ -237,7 +237,7 @@ public class TestHLog {
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
HLog wal = HLogFactory.createHLog(fs, dir, "hlogdir", conf);
|
HLog wal = HLogFactory.createHLog(fs, dir, "hlogdir", conf);
|
||||||
|
|
||||||
final int total = 20;
|
final int total = 20;
|
||||||
HLog.Reader reader = null;
|
HLog.Reader reader = null;
|
||||||
|
|
||||||
|
@ -367,10 +367,10 @@ public class TestHLog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We pass different values to recoverFileLease() so that different code paths are covered
|
* We pass different values to recoverFileLease() so that different code paths are covered
|
||||||
*
|
*
|
||||||
* For this test to pass, requires:
|
* For this test to pass, requires:
|
||||||
* 1. HDFS-200 (append support)
|
* 1. HDFS-200 (append support)
|
||||||
* 2. HDFS-988 (SafeMode should freeze file operations
|
* 2. HDFS-988 (SafeMode should freeze file operations
|
||||||
|
@ -506,7 +506,7 @@ public class TestHLog {
|
||||||
HLog log = null;
|
HLog log = null;
|
||||||
try {
|
try {
|
||||||
log = HLogFactory.createHLog(fs, hbaseDir, getName(), conf);
|
log = HLogFactory.createHLog(fs, hbaseDir, getName(), conf);
|
||||||
|
|
||||||
// Write columns named 1, 2, 3, etc. and then values of single byte
|
// Write columns named 1, 2, 3, etc. and then values of single byte
|
||||||
// 1, 2, 3...
|
// 1, 2, 3...
|
||||||
long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
|
@ -652,7 +652,7 @@ public class TestHLog {
|
||||||
final byte [] tableName = Bytes.toBytes("testLogCleaning");
|
final byte [] tableName = Bytes.toBytes("testLogCleaning");
|
||||||
final byte [] tableName2 = Bytes.toBytes("testLogCleaning2");
|
final byte [] tableName2 = Bytes.toBytes("testLogCleaning2");
|
||||||
|
|
||||||
HLog log = HLogFactory.createHLog(fs, hbaseDir,
|
HLog log = HLogFactory.createHLog(fs, hbaseDir,
|
||||||
getName(), conf);
|
getName(), conf);
|
||||||
try {
|
try {
|
||||||
HRegionInfo hri = new HRegionInfo(tableName,
|
HRegionInfo hri = new HRegionInfo(tableName,
|
||||||
|
@ -736,7 +736,7 @@ public class TestHLog {
|
||||||
@Test
|
@Test
|
||||||
public void testWALCoprocessorLoaded() throws Exception {
|
public void testWALCoprocessorLoaded() throws Exception {
|
||||||
// test to see whether the coprocessor is loaded or not.
|
// test to see whether the coprocessor is loaded or not.
|
||||||
HLog log = HLogFactory.createHLog(fs, hbaseDir,
|
HLog log = HLogFactory.createHLog(fs, hbaseDir,
|
||||||
getName(), conf);
|
getName(), conf);
|
||||||
try {
|
try {
|
||||||
WALCoprocessorHost host = log.getCoprocessorHost();
|
WALCoprocessorHost host = log.getCoprocessorHost();
|
||||||
|
@ -760,7 +760,7 @@ public class TestHLog {
|
||||||
log.append(hri, tableName, cols, timestamp, htd);
|
log.append(hri, tableName, cols, timestamp, htd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
@ -953,7 +953,7 @@ public class TestHLog {
|
||||||
@Override
|
@Override
|
||||||
public void logRollRequested() {
|
public void logRollRequested() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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
|
||||||
|
@ -140,7 +140,7 @@ public class TestHLogSplit {
|
||||||
TEST_UTIL.getConfiguration().setClass("hbase.regionserver.hlog.writer.impl",
|
TEST_UTIL.getConfiguration().setClass("hbase.regionserver.hlog.writer.impl",
|
||||||
InstrumentedSequenceFileLogWriter.class, HLog.Writer.class);
|
InstrumentedSequenceFileLogWriter.class, HLog.Writer.class);
|
||||||
TEST_UTIL.getConfiguration().setBoolean("dfs.support.broken.append", true);
|
TEST_UTIL.getConfiguration().setBoolean("dfs.support.broken.append", true);
|
||||||
TEST_UTIL.getConfiguration().setBoolean("dfs.support.append", true);
|
TEST_UTIL.getConfiguration().setBoolean("dfs.support.append", true);
|
||||||
// This is how you turn off shortcircuit read currently. TODO: Fix. Should read config.
|
// This is how you turn off shortcircuit read currently. TODO: Fix. Should read config.
|
||||||
System.setProperty("hbase.tests.use.shortcircuit.reads", "false");
|
System.setProperty("hbase.tests.use.shortcircuit.reads", "false");
|
||||||
// Create fake maping user to group and set it to the conf.
|
// Create fake maping user to group and set it to the conf.
|
||||||
|
@ -888,7 +888,7 @@ public class TestHLogSplit {
|
||||||
fs.initialize(fs.getUri(), conf);
|
fs.initialize(fs.getUri(), conf);
|
||||||
|
|
||||||
final AtomicInteger count = new AtomicInteger();
|
final AtomicInteger count = new AtomicInteger();
|
||||||
|
|
||||||
CancelableProgressable localReporter
|
CancelableProgressable localReporter
|
||||||
= new CancelableProgressable() {
|
= new CancelableProgressable() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
||||||
|
|
Loading…
Reference in New Issue