mirror of https://github.com/apache/lucene.git
SOLR-6511: fix back compat issue when reading existing data from ZK
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1631439 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1fb3769a89
commit
58a145fbba
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue