HBASE-4061 getTableDirs is missing directories to skip

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1143557 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-07-06 20:43:47 +00:00
parent db0cd694b2
commit a161fad751
5 changed files with 19 additions and 7 deletions

View File

@ -151,6 +151,7 @@ Release 0.91.0 - Unreleased
HBASE-3904 HBA.createTable(final HTableDescriptor desc, byte [][] splitKeys)
should be synchronous
HBASE-4053 Most of the regions were added into AssignmentManager#servers twice
HBASE-4061 getTableDirs is missing directories to skip
IMPROVEMENTS
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)

View File

@ -169,6 +169,11 @@ public final class HConstants {
* Use '.' as a special character to seperate the log files from table data */
public static final String HREGION_LOGDIR_NAME = ".logs";
/** Used to construct the name of the splitlog directory for a region server */
public static final String SPLIT_LOGDIR_NAME = "splitlog";
public static final String CORRUPT_DIR_NAME = ".corrupt";
/** Like the previous, but for old logs that are about to be deleted */
public static final String HREGION_OLDLOGDIR_NAME = ".oldlogs";
@ -487,8 +492,9 @@ public final class HConstants {
public static final float HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD = 0.2f;
public static final List<String> HBASE_NON_USER_TABLE_DIRS = new ArrayList<String>(
Arrays.asList(new String[]{".logs", ".oldlogs",
".corrupt", ".META.", "-ROOT-"}));
Arrays.asList(new String[]{ HREGION_LOGDIR_NAME, HREGION_OLDLOGDIR_NAME,
CORRUPT_DIR_NAME, Bytes.toString(META_TABLE_NAME),
Bytes.toString(ROOT_TABLE_NAME), SPLIT_LOGDIR_NAME }));
private HConstants() {
// Can't be instantiated with this ctor.

View File

@ -710,13 +710,17 @@ public class FSUtils {
}
public boolean accept(Path p) {
boolean isdir = false;
boolean isValid = false;
try {
isdir = this.fs.getFileStatus(p).isDir();
if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(p)) {
isValid = false;
} else {
isValid = this.fs.getFileStatus(p).isDir();
}
} catch (IOException e) {
e.printStackTrace();
}
return isdir;
return isValid;
}
}

View File

@ -33,6 +33,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.master.SplitLogManager;
import org.apache.hadoop.hbase.regionserver.SplitLogWorker;
import org.apache.hadoop.hbase.util.Bytes;
@ -151,7 +152,7 @@ public class ZKSplitLog {
}
public static Path getSplitLogDir(Path rootdir, String tmpname) {
return new Path(new Path(rootdir, "splitlog"), tmpname);
return new Path(new Path(rootdir, HConstants.SPLIT_LOGDIR_NAME), tmpname);
}
public static Path stripSplitLogTempDir(Path rootdir, Path file) {

View File

@ -211,7 +211,7 @@ public class ZooKeeperWatcher implements Watcher, Abortable {
clusterIdZNode = ZKUtil.joinZNode(baseZNode,
conf.get("zookeeper.znode.clusterId", "hbaseid"));
splitLogZNode = ZKUtil.joinZNode(baseZNode,
conf.get("zookeeper.znode.splitlog", "splitlog"));
conf.get("zookeeper.znode.splitlog", HConstants.SPLIT_LOGDIR_NAME));
}
/**