Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.io.EOFException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
import java.util.function.Function;

/**
Expand Down Expand Up @@ -169,9 +170,9 @@ protected BlockExtendedInputStream getOrOpenStream(int locationIndex) {
.setId(PipelineID.randomId())
.setState(Pipeline.PipelineState.CLOSED)
.build();

BlockID blockID = blockInfo.getBlockID();
BlockLocationInfo blkInfo = new BlockLocationInfo.Builder()
.setBlockID(blockInfo.getBlockID())
.setBlockID(blockID)
.setLength(internalBlockLength(locationIndex + 1))
.setPipeline(blockInfo.getPipeline())
.setToken(blockInfo.getToken())
Expand All @@ -182,7 +183,26 @@ protected BlockExtendedInputStream getOrOpenStream(int locationIndex) {
HddsProtos.ReplicationFactor.ONE),
blkInfo, pipeline,
blockInfo.getToken(), verifyChecksum, xceiverClientFactory,
refreshFunction);
blkID -> {
Pipeline ecPipeline = refreshFunction.apply(blkID);
if (ecPipeline == null) {
return null;
}
DatanodeDetails curIndexNode = ecPipeline.getNodes()
.stream().filter(dn ->
ecPipeline.getReplicaIndex(dn) == locationIndex + 1)
.findAny().orElse(null);
if (curIndexNode == null) {
return null;
}
return Pipeline.newBuilder().setReplicationConfig(
StandaloneReplicationConfig.getInstance(
HddsProtos.ReplicationFactor.ONE))
.setNodes(Collections.singletonList(curIndexNode))
.setId(PipelineID.randomId())
.setState(Pipeline.PipelineState.CLOSED)
.build();
});
blockStreams[locationIndex] = stream;
}
return stream;
Expand Down