HBASE-13716 use HdfsConstants instead of deprecated FSConstants.
This commit is contained in:
parent
4cab6963b0
commit
6529d8833d
|
@ -1539,7 +1539,7 @@ public class HMaster extends HRegionServer implements MasterServices, Server {
|
||||||
// HBASE-5680: Likely hadoop23 vs hadoop 20.x/1.x incompatibility
|
// HBASE-5680: Likely hadoop23 vs hadoop 20.x/1.x incompatibility
|
||||||
if (t instanceof NoClassDefFoundError &&
|
if (t instanceof NoClassDefFoundError &&
|
||||||
t.getMessage()
|
t.getMessage()
|
||||||
.contains("org/apache/hadoop/hdfs/protocol/FSConstants$SafeModeAction")) {
|
.contains("org/apache/hadoop/hdfs/protocol/HdfsConstants$SafeModeAction")) {
|
||||||
// improved error message for this special case
|
// improved error message for this special case
|
||||||
abort("HBase is having a problem with its Hadoop jars. You may need to "
|
abort("HBase is having a problem with its Hadoop jars. You may need to "
|
||||||
+ "recompile HBase against Hadoop version "
|
+ "recompile HBase against Hadoop version "
|
||||||
|
|
|
@ -507,7 +507,7 @@ public abstract class FSUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We use reflection because {@link DistributedFileSystem#setSafeMode(
|
* We use reflection because {@link DistributedFileSystem#setSafeMode(
|
||||||
* FSConstants.SafeModeAction action, boolean isChecked)} is not in hadoop 1.1
|
* HdfsConstants.SafeModeAction action, boolean isChecked)} is not in hadoop 1.1
|
||||||
*
|
*
|
||||||
* @param dfs
|
* @param dfs
|
||||||
* @return whether we're in safe mode
|
* @return whether we're in safe mode
|
||||||
|
@ -517,15 +517,15 @@ public abstract class FSUtils {
|
||||||
boolean inSafeMode = false;
|
boolean inSafeMode = false;
|
||||||
try {
|
try {
|
||||||
Method m = DistributedFileSystem.class.getMethod("setSafeMode", new Class<?> []{
|
Method m = DistributedFileSystem.class.getMethod("setSafeMode", new Class<?> []{
|
||||||
org.apache.hadoop.hdfs.protocol.FSConstants.SafeModeAction.class, boolean.class});
|
org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction.class, boolean.class});
|
||||||
inSafeMode = (Boolean) m.invoke(dfs,
|
inSafeMode = (Boolean) m.invoke(dfs,
|
||||||
org.apache.hadoop.hdfs.protocol.FSConstants.SafeModeAction.SAFEMODE_GET, true);
|
org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction.SAFEMODE_GET, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if (e instanceof IOException) throw (IOException) e;
|
if (e instanceof IOException) throw (IOException) e;
|
||||||
|
|
||||||
// Check whether dfs is on safemode.
|
// Check whether dfs is on safemode.
|
||||||
inSafeMode = dfs.setSafeMode(
|
inSafeMode = dfs.setSafeMode(
|
||||||
org.apache.hadoop.hdfs.protocol.FSConstants.SafeModeAction.SAFEMODE_GET);
|
org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction.SAFEMODE_GET);
|
||||||
}
|
}
|
||||||
return inSafeMode;
|
return inSafeMode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ import org.apache.hadoop.hbase.util.FSUtils;
|
||||||
import org.apache.hadoop.hbase.util.Threads;
|
import org.apache.hadoop.hbase.util.Threads;
|
||||||
import org.apache.hadoop.hdfs.DistributedFileSystem;
|
import org.apache.hadoop.hdfs.DistributedFileSystem;
|
||||||
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
import org.apache.hadoop.hdfs.MiniDFSCluster;
|
||||||
import org.apache.hadoop.hdfs.protocol.FSConstants;
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -384,7 +384,7 @@ public class TestWALFactory {
|
||||||
// Stop the cluster. (ensure restart since we're sharing MiniDFSCluster)
|
// Stop the cluster. (ensure restart since we're sharing MiniDFSCluster)
|
||||||
try {
|
try {
|
||||||
DistributedFileSystem dfs = (DistributedFileSystem) cluster.getFileSystem();
|
DistributedFileSystem dfs = (DistributedFileSystem) cluster.getFileSystem();
|
||||||
dfs.setSafeMode(FSConstants.SafeModeAction.SAFEMODE_ENTER);
|
dfs.setSafeMode(HdfsConstants.SafeModeAction.SAFEMODE_ENTER);
|
||||||
TEST_UTIL.shutdownMiniDFSCluster();
|
TEST_UTIL.shutdownMiniDFSCluster();
|
||||||
try {
|
try {
|
||||||
// wal.writer.close() will throw an exception,
|
// wal.writer.close() will throw an exception,
|
||||||
|
|
Loading…
Reference in New Issue