opensearch-project / k-NN

🆕 Find the k-nearest neighbors (k-NN) for your vector data
https://opensearch.org/docs/latest/search-plugins/knn/index/
Apache License 2.0
156 stars 123 forks source link

[Backport 2.x] Introduced writing layer, getting rid of writing logic that uses an absolute path in the filesystem. #2248

Closed 0ctopus13prime closed 2 weeks ago

0ctopus13prime commented 2 weeks ago

Description

Backporting #2241 to 2.x branch.

0ctopus13prime commented 2 weeks ago

Will check the failure in Windows

0ctopus13prime commented 2 weeks ago

The failure does not seem like related to the change. It failed to get a value from mocking instance.

We set the mocking here, but for some reasons, the mocked value is not being returned in Windows. I'm suspecting this is a concurrent issue in testing.

Model mockModel = new Model(modelMetadata1, modelBlob, modelId);
when(modelDao.get(modelId)).thenReturn(mockModel); <---------------- This should return 'test-model'
when(modelDao.getMetadata(modelId)).thenReturn(modelMetadata1);

Error :

  1> java.lang.IllegalArgumentException: Model ID 'test-model' is not created.
  1>    at org.opensearch.knn.indices.ModelUtil.getModelMetadata(ModelUtil.java:54)
  1>    at org.opensearch.knn.common.FieldInfoExtractor.extractKNNEngine(FieldInfoExtractor.java:42)
  1>    at org.opensearch.knn.index.codec.util.KNNCodecUtil.getNativeKNNEngine(KNNCodecUtil.java:126)
0ctopus13prime commented 2 weeks ago

Reran the test. If it is still failing, then will fix the code in Windows and reraise the PR!

0ctopus13prime commented 2 weeks ago

All tests passed :sweat_smile:
Will merge the PR. Also will create a new issue regarding the mocking failure.