elasticsearch version 6.3.2
Cluster: 3 master + data nodes
Index: 1 shard + 2 replicas, 10 second flush rate
When I perform a bulk create over many indexes sometimes I get a bulk threads exceeded exception, which is fine. {"_index":"read_59a484e523c0e43a8a40aeaf_201708","_type":"reading","_id":"p0ffogo87q5jp5fj68rr39gg5js0hk1a4g8ndd4c","status":429,"error":{"type":"es_rejected_execution_exception","reason":"rejected execution of org.elasticsearch.transport.TransportService$7@4654ea91 on EsThreadPoolExecutor[name = xxx-elastic-es1.local/write, queue capacity = 200, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@62651c07[Running, pool size = 2, active threads = 2, queued tasks = 200, completed tasks = 276758]]"}}
I then take the failed records and re-index them after 5 seconds.
It seems to succeed, yet the records get lost and the server logs report the following:
[2018-08-26T18:35:08,581][WARN ][o.e.i.f.SyncedFlushService] [xxx-elastic-es2.local] [read_5ae66d980a22ab3bda3dbea3_201804][0] can't to issue sync id [T9PDW8AyREOiYT4VoOC8-w] for out of sync replica [[read_5ae66d980a22ab3bda3dbea3_201804][0], node[ot6b_6T5Sv-Mf_7UN8csNg], [R], s[STARTED], a[id=a-6vfKnnRsS-UHUA_VS0Lg]] with num docs [122070]; num docs on primary [122064]
The reason behind failed bulk requests is described in this blog post. How many indices do you have in the cluster? How many concurrent indexing threads/processes?
There are currently 500 indexes in the system, about half of which are written to every 5 minutes.
All elasticsearch config is currently using default values except for fielddata size set to 25%.
I have a single nodejs process bulking documents to a maximum of 200 records per bulk, roughly 1200 records every 5 minutes, but spiking on the 5 minute boundary, not spread across the 5 minutes.
Erk! Problem is now solved!
I've been staring at this for 2 weeks, and I knew the minute I posted a question the answer would come to me. I've been using a splice to re-add the record to the queue, but stupidly assigning the result of the splice as a new queue. This had the effect of erasing the queue.
I guess karma requires my public shame before it'll provide me with the answer to my bugs.
Turns out this isn't solved, with more debugging I find this going on.
I index 1000 records in a bulk over 51 indexes.
The bulk fails 165 records due to bulk threads exceeded.
I wait 5 seconds and send the remaining 165 records.
I get a response saying all 165 records have been stored.
The records aren't in elasticsearch.
Some more info that may help:
I use my own unique Id for the records.
I am using op_type="create" and expecting a 409 on duplicate.
I am seeing sync issues on some of the nodes at the same time.
Some thoughts:
Is it possible that since the refresh_interval is 10 seconds and I'm retrying in 5 seconds, the new records are somehow lost as the id's already exist in an error state?
Is it possible some of the nodes did store the records and haven't removed them due to the flush not occurring yet and the sync between nodes not happened yet? Thus they don't get added as they are considered to already exist?
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.