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

A race in SerialNumberMap will cause wrong owner, group and XATTR

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      If namenode enables parallel fsimage loading, a race that occurs in SerialNumberMap will cause wrong owner ship for INodes.

      public int get(T t) {
        if (t == null) {
          return 0;
        }
        Integer sn = t2i.get(t);
        if (sn == null) {
          // Assume there are two thread with different t, such as:
          // T1 with hbase
          // T2 with hdfs
          // If T1 and T2 get the sn in the same time, they will get the same sn, such as 10
          sn = current.getAndIncrement();
          if (sn > max) {
            current.getAndDecrement();
            throw new IllegalStateException(name + ": serial number map is full");
          }
          Integer old = t2i.putIfAbsent(t, sn);
          if (old != null) {
            current.getAndDecrement();
            return old;
          }
          // If T1 puts the 10->hbase to the i2t first, T2 will use 10 -> hdfs to overwrite it. So it will cause that the Inodes will get a wrong owner hdfs, actual it should be hbase.
          i2t.put(sn, t);
        }
        return sn;
      } 

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment