# Unfollowing indices when leader is gone

**URL:** https://discuss.elastic.co/t/unfollowing-indices-when-leader-is-gone/221701
**Category:** Elasticsearch
**Tags:** ccr-cross-cluster-replication
**Created:** [March 2, 2020, 2:36pm UTC](https://discuss.elastic.co/t/unfollowing-indices-when-leader-is-gone/221701 "2020-03-02T14:36:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![javierE](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@javierE](https://discuss.elastic.co/u/javierE)
#### Post date: [March 2, 2020, 2:36pm UTC](https://discuss.elastic.co/t/unfollowing-indices-when-leader-is-gone/221701/1 "2020-03-02T14:36:37Z")

</div>

Hello,

I am currently testing ccr, and staging a particular scenario where my primary site is lost.

I need to script a procedure to change all my followers to R/W and resume the operations on the secondary site.  
To achieve this, i loop over all followers doing pause\_follower/close/unfollow/open

During this test I found two different behaviours when unfollowing indices when the leader is not available:

1. For some indices the unfollow call never returns (i waited for more than an hour), so i implement a timeout for this case.  
The cluster shows the unfollow task running but never dies.

and \_cat/tasks :

```
action task_id parent_task_id type start_time timestamp running_time ip node
indices:admin/xpack/ccr/unfollow HNTVVJ9-Qemfv9Vq4sImng:3976 - transport 1582919983003 19:59:43 2.6d 192.168.1.YYY node1b

```

1. The unfollow call returns immediately with an error

In both cases \_ccr/stats shows no followers and if I  
open the index , everything seems ok and ready to R/W operations.

Should I be concerned about this long running tasks? Is this the expected behaviour when unfollowing if the leader is not available?

ES Version: 7.4.2 (tgz distribution)

Thanks for your help.  
Regards.

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [March 2, 2020, 4:01pm UTC](https://discuss.elastic.co/t/unfollowing-indices-when-leader-is-gone/221701/2 "2020-03-02T16:01:39Z")

</div>

Hmm. I can imagine things for which unfollowing might be waiting (in vain) but I think you're right and it shouldn't be. Any chance you can try and reproduce this on 7.6, just in case it's something that's been fixed? If it persists in the latest version, would you open an issue on Github about this?

---

<div class="post-metadata">

### Author: ![javierE](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@javierE](https://discuss.elastic.co/u/javierE)
#### Post date: [March 2, 2020, 8:36pm UTC](https://discuss.elastic.co/t/unfollowing-indices-when-leader-is-gone/221701/3 "2020-03-02T20:36:02Z")

</div>

Thanks for your reply,

I reproduced this behaviour in version 7.6.0 , also realized that the unfollow task hangs only with indices with more than one primary shard. With 1 primary it returns de exception

I will run a few more tests and open a ticket.

---

<div class="post-metadata">

### Author: ![javierE](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@javierE](https://discuss.elastic.co/u/javierE)
#### Post date: [March 9, 2020, 12:29pm UTC](https://discuss.elastic.co/t/unfollowing-indices-when-leader-is-gone/221701/4 "2020-03-09T12:29:37Z")

</div>

For reference:

Open ticket: [https://github.com/elastic/elasticsearch/issues/53174](https://github.com/elastic/elasticsearch/issues/53174)  
Closed in: [https://github.com/elastic/elasticsearch/pull/53262](https://github.com/elastic/elasticsearch/pull/53262)

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [March 9, 2020, 1:10pm UTC](https://discuss.elastic.co/t/unfollowing-indices-when-leader-is-gone/221701/5 "2020-03-09T13:10:37Z")

</div>

Possibly one of the best-written bug reports I've ever read, thanks @javierE 🙂

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 6, 2020, 1:10pm UTC](https://discuss.elastic.co/t/unfollowing-indices-when-leader-is-gone/221701/6 "2020-04-06T13:10:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
