fix a few versionAdded values in ElasticsearchExceptions (#37877)

TooManyBucketsException was introduced in v6.2
and SnapshotInProgressException was introduced in v6.7
This commit is contained in:
Tal Levy 2019-01-31 08:28:20 -08:00 committed by GitHub
parent 7a597cad0d
commit 9923f0fe6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 4 deletions

View File

@ -1006,11 +1006,11 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
UNKNOWN_NAMED_OBJECT_EXCEPTION(org.elasticsearch.common.xcontent.UnknownNamedObjectException.class,
org.elasticsearch.common.xcontent.UnknownNamedObjectException::new, 148, UNKNOWN_VERSION_ADDED),
TOO_MANY_BUCKETS_EXCEPTION(MultiBucketConsumerService.TooManyBucketsException.class,
MultiBucketConsumerService.TooManyBucketsException::new, 149, Version.V_7_0_0),
MultiBucketConsumerService.TooManyBucketsException::new, 149, Version.V_6_2_0),
COORDINATION_STATE_REJECTED_EXCEPTION(org.elasticsearch.cluster.coordination.CoordinationStateRejectedException.class,
org.elasticsearch.cluster.coordination.CoordinationStateRejectedException::new, 150, Version.V_7_0_0),
SNAPSHOT_IN_PROGRESS_EXCEPTION(org.elasticsearch.snapshots.SnapshotInProgressException.class,
org.elasticsearch.snapshots.SnapshotInProgressException::new, 151, Version.V_7_0_0),
org.elasticsearch.snapshots.SnapshotInProgressException::new, 151, Version.V_6_7_0),
NO_SUCH_REMOTE_CLUSTER_EXCEPTION(org.elasticsearch.transport.NoSuchRemoteClusterException.class,
org.elasticsearch.transport.NoSuchRemoteClusterException::new, 152, Version.V_6_7_0);

View File

@ -363,9 +363,9 @@ public class ExceptionSerializationTests extends ESTestCase {
}
public void testTooManyBucketsException() throws IOException {
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_2_0, Version.CURRENT);
MultiBucketConsumerService.TooManyBucketsException ex =
serialize(new MultiBucketConsumerService.TooManyBucketsException("Too many buckets", 100),
randomFrom(Version.V_7_0_0));
serialize(new MultiBucketConsumerService.TooManyBucketsException("Too many buckets", 100), version);
assertEquals("Too many buckets", ex.getMessage());
assertEquals(100, ex.getMaxBuckets());
}
@ -880,6 +880,13 @@ public class ExceptionSerializationTests extends ESTestCase {
assertEquals(orig.getShardId(), ex.getShardId());
}
public void testSnapshotInProgressException() throws IOException {
SnapshotInProgressException orig = new SnapshotInProgressException("boom");
Version version = VersionUtils.randomVersionBetween(random(), Version.V_6_7_0, Version.CURRENT);
SnapshotInProgressException ex = serialize(orig, version);
assertEquals(orig.getMessage(), ex.getMessage());
}
private static class UnknownException extends Exception {
UnknownException(final String message, final Exception cause) {
super(message, cause);