Skip to content

Commit

Permalink
Fix failing CCR retention lease test
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jasontedor committed Feb 23, 2019
1 parent 435a8c6 commit 22e27c3
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
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;
Expand Down Expand Up @@ -190,7 +191,6 @@ public void testRetentionLeaseIsTakenAtTheStartOfRecovery() throws Exception {

}

@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/39268")
public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
final String leaderIndex = "leader";
final int numberOfShards = randomIntBetween(1, 3);
Expand All @@ -211,7 +211,8 @@ public void testRetentionLeaseIsRenewedDuringRecovery() throws Exception {
(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) {
Expand Down Expand Up @@ -433,7 +434,8 @@ public void testUnfollowRemovesRetentionLeases() throws Exception {
(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 =
Expand Down Expand Up @@ -517,7 +519,8 @@ public void testUnfollowFailsToRemoveRetentionLeases() throws Exception {
(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()
Expand Down

0 comments on commit 22e27c3

Please sign in to comment.