SOLR-4246: log forwarded updates

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1427037 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-12-31 03:05:56 +00:00
parent 1bb25c388d
commit 9e82c2409d
2 changed files with 24 additions and 10 deletions

View File

@ -178,6 +178,11 @@ New Features
these allow cores to be loaded only when needed and only transientCacheSize transient
cores will be loaded at a time, the rest aged out on an LRU basis.
* SOLR-4246: When update.distrib is set to skip update processors before
the distributed update processor, always include the log update processor
so forwarded updates will still be logged. (yonik)
Optimizations
----------------------

View File

@ -145,8 +145,7 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
* If the <code>DISTRIB_UPDATE_PARAM</code> is present in the request and is
* non-blank, then any factory in this chain prior to the instance of
* <code>{@link DistributingUpdateProcessorFactory}</code> will be skipped,
* and the <code>UpdateRequestProcessor</code> returned will be from that
* <code>DistributingUpdateProcessorFactory</code>
* except for the log update processor factory.
*
* @see UpdateRequestProcessorFactory#getInstance
* @see DistributingUpdateProcessorFactory#DISTRIB_UPDATE_PARAM
@ -157,18 +156,28 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
UpdateRequestProcessor processor = null;
UpdateRequestProcessor last = null;
final String distribPhase = req.getParams().get
(DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM, "");
final boolean skipToDistrib = ! distribPhase.trim().isEmpty();
final String distribPhase = req.getParams().get(DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM);
final boolean skipToDistrib = distribPhase != null;
boolean afterDistrib = true; // we iterate backwards, so true to start
for (int i = chain.length-1; i>=0; i--) {
processor = chain[i].getInstance(req, rsp, last);
last = processor == null ? last : processor;
if (skipToDistrib
&& chain[i] instanceof DistributingUpdateProcessorFactory) {
break;
UpdateRequestProcessorFactory factory = chain[i];
if (skipToDistrib) {
if (afterDistrib) {
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
continue;
}
}
processor = factory.getInstance(req, rsp, last);
last = processor == null ? last : processor;
}
return last;
}