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);
|
||||
} else {
|
||||
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 + "]");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ public class RoundTripTests extends ESTestCase {
|
|||
|
||||
// Try slices with a version that doesn't support slices. That should fail.
|
||||
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. "
|
||||
+ "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.
|
||||
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. "
|
||||
+ "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.
|
||||
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. "
|
||||
+ "Version is [5.0.0-rc1] but must be [5.1.0]", e.getMessage());
|
||||
|
||||
|
|
Loading…
Reference in New Issue