【发布时间】:2017-05-04 04:29:35
【问题描述】:
我有一个测试 ElasticSearch 框 (2.3.0),我使用 ES 的测试以随机顺序失败,这真的很令人沮丧(失败并出现 All shards failed 异常)。
查看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%)
澄清一下:当我说测试失败时,我的意思是上面提到的奇怪异常的错误(由于值不正确而没有失败测试)。我在每次插入/更新操作后都进行了手动刷新,所以值是正确的。
【问题讨论】:
-
您是否使用ESIntegTestCase 进行集成测试?
-
@chengpohi 不,目前它只是将测试框视为普通的 es 框..这是反模式还是什么?
标签: elasticsearch