Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-3184 Add public HDFS client API
  3. HDFS-3301

Add public waitOnSafeMode API with HdfsUtils

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 3.0.0-alpha1
    • None
    • hdfs-client
    • 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

          Activity

            People

              umamaheswararao Uma Maheswara Rao G
              umamaheswararao Uma Maheswara Rao G
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: