Skip to content
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

OAK-10811: (oak-search-elastic) reduce contention in IndexTracker #1466

Merged
merged 3 commits into from
May 23, 2024

Conversation

fabriziofortino
Copy link
Contributor

@fabriziofortino fabriziofortino commented May 16, 2024

The ElasticIndexTracker has been introduced to avoid loading the index definition from the node store for each read/write into the index. The logic has been inspired by the LuceneIndexTracker.

The isUpdateNeeded has this comment:

// for Elastic, we are not interested in checking for updates on :status, index definition is enough.
// The :status gets updated every time the indexed content is changed (with properties like last_update_ts),
// removing the check on :status reduces drastically the contention between queries (that need to acquire the
// read lock) and updates (need to acquire the write lock).
// Moreover, we don't check diffs in stored index definitions since are not created for elastic.

Although the comment makes total sense, the implementation was taking into account the :status node that gets updated every time the async lane changes the index.
This creates contention because it forces the next read/write operation to recreate the IndexNode and reload the definition from the node store.

With this PR, the logic does exactly what the comment above says reducing contention and avoiding unneeded object creation.

@fabriziofortino fabriziofortino marked this pull request as ready for review May 16, 2024 16:29
@fabriziofortino fabriziofortino merged commit 57d124c into apache:trunk May 23, 2024
1 of 2 checks passed
@fabriziofortino fabriziofortino deleted the OAK-10811 branch May 23, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants