incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject git commit: I think this should fix BLUR-93, need to test more to make sure.
Date Mon, 20 May 2013 13:34:40 GMT
Updated Branches:
  refs/heads/0.1.5 7e31cd283 -> a51089570


I think this should fix BLUR-93, need to test more to make sure.


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

Branch: refs/heads/0.1.5
Commit: a51089570c14c43c6fe9f2bd5f452b5b71a7f841
Parents: 7e31cd2
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Mon May 20 09:33:29 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Mon May 20 09:33:29 2013 -0400

----------------------------------------------------------------------
 .../blur/manager/writer/TransactionRecorder.java   |   16 +++++++++-----
 1 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/a5108957/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
----------------------------------------------------------------------
diff --git a/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
b/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
index fbd8da6..421d4cb 100644
--- a/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
+++ b/src/blur-core/src/main/java/org/apache/blur/manager/writer/TransactionRecorder.java
@@ -105,6 +105,8 @@ public class TransactionRecorder extends TimerTask {
   private final BlurAnalyzer _analyzer;
   private final FileSystem _fileSystem;
   private final Timer _timer;
+  private final String _table;
+  private final String _shard;
 
   public TransactionRecorder(ShardContext shardContext) throws IOException {
     TableContext tableContext = shardContext.getTableContext();
@@ -116,6 +118,8 @@ public class TransactionRecorder extends TimerTask {
     _timer = new Timer("wal-sync-[" + tableContext.getTable() + "/" + shardContext.getShard()
+ "]", true);
     _timer.schedule(this, TimeUnit.NANOSECONDS.toMillis(_timeBetweenSyncsNanos),
         TimeUnit.NANOSECONDS.toMillis(_timeBetweenSyncsNanos));
+    _table = tableContext.getTable();
+    _shard = shardContext.getShard();
   }
 
   public void open() throws IOException {
@@ -194,11 +198,11 @@ public class TransactionRecorder extends TimerTask {
   }
 
   public void close() throws IOException {
-    _timer.purge();
-    _timer.cancel();
     synchronized (_running) {
       _running.set(false);
     }
+    _timer.purge();
+    _timer.cancel();
     _outputStream.get().close();
   }
 
@@ -278,7 +282,7 @@ public class TransactionRecorder extends TimerTask {
     if (bs == null || _outputStream == null) {
       throw new RuntimeException("bs [" + bs + "] outputStream [" + _outputStream + "]");
     }
-    synchronized (_outputStream) {
+    synchronized (_running) {
       FSDataOutputStream os = _outputStream.get();
       os.writeInt(bs.length);
       os.write(bs);
@@ -287,7 +291,7 @@ public class TransactionRecorder extends TimerTask {
   }
 
   private void tryToSync() throws IOException {
-    synchronized (_outputStream) {
+    synchronized (_running) {
       tryToSync(_outputStream.get());
     }
   }
@@ -338,10 +342,10 @@ public class TransactionRecorder extends TimerTask {
       long s = System.nanoTime();
       writer.commit();
       long m = System.nanoTime();
-      LOG.info("Commit took [{0}] for [{1}]", (m - s) / 1000000.0, writer);
+      LOG.info("Commit took [{0} ms] for [{1}/{2}]", (m - s) / 1000000.0, _table, _shard);
       rollLog();
       long e = System.nanoTime();
-      LOG.info("Log roller took [{0}] for [{1}]", (e - m) / 1000000.0, writer);
+      LOG.info("Log roller took [{0} ms] for [{1}/{2}]", (e - m) / 1000000.0, _table, _shard);
     }
   }
 


Mime
View raw message