SOLR-864 -- DataImportHandler does not catch and log Errors

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@718187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2008-11-17 08:26:29 +00:00
parent f9b1fb4d63
commit a788efe789
3 changed files with 17 additions and 20 deletions

View File

@ -56,6 +56,8 @@ Bug Fixes
6. SOLR-838: The VariableResolver obtained from a DataSource's context does not have current data. 6. SOLR-838: The VariableResolver obtained from a DataSource's context does not have current data.
(Noble Paul via shalin) (Noble Paul via shalin)
7. SOLR-864: DataImportHandler does not catch and log Errors (shalin)
Documentation Documentation
---------------------- ----------------------

View File

@ -337,8 +337,8 @@ public class DataImporter {
docBuilder.execute(getConfig().documents.get(0).name); docBuilder.execute(getConfig().documents.get(0).name);
if (!requestParams.debug) if (!requestParams.debug)
cumulativeStatistics.add(docBuilder.importStatistics); cumulativeStatistics.add(docBuilder.importStatistics);
} catch (RuntimeException e) { } catch (Throwable t) {
LOG.error("Full Import failed", e); LOG.error("Full Import failed", t);
} finally { } finally {
setStatus(Status.IDLE); setStatus(Status.IDLE);
config.clearCaches(); config.clearCaches();
@ -360,8 +360,8 @@ public class DataImporter {
docBuilder.execute(config.documents.get(0).name); docBuilder.execute(config.documents.get(0).name);
if (!requestParams.debug) if (!requestParams.debug)
cumulativeStatistics.add(docBuilder.importStatistics); cumulativeStatistics.add(docBuilder.importStatistics);
} catch (RuntimeException e) { } catch (Throwable t) {
LOG.error("Delta Import Failed", e); LOG.error("Delta Import Failed", t);
} finally { } finally {
setStatus(Status.IDLE); setStatus(Status.IDLE);
config.clearCaches(); config.clearCaches();

View File

@ -29,11 +29,8 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
/** /**
* <p> * <p> DocBuilder is responsible for creating Solr documents out of the given configuration. It also maintains
* DocBuilder is responsible for creating Solr documents out of the given * statistics information. It depends on the EntityProcessor implementations to fetch data. </p>
* configuration. It also maintains statistics information. It depends on the
* EntityProcessor implementations to fetch data.
* </p>
* <p/> * <p/>
* <b>This API is experimental and subject to change</b> * <b>This API is experimental and subject to change</b>
* *
@ -335,6 +332,11 @@ public class DocBuilder {
throw e; throw e;
} else } else
throw e; throw e;
} catch (Throwable t) {
if (verboseDebug) {
writer.log(SolrWriter.ENTITY_EXCEPTION, entity.name, t);
}
throw new DataImportHandlerException(DataImportHandlerException.SEVERE, t);
} finally { } finally {
if (verboseDebug) { if (verboseDebug) {
writer.log(SolrWriter.ROW_END, entity.name, null); writer.log(SolrWriter.ROW_END, entity.name, null);
@ -431,18 +433,11 @@ public class DocBuilder {
} }
/** /**
* <p> * <p> Collects unique keys of all Solr documents for whom one or more source tables have been changed since the last
* Collects unique keys of all Solr documents for whom one or more source * indexed time. </p> <p> Note: In our definition, unique key of Solr document is the primary key of the top level
* tables have been changed since the last indexed time. * entity (unless skipped using docRoot=false) in the Solr document in data-config.xml </p>
* </p>
* <p>
* Note: In our definition, unique key of Solr document is the primary key of
* the top level entity (unless skipped using docRoot=false) in the Solr
* document in data-config.xml
* </p>
* *
* @return an iterator to the list of keys for which Solr documents should be * @return an iterator to the list of keys for which Solr documents should be updated.
* updated.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public Set<Map<String, Object>> collectDelta(DataConfig.Entity entity, public Set<Map<String, Object>> collectDelta(DataConfig.Entity entity,