xiangfu0 commented on code in PR #20439:
URL: https://github.com/apache/pinot/pull/20439#discussion_r4759805521
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/realtime/impl/vector/MutableVectorIndex.java:
##########
@@ -269,13 +276,25 @@ public void add(Object[] values, @Nullable int[] dictIds,
int docId) {
_indexWriter.commit();
_lastCommitTime = System.currentTimeMillis();
LOGGER.debug("Committed index for column: {}, segment: {}",
_vectorColumn, _segmentName);
+ refreshCommittedSearcher();
}
} catch (Exception e) {
throw new RuntimeException(
"Caught exception while adding a new document to the Lucene index
for column: " + _vectorColumn, e);
}
}
+ /// Makes the commit just written visible to the unfiltered search path. A
failed refresh leaves queries on the
+ /// previous commit rather than failing ingestion; the next commit retries.
+ private void refreshCommittedSearcher() {
+ try {
+ _committedSearcherManager.maybeRefresh();
+ } catch (IOException e) {
Review Comment:
A transient IOException here can hide committed rows for as long as the
segment is idle. The next unfiltered query acquires the old reader, and only
another add can trigger the next commit. I reproduced this with Lucene 10.6.0.
Two cached reads returned zero documents while a fresh reader saw the committed
document. Could we remember the failed refresh and retry on the next unfiltered
query, surfacing the error if the retry also fails?
##########
pinot-segment-local/src/test/java/org/apache/pinot/segment/local/realtime/impl/vector/MutableVectorIndexTest.java:
##########
@@ -237,6 +237,28 @@ public void testConcurrentFilteredSearchWithLiveWriter()
}
}
+ @Test
+ public void testUnfilteredSearchSeesEachCommitButNotUncommittedDocs() {
+ // commitDocs=4 commits on the 4th and 8th adds
+ MutableVectorIndex index = create2DIndex(4, 0);
Review Comment:
This fixture still uses the default 10-second commit interval. If the first
search stalls, adding doc 4 can trigger a time-based commit and the next
assertion will fail. Could we set commitIntervalMs to one day here, as the
nearby tests do, so commitDocs alone determines visibility during the test?
--
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]