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
This commit is contained in:
parent
2d4c98a991
commit
6e06f82106
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue