mirror of https://github.com/apache/lucene.git
SOLR-5395: add RunAlways marker interface for update processor facctories
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1536341 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
68078aebb5
commit
0522dd002e
|
@ -103,6 +103,11 @@ New Features
|
|||
* SOLR-5027: CollapsingQParserPlugin for high performance field collapsing on high cardinality fields.
|
||||
(Joel Bernstein)
|
||||
|
||||
* SOLR-5395: Added a RunAlways marker interface for UpdateRequestProcessorFactory
|
||||
implementations indicating that they should not be removed in later stages
|
||||
of distributed updates (usually signalled by the update.distrib parameter)
|
||||
(yonik)
|
||||
|
||||
|
||||
Bug Fixes
|
||||
----------------------
|
||||
|
|
|
@ -75,7 +75,7 @@ import java.util.ArrayList;
|
|||
* <code>UpdateRequestProcessorFactory</code>. If a chain includes
|
||||
* <code>RunUpdateProcessorFactory</code> but does not include a
|
||||
* <code>DistributingUpdateProcessorFactory</code>, it will be added
|
||||
* automaticly by {@link #init init()}.
|
||||
* automatically by {@link #init init()}.
|
||||
* </p>
|
||||
*
|
||||
* @see UpdateRequestProcessorFactory
|
||||
|
@ -195,8 +195,8 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
|||
if (factory instanceof DistributingUpdateProcessorFactory) {
|
||||
afterDistrib = false;
|
||||
}
|
||||
} else if (!(factory instanceof LogUpdateProcessorFactory)) { // TODO: use a marker interface for this?
|
||||
// skip anything that is not the log factory
|
||||
} else if (!(factory instanceof UpdateRequestProcessorFactory.RunAlways)) {
|
||||
// skip anything that doesn't have the marker interface
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,14 @@ import org.apache.solr.util.plugin.SolrCoreAware;
|
|||
* @since solr 1.3
|
||||
*/
|
||||
public abstract class UpdateRequestProcessorFactory implements NamedListInitializedPlugin
|
||||
{
|
||||
{
|
||||
|
||||
/** A marker interface for UpdateRequestProcessorFactory implementations indicating that
|
||||
* the factory should be used even if the update.distrib parameter would otherwise cause
|
||||
* it to not be run.
|
||||
*/
|
||||
public interface RunAlways {}
|
||||
|
||||
@Override
|
||||
public void init( NamedList args )
|
||||
{
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
<updateRequestProcessorChain name="distrib-chain-explicit">
|
||||
<!-- explicit test using processors before and after distrib -->
|
||||
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
||||
<processor class="solr.LogUpdateProcessorFactory" />
|
||||
<processor class="solr.DistributedUpdateProcessorFactory" />
|
||||
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
||||
<processor class="solr.RunUpdateProcessorFactory" />
|
||||
|
@ -69,6 +70,7 @@
|
|||
<updateRequestProcessorChain name="distrib-chain-implicit">
|
||||
<!-- implicit test w/o distrib declared -->
|
||||
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
||||
<processor class="solr.LogUpdateProcessorFactory" />
|
||||
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
||||
<!-- distrib should be injected here -->
|
||||
<processor class="solr.RunUpdateProcessorFactory" />
|
||||
|
@ -76,6 +78,7 @@
|
|||
<updateRequestProcessorChain name="distrib-chain-noop">
|
||||
<!-- explicit test using noop distrib -->
|
||||
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
||||
<processor class="solr.LogUpdateProcessorFactory" />
|
||||
<processor class="solr.NoOpDistributingUpdateProcessorFactory" />
|
||||
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
||||
<processor class="solr.RunUpdateProcessorFactory" />
|
||||
|
|
|
@ -78,7 +78,7 @@ public class UpdateRequestProcessorFactoryTest extends AbstractSolrTestCase {
|
|||
assertNotNull(name, chain);
|
||||
|
||||
// either explicitly, or because of injection
|
||||
assertEquals(name + " chain length", 4,
|
||||
assertEquals(name + " chain length", 5,
|
||||
chain.getFactories().length);
|
||||
|
||||
// Custom comes first in all three of our chains
|
||||
|
@ -93,7 +93,20 @@ public class UpdateRequestProcessorFactoryTest extends AbstractSolrTestCase {
|
|||
assertFalse(name + " post distrib proc should not be a CustomUpdateRequestProcessor: "
|
||||
+ proc.getClass().getName(),
|
||||
proc instanceof CustomUpdateRequestProcessor);
|
||||
|
||||
|
||||
int n=0;
|
||||
boolean foundLog = false;
|
||||
for (;;) {
|
||||
n++;
|
||||
if (proc instanceof LogUpdateProcessor) {
|
||||
foundLog = true;
|
||||
}
|
||||
proc = proc.next;
|
||||
if (proc == null) break;
|
||||
}
|
||||
|
||||
assertTrue( n < chain.getFactories().length ); // some processors should have been dropped
|
||||
assertTrue( foundLog ); // make sure the marker interface was successful in keeping the log processor
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue