|
[
Permlink
| « Hide
]
Akshay K. Ukey added a comment - 25/Aug/08 12:50 PM
This patch adds support for the configuration described in the issue description.
Thanks for the patch Akshay!
I think we should allow a user to specify his custom IndexDeletionPolicy too. We can provide a default implementation with all the options specified in the issue description. So I propose that we have the following syntax: <deletionPolicy class="com.MyDeletionPolicy" />
The default implementation will be SolrIndexDeletionPolicy which can be configured through a NamedList. Any custom deletion policy will be initialized with a NamedList if it implements NamedListInitializedPlugin. <!-- configure deletion policy here--> <deletionPolicy class="solr.SolrIndexDeletionPolicy"> <!-- Store only the commits with optimize.Non optimized commits will get deleted by lucene when the last IndexWriter/IndexReader using this commit point is closed --> <str name="keepOptimizedOnly">true</str> <!--Maximum no: of commit points stored . Older ones will be cleaned when they go out of scope--> <str name="maxCommitsToKeep"></str> <!-- max age of a stored commit--> <str name="maxCommitAge"></str> </deletionPolicy> To facilitate replication, we can have a wrapper over the IndexDeletionPolicy which can provide us the features needed for replication ( Attached is a patch with SolrDeletionPolicy class as the default deletion policy, with configuration as in Shalin's comment above, except that <str> is used for all the parameters in the named list. IndexDeletionPolicyWrapper class over IndexDeletionPolicy to enable access to commit details. Currently <maxCommitAge> named list parameter is not considered in the implementation of SolrDeletionPolicy.
This is looking great. Thanks!
We need a few tests for this. With the recent changes in Lucene trunk, we can get rid of the wrapper over IndexCommit. We need to support maxCommitAge too so that users who do a lot commits can reliably replicate without storing too many generations. I think the deletion policy should be able to support true reservation... see the prototype patch I put together in https://issues.apache.org/jira/secure/attachment/12383728/deletion_policy.patch
Lucene has added more capabilities since then, so we should be able to simplify it. We have two options:
I'm more in favor of the first approach. Here, the onus of keeping a commit point for reliable replication will fall on the user supplying configuration according to his commit frequency (the maxAge condition will be handy). Also, wouldn't implementing a reserve method limit us to only the default SolrDeletionPolicy? #1 and #2 can both lead to starvation. I think the default should finish grabbing an index even if a newer version is available.
If we can make it such that it just works, regardless of network speed, index size, etc, then I think we should. A reservation mechanism would easily enable this. The IndexDeletionPolicyWrapper should be able to support the reserve feature even if the user provided IndexDeletionPolicy does not do it because it is wrapping the IndexCommit object.
the config can be as follows <deletionPolicy class="solr.SolrIndexDeletionPolicy" > //this value will be honoured by the wrapper itself irrespective of the underlying implementation <str name="reserve">10</str> </deletionPolicy> This patch has:
1. maxCommitAge configuration support 2. Reservation mechanism is added in the ReplicationHandler configuration. Code for the same is in the latest patch of https://issues.apache.org/jira/browse/SOLR-561 3. Test cases. The patch looks good. I think this covers all the features we wanted to have.
A few minor nitpicks
The tests look good. Thanks for all the work, Akshay Also, we need to use slf4j instead of the JDK Logger in the patch.
Patch with changes suggested by Shalin and logging using slf4j.
Updated with more javadocs and comments in solrconfig.xml
I think this is ready to go in. I'll commit this in a day or two if there are no objection. Committed revision 699975.
Thanks Yonik, Noble and Akshay! |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||