You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/05/28 02:40:47 UTC

[07/13] git commit: ACCUMULO-2582 Use the full path, not just the file name.

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/ACCUMULO-378
Commit: 3c58a19b2054773841d823855af7a10469d855e9
Parents: be78097
Author: Josh Elser <el...@apache.org>
Authored: Tue May 27 17:17:24 2014 -0400
Committer: Josh Elser <el...@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";
         }
       }