mikemccand commented on code in PR #16923:
URL: https://github.com/apache/lucene/pull/16923#discussion_r4742360566
##########
lucene/core/src/java/org/apache/lucene/index/DirectoryReader.java:
##########
@@ -617,8 +617,24 @@ protected abstract DirectoryReader doOpenIfChanged(
/**
* Version number when this IndexReader was opened.
*
- * <p>This method returns the version recorded in the commit that the reader
opened. This version
+ * <p>For a reader opened from a commit, this is the version recorded in
that commit. The version
* is advanced every time a change is made with {@link IndexWriter}.
+ *
+ * <p>A near real-time reader's version can be higher than the version of
its commit ({@link
+ * #getIndexCommit()}): the reader can see changes that aren't committed
yet, and the writer
+ * increases the version once more after a commit during which a near
real-time reader was opened.
+ *
+ * <p>Readers with the same version see the same documents, except that a
later writer may give
+ * the same version to a reader with different documents in these cases:
+ *
+ * <ul>
+ * <li>A writer was rolled back, or closed without committing (see {@link
Review Comment:
Is it safe/allowed to continue using a near-real-time reader from a writer
after that writer is `close()`d or `rollback()`d?
I suspect Lucene does allow this (segment readers are
`incRef`'d/`decRef`'d), but it is super weird because that does enable re-using
version numbers (same version number is searching different sets of documents),
which is bad.
--
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]