Add debug log for CcrRetentionLeaseIT (#48820)
testRetentionLeaseIsAddedIfItDisappearsWhileFollowing is still failing although we already have several fixes. I think other tests interfere and cause this test to fail. We can use the test scope to isolate them. However, I prefer to add debug logs so we can find the source. Relates #45192
This commit is contained in:
parent
c24595e2ec
commit
4c70770877
|
@ -43,6 +43,7 @@ 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.TestIssueLogging;
|
||||
import org.elasticsearch.test.transport.MockTransportService;
|
||||
import org.elasticsearch.transport.ConnectTransportException;
|
||||
import org.elasticsearch.transport.RemoteTransportException;
|
||||
|
@ -86,6 +87,9 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
|
||||
@TestIssueLogging(
|
||||
value = "org.elasticsearch.xpack.ccr:trace,org.elasticsearch.indices.recovery:trace,org.elasticsearch.index.seqno:debug",
|
||||
issueUrl = "https://github.com/elastic/elasticsearch/issues/45192")
|
||||
public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
||||
|
||||
public static final class RetentionLeaseRenewIntervalSettingPlugin extends Plugin {
|
||||
|
@ -779,6 +783,9 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
|||
|| TransportActionProxy.getProxyAction(RetentionLeaseActions.Renew.ACTION_NAME).equals(action)) {
|
||||
senderTransportService.clearAllRules();
|
||||
final RetentionLeaseActions.RenewRequest renewRequest = (RetentionLeaseActions.RenewRequest) request;
|
||||
final String retentionLeaseId = getRetentionLeaseId(followerIndex, leaderIndex);
|
||||
assertThat(retentionLeaseId, equalTo(renewRequest.getId()));
|
||||
logger.info("--> intercepting renewal request for retention lease [{}]", retentionLeaseId);
|
||||
final String primaryShardNodeId =
|
||||
getLeaderCluster()
|
||||
.clusterService()
|
||||
|
@ -796,17 +803,17 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
|||
.getShardOrNull(renewRequest.getShardId());
|
||||
final CountDownLatch innerLatch = new CountDownLatch(1);
|
||||
// this forces the background renewal from following to face a retention lease not found exception
|
||||
primary.removeRetentionLease(
|
||||
getRetentionLeaseId(followerIndex, leaderIndex),
|
||||
logger.info("--> removing retention lease [{}] on the leader", retentionLeaseId);
|
||||
primary.removeRetentionLease(retentionLeaseId,
|
||||
ActionListener.wrap(r -> innerLatch.countDown(), e -> fail(e.toString())));
|
||||
|
||||
logger.info("--> waiting for the removed retention lease [{}] to be synced on the leader", retentionLeaseId);
|
||||
try {
|
||||
innerLatch.await();
|
||||
} catch (final InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
fail(e.toString());
|
||||
}
|
||||
|
||||
logger.info("--> removed retention lease [{}] on the leader", retentionLeaseId);
|
||||
latch.countDown();
|
||||
}
|
||||
connection.sendRequest(requestId, action, request, options);
|
||||
|
@ -877,6 +884,7 @@ public class CcrRetentionLeaseIT extends CcrIntegTestCase {
|
|||
if (RetentionLeaseActions.Renew.ACTION_NAME.equals(action)
|
||||
|| TransportActionProxy.getProxyAction(RetentionLeaseActions.Renew.ACTION_NAME).equals(action)) {
|
||||
final String retentionLeaseId = getRetentionLeaseId(followerIndex, leaderIndex);
|
||||
logger.info("--> blocking renewal request for retention lease [{}] until unfollowed", retentionLeaseId);
|
||||
try {
|
||||
removeLeaseLatch.countDown();
|
||||
unfollowLatch.await();
|
||||
|
|
Loading…
Reference in New Issue