-
Notifications
You must be signed in to change notification settings - Fork 169
Do not apply memory optimized serach for old indices. #2918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Do not apply memory optimized serach for old indices. #2918
Conversation
c330cef to
74dfc7e
Compare
5f203c7 to
847c533
Compare
61eb4e5 to
004a9d0
Compare
| ) { | ||
| // Since LuceneOnFaiss logic sits in newer codec, we don't support LuceneOnFaiss for older codec whose version < 2.19 | ||
| if (indexCreatedVersion.before(Version.V_2_19_0)) { | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this throw an exception? The idea is that if user tries to turn on the setting for indices before 2.19 it shouldn't be allowed rather than silently falling back to default behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, there's no way to block user from enabling memory optimized search as in the event listener, we can't look up mapping from IndicesService. And the setting sits at index level, requires user to close, update and reopen it again. If we throw an exception, then all traffics will be hitting 400, then to recover, user should close the index again, and turn it off, and reopen again where loading all bytes will happen. At the worst case, if there's no sufficient memory space, then whole cluster can be ruined. 😓
The best way is to block user from enabling it if the target index is not supported, but technically we can't do it right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@navneet1v Thoughts on throwing vs silently falling back to graph loading?
I am okay with silently falling back for now, please add a debug log and update the documentation for memory optimized search
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were some setting we depreacated in 3.0 and when I was trying in 3.1 , it was throwinng as undefined setting !! So if we have launched memoryoptimzed from 2.19 , would user able to set the setting since there is no updated code which has memoryoptimzed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0ctopus13prime I think the better experience here will be to throw the exception when the setting is getting set at the index. But since we cannot do this, as an application if somehow user has set this setting on old indices we should throw exception during query to ensure that user know they are doing something incorrect, rather than silently falling back.
@0ctopus13prime another thing, what is the reason for enabling this setting for indices >=2.19 ? it should be 2.17 because from 2.17 we started using KNNVectorField of Lucene.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@navneet1v
But isn't it better to fallback to default rather than throwing an error?
Once it's configured, then all traffic would end up getting 400 if we throw an exception there. 🤔
Would it be better if we could give a chance to user to pick window for closing index and reopen it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But isn't it better to fallback to default rather than throwing an error?
No its not better to fallback since it gives a wrong impression to users and operators that the feature is working. If we can throw exception during turning on of this setting that will be great. But looks like it is not possible. So atleast on search path we should throw exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good to me !!
| ) { | ||
| // Since LuceneOnFaiss logic sits in newer codec, we don't support LuceneOnFaiss for older codec whose version < 2.19 | ||
| if (indexCreatedVersion.before(Version.V_2_19_0)) { | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were some setting we depreacated in 3.0 and when I was trying in 3.1 , it was throwinng as undefined setting !! So if we have launched memoryoptimzed from 2.19 , would user able to set the setting since there is no updated code which has memoryoptimzed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0ctopus13prime another thing, what is the reason for enabling this setting for indices >=2.19 ? it should be 2.17 because from 2.17 we started using KNNVectorField of Lucene.
004a9d0 to
c443d5a
Compare
It must be a something 😅, it was not working for some reason, but it seems working now with 2.17. |
Signed-off-by: Dooyong Kim <[email protected]>
3ea1ec7 to
ebe486f
Compare
Signed-off-by: Doo Yong Kim <[email protected]>
Description
For old indices created before 2.17, will use its old codec where returning null as VectorReader leading NPE issue when memory optimized search is enabled.
This fix PR is adding index created check to return
falsefor isMemoryOptimizedSearchEnabled so that the flow can fallback to default logic which will then delegate C++ to load vectors into off-heap.For indices created after 2.18+, will use the codec has LuceneOnFaiss implementation, will delegate it to search on Faiss index.
Related Issues
Resolves #[Issue number to be closed when this PR is merged]
#2917
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.