accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [1/2] git commit: ACCUMULO-2029 root table errors go in zookeeper (for now), don\'t need to decode url-encoded parameters on the recv side, the server does that for you
Date Tue, 17 Dec 2013 00:12:12 GMT
Updated Branches:
  refs/heads/master c761b59e0 -> b9b15961d


ACCUMULO-2029 root table errors go in zookeeper (for now), don\'t need to decode url-encoded
parameters on the recv side, the server does that for you


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

Branch: refs/heads/master
Commit: f37342bab253d939f70e9616a222379ea2843334
Parents: ae20660
Author: Eric Newton <eric.newton@gmail.com>
Authored: Mon Dec 16 19:11:19 2013 -0500
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Mon Dec 16 19:11:45 2013 -0500

----------------------------------------------------------------------
 .../accumulo/server/problems/ProblemReports.java    | 16 ++++++++++------
 .../accumulo/monitor/servlets/BasicServlet.java     |  9 ---------
 .../accumulo/monitor/servlets/OperationServlet.java |  8 +-------
 .../accumulo/monitor/servlets/ProblemServlet.java   |  6 +++---
 4 files changed, 14 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f37342ba/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
b/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
index a68a3cd..53a1fe7 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/problems/ProblemReports.java
@@ -87,7 +87,7 @@ public class ProblemReports implements Iterable<ProblemReport> {
         log.debug("Filing problem report " + pr.getTableName() + " " + pr.getProblemType()
+ " " + pr.getResource());
         
         try {
-          if (pr.getTableName().equals(MetadataTable.ID) || pr.getTableName().equals(RootTable.ID))
{
+          if (isMeta(pr.getTableName())) {
             // file report in zookeeper
             pr.saveToZooKeeper();
           } else {
@@ -123,8 +123,8 @@ public class ProblemReports implements Iterable<ProblemReport> {
       @Override
       public void run() {
         try {
-          if (pr.getTableName().equals(MetadataTable.ID)) {
-            // file report in zookeeper
+          if (isMeta(pr.getTableName())) {
+           // file report in zookeeper
             pr.removeFromZooKeeper();
           } else {
             // file report in metadata table
@@ -147,7 +147,7 @@ public class ProblemReports implements Iterable<ProblemReport> {
   
   public void deleteProblemReports(String table) throws Exception {
     
-    if (MetadataTable.ID.equals(table)) {
+    if (isMeta(table)) {
       Iterator<ProblemReport> pri = iterator(table);
       while (pri.hasNext()) {
         pri.next().removeFromZooKeeper();
@@ -177,6 +177,10 @@ public class ProblemReports implements Iterable<ProblemReport>
{
       MetadataTableUtil.getMetadataTable(SystemCredentials.get()).update(delMut);
   }
   
+  private static boolean isMeta(String tableId) {
+    return tableId.equals(MetadataTable.ID) || tableId.equals(RootTable.ID);
+  }
+  
   public Iterator<ProblemReport> iterator(final String table) {
     try {
       
@@ -190,7 +194,7 @@ public class ProblemReports implements Iterable<ProblemReport> {
           if (iter1 == null) {
             try {
               List<String> children;
-              if (table == null || table.equals(MetadataTable.ID)) {
+              if (table == null || isMeta(table)) {
                 children = zoo.getChildren(ZooUtil.getRoot(HdfsZooInstance.getInstance())
+ Constants.ZPROBLEMS);
               } else {
                 children = Collections.emptyList();
@@ -209,7 +213,7 @@ public class ProblemReports implements Iterable<ProblemReport> {
         private Iterator<Entry<Key,Value>> getIter2() {
           if (iter2 == null) {
             try {
-              if ((table == null || !table.equals(MetadataTable.ID)) && iter1Count
== 0) {
+              if ((table == null || !isMeta(table)) && iter1Count == 0) {
                 Connector connector = HdfsZooInstance.getInstance().getConnector(SystemCredentials.get().getPrincipal(),
SystemCredentials.get().getToken());
                 Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
                 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f37342ba/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
index c81f7f4..ff1e976 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/BasicServlet.java
@@ -253,15 +253,6 @@ abstract public class BasicServlet extends HttpServlet {
     }
   }
 
-  public static String decode(String s) {
-    try {
-      return URLDecoder.decode(s, Constants.UTF8.name());
-    } catch (UnsupportedEncodingException e) {
-      Logger.getLogger(BasicServlet.class).fatal(Constants.UTF8.name() + " is not a recognized
encoding", e);
-      throw new RuntimeException(e);
-    }
-  }
-
   public static String sanitize(String xml) {
     return xml.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">",
"&gt;");
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f37342ba/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/OperationServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/OperationServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/OperationServlet.java
index 7bad3eb..961edc3 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/OperationServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/OperationServlet.java
@@ -47,8 +47,6 @@ public class OperationServlet extends BasicServlet {
     try {
       String operation = req.getParameter("action");
       redir = req.getParameter("redir");
-      if (redir != null)
-        redir = decode(redir);
       
       if (operation != null) {
         for (Class<?> subclass : OperationServlet.class.getClasses()) {
@@ -118,11 +116,7 @@ public class OperationServlet extends BasicServlet {
     public void execute(HttpServletRequest req, HttpServletResponse resp, Logger log) {
       String table = req.getParameter("table");
       String resource = req.getParameter("resource");
-      if (resource != null)
-        resource = decode(resource);
       String ptype = req.getParameter("ptype");
-      if (ptype != null)
-        ptype = decode(ptype);
       try {
         ProblemReports.getInstance().deleteProblemReport(table, ProblemType.valueOf(ptype),
resource);
       } catch (Exception e) {
@@ -162,7 +156,7 @@ public class OperationServlet extends BasicServlet {
   public static class ClearDeadServerOperation implements WebOperation {
     @Override
     public void execute(HttpServletRequest req, HttpServletResponse resp, Logger log) {
-      String server = decode(req.getParameter("server"));
+      String server = req.getParameter("server");
       Instance inst = HdfsZooInstance.getInstance();
       // a dead server should have a uniq address: a logger or tserver
       DeadServerList obit = new DeadServerList(ZooUtil.getRoot(inst) + Constants.ZDEADTSERVERS);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f37342ba/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ProblemServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ProblemServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ProblemServlet.java
index d20328e..60cece6 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ProblemServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/ProblemServlet.java
@@ -135,7 +135,7 @@ public class ProblemServlet extends BasicServlet {
       if (obj == null)
         return "-";
       String table = String.valueOf(obj);
-      return String.format("<a href='/problems?table=%s'>%s</a>", table, Tables.getPrintableTableNameFromId(tidToNameMap,
table));
+      return String.format("<a href='/problems?table=%s'>%s</a>", encode(table),
encode((Tables.getPrintableTableNameFromId(tidToNameMap, table))));
     }
   }
   
@@ -158,7 +158,7 @@ public class ProblemServlet extends BasicServlet {
       if (obj == null)
         return "-";
       String table = String.valueOf(obj);
-      return String.format("<a href='/op?table=%s&action=clearTableProblems&redir=%s'>clear
ALL %s problems</a>", table, currentPage(req),
+      return String.format("<a href='/op?table=%s&action=clearTableProblems&redir=%s'>clear
ALL %s problems</a>", encode(table), currentPage(req),
           Tables.getPrintableTableNameFromId(tidToNameMap, table));
     }
   }
@@ -180,7 +180,7 @@ public class ProblemServlet extends BasicServlet {
       if (obj == null)
         return "-";
       ProblemReport p = (ProblemReport) obj;
-      return String.format("<a href='/op?table=%s&action=clearProblem&redir=%s&resource=%s&ptype=%s'>clear
this problem</a>", p.getTableName(),
+      return String.format("<a href='/op?table=%s&action=clearProblem&redir=%s&resource=%s&ptype=%s'>clear
this problem</a>", encode(p.getTableName()),
           currentPage(req), encode(p.getResource()), encode(p.getProblemType().name()));
     }
     


Mime
View raw message