-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Switching to a fixed CFS threshold #15295
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
Conversation
| } | ||
|
|
||
| // Apply appropriate threshold based on merge policy type | ||
| if (mergePolicy instanceof LogDocMergePolicy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we can avoid customizing it for specific policies, otherwise it might be tricky to maintain in the future, if e.g. there is another policy that is based on doc size not bytes.
Maybe we can add a enum and a method to MergePolicy which returns its unit (bytes/docs) , and use it here to decide which threshold to use?
Or do we want to always choose compound format based on size in bytes even for LogDocMergePolicy? In this case we might be able to use merge.getMergeInfo().sizeInBytes() when we call this method and avoid relying on MergePolicy#size all together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to the idea of Enums, I will wait if anyone else has other suggestions here but having an enum makes most sense to me.
|
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution! |
stefanvodita
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had looked at this PR before, but I see it's gone stale. Hoping to revive it.
Surprised how many changes we needed for this!
lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java
Outdated
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/index/TestAddIndexes.java
Outdated
Show resolved
Hide resolved
lucene/test-framework/src/java/org/apache/lucene/tests/util/LuceneTestCase.java
Show resolved
Hide resolved
stefanvodita
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for addressing my comments! There are two questions left for me from the comments:
- Whether the thresholds we're starting with are good enough for a first iteration.
- Whether we can avoid branching logic based on which merge policy is in use.
lucene/core/src/java/org/apache/lucene/index/LiveIndexWriterConfig.java
Outdated
Show resolved
Hide resolved
|
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution! |
| public void testUniqueValuesCompression() throws IOException { | ||
| try (final Directory dir = new ByteBuffersDirectory()) { | ||
| final IndexWriterConfig iwc = new IndexWriterConfig(new MockAnalyzer(random())); | ||
| iwc.getCodec().compoundFormat().setShouldUseCompoundFile(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had to disable compound files here. The reason being, before this change we had a CFS ratio (10%) which in this case would not result in compound file creation. However since we switched to a fixed threshold (64 MB now) these files are way below the threshold leading to compound file creation and thus increase in file sizes. The increase is minimal (4 bytes for me below the original threshold) but enough to fail the tests. Threefore, I have disabled compound files here.
stefanvodita
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for following up on the remaining comments. I'll try to merge soon to avoid more merge conflicts for this large PR.
|
This looks like it's causing failures in some backwards-codecs tests: I think these are nightly-only so may have been missed by normal test runs. |
|
Thank you for pointing out the issue @romseygeek and thank you for addressing it quickly @shubhamsrkdev! |
Problem
Lucene uses CFS ratio (which is by default 10%) to determine whether to use Compound Files.
Solution
In this PR we are doing the following:
Switching from a CFS ratio to a fixed threshold which is:
Moved CFS configuration to CompoundFormat.java from Merge policies.
Fixes #14959