Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-12943 Consistent Reads from Standby Node
  3. HDFS-13898

Throw retriable exception for getBlockLocations when ObserverNameNode is in safemode

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: HDFS-12943, 3.3.0
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      When ObserverNameNode is in safe mode, getBlockLocations may throw safe mode exception if the given file doesn't have any block yet. 

          try {
            checkOperation(OperationCategory.READ);
            res = FSDirStatAndListingOp.getBlockLocations(
                dir, pc, srcArg, offset, length, true);
            if (isInSafeMode()) {
              for (LocatedBlock b : res.blocks.getLocatedBlocks()) {
                // if safemode & no block locations yet then throw safemodeException
                if ((b.getLocations() == null) || (b.getLocations().length == 0)) {
                  SafeModeException se = newSafemodeException(
                      "Zero blocklocations for " + srcArg);
                  if (haEnabled && haContext != null &&
                      haContext.getState().getServiceState() == HAServiceState.ACTIVE) {
                    throw new RetriableException(se);
                  } else {
                    throw se;
                  }
                }
              }
            }
      

      It only throws RetriableException for active NN so requests on observer may just fail.

        Attachments

        1. HDFS-13898-HDFS-12943.004.patch
          8 kB
          Chao Sun
        2. HDFS-13898-HDFS-12943.003.patch
          8 kB
          Chao Sun
        3. HDFS-13898-HDFS-12943.002.patch
          7 kB
          Chao Sun
        4. HDFS-13898-HDFS-12943.001.patch
          7 kB
          Chao Sun
        5. HDFS-13898-HDFS-12943.000.patch
          10 kB
          Chao Sun

          Issue Links

            Activity

              People

              • Assignee:
                csun Chao Sun
                Reporter:
                csun Chao Sun
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: