[MINDEXER-191] Avoid group rebuilding during incremental updates #318
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.
Rebuilding of the in-memory group data takes more time than the index update itself since it has to iterate through the full index.
What is worse is that rebuilding happens in a loop for each chunk:
maven-indexer/indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
Lines 428 to 430 in fbf7c0c
The reader has all group data of the extracted incremental update already, while the context should have the group data of the current index.
If we assume that maven group IDs are rarely removed we can simply merge both collections without having to rebuild anything.
context:
#202 moved the groups from index to memory storage which is why NetBeans is persisting the group data after maven-indexer did the extraction apache/netbeans#4136. When the index context is loaded the group data is restored by NB. Incremental updates can simply add more groups to that collection.
Other use cases might want to call
IndexingContext#rebuildGroups()
explicitly, if this isn't done, the context will have only the groups of the incremental update, post update.https://issues.apache.org/jira/browse/MINDEXER-191