You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ga...@apache.org on 2011/10/28 18:25:34 UTC
svn commit: r1190428 - in /hbase/trunk: CHANGES.txt
src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
Author: garyh
Date: Fri Oct 28 16:25:34 2011
New Revision: 1190428
URL: http://svn.apache.org/viewvc?rev=1190428&view=rev
Log:
HBASE-4680 FSUtils.isInSafeMode() checks should operate on HBase root dir, where we have permissions
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1190428&r1=1190427&r2=1190428&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Fri Oct 28 16:25:34 2011
@@ -417,6 +417,8 @@ 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
TESTS
HBASE-4450 test for number of blocks read: to serve as baseline for expected
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java?rev=1190428&r1=1190427&r2=1190428&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java Fri Oct 28 16:25:34 2011
@@ -156,16 +156,16 @@ public abstract class FSUtils {
* @return true if dfs is in safemode, false otherwise.
*
*/
- private static boolean isInSafeMode(FileSystem fs) throws IOException {
+ private static boolean isInSafeMode(FileSystem fs, Path rootDir)
+ throws IOException {
// Refactored safe-mode check for HBASE-4510
if (fs instanceof DistributedFileSystem) {
- Path rootPath = new Path("/");
- FsPermission rootPerm = fs.getFileStatus(rootPath).getPermission();
+ FsPermission rootPerm = fs.getFileStatus(rootDir).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(rootPath, rootPerm);
+ fs.setPermission(rootDir, rootPerm);
} catch (SafeModeException e) {
return true;
}
@@ -180,8 +180,9 @@ 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)) {
+ if (isInSafeMode(fs, rootDir)) {
throw new IOException("File system is in safemode, it can't be written now");
}
}
@@ -451,9 +452,10 @@ 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)) {
+ while (isInSafeMode(fs, rootDir)) {
LOG.info("Waiting for dfs to exit safe mode...");
try {
Thread.sleep(wait);