accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [09/51] [abbrv] git commit: ACCUMULO-2582 Use the full path, not just the file name.
Date Sat, 14 Jun 2014 04:55:09 GMT
ACCUMULO-2582 Use the full path, not just the file name.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/3c58a19b
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/3c58a19b
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/3c58a19b

Branch: refs/heads/master
Commit: 3c58a19b2054773841d823855af7a10469d855e9
Parents: be78097
Author: Josh Elser <elserj@apache.org>
Authored: Tue May 27 17:17:24 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Tue May 27 17:17:24 2014 -0400

----------------------------------------------------------------------
 .../monitor/servlets/ReplicationServlet.java    | 59 +++++++++++---------
 1 file changed, 33 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/3c58a19b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java
index 234c7b4..8655462 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ReplicationServlet.java
@@ -214,38 +214,45 @@ public class ReplicationServlet extends BasicServlet {
       String filename = queueKeyPair.getKey();
       ReplicationTarget target = queueKeyPair.getValue();
 
-      Scanner s = ReplicationTable.getScanner(conn);
-      s.setRange(Range.exact(filename));
-      s.fetchColumn(WorkSection.NAME, target.toText());
+      byte[] data = zooCache.get(workQueuePath + "/" + queueKey);
 
-      // Fetch the work entry for this item
+      // We could try to grep over the table, but without knowing the full file path, we
+      // can't find the status quickly
       String status = "Unknown";
-      Entry<Key,Value> kv = null;
-      try {
-        kv = Iterables.getOnlyElement(s);
-      } catch (NoSuchElementException e) {
-       log.trace("Could not find status of {} replicating to {}", filename, target);
-       status = "Unknown";
-      } finally {
-        s.close();
-      }
-
-      // If we found the work entry for it, try to compute some progress
-      if (null != kv) {
+      if (null != data) {
+        String path = new String(filename);
+        Scanner s = ReplicationTable.getScanner(conn);
+        s.setRange(Range.exact(path));
+        s.fetchColumn(WorkSection.NAME, target.toText());
+  
+        // Fetch the work entry for this item
+        Entry<Key,Value> kv = null;
         try {
-          Status stat = Status.parseFrom(kv.getValue().get());
-          if (StatusUtil.isFullyReplicated(stat)) {
-            status = "Finished";
-          } else {
-            if (stat.getInfiniteEnd()) {
-              status = stat.getBegin() + "/&infin;";
+          kv = Iterables.getOnlyElement(s);
+        } catch (NoSuchElementException e) {
+         log.trace("Could not find status of {} replicating to {}", filename, target);
+         status = "Unknown";
+        } finally {
+          s.close();
+        }
+  
+        // If we found the work entry for it, try to compute some progress
+        if (null != kv) {
+          try {
+            Status stat = Status.parseFrom(kv.getValue().get());
+            if (StatusUtil.isFullyReplicated(stat)) {
+              status = "Finished";
             } else {
-              status = stat.getBegin() + "/" + stat.getEnd();
+              if (stat.getInfiniteEnd()) {
+                status = stat.getBegin() + "/&infin;";
+              } else {
+                status = stat.getBegin() + "/" + stat.getEnd();
+              }
             }
+          } catch (InvalidProtocolBufferException e) {
+            log.warn("Could not deserialize protobuf for {}", kv.getKey(), e);
+            status = "Unknown";
           }
-        } catch (InvalidProtocolBufferException e) {
-          log.warn("Could not deserialize protobuf for {}", kv.getKey(), e);
-          status = "Unknown";
         }
       }
 


Mime
View raw message