@@ -4325,11 +4325,22 @@ BatchedDirectoryListing getBatchedListing(String[] srcs, byte[] startAfter,
4325
4325
if (dirListing == null ) {
4326
4326
throw new FileNotFoundException ("Path " + src + " does not exist" );
4327
4327
}
4328
+ if (needLocation && isObserver ()) {
4329
+ for (HdfsFileStatus fs : dirListing .getPartialListing ()) {
4330
+ if (fs instanceof HdfsLocatedFileStatus ) {
4331
+ LocatedBlocks lbs = ((HdfsLocatedFileStatus ) fs ).getLocatedBlocks ();
4332
+ checkBlockLocationsWhenObserver (lbs , fs .toString ());
4333
+ }
4334
+ }
4335
+ }
4328
4336
listing = new HdfsPartialListing (
4329
4337
srcsIndex , Lists .newArrayList (dirListing .getPartialListing ()));
4330
4338
numEntries += listing .getPartialListing ().size ();
4331
4339
lastListing = dirListing ;
4332
4340
} catch (Exception e ) {
4341
+ if (e instanceof ObserverRetryOnActiveException ) {
4342
+ throw (ObserverRetryOnActiveException ) e ;
4343
+ }
4333
4344
if (e instanceof AccessControlException ) {
4334
4345
logAuditEvent (false , operationName , src );
4335
4346
}
@@ -4392,6 +4403,8 @@ BatchedDirectoryListing getBatchedListing(String[] srcs, byte[] startAfter,
4392
4403
true ,
4393
4404
returnedStartAfter );
4394
4405
}
4406
+ } catch (ObserverRetryOnActiveException e ){
4407
+ throw e ;
4395
4408
} finally {
4396
4409
readUnlock (RwLockMode .FS , operationName ,
4397
4410
getLockReportInfoSupplier (Arrays .toString (srcs )));
0 commit comments