code: private void waitForUpgradeDone(int namespaceId) {
      UpgradeManagerDatanode um = datanode.getUpgradeManager(namespaceId);
      while (!um.isUpgradeCompleted()) {
        try {
          datanode.updateAndReportThreadLiveness(BackgroundThread.BLOCK_SCANNER);
          Thread.sleep(5000);
          LOG.info("sleeping ............");
        } catch (InterruptedException e) {
          blockScannerThread.interrupt();
          return;
        }
      }
    }
docs: Wait for upgrading done for the given namespace