43
43
import org .elasticsearch .plugins .Plugin ;
44
44
import org .elasticsearch .snapshots .RestoreInfo ;
45
45
import org .elasticsearch .snapshots .RestoreService ;
46
+ import org .elasticsearch .test .junit .annotations .TestIssueLogging ;
46
47
import org .elasticsearch .test .transport .MockTransportService ;
47
48
import org .elasticsearch .transport .ConnectTransportException ;
48
49
import org .elasticsearch .transport .RemoteTransportException ;
86
87
import static org .hamcrest .Matchers .greaterThan ;
87
88
import static org .hamcrest .Matchers .hasSize ;
88
89
90
+ @ TestIssueLogging (
91
+ value = "org.elasticsearch.xpack.ccr:trace,org.elasticsearch.indices.recovery:trace,org.elasticsearch.index.seqno:debug" ,
92
+ issueUrl = "https://github.com/elastic/elasticsearch/issues/45192" )
89
93
public class CcrRetentionLeaseIT extends CcrIntegTestCase {
90
94
91
95
public static final class RetentionLeaseRenewIntervalSettingPlugin extends Plugin {
@@ -779,6 +783,9 @@ public void testRetentionLeaseIsAddedIfItDisappearsWhileFollowing() throws Excep
779
783
|| TransportActionProxy .getProxyAction (RetentionLeaseActions .Renew .ACTION_NAME ).equals (action )) {
780
784
senderTransportService .clearAllRules ();
781
785
final RetentionLeaseActions .RenewRequest renewRequest = (RetentionLeaseActions .RenewRequest ) request ;
786
+ final String retentionLeaseId = getRetentionLeaseId (followerIndex , leaderIndex );
787
+ assertThat (retentionLeaseId , equalTo (renewRequest .getId ()));
788
+ logger .info ("--> intercepting renewal request for retention lease [{}]" , retentionLeaseId );
782
789
final String primaryShardNodeId =
783
790
getLeaderCluster ()
784
791
.clusterService ()
@@ -796,17 +803,17 @@ public void testRetentionLeaseIsAddedIfItDisappearsWhileFollowing() throws Excep
796
803
.getShardOrNull (renewRequest .getShardId ());
797
804
final CountDownLatch innerLatch = new CountDownLatch (1 );
798
805
// this forces the background renewal from following to face a retention lease not found exception
799
- primary . removeRetentionLease (
800
- getRetentionLeaseId ( followerIndex , leaderIndex ) ,
806
+ logger . info ( "--> removing retention lease [{}] on the leader" , retentionLeaseId );
807
+ primary . removeRetentionLease ( retentionLeaseId ,
801
808
ActionListener .wrap (r -> innerLatch .countDown (), e -> fail (e .toString ())));
802
-
809
+ logger . info ( "--> waiting for the removed retention lease [{}] to be synced on the leader" , retentionLeaseId );
803
810
try {
804
811
innerLatch .await ();
805
812
} catch (final InterruptedException e ) {
806
813
Thread .currentThread ().interrupt ();
807
814
fail (e .toString ());
808
815
}
809
-
816
+ logger . info ( "--> removed retention lease [{}] on the leader" , retentionLeaseId );
810
817
latch .countDown ();
811
818
}
812
819
connection .sendRequest (requestId , action , request , options );
@@ -877,6 +884,7 @@ public void testPeriodicRenewalDoesNotAddRetentionLeaseAfterUnfollow() throws Ex
877
884
if (RetentionLeaseActions .Renew .ACTION_NAME .equals (action )
878
885
|| TransportActionProxy .getProxyAction (RetentionLeaseActions .Renew .ACTION_NAME ).equals (action )) {
879
886
final String retentionLeaseId = getRetentionLeaseId (followerIndex , leaderIndex );
887
+ logger .info ("--> blocking renewal request for retention lease [{}] until unfollowed" , retentionLeaseId );
880
888
try {
881
889
removeLeaseLatch .countDown ();
882
890
unfollowLatch .await ();
0 commit comments