opendistro-for-elasticsearch / k-NN

🆕 A machine learning plugin which supports an approximate k-NN search algorithm for Open Distro.
https://opendistro.github.io/
Apache License 2.0
277 stars 55 forks source link

Fix test testScriptStats_multipleShards #272

Closed vamshin closed 3 years ago

vamshin commented 3 years ago

When upgraded to ES version 7.10.0, number of script query requests seem to mismatch. Most likely issue with test case

REPRODUCE WITH: ./gradlew ':integTest' --tests "com.amazon.opendistroforelasticsearch.knn.plugin.action.RestKNNStatsHandlerIT.testScriptStats_multipleShards" -Dtests.seed=A4F5BF99A3533F39 -Dtests.security.manager=false -Dtests.locale=ar-AE -Dtests.timezone=Asia/Harbin -Druntime.java=14

com.amazon.opendistroforelasticsearch.knn.plugin.action.RestKNNStatsHandlerIT > testScriptStats_multipleShards FAILED java.lang.AssertionError: expected:<2> but was:<4> at __randomizedtesting.SeedInfo.seed([A4F5BF99A3533F39:18BA805562F7F047]:0) at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.failNotEquals(Assert.java:834) at org.junit.Assert.assertEquals(Assert.java:645) at org.junit.Assert.assertEquals(Assert.java:631) at com.amazon.opendistroforelasticsearch.knn.plugin.action.RestKNNStatsHandlerIT.testScriptStats_multipleShards(RestKNNStatsHandlerIT.java:282)

jmazanec15 commented 3 years ago

I don't believe this is an issue with the test case. It seems like the constructor for VectorScoreScriptFactory is getting called twice per shard per query. Need to dig into this a little bit more to understand why this is happening. But, at the moment, this appears to be a bug.