Added some comments.
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_lsm_experiments@2822 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java
index 05aa6d0..3ce1f48 100644
--- a/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java
+++ b/hyracks-storage-am-lsm-invertedindex/src/main/java/edu/uci/ics/hyracks/storage/am/lsm/invertedindex/search/PartitionedTOccurrenceSearcher.java
@@ -43,9 +43,10 @@
protected final ConcatenatingTupleReference fullLowSearchKey = new ConcatenatingTupleReference(2);
protected final ConcatenatingTupleReference fullHighSearchKey = new ConcatenatingTupleReference(2);
- // HACK for better IO perf
+ // Inverted list cursors ordered by token. Used to read relevant inverted-list partitions of one token one after
+ // the other for better I/O performance (because the partitions of one inverted list are stored contiguously in a file).
+ // The above implies that we currently require holding all inverted list for a query in memory.
protected final ArrayList<IInvertedListCursor> cursorsOrderedByTokens = new ArrayList<IInvertedListCursor>();
-
protected final InvertedListPartitions partitions = new InvertedListPartitions();
public PartitionedTOccurrenceSearcher(IHyracksCommonContext ctx, IInvertedIndex invIndex) {
@@ -121,7 +122,13 @@
short start = partitions.getMinValidPartitionIndex();
short end = partitions.getMaxValidPartitionIndex();
- // HACK FOR BETTER IO
+ // Typically, we only enter this case for disk-based inverted indexes.
+ // TODO: This behavior could potentially lead to a deadlock if we cannot pin
+ // all inverted lists in memory, and are forced to wait for a page to get evicted
+ // (other concurrent searchers may be in the same situation).
+ // We should detect such cases, then unpin all pages, and then keep retrying to pin until we succeed.
+ // This will require a different "tryPin()" mechanism in the BufferCache that will return false
+ // if we'd have to wait for a page to get evicted.
if (!cursorsOrderedByTokens.isEmpty()) {
for (int i = start; i <= end; i++) {
if (partitionCursors[i] == null) {