Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Duplicate
-
3.0.0-alpha1
-
None
-
None
Description
Add public waitOnSafeMode API as HdfsUtils.
I have seen this util api in Hbase and using FSCOnstants in it. Currently that is deprecated and moved the SafeModeActions to HdfsConstants and also marked as private audience. So, it wil help adding such api in HdfsUtils itself to avoid the need of accessing HdfsConstants.
from Hbase FSUtils class.
/** * If DFS, check safe mode and if so, wait until we clear it. * @param conf configuration * @param wait Sleep between retries * @throws IOException e */ public static void waitOnSafeMode(final Configuration conf, final long wait) throws IOException { FileSystem fs = FileSystem.get(conf); if (!(fs instanceof DistributedFileSystem)) return; DistributedFileSystem dfs = (DistributedFileSystem)fs; // Make sure dfs is not in safe mode while (dfs.setSafeMode(org.apache.hadoop.hdfs.protocol.FSConstants.SafeModeAction.SAFEMODE_GET)) { LOG.info("Waiting for dfs to exit safe mode..."); try { Thread.sleep(wait); } catch (InterruptedException e) { //continue } } }
Attachments
Issue Links
- duplicates
-
HDFS-2413 Add public APIs for safemode
- Closed