[ 
https://issues.apache.org/jira/browse/HDFS-13898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16612499#comment-16612499
 ] 

Chao Sun commented on HDFS-13898:
---------------------------------

Thanks [~xkrogen] for taking a look!

bq. I also don't really understand why we need to tweak the number of DNs if 
the BlockManager is mocked anyway?

Yes we don't need to change {{MiniQJMHACluster}} - I did that mainly because it 
already has a {{setNumNameNodes}} method. Will change back.

bq. I also don't really understand why we need to tweak the number of DNs if 
the BlockManager is mocked anyway?

This is to bypass the exception: 
"org.apache.hadoop.ipc.RemoteException(java.io.IOException): Requested 
replication factor of 0 is less than the required minimum of 1" when calling 
{{dfs.createNewFile(testPath);}}. This is not related to  the BlockManager I 
think.

bq. I don't really find the BlockManager mocking to be very clean. I think we 
should be able to achieve something similar by using a real BlockManager, but 
injecting some fake blocks ...

Hmm. For the first approach using {{addBlockLocation}}, we have to provide the 
{{BlockInfo}} instance for the specific test file, is that right? Looking at 
{{FSDirStatAndListingOp#getBlockLocations}}, it requires non-trivial code to 
come up with all the parameters to get the required {{BlockInfo}}. Wonder if 
you have any suggestion.

Not sure how {{corruptBlockOnDataNodes}} will work in this case - we are trying 
to 


> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to