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




geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LucenePrimaryBucketListener.java
 (line 39)
<https://reviews.apache.org/r/55440/#comment233247>

    yes, this will result in the initial problem. There may be a possibility 
that the chunk bucket has become primary but the file bucket was in the process 
of becoming primary when this listener was invoked, resulting in a bucket not 
found exception. To avoid exceptions during rebalancing we are giving the 
system another chance to create the Index repo.


- nabarun nag


On Jan. 17, 2017, 10:09 p.m., nabarun nag wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/55440/
> -----------------------------------------------------------
> 
> (Updated Jan. 17, 2017, 10:09 p.m.)
> 
> 
> Review request for geode, Barry Oglesby, Jason Huynh, Dan Smith, and xiaojian 
> zhou.
> 
> 
> 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
> -----
> 
>   
> 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