-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support modifying segmentInfos.counter in IndexWriter #14417
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
Support modifying segmentInfos.counter in IndexWriter #14417
Conversation
Signed-off-by: guojialiang <[email protected]>
Signed-off-by: guojialiang <[email protected]>
lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
Outdated
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
Outdated
Show resolved
Hide resolved
lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java
Outdated
Show resolved
Hide resolved
Signed-off-by: guojialiang <[email protected]>
Hi, @vigyasharma |
I think we can add a couple more tests to make it robust.
|
Also, IIUC |
Signed-off-by: guojialiang <[email protected]>
Signed-off-by: guojialiang <[email protected]>
Thanks, @vigyasharma
I have added the following tests according to the suggestions:
|
Thanks, @vigyasharma
In the code comments of Lucene's native segment replication, the risk of file conflicts is also mentioned, but no additional processing is done. From a robustness perspective, perhaps control should also be carried out. The relevant code is as follows:
|
Hi, @vigyasharma |
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.
Apologies for the delay, these changes look great, @guojialiang92. I love the new tests, and how you're testing multi-threaded scenarios.
I have some minor comments. Please also add a CHANGES.txt
entry as well and I'll merge this.
@@ -189,6 +190,19 @@ public void run() { | |||
addedField = null; | |||
} | |||
|
|||
// Maybe advance segment counter | |||
if (random().nextBoolean()) { |
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.
Running this with 50% probability might slow down the tests too much with the synchronization this needs. Let's run it with a lower probability, something like 1 in 7 – if (random().nextInt(7) == 5) { ... }
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.
Thanks, I have modified the test and CHANGES.txt.
…rt_advance_segment_counter
Signed-off-by: guojialiang <[email protected]>
Thanks, @vigyasharma |
Description
This PR aims to address issue 14362. This issue includes a discussion of the benefits of this modification.
Tests
TestIndexWriter#testAdvanceSegmentInfosCounter
, the writer index a bunch of docs, then advance its counter.TestIndexWriter#testAdvanceSegmentCounterInCrashAndRecoveryScenario
, the writer index a bunch of docs, then close it, start a new writer on the same index, and advance its counter.ThreadedIndexingAndSearchingTestCase
, in the concurrent write thread, increased the logic of randomly modifying the segment counter, and checked after all write threads ended.Checklist