瀏覽代碼

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.

Closes #39268
Jason Tedor 6 年之前
父節點
當前提交
094309e19e
共有 1 個文件被更改,包括 7 次插入7 次删除
  1. 7 7
      x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java

+ 7 - 7
x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrRetentionLeaseIT.java

@@ -40,9 +40,9 @@ import org.elasticsearch.indices.IndicesService;
 import org.elasticsearch.plugins.Plugin;
 import org.elasticsearch.snapshots.RestoreInfo;
 import org.elasticsearch.snapshots.RestoreService;
-import org.elasticsearch.test.junit.annotations.TestLogging;
 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;
@@ -191,7 +191,6 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
 
     }
 
-    @TestLogging(value = "org.elasticsearch.xpack.ccr:trace")
     public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
         final String leaderIndex = "leader";
         final int numberOfShards = randomIntBetween(1, 3);
@@ -212,10 +211,9 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
                     (MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
             senderTransportService.addSendBehavior(
                     (connection, requestId, action, request, options) -> {
-                        logger.info("action [{}]", action);
-                        if (ClearCcrRestoreSessionAction.NAME.equals(action)) {
+                        if (ClearCcrRestoreSessionAction.NAME.equals(action)
+                                || TransportActionProxy.getProxyAction(ClearCcrRestoreSessionAction.NAME).equals(action)) {
                             try {
-                                logger.info("latching");
                                 latch.await();
                             } catch (final InterruptedException e) {
                                 fail(e.toString());
@@ -436,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 =
@@ -520,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()