is there any possibility to get informed, when a shard is moved from
one instance to another or when it is being deleted? I'd like to free
up some in-memory resources in case that happens in my
AbstractIndexShardComponent.
For the former, you probably can poll the cluster state for reallocating
shards. Not very efficient, but since shard reallocation can take some time
for non-trivial indices (large shards), the polling interval can be large.
Deletions would be tough. When exactly is a shard deleted in Elasticsearch?
The only scenario I can think of is during a reallocation (copy and
deleted) and when the numbers of replicas is reduced (which is under user
control).
--
Ivan
On Wed, Oct 3, 2012 at 2:43 AM, Alexander Reelsen alr@spinscale.de wrote:
Hi,
is there any possibility to get informed, when a shard is moved from
one instance to another or when it is being deleted? I'd like to free
up some in-memory resources in case that happens in my
AbstractIndexShardComponent.
On Wednesday, October 3, 2012 5:43:15 AM UTC-4, Alexander Reelsen wrote:
Hi,
is there any possibility to get informed, when a shard is moved from
one instance to another or when it is being deleted? I'd like to free
up some in-memory resources in case that happens in my
AbstractIndexShardComponent.
I think I asked about this once on the ML and I think I subsequently opened
an issue on Github.
Hm. What about IndicesLifecycle.Listener.beforeIndexShardClosed() -
which seems to do what I just want. It even handles deletes
differently.
Calling this should be enough:
indicesService.indicesLifecycle().addListener(new Listener() { /*
yadayadayada */ })
there is also a shardRoutingChanged() method... so I can catch deleted
and shard moves (which in the end will likely also issue an delete on
the shard moved, everything fine for me).
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.