SOLR-2492 -- DIH does not commit if only deletes are processed

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1145925 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2011-07-13 09:15:55 +00:00
parent 4e198e8caf
commit dddbb9c0a0
3 changed files with 18 additions and 1 deletions

View File

@ -14,7 +14,10 @@ $Id$
================== 3.4.0-dev ============== ================== 3.4.0-dev ==============
Bug Fixes
----------------------
* SOLR-2644: When using threads=2 the default logging is set too high (Bill Bell via shalin) * 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 ================== ================== 3.3.0 ==================

View File

@ -703,9 +703,11 @@ public class DocBuilder {
Collection collection = (Collection) value; Collection collection = (Collection) value;
for (Object o : collection) { for (Object o : collection) {
writer.deleteDoc(o.toString()); writer.deleteDoc(o.toString());
importStatistics.deletedDocCount.incrementAndGet();
} }
} else { } else {
writer.deleteDoc(value); writer.deleteDoc(value);
importStatistics.deletedDocCount.incrementAndGet();
} }
} }
value = arow.get("$deleteDocByQuery"); value = arow.get("$deleteDocByQuery");
@ -714,9 +716,11 @@ public class DocBuilder {
Collection collection = (Collection) value; Collection collection = (Collection) value;
for (Object o : collection) { for (Object o : collection) {
writer.deleteByQuery(o.toString()); writer.deleteByQuery(o.toString());
importStatistics.deletedDocCount.incrementAndGet();
} }
} else { } else {
writer.deleteByQuery(value.toString()); writer.deleteByQuery(value.toString());
importStatistics.deletedDocCount.incrementAndGet();
} }
} }
value = arow.get("$docBoost"); value = arow.get("$docBoost");

View File

@ -225,6 +225,16 @@ public class TestDocBuilder2 extends AbstractDataImportHandlerTestCase {
assertTrue("Update request processor processDelete was not called", TestUpdateRequestProcessor.processDeleteCalled); assertTrue("Update request processor processDelete was not called", TestUpdateRequestProcessor.processDeleteCalled);
assertTrue("Update request processor finish was not called", TestUpdateRequestProcessor.finishCalled); 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 @Test