Skip to content

Commit 1f1a4d1

Browse files
committed
Remove BWC layer for rejected execution exception
The serialization changes for rejected execution exceptions has been backported to 6.x with the intention to appear in all versions since 6.3.0. Therefore, this BWC layer is no longer needed in master since master would never speak to a node that does not speak the same serialization.
1 parent 6bf742d commit 1f1a4d1

File tree

2 files changed

+3
-26
lines changed

2 files changed

+3
-26
lines changed

server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java

-7
Original file line numberDiff line numberDiff line change
@@ -748,13 +748,6 @@ public <T extends Exception> T readException() throws IOException {
748748
switch (key) {
749749
case 0:
750750
final int ord = readVInt();
751-
// TODO: remove the if branch when master is bumped to 8.0.0
752-
assert Version.CURRENT.major < 8;
753-
if (ord == 59) {
754-
final ElasticsearchException ex = new ElasticsearchException(this);
755-
final boolean isExecutorShutdown = readBoolean();
756-
return (T) new EsRejectedExecutionException(ex.getMessage(), isExecutorShutdown);
757-
}
758751
return (T) ElasticsearchException.readException(this, ord);
759752
case 1:
760753
String msg1 = readOptionalString();

server/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java

+3-19
Original file line numberDiff line numberDiff line change
@@ -854,25 +854,9 @@ public void writeException(Throwable throwable) throws IOException {
854854
} else if (throwable instanceof IOException) {
855855
writeVInt(17);
856856
} else if (throwable instanceof EsRejectedExecutionException) {
857-
// TODO: remove the if branch when master is bumped to 8.0.0
858-
assert Version.CURRENT.major < 8;
859-
if (version.before(Version.V_7_0_0_alpha1)) {
860-
/*
861-
* This is a backwards compatibility layer when speaking to nodes that still treated EsRejectedExceutionException as an
862-
* instance of ElasticsearchException. As such, we serialize this in a way that the receiving node would read this as an
863-
* EsRejectedExecutionException.
864-
*/
865-
final ElasticsearchException ex = new ElasticsearchException(throwable.getMessage());
866-
writeVInt(0);
867-
writeVInt(59);
868-
ex.writeTo(this);
869-
writeBoolean(((EsRejectedExecutionException) throwable).isExecutorShutdown());
870-
return;
871-
} else {
872-
writeVInt(18);
873-
writeBoolean(((EsRejectedExecutionException) throwable).isExecutorShutdown());
874-
writeCause = false;
875-
}
857+
writeVInt(18);
858+
writeBoolean(((EsRejectedExecutionException) throwable).isExecutorShutdown());
859+
writeCause = false;
876860
} else {
877861
final ElasticsearchException ex;
878862
if (throwable instanceof ElasticsearchException && ElasticsearchException.isRegistered(throwable.getClass(), version)) {

0 commit comments

Comments
 (0)