raghavyadav01 commented on code in PR #19945:
URL: https://github.com/apache/pinot/pull/19945#discussion_r4319322623
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/realtime/impl/invertedindex/RealtimeLuceneTextIndex.java:
##########
@@ -339,8 +340,26 @@ public void close() {
public SearcherManager getSearcherManager() {
return _searcherManager;
}
+
@Override
public int getSearchableDocCount() {
- return _refreshListener.getLastRefreshNumDocs();
+ // The refresh listener records a lower bound that can miss documents
added during a refresh.
+ SearcherManager searcherManager = _searcherManager;
+ IndexSearcher indexSearcher = null;
+ try {
+ indexSearcher = searcherManager.acquire();
+ return indexSearcher.getIndexReader().numDocs();
Review Comment:
Since this is used as a doc-id fence, `maxDoc()` reads a bit more honestly
than `numDocs()`. Same value today because the realtime index never deletes,
but `numDocs()` would quietly shrink the fence if deletes ever show up.
--
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]