Ok, I think I understand what is happening now.
The error condition that I was seeing is reproducible with the
following sequence of events:
- Index a parent document
- Index a child document of the parent from step 1.
- Delete the parent document
- Execute a has_child search. This will return a shard failure and
the log file shows the null pointer exception.
Well, it makes sense that this would represent an error condition.
The situation comes up somehow with our functional tests that are
doing a lot of indexing, re-indexing, and deleting, and it seems that
somehow the deletes are getting interleaved with the updates.
I think what is happening in our app test is that a delete operation
is underway that is deleting the child and then the parent, but an
indexing operation snuck in between and indexed the parent and the
child, like this:
- On thread 1 - Delete Child document executes, but before the Delete
- On another thread the same child gets indexed. Now the child doc
- Now, back on thread 1 - the Delete Parent operation executes. Now
the child is orphaned, and the has_child search will fail.
I think we can make changes in our app to avoid this. If we delete
the parent first, then the above scenario wouldn't result in the shard
failure, and just an orphaned parent instead, which isn't so bad.
Are there other strategies to avoid this? Is there a way to execute a
delete against both the child and the parent in an atomic fashion, or
perhaps a way to have the deletion of the parent automatically delete
On Apr 12, 2:34 pm, Shay Banon shay.ba...@elasticsearch.com wrote:
The simplest way would be something like a curl recreation where it first index some data, and then run the query (possibly multiple times) to create the error. This will allow me to convert it into an integration test and fix it, and also make sure it will never happen again :).
If you can try and work on the above, it would be very helpful. If its a no go, then ping me privately on IRC where I can download the data files and I can try and recreate it that way.
On Tuesday, April 12, 2011 at 9:17 PM, lmader wrote:
Thanks for the speedy reply!
What would you need to run this? I can send you the elasticsearch
data files when it is in this state, along with the query (and any
other supporting files). Let me know what you need and where to send
Thanks so much!
On Apr 12, 2:25 am, Shay Banon shay.ba...@elasticsearch.com wrote:
I can see where it happens, but not sure why. Can you provide a recreation (even if intermediately) that I can run?
On Tuesday, April 12, 2011 at 2:54 AM, lmader wrote:
I check the elasticsearch log and see the following:
[2011-04-11 16:51:09,892][DEBUG][action.search.type ] [Ardina]
[acme], node[8ZUq44E3QUu8XPbPvb9yfA], [P], s[STARTED]: Failed to
Query Failed [Failed to execute child query [filtered(file:mission
Caused by: java.lang.NullPointerException
... 9 more
On Apr 11, 4:23 pm, lmader lmaderintre...@gmail.com wrote:
I'm having a problem with intermittent shard failures (doesn't always
happen) when executing "has_child" type queries against parent/child
This comes up when I am running a set of functional tests against my
application. The tests create some documents, index them, update the
documents, re-index them, search on them, delete documents, etc.
Most of the time the tests run successfully, but occasionally the
search fails. When it fails, the search doesn't throw an exception,
but it doesn't find the document, and the response contains shard
However once it gets in the state where the search returns shard
failures, it consistently fails the search. It is only intermittent
in the sense that most of the time the tests succeed. Here are the
[shard [[8ZUq44E3QUu8XPbPvb9yfA][acme]], reason
phase/query]]; nested: QueryPhaseExecutionException[[acme]:
Query Failed [Failed to execute child query [filtered(file:test)-
FilterCacheFilterWrapper(_type:contentFiles)]]]; nested: ]]
Any idea what could be causing this?
Is there anything to be careful of when re-indexing the parent and
child documents separately? Routing?