[ https://issues.apache.org/jira/browse/HDFS-13898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16615283#comment-16615283 ]
Erik Krogen commented on HDFS-13898: ------------------------------------ I explored for a while how to do this without a mock BlockManager, and it should be possible, but it was getting pretty complex since there are parts of the code that try to enforce expectations and we have to do things in a way that doesn't violate them. I think in the end it's probably better to leave it as-is with your mocking strategy. > 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 > Assignee: Chao Sun > Priority: Major > Attachments: HDFS-13898-HDFS-12943.000.patch > > > 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-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org