incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [01/10] git commit: Small amount of code refactor.
Date Mon, 27 May 2013 17:02:00 GMT
Updated Branches:
  refs/heads/0.1.5 c31fac17d -> f86600aba


Small amount of code refactor.


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

Branch: refs/heads/0.1.5
Commit: ff82023d532582951bf849ff0f4f49b2d5735bc0
Parents: c31fac1
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon May 27 08:47:34 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon May 27 08:47:34 2013 -0400

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


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/ff82023d/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 d9a4cfc..74cfabc 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
@@ -106,12 +106,12 @@ public class IndexImporter extends TimerTask implements Closeable {
               isRollbackDueToException = true;
             }
           }
+          Path dirPath = directory.getPath();
           if (isSuccess) {
             LOG.info("Add index [{0}] [{1}/{2}]", directory, shard, table);
             indexWriter.addIndexes(directory);
             LOG.info("Finishing import [{0}], commiting on [{1}/{2}]", directory, shard,
table);
             indexWriter.commit();
-            Path dirPath = directory.getPath();
             LOG.info("Cleaning up old directory [{0}] for [{1}/{2}]", dirPath, shard, table);
             fileSystem.delete(dirPath, true);
             LOG.info("Import complete on [{0}/{1}]", shard, table);
@@ -122,9 +122,10 @@ public class IndexImporter extends TimerTask implements Closeable {
             LOG.info("Starting rollback on [{0}/{1}]", shard, table);
             indexWriter.rollback();
             LOG.info("Finished rollback on [{0}/{1}]", shard, table);
-            Path oldDirPath = directory.getPath();
-            String newDirectoryName = oldDirPath.getName().split("\\.")[0] + ".bad_rowids";
-            fileSystem.rename(oldDirPath, new Path(oldDirPath.getParent(), newDirectoryName));
+            String name = dirPath.getName();
+            int lastIndexOf = name.lastIndexOf('.');
+            String badRowIdsName = name.substring(0, lastIndexOf) + ".bad_rowids";
+            fileSystem.rename(dirPath, new Path(dirPath.getParent(), badRowIdsName));
           }
         }
       } finally {


Mime
View raw message