mirror of https://github.com/apache/lucene.git
SOLR-2382 - regression . debug not working
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1152692 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
31e3b272c5
commit
5fca7fc938
|
@ -74,8 +74,6 @@ public class DataImportHandler extends RequestHandlerBase implements
|
||||||
|
|
||||||
private Map<String, Properties> dataSources = new HashMap<String, Properties>();
|
private Map<String, Properties> dataSources = new HashMap<String, Properties>();
|
||||||
|
|
||||||
private List<SolrInputDocument> debugDocuments;
|
|
||||||
|
|
||||||
private boolean debugEnabled = true;
|
private boolean debugEnabled = true;
|
||||||
|
|
||||||
private String myName = "dataimport";
|
private String myName = "dataimport";
|
||||||
|
@ -203,10 +201,12 @@ public class DataImportHandler extends RequestHandlerBase implements
|
||||||
// Synchronous request for the debug mode
|
// Synchronous request for the debug mode
|
||||||
importer.runCmd(requestParams, sw);
|
importer.runCmd(requestParams, sw);
|
||||||
rsp.add("mode", "debug");
|
rsp.add("mode", "debug");
|
||||||
rsp.add("documents", debugDocuments);
|
rsp.add("documents", requestParams.debugDocuments);
|
||||||
if (sw.debugLogger != null)
|
if (requestParams.debugVerboseOutput != null) {
|
||||||
rsp.add("verbose-output", sw.debugLogger.output);
|
rsp.add("verbose-output", requestParams.debugVerboseOutput);
|
||||||
debugDocuments = null;
|
}
|
||||||
|
requestParams.debugDocuments = new ArrayList<SolrInputDocument>(0);
|
||||||
|
requestParams.debugVerboseOutput = null;
|
||||||
} else {
|
} else {
|
||||||
message = DataImporter.MSG.DEBUG_NOT_ENABLED;
|
message = DataImporter.MSG.DEBUG_NOT_ENABLED;
|
||||||
}
|
}
|
||||||
|
@ -285,11 +285,6 @@ public class DataImportHandler extends RequestHandlerBase implements
|
||||||
@Override
|
@Override
|
||||||
public boolean upload(SolrInputDocument document) {
|
public boolean upload(SolrInputDocument document) {
|
||||||
try {
|
try {
|
||||||
if (requestParams.debug) {
|
|
||||||
if (debugDocuments == null)
|
|
||||||
debugDocuments = new ArrayList<SolrInputDocument>();
|
|
||||||
debugDocuments.add(document);
|
|
||||||
}
|
|
||||||
return super.upload(document);
|
return super.upload(document);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
LOG.error( "Exception while adding: " + document, e);
|
LOG.error( "Exception while adding: " + document, e);
|
||||||
|
|
|
@ -18,11 +18,13 @@
|
||||||
package org.apache.solr.handler.dataimport;
|
package org.apache.solr.handler.dataimport;
|
||||||
|
|
||||||
import org.apache.solr.common.SolrException;
|
import org.apache.solr.common.SolrException;
|
||||||
|
import org.apache.solr.common.SolrInputDocument;
|
||||||
import org.apache.solr.core.SolrConfig;
|
import org.apache.solr.core.SolrConfig;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.schema.IndexSchema;
|
import org.apache.solr.schema.IndexSchema;
|
||||||
import org.apache.solr.schema.SchemaField;
|
import org.apache.solr.schema.SchemaField;
|
||||||
import org.apache.solr.common.util.ContentStream;
|
import org.apache.solr.common.util.ContentStream;
|
||||||
|
import org.apache.solr.common.util.NamedList;
|
||||||
import org.apache.solr.common.util.StrUtils;
|
import org.apache.solr.common.util.StrUtils;
|
||||||
import org.apache.solr.common.util.SystemIdResolver;
|
import org.apache.solr.common.util.SystemIdResolver;
|
||||||
import org.apache.solr.common.util.XMLErrorLogger;
|
import org.apache.solr.common.util.XMLErrorLogger;
|
||||||
|
@ -538,6 +540,10 @@ public class DataImporter {
|
||||||
|
|
||||||
public ContentStream contentStream;
|
public ContentStream contentStream;
|
||||||
|
|
||||||
|
public List<SolrInputDocument> debugDocuments = new ArrayList<SolrInputDocument>(0);
|
||||||
|
|
||||||
|
public NamedList debugVerboseOutput = null;
|
||||||
|
|
||||||
public RequestParams() {
|
public RequestParams() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,11 +72,13 @@ public class DocBuilder {
|
||||||
private static final String PARAM_WRITER_IMPL = "writerImpl";
|
private static final String PARAM_WRITER_IMPL = "writerImpl";
|
||||||
private static final String DEFAULT_WRITER_NAME = "SolrWriter";
|
private static final String DEFAULT_WRITER_NAME = "SolrWriter";
|
||||||
private DebugLogger debugLogger;
|
private DebugLogger debugLogger;
|
||||||
|
private DataImporter.RequestParams reqParams;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public DocBuilder(DataImporter dataImporter, SolrWriter solrWriter, DIHPropertiesWriter propWriter, DataImporter.RequestParams reqParams) {
|
public DocBuilder(DataImporter dataImporter, SolrWriter solrWriter, DIHPropertiesWriter propWriter, DataImporter.RequestParams reqParams) {
|
||||||
INSTANCE.set(this);
|
INSTANCE.set(this);
|
||||||
this.dataImporter = dataImporter;
|
this.dataImporter = dataImporter;
|
||||||
|
this.reqParams = reqParams;
|
||||||
this.propWriter = propWriter;
|
this.propWriter = propWriter;
|
||||||
DataImporter.QUERY_COUNT.set(importStatistics.queryCount);
|
DataImporter.QUERY_COUNT.set(importStatistics.queryCount);
|
||||||
requestParameters = reqParams;
|
requestParameters = reqParams;
|
||||||
|
@ -261,6 +263,9 @@ public class DocBuilder {
|
||||||
{
|
{
|
||||||
if (writer != null) {
|
if (writer != null) {
|
||||||
writer.close();
|
writer.close();
|
||||||
|
}
|
||||||
|
if(requestParameters.debug) {
|
||||||
|
requestParameters.debugVerboseOutput = getDebugLogger().output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -514,6 +519,9 @@ public class DocBuilder {
|
||||||
LOG.debug("adding a doc "+docWrapper);
|
LOG.debug("adding a doc "+docWrapper);
|
||||||
}
|
}
|
||||||
boolean result = writer.upload(docWrapper);
|
boolean result = writer.upload(docWrapper);
|
||||||
|
if(reqParams.debug) {
|
||||||
|
reqParams.debugDocuments.add(docWrapper);
|
||||||
|
}
|
||||||
docWrapper = null;
|
docWrapper = null;
|
||||||
if (result){
|
if (result){
|
||||||
importStatistics.docCount.incrementAndGet();
|
importStatistics.docCount.incrementAndGet();
|
||||||
|
@ -672,6 +680,9 @@ public class DocBuilder {
|
||||||
return;
|
return;
|
||||||
if (!doc.isEmpty()) {
|
if (!doc.isEmpty()) {
|
||||||
boolean result = writer.upload(doc);
|
boolean result = writer.upload(doc);
|
||||||
|
if(reqParams.debug) {
|
||||||
|
reqParams.debugDocuments.add(doc);
|
||||||
|
}
|
||||||
doc = null;
|
doc = null;
|
||||||
if (result){
|
if (result){
|
||||||
importStatistics.docCount.incrementAndGet();
|
importStatistics.docCount.incrementAndGet();
|
||||||
|
|
|
@ -44,8 +44,6 @@ public class SolrWriter implements DIHWriter {
|
||||||
|
|
||||||
private final UpdateRequestProcessor processor;
|
private final UpdateRequestProcessor processor;
|
||||||
|
|
||||||
DebugLogger debugLogger;
|
|
||||||
|
|
||||||
SolrQueryRequest req;
|
SolrQueryRequest req;
|
||||||
|
|
||||||
public SolrWriter(UpdateRequestProcessor processor, SolrQueryRequest req) {
|
public SolrWriter(UpdateRequestProcessor processor, SolrQueryRequest req) {
|
||||||
|
|
Loading…
Reference in New Issue