diff --git a/solr/contrib/dataimporthandler/CHANGES.txt b/solr/contrib/dataimporthandler/CHANGES.txt index 61f6fb568eb..1b230df0335 100644 --- a/solr/contrib/dataimporthandler/CHANGES.txt +++ b/solr/contrib/dataimporthandler/CHANGES.txt @@ -14,7 +14,10 @@ $Id$ ================== 3.4.0-dev ============== +Bug Fixes +---------------------- * SOLR-2644: When using threads=2 the default logging is set too high (Bill Bell via shalin) +* SOLR-2492: DIH does not commit if only deletes are processed (James Dyer via shalin) ================== 3.3.0 ================== diff --git a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java index 260cb72d309..fed23064f5f 100644 --- a/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java +++ b/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java @@ -703,20 +703,24 @@ public class DocBuilder { Collection collection = (Collection) value; for (Object o : collection) { writer.deleteDoc(o.toString()); + importStatistics.deletedDocCount.incrementAndGet(); } } else { writer.deleteDoc(value); + importStatistics.deletedDocCount.incrementAndGet(); } - } + } value = arow.get("$deleteDocByQuery"); if (value != null) { if (value instanceof Collection) { Collection collection = (Collection) value; for (Object o : collection) { writer.deleteByQuery(o.toString()); + importStatistics.deletedDocCount.incrementAndGet(); } } else { writer.deleteByQuery(value.toString()); + importStatistics.deletedDocCount.incrementAndGet(); } } value = arow.get("$docBoost"); diff --git a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java index daa32cab7bf..d6c7b8b9bb3 100644 --- a/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java +++ b/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilder2.java @@ -225,6 +225,16 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase { assertTrue("Update request processor processDelete was not called", TestUpdateRequestProcessor.processDeleteCalled); assertTrue("Update request processor finish was not called", TestUpdateRequestProcessor.finishCalled); + MockDataSource.clearCache(); + rows = new ArrayList(); + rows.add(createMap("$deleteDocById", "3")); + MockDataSource.setIterator("select * from x", rows.iterator()); + runFullImport(dataConfigForSkipTransform, createMap("clean","false")); + assertQ(req("id:3"), "//*[@numFound='0']"); + + assertTrue("Update request processor processDelete was not called", TestUpdateRequestProcessor.processDeleteCalled); + assertTrue("Update request processor finish was not called", TestUpdateRequestProcessor.finishCalled); + } @Test