Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Java node client and deleting all indexes cause system hungs #2692

Closed
lordofthejars opened this issue Feb 26, 2013 · 2 comments
Closed

Comments

@lordofthejars
Copy link

Using elasticsearch 0.20.5 in Java 1.6 with Ubuntu 12.04 (but also happens with Windows), the system is frozen when you try to delete all indexes when there are no indexes yet into the elasticsearch. This error is a bit strange but I can reproduce it without any problem.

First of all create a new project in Eclipse (in my case but of course in command line or Intellij should do the same). Then add elasticsearch 0.20.5 as dependency and write one simple test:

Node node = nodeBuilder().local(true).node();
Client client = node.client();

DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = new DeleteByQueryRequestBuilder(client);

deleteByQueryRequestBuilder.setQuery(QueryBuilders.matchAllQuery());
deleteByQueryRequestBuilder.execute().actionGet();

node.close();

Then I run the test and the output is:

26-feb-2013 10:17:31 org.elasticsearch.node
INFO: [Assassin] {0.20.5}[4352]: initializing ...
26-feb-2013 10:17:31 org.elasticsearch.plugins
INFO: [Assassin] loaded [], sites []
26-feb-2013 10:17:33 org.elasticsearch.node
INFO: [Assassin] {0.20.5}[4352]: initialized
26-feb-2013 10:17:33 org.elasticsearch.node
INFO: [Assassin] {0.20.5}[4352]: starting ...
26-feb-2013 10:17:33 org.elasticsearch.transport
INFO: [Assassin] bound_address {local[1]}, publish_address {local[1]}
26-feb-2013 10:17:33 org.elasticsearch.cluster.service
INFO: [Assassin] new_master [Assassin][1][local[1]]{local=true}, reason: local-disco-initial_connect(master)
26-feb-2013 10:17:33 org.elasticsearch.discovery
INFO: [Assassin] elasticsearch/1
26-feb-2013 10:17:33 org.elasticsearch.http
INFO: [Assassin] bound_address {inet[/0.0.0.0:9200]}, publish_address {inet[/<ipaddress>:9200]}
26-feb-2013 10:17:33 org.elasticsearch.node
INFO: [Assassin] {0.20.5}[4352]: started
26-feb-2013 10:17:33 org.elasticsearch.gateway
INFO: [Assassin] recovered [0] indices into cluster_state

But the test never ends, the actionGet() call does not return any result it is hung there.

Then I abort the test and I do the next modification in test:

Node node = nodeBuilder().local(true).node();
Client client = node.client();

String json = "{" +
            "\"user\":\"kimchy\"," +
            "\"postDate\":\"2013-01-30\"," +
            "\"message\":\"trying out Elastic Search\"" +
        "}";

IndexResponse response = client.prepareIndex("twitter", "tweet")
                .setSource(json)
                .execute()
                .actionGet();

DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = new DeleteByQueryRequestBuilder(client);

deleteByQueryRequestBuilder.setQuery(QueryBuilders.matchAllQuery());
deleteByQueryRequestBuilder.execute().actionGet();

node.close();

And then it works as expected, but now comes the "paranoic" part, I rerun the first test again without preparing an index before deleting:

Node node = nodeBuilder().local(true).node();
Client client = node.client();

DeleteByQueryRequestBuilder deleteByQueryRequestBuilder = new DeleteByQueryRequestBuilder(client);

deleteByQueryRequestBuilder.setQuery(QueryBuilders.matchAllQuery());
deleteByQueryRequestBuilder.execute().actionGet();

node.close();

But now also it works as expected, mostly because there is one index. (data directory is there already created so can work perfectly).

INFO: [Cold War] recovered [1] indices into cluster_state

So it seems that delete all command does not work correctly when there is no indexes to remove (first time you start the node). Maybe I am doing wrong about how to remove all indexes, but anyway there is still an error on operation which makes all application (test in my case) hungs.

Alex.

@ghost ghost assigned s1monw Mar 1, 2013
@s1monw
Copy link
Contributor

s1monw commented Mar 1, 2013

hey, thanks for reporting this. This is indeed a bug. It manifests if you do the delete by query on a cluster without any indices. Yet, the fact that this works on the second try is that with delete by query you are only deleting all documents but not the index. So the index exists and the bug is not triggered. If you want to delete the index try client.admin().indices("index_name").prepareDelete().execute().actionGet(); <-- you can omit the name to del all indices but be careful!

s1monw added a commit to s1monw/elasticsearch that referenced this issue Mar 1, 2013
@s1monw s1monw closed this as completed in 39f3623 Mar 1, 2013
@s1monw
Copy link
Contributor

s1monw commented Mar 3, 2013

i also applied this to 0.20

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants