blackfox1983 commented on a change in pull request #3454:
URL: https://github.com/apache/incubator-doris/pull/3454#discussion_r420603017



##########
File path: fe/src/main/java/org/apache/doris/external/EsIndexState.java
##########
@@ -166,7 +137,8 @@ public void setPartitionId(long partitionId) {
 
     @Override
     public String toString() {
-        return "EsIndexState [indexName=" + indexName + ", partitionDesc=" + 
partitionDesc + ", partitionKey="
-                + partitionKey + "]";
+        return "EsIndexState [indexName=" + indexName + ", partitionDesc=" + 
partitionDesc
+            + ", partitionKey="
+            + partitionKey + "]";

Review comment:
       这个折行 ,没看懂逻辑。
   如果折行,可以都折行。否则按照变量组折行。避免从中间折行

##########
File path: fe/src/main/java/org/apache/doris/external/EsIndexState.java
##########
@@ -76,66 +68,45 @@ public TNetworkAddress randomAddress(Map<String, 
EsNodeInfo> nodesInfo) {
         EsNodeInfo[] nodeInfos = (EsNodeInfo[]) nodesInfo.values().toArray();
         return nodeInfos[seed].getPublishAddress();
     }
-    
-    public static EsIndexState parseIndexStateV55(String indexName, JSONObject 
indicesRoutingMap, 
-            JSONObject nodesMap, 
-            JSONObject indicesMetaMap, PartitionInfo partitionInfo) throws 
AnalysisException {
+
+    public static EsIndexState parseIndexState(String indexName, JSONObject 
nodesMap,
+        JSONArray shards) {
         EsIndexState indexState = new EsIndexState(indexName);
-        JSONObject shardRoutings = 
indicesRoutingMap.getJSONObject(indexName).getJSONObject("shards");
-        for (String shardKey : shardRoutings.keySet()) {
+        int length = shards.length();
+        for (int i = 0; i < length; i++) {
             List<EsShardRouting> singleShardRouting = Lists.newArrayList();
-            JSONArray shardRouting = shardRoutings.getJSONArray(shardKey);
-            for (int i = 0; i < shardRouting.length(); ++i) {
-                JSONObject shard = shardRouting.getJSONObject(i);
+            JSONArray shardsArray = shards.getJSONArray(i);
+            int arrayLength = shardsArray.length();
+            for (int j = 0; j < arrayLength; j++) {
+                JSONObject shard = shardsArray.getJSONObject(j);
                 String shardState = shard.getString("state");
                 if ("STARTED".equalsIgnoreCase(shardState)) {

Review comment:
       有些shard的分片是relocating状态的,其实也可以读取。不然因为一个临时的状态就导致整个表没法查询了,直接就停服了,无法接受




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to