incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject git commit: BLUR:108 skip delete if numDocs is 0
Date Mon, 27 May 2013 05:19:48 GMT
Updated Branches:
  refs/heads/0.1.5 9a8b1da5c -> b85f5d797


BLUR:108 skip delete if numDocs is 0


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/b85f5d79
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/b85f5d79
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/b85f5d79

Branch: refs/heads/0.1.5
Commit: b85f5d7976afc78ef87cee68385ac02728ddd607
Parents: 9a8b1da
Author: Gagan <gagandeepjuneja@gmail.com>
Authored: Mon May 27 10:43:34 2013 +0530
Committer: Gagan <gagandeepjuneja@gmail.com>
Committed: Mon May 27 10:43:34 2013 +0530

----------------------------------------------------------------------
 .../apache/blur/manager/writer/IndexImporter.java  |   16 ++++++++------
 1 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/b85f5d79/src/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
b/src/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
index 4efd908..6e31201 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/writer/IndexImporter.java
@@ -95,14 +95,16 @@ public class IndexImporter extends TimerTask implements Closeable {
         for (HdfsDirectory directory : indexesToImport) {
           LOG.info("Starting import [{0}], commiting on [{1}/{2}]", directory, shard, table);
           indexWriter.commit();
-          boolean isSuccess = false;
+          boolean isSuccess = true;
           boolean isRollbackDueToException = false;
-          try {
-            isSuccess = applyDeletes(directory, indexWriter, shard);
-          }catch(IOException e){
-            LOG.error("Some issue with deleting the old index", e);
-            isSuccess = false;
-            isRollbackDueToException = true;
+          if (indexWriter.numDocs() != 0) {
+            try {
+              isSuccess = applyDeletes(directory, indexWriter, shard);
+            } catch (IOException e) {
+              LOG.error("Some issue with deleting the old index", e);
+              isSuccess = false;
+              isRollbackDueToException = true;
+            }
           }
           if (isSuccess) {
             LOG.info("Add index [{0}] [{1}/{2}]", directory, shard, table);


Mime
View raw message