guojialiang92 commented on code in PR #14417:
URL: https://github.com/apache/lucene/pull/14417#discussion_r2015951779
##########
lucene/core/src/java/org/apache/lucene/index/IndexWriter.java:
##########
@@ -1427,6 +1427,24 @@ 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;
+ }
+ }
+
+ /** Returns the {@link SegmentInfos#counter}. */
+ public synchronized long getSegmentInfosCounter() {
Review Comment:
I have removed the synchronization to avoid affecting performance when it is
heavily called in some scenarios.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]