lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thelabd...@apache.org
Subject svn commit: r1631439 - /lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java
Date Mon, 13 Oct 2014 15:35:36 GMT
Author: thelabdude
Date: Mon Oct 13 15:35:35 2014
New Revision: 1631439

URL: http://svn.apache.org/r1631439
Log:
SOLR-6511: fix back compat issue when reading existing data from ZK

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java?rev=1631439&r1=1631438&r2=1631439&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/cloud/ZkController.java Mon Oct 13
15:35:35 2014
@@ -1989,8 +1989,18 @@ public final class ZkController {
     }
 
     Map<String,Object> stateObj = null;
-    if (stateData != null && stateData.length > 0)
-      stateObj = (Map<String, Object>) ZkStateReader.fromJSON(stateData);
+    if (stateData != null && stateData.length > 0) {
+      Object parsedJson = ZkStateReader.fromJSON(stateData);
+      if (parsedJson instanceof Map) {
+        stateObj = (Map<String,Object>)parsedJson;
+      } else if (parsedJson instanceof String) {
+        // old format still in ZK
+        stateObj = new LinkedHashMap<>();
+        stateObj.put("state", (String)parsedJson);
+      } else {
+        throw new SolrException(ErrorCode.SERVER_ERROR, "Leader-initiated recovery state
data is invalid! "+parsedJson);
+      }
+    }
 
     return stateObj;
   }



Mime
View raw message