From 6e06f821060c8974450dd4bc3d8a87b531e51cab Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Fri, 22 Feb 2019 18:34:33 -0500 Subject: [PATCH] Fix failing CCR retention lease test Finally! This commit should fix the issues with the CCR retention lease that has been plaguing build failures. The issue here is that we are trying to prevent the clear session requests from being executed until after we have been able to validate that retention leases are being renewed. However, we were only blocking the clear session requests but not blocking them when they are proxied through another node. This commit addresses that. Relates #39268 --- .../elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java index 51f010809d4..eb25bd8c342 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java @@ -42,6 +42,7 @@ import org.elasticsearch.snapshots.RestoreInfo; import org.elasticsearch.snapshots.RestoreService; import org.elasticsearch.test.transport.MockTransportService; import org.elasticsearch.transport.ConnectTransportException; +import org.elasticsearch.transport.TransportActionProxy; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.CcrIntegTestCase; import org.elasticsearch.xpack.ccr.action.repositories.ClearCcrRestoreSessionAction; @@ -190,7 +191,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { } - @AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/39268") public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception { final String leaderIndex = "leader"; final int numberOfShards = randomIntBetween(1, 3); @@ -211,7 +211,8 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { (MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName()); senderTransportService.addSendBehavior( (connection, requestId, action, request, options) -> { - if (ClearCcrRestoreSessionAction.NAME.equals(action)) { + if (ClearCcrRestoreSessionAction.NAME.equals(action) + || TransportActionProxy.getProxyAction(ClearCcrRestoreSessionAction.NAME).equals(action)) { try { latch.await(); } catch (final InterruptedException e) { @@ -433,7 +434,8 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { (MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName()); senderTransportService.addSendBehavior( (connection, requestId, action, request, options) -> { - if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)) { + if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action) + || TransportActionProxy.getProxyAction(RetentionLeaseActions.Remove.ACTION_NAME).equals(action)) { final RetentionLeaseActions.RemoveRequest removeRequest = (RetentionLeaseActions.RemoveRequest) request; if (shardIds.contains(removeRequest.getShardId().id())) { final String primaryShardNodeId = @@ -517,7 +519,8 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase { (MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName()); senderTransportService.addSendBehavior( (connection, requestId, action, request, options) -> { - if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)) { + if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action) + || TransportActionProxy.getProxyAction(RetentionLeaseActions.Remove.ACTION_NAME).equals(action)) { final RetentionLeaseActions.RemoveRequest removeRequest = (RetentionLeaseActions.RemoveRequest) request; if (shardIds.contains(removeRequest.getShardId().id())) { throw randomBoolean()