vigyasharma commented on code in PR #14417: URL: https://github.com/apache/lucene/pull/14417#discussion_r2032521908
########## lucene/core/src/java/org/apache/lucene/index/IndexWriter.java: ########## @@ -1427,6 +1427,25 @@ public synchronized void advanceSegmentInfosVersion(long newVersion) { changed(); } + /** + * If {@link SegmentInfos#counter} is below {@code newCounter} then update it to this value. + * + * @lucene.internal + */ + public synchronized void advanceSegmentInfosCounter(long newCounter) { + this.ensureOpen(); + if (segmentInfos.counter < newCounter) { + segmentInfos.counter = newCounter; + } + changed(); + } + + /** Returns the {@link SegmentInfos#counter}. */ + public long getSegmentInfosCounter() { + this.ensureOpen(); Review Comment: Do we care that the writer is open for this API? ########## lucene/test-framework/src/java/org/apache/lucene/tests/index/ThreadedIndexingAndSearchingTestCase.java: ########## @@ -189,6 +190,19 @@ public void run() { addedField = null; } + // Maybe advance segment counter + if (random().nextBoolean()) { Review Comment: 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) { ... }` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org