Skip to content

Commit

Permalink
Fall back on ufs if finding a worker with block fails (#6969)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaudiber committed Mar 15, 2018
1 parent 42b6076 commit f67a6e9
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ public BlockInStream getInStream(long blockId, InStreamOptions options,
WorkerNetAddress dataSource = null;
locations = locations.stream()
.filter(location -> workers.contains(location.getWorkerAddress())).collect(toList());
// First try to read data from Alluxio
if (!locations.isEmpty()) {
// Case 1: we still have at least one worker containing the block.
// TODO(calvin): Get location via a policy
List<TieredIdentity> tieredLocations =
locations.stream().map(location -> location.getWorkerAddress().getTieredIdentity())
Expand All @@ -196,8 +196,9 @@ public BlockInStream getInStream(long blockId, InStreamOptions options,
dataSourceType = BlockInStreamSource.REMOTE;
}
}
} else {
// Case 2: no worker contains the block; we must read from the UFS.
}
// Can't get data from Alluxio, get it from the UFS instead
if (dataSource == null) {
dataSourceType = BlockInStreamSource.UFS;
BlockLocationPolicy policy =
Preconditions.checkNotNull(options.getOptions().getUfsReadLocationPolicy(),
Expand Down

0 comments on commit f67a6e9

Please sign in to comment.