Skip to content

LUCENE-10574: Avoid O(n^2) merging with LogMergePolicy#936

Merged
jpountz merged 8 commits intoapache:mainfrom
jpountz:fix_log_merge_policy
Jun 3, 2022
Merged

LUCENE-10574: Avoid O(n^2) merging with LogMergePolicy#936
jpountz merged 8 commits intoapache:mainfrom
jpountz:fix_log_merge_policy

Conversation

@jpountz
Copy link
Copy Markdown
Contributor

@jpountz jpountz commented May 31, 2022

Originally I had tried to remove O(n^2) merging from LogMergePolicy using the
same approach as for TieredMergePolicy, but this did not work well as it fought
against invariants that LogMergePolicy is trying to maintain. So this switches
to a completely different approach that is more in line with the existing logir
of LogMergePolicy: instead of being rounded to the floor segment size, segments
below the floor segment size get applied a greater level span that allows more
unbalanced merges on smaller segments but still requires them to be somewhat
balanced.

} else {
newInfos.add(info);
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this change maintains order of merged segments in segment infos, akin to SegmentInfos#applyMergeChanges, which is important for LogMergePolicy

@jpountz jpountz merged commit 3738beb into apache:main Jun 3, 2022
@jpountz jpountz deleted the fix_log_merge_policy branch June 3, 2022 09:02
shaie pushed a commit to mdmarshmallow/lucene that referenced this pull request Jun 22, 2022
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.

1 participant