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

RBF: updateMountTableEntry shouldn't update mountTableEntry if targetPath not exist

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.1.2
    • 3.3.0
    • rbf
    • None
    • Reviewed

    Description

      The updateMountTableEntry shouldn't update the mountEntry if the targetPath not exist.

      @Override
      public UpdateMountTableEntryResponse updateMountTableEntry(
          UpdateMountTableEntryRequest request) throws IOException {
        UpdateMountTableEntryResponse response =
            getMountTableStore().updateMountTableEntry(request);
      
        MountTable mountTable = request.getEntry();
        if (mountTable != null && router.isQuotaEnabled()) {
          synchronizeQuota(mountTable.getSourcePath(),
              mountTable.getQuota().getQuota(),
              mountTable.getQuota().getSpaceQuota());
        }
        return response;
      }
      
      /**
       * Synchronize the quota value across mount table and subclusters.
       * @param path Source path in given mount table.
       * @param nsQuota Name quota definition in given mount table.
       * @param ssQuota Space quota definition in given mount table.
       * @throws IOException
       */
      private void synchronizeQuota(String path, long nsQuota, long ssQuota)
          throws IOException {
        if (router.isQuotaEnabled() &&
            (nsQuota != HdfsConstants.QUOTA_DONT_SET
            || ssQuota != HdfsConstants.QUOTA_DONT_SET)) {
          HdfsFileStatus ret = this.router.getRpcServer().getFileInfo(path);
          if (ret != null) {
            this.router.getRpcServer().getQuotaModule().setQuota(path, nsQuota,
                ssQuota, null);
          }
        }
      }
      

      As above, updateMountTableEntry update one mountEntry:

      1. update mountEntry in zookeeper
      2. synchronizeQuota(maybe throw some exception like "Directory does not exist")

       

      if  synchronizeQuota throw some exception, will return some exception to dfsRouterAdmin, but the new mountEntry has been updated to zk.  

      It's clearly not what we would expect.

      Attachments

        1. HDFS-14661-HDFS-13891-001.patch
          4 kB
          ZanderXu
        2. HDFS-14661-trunk-001.patch
          4 kB
          ZanderXu
        3. HDFS-14661-trunk-002.patch
          6 kB
          ZanderXu
        4. HDFS-14661-trunk-003.patch
          6 kB
          ZanderXu
        5. HDFS-14661-trunk-004.patch
          6 kB
          ZanderXu

        Activity

          People

            xuzq_zander ZanderXu
            xuzq_zander ZanderXu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: