Skip to content

fix: Non-blocking payload index building - #4941

Merged
coszio merged 4 commits into
devfrom
non-blocking-payload-index-building
Aug 23, 2024
Merged

coszio merged 4 commits into
devfrom
non-blocking-payload-index-building

Conversation

@coszio

@coszio coszio commented Aug 22, 2024 •

Copy link
Copy Markdown
Contributor

Fixes #4934

Currently, when we build a payload index, we hold a write lock the entire time the index is being built. This might be acceptable for small collections, but on bigger ones this means that searches will be completely interrupted (and even make them timeout) during building.

With these changes I've separated the building and applying sections, so that we only need a read lock when building, and upgrades to a write lock when applying it to the segment.

I've tested this manually with bfb + dashboard, and now searches keep responding normally during index building, with only a really small hiccup at the end.

@coszio

coszio commented Aug 22, 2024

Copy link
Copy Markdown
Contributor Author

Note: Since these changes, I've had to add ?wait=true to some of our tests, because now it truly happens on the background, not only for responding quickly.

Our tests worked because the index building locked the server while it finished, so it behaved similarly as if wait was always true.

@generall generall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@coszio
coszio merged commit 797a0d5 into dev Aug 23, 2024
@coszio
coszio deleted the non-blocking-payload-index-building branch August 23, 2024 12:30
@timvisee

Copy link
Copy Markdown
Member

Sweet! Thanks for implementing it so quickly.

generall pushed a commit that referenced this pull request Aug 26, 2024
* separate index creation into build and apply

* check version in Segment impl of `build_field_index`

* add wait to issues test

* fix consensus tests
@timvisee timvisee mentioned this pull request Aug 28, 2024
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants