HBASE-4025 Server startup fails during startup due to failure in loading

all table descriptors. (Subbu Iyer via Ted Yu)



git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1139552 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2011-06-25 15:21:20 +00:00
parent a769d1e10d
commit 93b2e8d2bc
4 changed files with 26 additions and 11 deletions

View File

@ -292,6 +292,8 @@ Release 0.91.0 - Unreleased
HBASE-3970 Address HMaster crash/failure half way through meta migration
(Subbu M Iyer)
HBASE-4013 Make ZooKeeperListener Abstract (Akash Ashok via Ted Yu)
HBASE-4025 Server startup fails during startup due to failure in loading
all table descriptors. (Subbu Iyer via Ted Yu)
NEW FEATURES
HBASE-2001 Coprocessors: Colocate user code with regions (Mingjie Lai via

View File

@ -22,6 +22,10 @@ package org.apache.hadoop.hbase;
import org.apache.hadoop.hbase.ipc.HRegionInterface;
import org.apache.hadoop.hbase.util.Bytes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* HConstants holds a bunch of HBase-related constants
*/
@ -142,7 +146,7 @@ public final class HConstants {
/** Default value for thread wake frequency */
public static final int DEFAULT_THREAD_WAKE_FREQUENCY = 10 * 1000;
/** Parameter name for how often a region should should perform a major compaction */
public static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction";
@ -456,7 +460,7 @@ public final class HConstants {
* timeout for each RPC
*/
public static String HBASE_RPC_TIMEOUT_KEY = "hbase.rpc.timeout";
/**
* Default value of {@link #HBASE_RPC_TIMEOUT_KEY}
*/
@ -482,6 +486,10 @@ 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-"}));
private HConstants() {
// Can't be instantiated with this ctor.
}

View File

@ -114,6 +114,11 @@ public class FSTableDescriptors implements TableDescriptors {
cachehits++;
return HTableDescriptor.META_TABLEDESC;
}
// .META. and -ROOT- is already handled. If some one tries to get the descriptor for
// .logs, .oldlogs or .corrupt throw an exception.
if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tablename)) {
throw new IOException("No descriptor found for table = " + tablename);
}
// Look in cache of descriptors.
TableDescriptorModtime tdm = this.cache.get(tablename);
@ -161,6 +166,9 @@ public class FSTableDescriptors implements TableDescriptors {
if (Bytes.equals(HConstants.META_TABLE_NAME, htd.getName())) {
throw new NotImplementedException();
}
if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(htd.getNameAsString())) {
throw new NotImplementedException();
}
if (!this.fsreadonly) FSUtils.updateHTableDescriptor(this.fs, this.rootdir, htd);
long modtime =
FSUtils.getTableInfoModtime(this.fs, this.rootdir, htd.getNameAsString());
@ -181,4 +189,4 @@ public class FSTableDescriptors implements TableDescriptors {
TableDescriptorModtime tdm = this.cache.remove(tablename);
return tdm == null? null: tdm.getTableDescriptor();
}
}
}

View File

@ -840,7 +840,8 @@ public class FSUtils {
/**
* @param fs
* @param rootdir
* @return All the table directories under <code>rootdir</code>
* @return All the table directories under <code>rootdir</code>. Ignore non table hbase folders such as
* .logs, .oldlogs, .corrupt, .META., and -ROOT- folders.
* @throws IOException
*/
public static List<Path> getTableDirs(final FileSystem fs, final Path rootdir)
@ -851,13 +852,9 @@ public class FSUtils {
for (FileStatus dir: dirs) {
Path p = dir.getPath();
String tableName = p.getName();
if (tableName.equals(HConstants.HREGION_LOGDIR_NAME) ||
tableName.equals(Bytes.toString(HConstants.ROOT_TABLE_NAME)) ||
tableName.equals(Bytes.toString(HConstants.META_TABLE_NAME)) ||
tableName.equals(HConstants.HREGION_OLDLOGDIR_NAME) ) {
continue;
if (!HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tableName)) {
tabledirs.add(p);
}
tabledirs.add(p);
}
return tabledirs;
}
@ -1056,4 +1053,4 @@ public class FSUtils {
out.close();
}
}
}
}