-
Notifications
You must be signed in to change notification settings - Fork 411
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-11232 - indexing-job - Simplify download from Mongo logic by traversing only by _modified instead of (_modified, _id) #1827
Open
nfsantos
wants to merge
37
commits into
apache:trunk
Choose a base branch
from
nfsantos:OAK-11232
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…nsidered for download by matching only against the indexes for which the feature is enabled. Previously, it was checking against all indexes, which could lead to downloading blobs for nodes that are not indexed by an index that needs the blob. Add tests for AOT blob downloader.
… download to the transform phase, which alleviates the load on the download threads, speeding up download.
When writing a sorted batch of node state entries to disk, skip duplicate entries. Fix tests
… only the Mongo connection.
fabriziofortino
approved these changes
Oct 31, 2024
.../apache/jackrabbit/oak/index/indexer/document/flatfile/pipelined/PipelinedTransformTask.java
Outdated
Show resolved
Hide resolved
…indexer/document/flatfile/pipelined/PipelinedTransformTask.java Co-authored-by: Fabrizio Fortino <[email protected]>
thomasmueller
approved these changes
Nov 1, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Mongo downloader traverses the repository by order of the fields
(_modified, _id)
. In case of disconnection from Mongo, this allows resuming the download from where it was interrupted without redownloading any document.However, the downloader does not need to ensure that no duplicate documents are downloaded, because the merge-sort stage of the Pipelined strategy discards duplicates. Avoiding duplicates in case of reconnections is only a performance optimization for a relatively rare occurrence.
This PR simplifies the downloader by traversing only by
_modified
. In case of failure, the download resumes from the last value of_modified
seen. So if the last_modified
value seen was 1000, the downloader will again download the documents with_modified
=1000 that had previously downloaded. But this would likely take just a few seconds even in the worst case scenario._modified
has a resolution of 5 seconds, so the number of documents with the same value is limited by how much Oak can write to Mongo in a 5 seconds window. The downloader is streaming the results directly using a Mongo query, which is much faster than what Oak can write. So likely, the downloader will download all values with the same _modified value in a fraction of the time it took Oak to write them, which is an acceptable overhead in the rare case of disconnection from Mongo.This change greatly simplifies the logic of the downloader:
_modified
(_modified=modified_last_seen, _id>id_last_seen
) and then another query with_modified>modified_last_seen
. Now it is enough to query for_modified>=modified_last_seen
._id
field in the downloader threads.(_modified, _id)
, it now only does it by_modified
. I have not observed a significant speed-up on Mongo traversal speed, but in theory the Mongo optimizer has more freedom to optimize the new simpler query.Other changes in the PR: