Switch reindex with slices error to IAE
If you try to reindex with multiple slices against a node that doesn't support it we throw an `IllegalArgumentException` so `assertVersionSerializable` is ok with it and so if this happens in REST it comes back as a 400 error.
This commit is contained in:
parent
b7531984a9
commit
a3bd6d1ad9
|
@ -424,7 +424,7 @@ public abstract class AbstractBulkByScrollRequest<Self extends AbstractBulkByScr
|
||||||
out.writeVInt(slices);
|
out.writeVInt(slices);
|
||||||
} else {
|
} else {
|
||||||
if (slices > 1) {
|
if (slices > 1) {
|
||||||
throw new UnsupportedOperationException("Attempting to send sliced reindex-style request to a node that doesn't support "
|
throw new IllegalArgumentException("Attempting to send sliced reindex-style request to a node that doesn't support "
|
||||||
+ "it. Version is [" + out.getVersion() + "] but must be [" + BulkByScrollTask.V_5_1_0_UNRELEASED + "]");
|
+ "it. Version is [" + out.getVersion() + "] but must be [" + BulkByScrollTask.V_5_1_0_UNRELEASED + "]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class RoundTripTests extends ESTestCase {
|
||||||
|
|
||||||
// Try slices with a version that doesn't support slices. That should fail.
|
// Try slices with a version that doesn't support slices. That should fail.
|
||||||
reindex.setSlices(between(2, 1000));
|
reindex.setSlices(between(2, 1000));
|
||||||
Exception e = expectThrows(UnsupportedOperationException.class, () -> roundTrip(Version.V_5_0_0_rc1, reindex, null));
|
Exception e = expectThrows(IllegalArgumentException.class, () -> roundTrip(Version.V_5_0_0_rc1, reindex, null));
|
||||||
assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. "
|
assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. "
|
||||||
+ "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage());
|
+ "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage());
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ public class RoundTripTests extends ESTestCase {
|
||||||
|
|
||||||
// Try slices with a version that doesn't support slices. That should fail.
|
// Try slices with a version that doesn't support slices. That should fail.
|
||||||
update.setSlices(between(2, 1000));
|
update.setSlices(between(2, 1000));
|
||||||
Exception e = expectThrows(UnsupportedOperationException.class, () -> roundTrip(Version.V_5_0_0_rc1, update, null));
|
Exception e = expectThrows(IllegalArgumentException.class, () -> roundTrip(Version.V_5_0_0_rc1, update, null));
|
||||||
assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. "
|
assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. "
|
||||||
+ "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage());
|
+ "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage());
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public class RoundTripTests extends ESTestCase {
|
||||||
|
|
||||||
// Try slices with a version that doesn't support slices. That should fail.
|
// Try slices with a version that doesn't support slices. That should fail.
|
||||||
delete.setSlices(between(2, 1000));
|
delete.setSlices(between(2, 1000));
|
||||||
Exception e = expectThrows(UnsupportedOperationException.class, () -> roundTrip(Version.V_5_0_0_rc1, delete, null));
|
Exception e = expectThrows(IllegalArgumentException.class, () -> roundTrip(Version.V_5_0_0_rc1, delete, null));
|
||||||
assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. "
|
assertEquals("Attempting to send sliced reindex-style request to a node that doesn't support it. "
|
||||||
+ "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage());
|
+ "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue