Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 commits
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 @@ -103,14 +103,26 @@ public void fetchBlocks(
try {
RetryingBlockFetcher.BlockFetchStarter blockFetchStarter =
(blockIds1, listener1) -> {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we revert this unnecessary line?

// Unless this client is closed.
if (clientFactory != null) {
TransportClient client = clientFactory.createClient(host, port);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we only add try-catch to wrap this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we only add try-catch to wrap this line?

It's OK to only wrap this line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we only add try-catch to wrap this line?

Updated, hope for review current change

TransportClient client = null;
try {
client = clientFactory.createClient(host, port);
} catch (Exception e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that any exception implies the lost external shuffle service?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that any exception implies the lost external shuffle service?

No, that's why I say that we may need a way to check External Shuffle Service alive.
Any good suggestions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any good idea yet.

And if we disallow retry for any exception, why shouldn't we just set to not retry at the beginning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any good idea yet.

And if we disallow retry for any exception, why shouldn't we just set to not retry at the beginning?

Connect failed because of network should retry, but if because of server down, shouldn't retry, I need to find way to check external shuffle service is down.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have any good idea yet.

And if we disallow retry for any exception, why shouldn't we just set to not retry at the beginning?

How about current check , check host reachable and port can be connected.

// throw ExternalShuffleServiceLostException exception then we won't retry to connect
// un-connected External Shuffle Service.
String msg = "The relative remote external shuffle service (host: " + host + "," +
"port: " + port + "), which maintains the block data can't been connected.";
logger.info(msg);
throw new ExternalShuffleServiceLostException(msg);
}
new OneForOneBlockFetcher(client, appId, execId,
blockIds1, listener1, conf, downloadFileManager).start();
blockIds1, listener1, conf, downloadFileManager).start();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we use 2 indents in java?

} else {
logger.info("This clientFactory was closed. Skipping further block fetch retries.");
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert?

};

int maxRetries = conf.maxIORetries();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.spark.network.shuffle;

/**
* Exception throw when we can't connect to external shuffle service to sto unnecessary
* retry in ExternalShuffleStoreClient.fetchBlocks()
*/
public class ExternalShuffleServiceLostException extends Exception {

ExternalShuffleServiceLostException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public interface BlockFetchStarter {
* issues.
*/
void createAndStart(String[] blockIds, BlockFetchingListener listener)
throws IOException, InterruptedException;
throws IOException, InterruptedException, ExternalShuffleServiceLostException;
}

/** Shared executor service used for waiting and retrying. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ private static void performInteractions(List<? extends Map<String, Object>> inte
}

assertNotNull(stub);
stub.when(fetchStarter).createAndStart(any(), any());
try {
stub.when(fetchStarter).createAndStart(any(), any());
} catch (ExternalShuffleServiceLostException e) {
throw new IOException(e);
}
String[] blockIdArray = blockIds.toArray(new String[blockIds.size()]);
new RetryingBlockFetcher(conf, fetchStarter, blockIdArray, listener).start();
}
Expand Down