Jackie-Jiang commented on a change in pull request #4051: Fix the race 
condition for real-time inverted index reader
URL: https://github.com/apache/incubator-pinot/pull/4051#discussion_r271425667
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/realtime/impl/invertedindex/RealtimeInvertedIndexReader.java
 ##########
 @@ -60,6 +60,13 @@ public MutableRoaringBitmap getDocIds(int dictId) {
     ThreadSafeMutableRoaringBitmap bitmap;
     try {
       _readLock.lock();
+      // NOTE: the given dict Id might not be added to the inverted index yet. 
We first add the value to the dictionary.
+      // Before the value is added to the inverted index, the query might have 
a predicate which matches the newly added
+      // value. In that case, the given dictionary Id does not exist in the 
inverted index, and we return an empty
+      // bitmap.
+      if (_bitmaps.size() == dictId) {
 
 Review comment:
   @kishoreg Actually you are right for multi-valued column. I'll change this 
to `_bitmaps.size() <= dictId` to handle all cases.
   In the ancient code, we might return null, but then we refactored the code 
and uniformed the interface. Right now the interface does not expect null 
return value, and this is corner case which happens rarely, so I would rather 
handle this inside the implementation by returning an empty bitmap instead of 
null.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to