snleee 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_r271135542
##########
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:
Previous behavior caused `IndexOutOfBounds` error when the race condition
happened (the query hits when the value got added to dictionary but not yet in
the inverted index). I thought that it's only possible to meet the case where
`bitmap.size() == dictId` since the consumption is happening in a single
thread.
@Jackie-Jiang can explain it in more detail and also comment on `not in`
case.
----------------------------------------------------------------
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]