elasticsearch/elasticsearch — pull request #8608 by s1monw (2014-11-22 19:43:55+00:00)
Title: [CORE] Wait for pending shard removal on IndexService close

When an index service gets closed due to a delete index event it's possible
that shards are already removed from the service that are currently in
recovery. The recovery source applies the delete index first and causes
the target to fail its shard. This shard gets removed from the service
but it's content doesn't get deleted if the actual delete index is faster
applied. This commit makes sure we wait for the pending removals that
are in-flight before we close the index an delete it's content too once
the lock is released.