gpt4 book ai didi

elasticsearch - 运行测试时,ElasticSearch随机失败

转载 作者:行者123 更新时间:2023-12-02 23:25:33 24 4
gpt4 key购买 nike

我有一个测试ElasticSearch框(2.3.0),我使用ES的测试以随机顺序失败,这真令人沮丧(All shards失败异常失败)。

查看elastic_search.log文件,它只向我显示了这个

[2017-05-04 04:19:15,990][DEBUG][action.search.type       ] [es-testing-1] All shards failed for phase: [query]
RemoteTransportException[[es-testing-1][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: IllegalIndexShardStateException[CurrentState[RECOVERING] operations only allowed when shard state is one of [POST_RECOVERY, STARTED, RELOCATED]];
Caused by: [derp_test][[derp_test][3]] IllegalIndexShardStateException[CurrentState[RECOVERING] operations only allowed when shard state is one of [POST_RECOVERY, STARTED, RELOCATED]]
at org.elasticsearch.index.shard.IndexShard.readAllowed(IndexShard.java:993)
at org.elasticsearch.index.shard.IndexShard.acquireSearcher(IndexShard.java:814)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:641)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:618)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:369)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:368)
at org.elasticsearch.search.action.SearchServiceTransportAction$SearchQueryTransportHandler.messageReceived(SearchServiceTransportAction.java:365)
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:350)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

知道发生了什么吗?到目前为止,我的研究仅告诉我,这很可能是由于损坏的Translog引起的-但我认为删除Translog不会有所帮助,因为该测试会删除每个命名空间的测试索引

ES测试箱具有3.5GB RAM,正在使用2.5GB堆大小,测试期间的CPU使用率非常正常(峰值为15%)

需要澄清的是:当我说测试失败时,我的意思是如上所述的异常异常错误(由于值不正确而导致测试失败)。我在每次插入/更新操作后都进行了手动刷新,因此值是正确的。

最佳答案

在研究了ElasticSearch日志文件(处于DEBUG级别)和源代码之后,发现实际发生的情况是在创建索引之后,这些碎片进入了RECOVERING状态,有时我的测试试图在ElasticSearch上执行查询,而这些碎片还没有 Activity -因此是异常(exception)。

修复很简单-创建索引后,只需等到使用setWaitForActiveShards函数激活分片,并且更偏执,我还添加了setWaitForYellowStatus

关于elasticsearch - 运行测试时,ElasticSearch随机失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43773909/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com