Skip to content

Commit 22e27c3

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. Relates #39268
1 parent 435a8c6 commit 22e27c3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.elasticsearch.snapshots.RestoreService;
4343
import org.elasticsearch.test.transport.MockTransportService;
4444
import org.elasticsearch.transport.ConnectTransportException;
45+
import org.elasticsearch.transport.TransportActionProxy;
4546
import org.elasticsearch.transport.TransportService;
4647
import org.elasticsearch.xpack.CcrIntegTestCase;
4748
import org.elasticsearch.xpack.ccr.action.repositories.ClearCcrRestoreSessionAction;
@@ -190,7 +191,6 @@ public void testRetentionLeaseIsTakenAtTheStartOfRecovery() throws Exception {
190191

191192
}
192193

193-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/39268")
194194
public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
195195
final String leaderIndex = "leader";
196196
final int numberOfShards = randomIntBetween(1, 3);
@@ -211,7 +211,8 @@ public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
211211
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
212212
senderTransportService.addSendBehavior(
213213
(connection, requestId, action, request, options) -> {
214-
if (ClearCcrRestoreSessionAction.NAME.equals(action)) {
214+
if (ClearCcrRestoreSessionAction.NAME.equals(action)
215+
|| TransportActionProxy.getProxyAction(ClearCcrRestoreSessionAction.NAME).equals(action)) {
215216
try {
216217
latch.await();
217218
} catch (final InterruptedException e) {
@@ -433,7 +434,8 @@ public void testUnfollowRemovesRetentionLeases() throws Exception {
433434
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
434435
senderTransportService.addSendBehavior(
435436
(connection, requestId, action, request, options) -> {
436-
if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)) {
437+
if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)
438+
|| TransportActionProxy.getProxyAction(RetentionLeaseActions.Remove.ACTION_NAME).equals(action)) {
437439
final RetentionLeaseActions.RemoveRequest removeRequest = (RetentionLeaseActions.RemoveRequest) request;
438440
if (shardIds.contains(removeRequest.getShardId().id())) {
439441
final String primaryShardNodeId =
@@ -517,7 +519,8 @@ public void testUnfollowFailsToRemoveRetentionLeases() throws Exception {
517519
(MockTransportService) getFollowerCluster().getInstance(TransportService.class, senderNode.value.getName());
518520
senderTransportService.addSendBehavior(
519521
(connection, requestId, action, request, options) -> {
520-
if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)) {
522+
if (RetentionLeaseActions.Remove.ACTION_NAME.equals(action)
523+
|| TransportActionProxy.getProxyAction(RetentionLeaseActions.Remove.ACTION_NAME).equals(action)) {
521524
final RetentionLeaseActions.RemoveRequest removeRequest = (RetentionLeaseActions.RemoveRequest) request;
522525
if (shardIds.contains(removeRequest.getShardId().id())) {
523526
throw randomBoolean()

0 commit comments

Comments
 (0)