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.
|
* SOLR-5027: CollapsingQParserPlugin for high performance field collapsing on high cardinality fields.
|
||||||
(Joel Bernstein)
|
(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
|
Bug Fixes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
|
@ -75,7 +75,7 @@ import java.util.ArrayList;
|
||||||
* <code>UpdateRequestProcessorFactory</code>. If a chain includes
|
* <code>UpdateRequestProcessorFactory</code>. If a chain includes
|
||||||
* <code>RunUpdateProcessorFactory</code> but does not include a
|
* <code>RunUpdateProcessorFactory</code> but does not include a
|
||||||
* <code>DistributingUpdateProcessorFactory</code>, it will be added
|
* <code>DistributingUpdateProcessorFactory</code>, it will be added
|
||||||
* automaticly by {@link #init init()}.
|
* automatically by {@link #init init()}.
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
* @see UpdateRequestProcessorFactory
|
* @see UpdateRequestProcessorFactory
|
||||||
|
@ -195,8 +195,8 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
if (factory instanceof DistributingUpdateProcessorFactory) {
|
if (factory instanceof DistributingUpdateProcessorFactory) {
|
||||||
afterDistrib = false;
|
afterDistrib = false;
|
||||||
}
|
}
|
||||||
} else if (!(factory instanceof LogUpdateProcessorFactory)) { // TODO: use a marker interface for this?
|
} else if (!(factory instanceof UpdateRequestProcessorFactory.RunAlways)) {
|
||||||
// skip anything that is not the log factory
|
// skip anything that doesn't have the marker interface
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,13 @@ import org.apache.solr.util.plugin.SolrCoreAware;
|
||||||
*/
|
*/
|
||||||
public abstract class UpdateRequestProcessorFactory implements NamedListInitializedPlugin
|
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
|
@Override
|
||||||
public void init( NamedList args )
|
public void init( NamedList args )
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
<updateRequestProcessorChain name="distrib-chain-explicit">
|
<updateRequestProcessorChain name="distrib-chain-explicit">
|
||||||
<!-- explicit test using processors before and after distrib -->
|
<!-- explicit test using processors before and after distrib -->
|
||||||
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
||||||
|
<processor class="solr.LogUpdateProcessorFactory" />
|
||||||
<processor class="solr.DistributedUpdateProcessorFactory" />
|
<processor class="solr.DistributedUpdateProcessorFactory" />
|
||||||
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
||||||
<processor class="solr.RunUpdateProcessorFactory" />
|
<processor class="solr.RunUpdateProcessorFactory" />
|
||||||
|
@ -69,6 +70,7 @@
|
||||||
<updateRequestProcessorChain name="distrib-chain-implicit">
|
<updateRequestProcessorChain name="distrib-chain-implicit">
|
||||||
<!-- implicit test w/o distrib declared -->
|
<!-- implicit test w/o distrib declared -->
|
||||||
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
||||||
|
<processor class="solr.LogUpdateProcessorFactory" />
|
||||||
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
||||||
<!-- distrib should be injected here -->
|
<!-- distrib should be injected here -->
|
||||||
<processor class="solr.RunUpdateProcessorFactory" />
|
<processor class="solr.RunUpdateProcessorFactory" />
|
||||||
|
@ -76,6 +78,7 @@
|
||||||
<updateRequestProcessorChain name="distrib-chain-noop">
|
<updateRequestProcessorChain name="distrib-chain-noop">
|
||||||
<!-- explicit test using noop distrib -->
|
<!-- explicit test using noop distrib -->
|
||||||
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
<processor class="solr.CustomUpdateRequestProcessorFactory" />
|
||||||
|
<processor class="solr.LogUpdateProcessorFactory" />
|
||||||
<processor class="solr.NoOpDistributingUpdateProcessorFactory" />
|
<processor class="solr.NoOpDistributingUpdateProcessorFactory" />
|
||||||
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
<processor class="solr.RemoveBlankFieldUpdateProcessorFactory" />
|
||||||
<processor class="solr.RunUpdateProcessorFactory" />
|
<processor class="solr.RunUpdateProcessorFactory" />
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class UpdateRequestProcessorFactoryTest extends AbstractSolrTestCase {
|
||||||
assertNotNull(name, chain);
|
assertNotNull(name, chain);
|
||||||
|
|
||||||
// either explicitly, or because of injection
|
// either explicitly, or because of injection
|
||||||
assertEquals(name + " chain length", 4,
|
assertEquals(name + " chain length", 5,
|
||||||
chain.getFactories().length);
|
chain.getFactories().length);
|
||||||
|
|
||||||
// Custom comes first in all three of our chains
|
// Custom comes first in all three of our chains
|
||||||
|
@ -94,6 +94,19 @@ public class UpdateRequestProcessorFactoryTest extends AbstractSolrTestCase {
|
||||||
+ proc.getClass().getName(),
|
+ proc.getClass().getName(),
|
||||||
proc instanceof CustomUpdateRequestProcessor);
|
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