[
https://issues.apache.org/jira/browse/HDFS-3301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13257418#comment-13257418
]
Harsh J commented on HDFS-3301:
-------------------------------
Isn't this a dupe of HDFS-2413, which was done for HBase as well?
> Add public waitOnSafeMode API with HdfsUtils
> ---------------------------------------------
>
> Key: HDFS-3301
> URL: https://issues.apache.org/jira/browse/HDFS-3301
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: hdfs client
> Affects Versions: 3.0.0
> Reporter: Uma Maheswara Rao G
> Assignee: Uma Maheswara Rao G
>
> 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.
> {code}
> /**
> * 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
> }
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira