You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Chao Sun (JIRA)" <ji...@apache.org> on 2018/09/06 06:29:00 UTC

[jira] [Created] (HDFS-13898) Throw retriable exception for getBlockLocations when ObserverNameNode is in safemode

Chao Sun created HDFS-13898:
-------------------------------

             Summary: Throw retriable exception for getBlockLocations when ObserverNameNode is in safemode
                 Key: HDFS-13898
                 URL: https://issues.apache.org/jira/browse/HDFS-13898
             Project: Hadoop HDFS
          Issue Type: Sub-task
            Reporter: Chao Sun


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

{code}
    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;
            }
          }
        }
      }
{code}

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



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org