-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Limit the number of concurrently opened indexes #3331
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
Conversation
d0037d8
to
952d0d1
Compare
911d88f
to
1603e29
Compare
952d0d1
to
a69fbf8
Compare
3f51ffb
to
e5aeaea
Compare
I feel like with the tests I did, this PR is now ready for review. |
a69fbf8
to
e1cc4e3
Compare
Uffizzi Preview |
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.
Thank you very much, maybe some small changes to do.
e1cc4e3
to
a8fe5fa
Compare
|
a8fe5fa
to
08cd94c
Compare
08cd94c
to
7c42fb9
Compare
index-scheduler/src/index_mapper.rs
Outdated
if tries >= 100 { | ||
panic!("Too many attempts to close index {name} prior to deletion.") | ||
} |
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.
I'm not sure I understood in which case this can happen, and what follows if we panic here?
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.
what follows if we panic here?
I expect we will respawn a scheduler thread after some logging but you're right that I should check that.
I'm not sure I understood in which case this can happen
This should be a comment (I will add it), but I see 2 situations this can happen:
- There's a bug in the code, and the index is never adequately closed. I believe this actually happened during development, this could happen again during refactoring. It is better to eventually get an error message rather than a full on "infinite loop"
- There's a reader that won't relinquish the Index object for more than 600 seconds.
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.
I added a comment stating the situations where the panic could possibly occur.
I also tested manually triggering a panic at this location. It fails the deletion task, and kills the batch thread, which is renewed for each task, so no other side effect.
index-scheduler/src/index_mapper.rs
Outdated
if tries > 100 { | ||
panic!("Too many spurious wake ups while the index is being resized"); | ||
} |
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.
Same question
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.
I added a comment stating the situations where the panic could possibly occur.
I also tested manually triggering the panic and trying to search/add documents in an index. In both cases it kills an "actix arbiter" thread and fails the request (not in a very graceful manner, I basically get curl: (56) Recv failure: Connection reset by peer
).
It looks like actix respawns the arbiter threads, so we're not at risk of running out of threads in this situation.
Added an update with the following:
This should result in the following:
I will do a second prototype with these changes soon. remaining TODO
|
7c42fb9
to
3908fde
Compare
Pushed an update that handles the methods that attempt to open all indexes at once. There is now a The There is some performance effect to calling |
fac978a
to
006663f
Compare
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.
Thank you very much!
TODO:
Follow-ups for subsequent PRs (to be added in the tracking issue and/or opened as different issues):
|
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.
Beautiful work @dureuill 🎉 I think we can merge this PR and address your comment (☝️) in other PRs. I let you bors merge.
Thank you for the review @Kerollmops! bors merge |
Build succeeded:
|
Pull Request
Related issue
Relevant to #1841, fixes #3382
What does this PR do?
User standpoint
Implementation standpoint
index-scheduler::lru
. A more complete implementation (eg with helper functions not used here) is available but would better fit a dedicated crate.IndexScheduler
. To simplify the lifecycle of indexes, they are never removed from the cache when they are in the middle of a resize or delete operation. To achieve this, an intermediateVec
stores the UUIDs of the indexes that are in the middle of such an operation.