Skip to content

Commit 9923f0f

Browse files
authored
fix a few versionAdded values in ElasticsearchExceptions (#37877)
TooManyBucketsException was introduced in v6.2 and SnapshotInProgressException was introduced in v6.7
1 parent 7a597ca commit 9923f0f

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

server/src/main/java/org/elasticsearch/ElasticsearchException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,11 +1006,11 @@ private enum ElasticsearchExceptionHandle {
10061006
UNKNOWN_NAMED_OBJECT_EXCEPTION(org.elasticsearch.common.xcontent.UnknownNamedObjectException.class,
10071007
org.elasticsearch.common.xcontent.UnknownNamedObjectException::new, 148, UNKNOWN_VERSION_ADDED),
10081008
TOO_MANY_BUCKETS_EXCEPTION(MultiBucketConsumerService.TooManyBucketsException.class,
1009-
MultiBucketConsumerService.TooManyBucketsException::new, 149, Version.V_7_0_0),
1009+
MultiBucketConsumerService.TooManyBucketsException::new, 149, Version.V_6_2_0),
10101010
COORDINATION_STATE_REJECTED_EXCEPTION(org.elasticsearch.cluster.coordination.CoordinationStateRejectedException.class,
10111011
org.elasticsearch.cluster.coordination.CoordinationStateRejectedException::new, 150, Version.V_7_0_0),
10121012
SNAPSHOT_IN_PROGRESS_EXCEPTION(org.elasticsearch.snapshots.SnapshotInProgressException.class,
1013-
org.elasticsearch.snapshots.SnapshotInProgressException::new, 151, Version.V_7_0_0),
1013+
org.elasticsearch.snapshots.SnapshotInProgressException::new, 151, Version.V_6_7_0),
10141014
NO_SUCH_REMOTE_CLUSTER_EXCEPTION(org.elasticsearch.transport.NoSuchRemoteClusterException.class,
10151015
org.elasticsearch.transport.NoSuchRemoteClusterException::new, 152, Version.V_6_7_0);
10161016

server/src/test/java/org/elasticsearch/ExceptionSerializationTests.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ public void testCircuitBreakingException() throws IOException {
363363
}
364364

365365
public void testTooManyBucketsException() throws IOException {
366+
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_2_0, Version.CURRENT);
366367
MultiBucketConsumerService.TooManyBucketsException ex =
367-
serialize(new MultiBucketConsumerService.TooManyBucketsException("Too many buckets", 100),
368-
randomFrom(Version.V_7_0_0));
368+
serialize(new MultiBucketConsumerService.TooManyBucketsException("Too many buckets", 100), version);
369369
assertEquals("Too many buckets", ex.getMessage());
370370
assertEquals(100, ex.getMaxBuckets());
371371
}
@@ -880,6 +880,13 @@ public void testShardLockObtainFailedException() throws IOException {
880880
assertEquals(orig.getShardId(), ex.getShardId());
881881
}
882882

883+
public void testSnapshotInProgressException() throws IOException {
884+
SnapshotInProgressException orig = new SnapshotInProgressException("boom");
885+
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_7_0, Version.CURRENT);
886+
SnapshotInProgressException ex = serialize(orig, version);
887+
assertEquals(orig.getMessage(), ex.getMessage());
888+
}
889+
883890
private static class UnknownException extends Exception {
884891
UnknownException(final String message, final Exception cause) {
885892
super(message, cause);

0 commit comments

Comments
 (0)