diff options
author | Yannick Welsch <yannick@welsch.lu> | 2017-07-01 11:36:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-01 11:36:45 +0200 |
commit | bb23d3b2c5c9be8026705dd24229ebabf2935775 (patch) | |
tree | 632ce40b82a24a4fa8425d22b63d6f70473326a4 /core/src/test/java | |
parent | 6ae4497c13b735b88479f5c5362aa899838121ba (diff) |
Remove allocation id from replica replication response (#25488)
The replica replication response object has an extra allocationId field that contains the allocation id of the replica on which the request was executed. As we are sending the allocation id with the actual replica replication request, and check when executing the replica replication action that the allocation id of the replica shard is what we expect, there is no need to communicate back the allocation id as part of the response object.
Diffstat (limited to 'core/src/test/java')
4 files changed, 5 insertions, 16 deletions
diff --git a/core/src/test/java/org/elasticsearch/action/support/replication/ReplicationOperationTests.java b/core/src/test/java/org/elasticsearch/action/support/replication/ReplicationOperationTests.java index 88cf5769a4..dc33be6e4d 100644 --- a/core/src/test/java/org/elasticsearch/action/support/replication/ReplicationOperationTests.java +++ b/core/src/test/java/org/elasticsearch/action/support/replication/ReplicationOperationTests.java @@ -464,11 +464,9 @@ public class ReplicationOperationTests extends ESTestCase { } static class ReplicaResponse implements ReplicationOperation.ReplicaResponse { - final String allocationId; final long localCheckpoint; - ReplicaResponse(String allocationId, long localCheckpoint) { - this.allocationId = allocationId; + ReplicaResponse(long localCheckpoint) { this.localCheckpoint = localCheckpoint; } @@ -476,11 +474,6 @@ public class ReplicationOperationTests extends ESTestCase { public long localCheckpoint() { return localCheckpoint; } - - @Override - public String allocationId() { - return allocationId; - } } static class TestReplicaProxy implements ReplicationOperation.Replicas<Request> { @@ -515,7 +508,7 @@ public class ReplicationOperationTests extends ESTestCase { final String allocationId = replica.allocationId().getId(); Long existing = generatedLocalCheckpoints.put(allocationId, checkpoint); assertNull(existing); - listener.onResponse(new ReplicaResponse(allocationId, checkpoint)); + listener.onResponse(new ReplicaResponse(checkpoint)); } } diff --git a/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java b/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java index a4a34b7002..8bfc31f871 100644 --- a/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java +++ b/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java @@ -636,8 +636,7 @@ public class TransportReplicationActionTests extends ESTestCase { CapturingTransport.CapturedRequest[] captures = transport.getCapturedRequestsAndClear(); assertThat(captures, arrayWithSize(1)); if (randomBoolean()) { - final TransportReplicationAction.ReplicaResponse response = - new TransportReplicationAction.ReplicaResponse(randomAlphaOfLength(10), randomLong()); + final TransportReplicationAction.ReplicaResponse response = new TransportReplicationAction.ReplicaResponse(randomLong()); transport.handleResponse(captures[0].requestId, response); assertTrue(listener.isDone()); assertThat(listener.get(), equalTo(response)); diff --git a/core/src/test/java/org/elasticsearch/action/support/replication/TransportWriteActionTests.java b/core/src/test/java/org/elasticsearch/action/support/replication/TransportWriteActionTests.java index 7e1ff9e1ca..a1d33960f7 100644 --- a/core/src/test/java/org/elasticsearch/action/support/replication/TransportWriteActionTests.java +++ b/core/src/test/java/org/elasticsearch/action/support/replication/TransportWriteActionTests.java @@ -286,8 +286,7 @@ public class TransportWriteActionTests extends ESTestCase { CapturingTransport.CapturedRequest[] captures = transport.getCapturedRequestsAndClear(); assertThat(captures, arrayWithSize(1)); if (randomBoolean()) { - final TransportReplicationAction.ReplicaResponse response = - new TransportReplicationAction.ReplicaResponse(randomAlphaOfLength(10), randomLong()); + final TransportReplicationAction.ReplicaResponse response = new TransportReplicationAction.ReplicaResponse(randomLong()); transport.handleResponse(captures[0].requestId, response); assertTrue(listener.isDone()); assertThat(listener.get(), equalTo(response)); diff --git a/core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java b/core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java index 75a59a36d7..be1b4661c5 100644 --- a/core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java +++ b/core/src/test/java/org/elasticsearch/index/replication/ESIndexLevelReplicationTestCase.java @@ -537,9 +537,7 @@ public abstract class ESIndexLevelReplicationTestCase extends IndexShardTestCase try { performOnReplica(request, replica); releasable.close(); - listener.onResponse( - new ReplicaResponse( - replica.routingEntry().allocationId().getId(), replica.getLocalCheckpoint())); + listener.onResponse(new ReplicaResponse(replica.getLocalCheckpoint())); } catch (final Exception e) { Releasables.closeWhileHandlingException(releasable); listener.onFailure(e); |