lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hoss...@apache.org
Subject svn commit: r1519763 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java webapp/web/js/scripts/cloud.js
Date Tue, 03 Sep 2013 17:29:49 GMT
Author: hossman
Date: Tue Sep  3 17:29:49 2013
New Revision: 1519763

URL: http://svn.apache.org/r1519763
Log:
SOLR-3852: Fixed ZookeeperInfoServlet so that the SolrCloud Admin UI pages will work even
if ZK contains nodes with data which are not utf8 text

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java
    lucene/dev/trunk/solr/webapp/web/js/scripts/cloud.js

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1519763&r1=1519762&r2=1519763&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Tue Sep  3 17:29:49 2013
@@ -173,6 +173,9 @@ Bug Fixes
 * SOLR-5190: SolrEntityProcessor substitutes variables only once in child entities
   (Harsh Chawla, shalin)
 
+* SOLR-3852: Fixed ZookeeperInfoServlet so that the SolrCloud Admin UI pages will 
+  work even if ZK contains nodes with data which are not utf8 text. (hossman)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java?rev=1519763&r1=1519762&r2=1519763&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/servlet/ZookeeperInfoServlet.java
Tue Sep  3 17:29:49 2013
@@ -290,21 +290,6 @@ public final class ZookeeperInfoServlet 
           printZnode(json, path);
         }
 
-        /*
-        if (stat.getNumChildren() != 0)
-        {
-          writeKeyValue(json, "children_count",  stat.getNumChildren(), false );
-          out.println(", \"children_count\" : \"" + stat.getNumChildren() + "\"");
-        }
-        */
-
-        //if (stat.getDataLength() != 0)
-        if (data != null) {
-          String str = new BytesRef(data).utf8ToString();
-          //?? writeKeyValue(json, "content", str, false );
-          // Does nothing now, but on the assumption this will be used later we'll leave
it in. If it comes out
-          // the catches below need to be restructured.
-        }
       } catch (IllegalArgumentException e) {
         // path doesn't exist (must have been removed)
         writeKeyValue(json, "warning", "(path gone)", false);
@@ -381,6 +366,16 @@ public final class ZookeeperInfoServlet 
         // Trickily, the call to zkClient.getData fills in the stat variable
         byte[] data = zkClient.getData(path, null, stat, true);
 
+        String dataStr = null;
+        String dataStrErr = null;
+        if (null != data) {
+          try {
+            dataStr = (new BytesRef(data)).utf8ToString();
+          } catch (Exception e) {
+            dataStrErr = "data is not parsable as a utf8 String: " + e.toString();
+          }
+        }
+
         json.writeString("znode");
         json.writeNameSeparator();
         json.startObject();
@@ -397,15 +392,18 @@ public final class ZookeeperInfoServlet 
         writeKeyValue(json, "ctime", time(stat.getCtime()), false);
         writeKeyValue(json, "cversion", stat.getCversion(), false);
         writeKeyValue(json, "czxid", stat.getCzxid(), false);
-        writeKeyValue(json, "dataLength", stat.getDataLength(), false);
         writeKeyValue(json, "ephemeralOwner", stat.getEphemeralOwner(), false);
         writeKeyValue(json, "mtime", time(stat.getMtime()), false);
         writeKeyValue(json, "mzxid", stat.getMzxid(), false);
         writeKeyValue(json, "pzxid", stat.getPzxid(), false);
+        writeKeyValue(json, "dataLength", stat.getDataLength(), false);
+        if (null != dataStrErr) {
+          writeKeyValue(json, "dataNote", dataStrErr, false);
+        }
         json.endObject();
 
-        if (data != null) {
-          writeKeyValue(json, "data", new BytesRef(data).utf8ToString(), false);
+        if (null != dataStr) {
+          writeKeyValue(json, "data", dataStr, false);
         }
         json.endObject();
       } catch (KeeperException e) {

Modified: lucene/dev/trunk/solr/webapp/web/js/scripts/cloud.js
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/webapp/web/js/scripts/cloud.js?rev=1519763&r1=1519762&r2=1519763&view=diff
==============================================================================
--- lucene/dev/trunk/solr/webapp/web/js/scripts/cloud.js (original)
+++ lucene/dev/trunk/solr/webapp/web/js/scripts/cloud.js Tue Sep  3 17:29:49 2013
@@ -612,7 +612,7 @@ var init_tree = function( tree_element )
                     var data_element = $( '#data', this );
 
                     var highlight = false;
-                    var data = '<em>File "' + response.znode.path + '" has no Content</em>';
+                    var data = '<em>Node "' + response.znode.path + '" has no utf8
Content</em>';
 
                     if( response.znode.data )
                     {



Mime
View raw message