incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [1/2] git commit: Added debug flag to turn a simple set of counters used for debuging HDFS activity on and off.
Date Wed, 08 May 2013 13:30:29 GMT
Updated Branches:
  refs/heads/0.1.5 b03b603a9 -> 27912aef7


Added debug flag to turn a simple set of counters used for debuging HDFS activity on and off.


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

Branch: refs/heads/0.1.5
Commit: 4c99b4609ce5e826644617816766f4c1a442ec1f
Parents: b03b603
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Tue May 7 21:46:48 2013 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Tue May 7 21:46:48 2013 -0400

----------------------------------------------------------------------
 .../org/apache/blur/store/hdfs/HdfsDirectory.java  |   63 ++++++++-------
 1 files changed, 35 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/4c99b460/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
----------------------------------------------------------------------
diff --git a/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java b/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
index 2e5fa98..a3e11f8 100644
--- a/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
+++ b/src/blur-store/src/main/java/org/apache/blur/store/hdfs/HdfsDirectory.java
@@ -51,9 +51,8 @@ import com.yammer.metrics.Metrics;
 import com.yammer.metrics.core.Histogram;
 import com.yammer.metrics.core.Meter;
 import com.yammer.metrics.core.MetricName;
-public class HdfsDirectory extends Directory {
 
-  
+public class HdfsDirectory extends Directory {
 
   private static final Log LOG = LogFactory.getLog(HdfsDirectory.class);
 
@@ -65,29 +64,33 @@ public class HdfsDirectory extends Directory {
   private static AtomicLong createCounter = new AtomicLong();
   private static AtomicLong isFileCounter = new AtomicLong();
 
+  private static final boolean debug = false;
+
   static {
-    Thread thread = new Thread(new Runnable() {
-      @Override
-      public void run() {
-        while (true) {
-          LOG.debug("Delete Counter [" + deleteCounter + "]");
-          LOG.debug("Exists Counter [" + existsCounter + "]");
-          LOG.debug("File Status Counter [" + fileStatusCounter + "]");
-          LOG.debug("Rename Counter [" + renameCounter + "]");
-          LOG.debug("List Counter [" + listCounter + "]");
-          LOG.debug("Create Counter [" + createCounter + "]");
-          LOG.debug("IsFile Counter [" + isFileCounter + "]");
-          try {
-            Thread.sleep(5000);
-          } catch (InterruptedException e) {
-            return;
+    if (debug) {
+      Thread thread = new Thread(new Runnable() {
+        @Override
+        public void run() {
+          while (true) {
+            LOG.debug("Delete Counter [" + deleteCounter + "]");
+            LOG.debug("Exists Counter [" + existsCounter + "]");
+            LOG.debug("File Status Counter [" + fileStatusCounter + "]");
+            LOG.debug("Rename Counter [" + renameCounter + "]");
+            LOG.debug("List Counter [" + listCounter + "]");
+            LOG.debug("Create Counter [" + createCounter + "]");
+            LOG.debug("IsFile Counter [" + isFileCounter + "]");
+            try {
+              Thread.sleep(5000);
+            } catch (InterruptedException e) {
+              return;
+            }
           }
         }
-      }
-    });
-    thread.setName("HDFS dir counter logger");
-    thread.setDaemon(true);
-    thread.start();
+      });
+      thread.setName("HDFS dir counter logger");
+      thread.setDaemon(true);
+      thread.start();
+    }
   }
 
   private final Path path;
@@ -107,7 +110,7 @@ public class HdfsDirectory extends Directory {
       this.writeThroughput = writeThroughput;
     }
   }
-  
+
   /**
    * We keep the metrics separate per filesystem.
    */
@@ -122,11 +125,15 @@ public class HdfsDirectory extends Directory {
       MetricsGroup metricsGroup = metricsGroupMap.get(uri);
       if (metricsGroup == null) {
         String scope = uri.toString();
-        
-        Histogram readAccess = Metrics.newHistogram(new MetricName(ORG_APACHE_BLUR, HDFS,
"Read Latency in \u00B5s", scope));
-        Histogram writeAccess = Metrics.newHistogram(new MetricName(ORG_APACHE_BLUR, HDFS,
"Write Latency in \u00B5s", scope));
-        Meter readThroughput = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, HDFS, "Read
Throughput", scope), "Read Bytes", TimeUnit.SECONDS);
-        Meter writeThroughput = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, HDFS, "Write
Throughput", scope), "Write Bytes", TimeUnit.SECONDS);
+
+        Histogram readAccess = Metrics.newHistogram(new MetricName(ORG_APACHE_BLUR, HDFS,
"Read Latency in \u00B5s",
+            scope));
+        Histogram writeAccess = Metrics.newHistogram(new MetricName(ORG_APACHE_BLUR, HDFS,
"Write Latency in \u00B5s",
+            scope));
+        Meter readThroughput = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, HDFS, "Read
Throughput", scope),
+            "Read Bytes", TimeUnit.SECONDS);
+        Meter writeThroughput = Metrics.newMeter(new MetricName(ORG_APACHE_BLUR, HDFS, "Write
Throughput", scope),
+            "Write Bytes", TimeUnit.SECONDS);
         metricsGroup = new MetricsGroup(readAccess, writeAccess, readThroughput, writeThroughput);
         metricsGroupMap.put(uri, metricsGroup);
       }


Mime
View raw message