HBASE-4680 FSUtils.isInSafeMode() checks should operate on HBase root dir, where we have permissions; REVERT

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1195588 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2011-10-31 18:09:17 +00:00
parent e32b161c8f
commit f6ad8d2647
2 changed files with 6 additions and 10 deletions

View File

@ -420,8 +420,6 @@ Release 0.92.0 - Unreleased
HBASE-4679 Thrift null mutation error
HBASE-4304 requestsPerSecond counter stuck at 0 (Li Pi)
HBASE-4692 HBASE-4300 broke the build
HBASE-4680 FSUtils.isInSafeMode() checks should operate on HBase root dir,
where we have permissions
HBASE-4641 Block cache can be mistakenly instantiated on Master (jgray)
HBASE-4687 regionserver may miss zk-heartbeats to master when replaying
edits at region open (prakash via jgray)

View File

@ -156,16 +156,16 @@ public abstract class FSUtils {
* @return true if dfs is in safemode, false otherwise.
*
*/
private static boolean isInSafeMode(FileSystem fs, Path rootDir)
throws IOException {
private static boolean isInSafeMode(FileSystem fs) throws IOException {
// Refactored safe-mode check for HBASE-4510
if (fs instanceof DistributedFileSystem) {
FsPermission rootPerm = fs.getFileStatus(rootDir).getPermission();
Path rootPath = new Path("/");
FsPermission rootPerm = fs.getFileStatus(rootPath).getPermission();
try {
// Should be harmless to set back the path we retrieved.
// The first check server-side is the safemode, so if
// other exceptions are spewed out, we're not interested.
fs.setPermission(rootDir, rootPerm);
fs.setPermission(rootPath, rootPerm);
} catch (SafeModeException e) {
return true;
}
@ -180,9 +180,8 @@ public abstract class FSUtils {
*/
public static void checkDfsSafeMode(final Configuration conf)
throws IOException {
Path rootDir = getRootDir(conf);
FileSystem fs = FileSystem.get(conf);
if (isInSafeMode(fs, rootDir)) {
if (isInSafeMode(fs)) {
throw new IOException("File system is in safemode, it can't be written now");
}
}
@ -452,10 +451,9 @@ public abstract class FSUtils {
public static void waitOnSafeMode(final Configuration conf,
final long wait)
throws IOException {
Path rootDir = getRootDir(conf);
FileSystem fs = FileSystem.get(conf);
// Make sure dfs is not in safe mode
while (isInSafeMode(fs, rootDir)) {
while (isInSafeMode(fs)) {
LOG.info("Waiting for dfs to exit safe mode...");
try {
Thread.sleep(wait);