mirror of https://github.com/apache/lucene.git
SOLR-11268: AtomicUpdateProcessor complains missing UpdateLog
This commit is contained in:
parent
ef079cc3b4
commit
8658742096
|
@ -472,6 +472,8 @@ Bug Fixes
|
||||||
|
|
||||||
* SOLR-11243: Replica Placement rules are ignored if a cluster policy exists. (shalin)
|
* SOLR-11243: Replica Placement rules are ignored if a cluster policy exists. (shalin)
|
||||||
|
|
||||||
|
* SOLR-11268: AtomicUpdateProcessor complains missing UpdateLog (noble, Ishan Chattopadhyaya)
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.request.SolrQueryRequest;
|
import org.apache.solr.request.SolrQueryRequest;
|
||||||
import org.apache.solr.response.SolrQueryResponse;
|
import org.apache.solr.response.SolrQueryResponse;
|
||||||
import org.apache.solr.util.plugin.PluginInfoInitialized;
|
import org.apache.solr.util.plugin.PluginInfoInitialized;
|
||||||
|
import org.apache.solr.util.plugin.SolrCoreAware;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -278,7 +279,9 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
|
||||||
PluginInfo pluginInfo = new PluginInfo("updateProcessor",
|
PluginInfo pluginInfo = new PluginInfo("updateProcessor",
|
||||||
Utils.makeMap("name", s,
|
Utils.makeMap("name", s,
|
||||||
"class", factoryClass.getName()));
|
"class", factoryClass.getName()));
|
||||||
core.getUpdateProcessors().put(s, p = core.getUpdateProcessors().createPlugin(pluginInfo).get());
|
UpdateRequestProcessorFactory plugin = p = core.getUpdateProcessors().createPlugin(pluginInfo).get();
|
||||||
|
if (plugin instanceof SolrCoreAware) ((SolrCoreAware) plugin).inform(core);
|
||||||
|
core.getUpdateProcessors().put(s, plugin);
|
||||||
}
|
}
|
||||||
if (p == null)
|
if (p == null)
|
||||||
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No such processor " + s);
|
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No such processor " + s);
|
||||||
|
|
|
@ -83,15 +83,16 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
|
||||||
|
|
||||||
public void testBasics() throws Exception {
|
public void testBasics() throws Exception {
|
||||||
|
|
||||||
|
ModifiableSolrParams params = new ModifiableSolrParams()
|
||||||
|
.add("processor", "atomic")
|
||||||
|
.add("atomic.cat", "add")
|
||||||
|
.add("atomic.title", "set")
|
||||||
|
.add("atomic.count_i", "set")
|
||||||
|
.add("atomic.name_s", "set")
|
||||||
|
.add("atomic.multiDefault", "set")
|
||||||
|
.add("commit", "true");
|
||||||
AddUpdateCommand cmd = new AddUpdateCommand(new LocalSolrQueryRequest(h.getCore(),
|
AddUpdateCommand cmd = new AddUpdateCommand(new LocalSolrQueryRequest(h.getCore(),
|
||||||
new ModifiableSolrParams()
|
params
|
||||||
.add("processor", "atomic")
|
|
||||||
.add("atomic.cat", "add")
|
|
||||||
.add("atomic.title", "set")
|
|
||||||
.add("atomic.count_i", "set")
|
|
||||||
.add("atomic.name_s", "set")
|
|
||||||
.add("atomic.multiDefault", "set")
|
|
||||||
.add("commit","true")
|
|
||||||
));
|
));
|
||||||
|
|
||||||
cmd.solrDoc = new SolrInputDocument();
|
cmd.solrDoc = new SolrInputDocument();
|
||||||
|
@ -102,11 +103,10 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
|
||||||
cmd.solrDoc.addField("name_s", "Virat");
|
cmd.solrDoc.addField("name_s", "Virat");
|
||||||
cmd.solrDoc.addField("multiDefault", "Delhi");
|
cmd.solrDoc.addField("multiDefault", "Delhi");
|
||||||
|
|
||||||
AtomicUpdateProcessorFactory factory = new AtomicUpdateProcessorFactory();
|
UpdateRequestProcessor chain = h.getCore()
|
||||||
factory.inform(h.getCore());
|
.getUpdateProcessorChain(params)
|
||||||
factory.getInstance(cmd.getReq(), new SolrQueryResponse(),
|
.createProcessor(cmd.getReq(), new SolrQueryResponse());
|
||||||
new DistributedUpdateProcessor(cmd.getReq(), new SolrQueryResponse(),
|
chain.processAdd(cmd);
|
||||||
new RunUpdateProcessor(cmd.getReq(), null))).processAdd(cmd);
|
|
||||||
|
|
||||||
assertU(commit());
|
assertU(commit());
|
||||||
|
|
||||||
|
@ -134,16 +134,15 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
|
||||||
req("q", "multiDefault:Delhi")
|
req("q", "multiDefault:Delhi")
|
||||||
, "//result[@numFound=1]");
|
, "//result[@numFound=1]");
|
||||||
|
|
||||||
cmd = new AddUpdateCommand(new LocalSolrQueryRequest(h.getCore(),
|
params = new ModifiableSolrParams()
|
||||||
new ModifiableSolrParams()
|
.add("processor", "atomic")
|
||||||
.add("processor", "atomic")
|
.add("atomic.cat", "add")
|
||||||
.add("atomic.cat", "add")
|
.add("atomic.title", "set")
|
||||||
.add("atomic.title", "set")
|
.add("atomic.count_i", "inc")
|
||||||
.add("atomic.count_i", "inc")
|
.add("atomic.name_s", "remove")
|
||||||
.add("atomic.name_s", "remove")
|
.add("atomic.multiDefault", "removeregex")
|
||||||
.add("atomic.multiDefault", "removeregex")
|
.add("commit", "true");
|
||||||
.add("commit","true")
|
cmd = new AddUpdateCommand(new LocalSolrQueryRequest(h.getCore(), params));
|
||||||
));
|
|
||||||
|
|
||||||
cmd.solrDoc = new SolrInputDocument();
|
cmd.solrDoc = new SolrInputDocument();
|
||||||
cmd.solrDoc.addField("id", 1);
|
cmd.solrDoc.addField("id", 1);
|
||||||
|
@ -152,12 +151,8 @@ public class AtomicUpdateProcessorFactoryTest extends SolrTestCaseJ4 {
|
||||||
cmd.solrDoc.addField("count_i", 20);
|
cmd.solrDoc.addField("count_i", 20);
|
||||||
cmd.solrDoc.addField("name_s", "Virat");
|
cmd.solrDoc.addField("name_s", "Virat");
|
||||||
cmd.solrDoc.addField("multiDefault", ".elh.");
|
cmd.solrDoc.addField("multiDefault", ".elh.");
|
||||||
|
chain = h.getCore().getUpdateProcessorChain(params).createProcessor(cmd.getReq(), new SolrQueryResponse());
|
||||||
factory = new AtomicUpdateProcessorFactory();
|
chain.processAdd(cmd);
|
||||||
factory.inform(h.getCore());
|
|
||||||
factory.getInstance(cmd.getReq(), new SolrQueryResponse(),
|
|
||||||
new DistributedUpdateProcessor(cmd.getReq(), new SolrQueryResponse(),
|
|
||||||
new RunUpdateProcessor(cmd.getReq(), null))).processAdd(cmd);
|
|
||||||
|
|
||||||
assertU(commit());
|
assertU(commit());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue