Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-7645

Rolling upgrade is restoring blocks from trash multiple times

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.6.0
    • 2.8.0, 2.7.2, 3.0.0-alpha1
    • datanode
    • None
    • Reviewed

    Description

      When performing an HDFS rolling upgrade, the trash directory is getting restored twice when under normal circumstances it shouldn't need to be restored at all. iiuc, the only time these blocks should be restored is if we need to rollback a rolling upgrade.

      On a busy cluster, this can cause significant and unnecessary block churn both on the datanodes, and more importantly in the namenode.

      The two times this happens are:
      1) restart of DN onto new software

        private void doTransition(DataNode datanode, StorageDirectory sd,
            NamespaceInfo nsInfo, StartupOption startOpt) throws IOException {
          if (startOpt == StartupOption.ROLLBACK && sd.getPreviousDir().exists()) {
            Preconditions.checkState(!getTrashRootDir(sd).exists(),
                sd.getPreviousDir() + " and " + getTrashRootDir(sd) + " should not " +
                " both be present.");
            doRollback(sd, nsInfo); // rollback if applicable
          } else {
            // Restore all the files in the trash. The restored files are retained
            // during rolling upgrade rollback. They are deleted during rolling
            // upgrade downgrade.
            int restored = restoreBlockFilesFromTrash(getTrashRootDir(sd));
            LOG.info("Restored " + restored + " block files from trash.");
          }
      

      2) When heartbeat response no longer indicates a rollingupgrade is in progress

        /**
         * Signal the current rolling upgrade status as indicated by the NN.
         * @param inProgress true if a rolling upgrade is in progress
         */
        void signalRollingUpgrade(boolean inProgress) throws IOException {
          String bpid = getBlockPoolId();
          if (inProgress) {
            dn.getFSDataset().enableTrash(bpid);
            dn.getFSDataset().setRollingUpgradeMarker(bpid);
          } else {
            dn.getFSDataset().restoreTrash(bpid);
            dn.getFSDataset().clearRollingUpgradeMarker(bpid);
          }
        }
      

      HDFS-6800 and HDFS-6981 were modifying this behavior making it not completely clear whether this is somehow intentional.

      Attachments

        1. HDFS-7645.07.patch
          22 kB
          Vinayakumar B
        2. HDFS-7645.06.patch
          22 kB
          Vinayakumar B
        3. HDFS-7645.05.patch
          18 kB
          Vinayakumar B
        4. HDFS-7645.04.patch
          7 kB
          Keisuke Ogiwara
        5. HDFS-7645.03.patch
          6 kB
          Keisuke Ogiwara
        6. HDFS-7645.02.patch
          8 kB
          Keisuke Ogiwara
        7. HDFS-7645.01.patch
          1 kB
          Keisuke Ogiwara

        Issue Links

          Activity

            People

              ogikei Keisuke Ogiwara
              nroberts Nathan Roberts
              Votes:
              0 Vote for this issue
              Watchers:
              17 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: