-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/55440/
-----------------------------------------------------------

(Updated Jan. 18, 2017, 4:19 a.m.)


Review request for geode, Barry Oglesby, Jason Huynh, Dan Smith, and xiaojian 
zhou.


Changes
-------

Instead of Thread.start(), DM.getWaitingThreadPool.excute() is now being used.

Precheck passed.
No deadlocks observed in LuceneQueriesPeerPRRedundancyDUnitTest 
returnCorrectResultsWhenMoveBucketHappensOnIndexUpdate (GEODE-2314 still occurs)


Repository: geode


Description
-------

Issue(Steps are using GFSH as mentioned in the ticket):
1. Indexes are created, and documents are inserted into a persistent region.
2. Server is restarted.
3. Immediately displaying the lucene index stats shows no documents are indexed
4. Run a lucene query, which gets executed successfully.
5. Now, displaying index stats with "list lucene index --with-stats" shows the 
actual number of documents indexed.


Reason:
Number of documents indexed is taken from the IndexWriter, which is created 
lazily when a lucene query is executed. Hence when a persistent server is 
restarted or a rebalance occurs we lose the stats for number of documents 
indexed until the IndexWriter is created when a lucene query is executed.

Solution:
We attached a listener to each chunk bucket so that when a bucket becomes 
primary, it initiates the process to create the IndexReposity for the bucket 
which creates the IndexWriter, thus we get stat for number of documents 
immediately after a rebalance or a restart occurs.
When a bucket becomes secondary, it removes its document count from the stats.


NOTE: IndexWriter can be created only when we have both chuck and file primary 
bucket present. There can be a possibility that chuck bucket became primary but 
the file bucket was still in the process of becoming primary hence the 
IndexRepository creation will result in BucketNotFoundException. If this 
happens we log a warning and defer the index repository to be created lazily 
during query excution. Rather than shutting the system down with an exception 
we give it second chance.


Diffs (updated)
-----

  
geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegion.java
 c760726 
  
geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LucenePrimaryBucketListener.java
 PRE-CREATION 
  
geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImpl.java
 572b5ea 
  
geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneIndexForPartitionedRegionTest.java
 5c0c0a0 
  
geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/repository/IndexRepositoryImplJUnitTest.java
 dd52258 

Diff: https://reviews.apache.org/r/55440/diff/


Testing
-------

1. Precheckin
2. Running gfsh commands to create a persistent server and restarting it and 
checking the stats are correct.
3. Running gfsh command to create two servers and shutting / restarting them 
alternatively and checking if the stats remain correct after the primary 
buckets are moved around.


Thanks,

nabarun nag

Reply via email to