RexXiong commented on code in PR #3093:
URL: https://github.com/apache/celeborn/pull/3093#discussion_r1952030446
##########
client/src/main/java/org/apache/celeborn/client/read/DfsPartitionReader.java:
##########
@@ -97,26 +98,28 @@ public DfsPartitionReader(
if (endMapIndex != Integer.MAX_VALUE) {
long fetchTimeoutMs = conf.clientFetchTimeoutMs();
- try {
- client = clientFactory.createClient(location.getHost(),
location.getFetchPort());
- TransportMessage openStream =
- new TransportMessage(
- MessageType.OPEN_STREAM,
- PbOpenStream.newBuilder()
- .setShuffleKey(shuffleKey)
- .setFileName(location.getFileName())
- .setStartIndex(startMapIndex)
- .setEndIndex(endMapIndex)
- .build()
- .toByteArray());
- ByteBuffer response = client.sendRpcSync(openStream.toByteBuffer(),
fetchTimeoutMs);
- streamHandler =
TransportMessage.fromByteBuffer(response).getParsedPayload();
- // Parse this message to ensure sort is done.
- } catch (IOException | InterruptedException e) {
- throw new IOException(
- "read shuffle file from DFS failed, filePath: "
- + location.getStorageInfo().getFilePath(),
- e);
+ if (pbStreamHandler == null) {
+ try {
+ client = clientFactory.createClient(location.getHost(),
location.getFetchPort());
+ TransportMessage openStream =
+ new TransportMessage(
+ MessageType.OPEN_STREAM,
+ PbOpenStream.newBuilder()
+ .setShuffleKey(shuffleKey)
+ .setFileName(location.getFileName())
+ .setStartIndex(startMapIndex)
+ .setEndIndex(endMapIndex)
+ .build()
+ .toByteArray());
+ ByteBuffer response = client.sendRpcSync(openStream.toByteBuffer(),
fetchTimeoutMs);
+ streamHandler =
TransportMessage.fromByteBuffer(response).getParsedPayload();
+ // Parse this message to ensure sort is done.
+ } catch (IOException | InterruptedException e) {
+ throw new IOException(
+ "read shuffle file from DFS failed, filePath: "
+ + location.getStorageInfo().getFilePath(),
+ e);
+ }
Review Comment:
You are correct, but the closeStream method should create a client to send a
request to the worker to end the stream. This allows the worker to safely
delete the original file. It's important to note that the stream must also be
opened before reading. Therefore, it's incorrect to create the client only
during the map range read, so the check for endMapIndex != Integer.MAX_VALUE
should be removed in DfsPartitionReader. For more details, please refer to
https://github.com/apache/celeborn/pull/1932
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]