Skip to content

Commit 094309e

Browse files
committed
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
1 parent fee33d5 commit 094309e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@
4040
import org.elasticsearch.plugins.Plugin;
4141
import org.elasticsearch.snapshots.RestoreInfo;
4242
import org.elasticsearch.snapshots.RestoreService;
43-
import org.elasticsearch.test.junit.annotations.TestLogging;
4443
import org.elasticsearch.test.transport.MockTransportService;
4544
import org.elasticsearch.transport.ConnectTransportException;
45+
import org.elasticsearch.transport.TransportActionProxy;
4646
import org.elasticsearch.transport.TransportService;
4747
import org.elasticsearch.xpack.CcrIntegTestCase;
4848
import org.elasticsearch.xpack.ccr.action.repositories.ClearCcrRestoreSessionAction;
@@ -191,7 +191,6 @@ public void testRetentionLeaseIsTakenAtTheStartOfRecovery() throws Exception {
191191

192192
}
193193

194-
@TestLogging(value = "org.elasticsearch.xpack.ccr:trace")
195194
public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
196195
final String leaderIndex = "leader";
197196
final int numberOfShards = randomIntBetween(1, 3);
@@ -212,10 +211,9 @@ public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
212211
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
213212
senderTransportService.addSendBehavior(
214213
(connection, requestId, action, request, options) -> {
215-
logger.info("action [{}]", action);
216-
if (ClearCcrRestoreSessionAction.NAME.equals(action)) {
214+
if (ClearCcrRestoreSessionAction.NAME.equals(action)
215+
|| TransportActionProxy.getProxyAction(ClearCcrRestoreSessionAction.NAME).equals(action)) {
217216
try {
218-
logger.info("latching");
219217
latch.await();
220218
} catch (final InterruptedException e) {
221219
fail(e.toString());
@@ -436,7 +434,8 @@ public void testUnfollowRemovesRetentionLeases() throws Exception {
436434
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
437435
senderTransportService.addSendBehavior(
438436
(connection, requestId, action, request, options) -> {
439-
if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)) {
437+
if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)
438+
|| TransportActionProxy.getProxyAction(RetentionLeaseActions.Remove.ACTION_NAME).equals(action)) {
440439
final RetentionLeaseActions.RemoveRequest removeRequest = (RetentionLeaseActions.RemoveRequest) request;
441440
if (shardIds.contains(removeRequest.getShardId().id())) {
442441
final String primaryShardNodeId =
@@ -520,7 +519,8 @@ public void testUnfollowFailsToRemoveRetentionLeases() throws Exception {
520519
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
521520
senderTransportService.addSendBehavior(
522521
(connection, requestId, action, request, options) -> {
523-
if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)) {
522+
if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)
523+
|| TransportActionProxy.getProxyAction(RetentionLeaseActions.Remove.ACTION_NAME).equals(action)) {
524524
final RetentionLeaseActions.RemoveRequest removeRequest = (RetentionLeaseActions.RemoveRequest) request;
525525
if (shardIds.contains(removeRequest.getShardId().id())) {
526526
throw randomBoolean()

0 commit comments

Comments
 (0)