mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Treat TransportService stopped error as node is closing (#39800)
If TransportService is stopped before a shard-failure request is sent but after the request is registered, TransportService will notify ReplicationOperation a TransportException with an error message: "transport stop, action: internal:cluster/shard/failure". Relates #39584
This commit is contained in:
parent
6c52da54c8
commit
a0a91f74ff
@ -206,7 +206,9 @@ public class ReplicationOperation<
|
||||
private void onNoLongerPrimary(Exception failure) {
|
||||
final Throwable cause = ExceptionsHelper.unwrapCause(failure);
|
||||
final boolean nodeIsClosing = cause instanceof NodeClosedException
|
||||
|| (cause instanceof TransportException && "TransportService is closed stopped can't send request".equals(cause.getMessage()));
|
||||
|| (cause instanceof TransportException &&
|
||||
("TransportService is closed stopped can't send request".equals(cause.getMessage())
|
||||
|| "transport stopped, action: internal:cluster/shard/failure".equals(cause.getMessage())));
|
||||
final String message;
|
||||
if (nodeIsClosing) {
|
||||
message = String.format(Locale.ROOT,
|
||||
|
@ -205,8 +205,11 @@ public class ReplicationOperationTests extends ESTestCase {
|
||||
shardActionFailure = new NodeClosedException(new DiscoveryNode("foo", buildNewFakeTransportAddress(), Version.CURRENT));
|
||||
} else if (randomBoolean()) {
|
||||
shardActionFailure = new SendRequestTransportException(
|
||||
new DiscoveryNode("foo", buildNewFakeTransportAddress(), Version.CURRENT), "internal:cluster/shard/failure",
|
||||
new DiscoveryNode("foo", buildNewFakeTransportAddress(), Version.CURRENT), ShardStateAction.SHARD_FAILED_ACTION_NAME,
|
||||
new TransportException("TransportService is closed stopped can't send request"));
|
||||
} else if (randomBoolean()) {
|
||||
shardActionFailure = new TransportException(
|
||||
"transport stopped, action: " + ShardStateAction.SHARD_FAILED_ACTION_NAME);
|
||||
} else {
|
||||
shardActionFailure = new ShardStateAction.NoLongerPrimaryShardException(failedReplica.shardId(), "the king is dead");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user