stalary commented on a change in pull request #3454: URL: https://github.com/apache/incubator-doris/pull/3454#discussion_r443091939
########## File path: fe/src/main/java/org/apache/doris/external/elasticsearch/EsShardPartitions.java ########## @@ -76,66 +102,15 @@ 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 { - EsIndexState indexState = new EsIndexState(indexName); - JSONObject shardRoutings = indicesRoutingMap.getJSONObject(indexName).getJSONObject("shards"); - for (String shardKey : shardRoutings.keySet()) { - List<EsShardRouting> singleShardRouting = Lists.newArrayList(); - JSONArray shardRouting = shardRoutings.getJSONArray(shardKey); - for (int i = 0; i < shardRouting.length(); ++i) { - JSONObject shard = shardRouting.getJSONObject(i); - String shardState = shard.getString("state"); - if ("STARTED".equalsIgnoreCase(shardState)) { - try { - singleShardRouting.add(EsShardRouting.parseShardRoutingV55(shardState, - shardKey, shard, nodesMap)); - } catch (Exception e) { - LOG.info("errors while parse shard routing from json [{}], ignore this shard", shard.toString(), e); - } - } - } - if (singleShardRouting.isEmpty()) { - LOG.warn("could not find a healthy allocation for [{}][{}]", indexName, shardKey); - } - indexState.addShardRouting(Integer.valueOf(shardKey), singleShardRouting); - } - // get some meta info from es, could be used to prune index when query - // index.bpack.partition.upperbound: stu_age - if (partitionInfo != null && partitionInfo instanceof RangePartitionInfo) { - JSONObject indexMeta = indicesMetaMap.getJSONObject(indexName); - JSONObject partitionSetting = EsUtil.getJsonObject(indexMeta, "settings.index.bpack.partition", 0); - LOG.debug("index {} range partition setting is {}", indexName, - partitionSetting == null ? "" : partitionSetting.toString()); - if (partitionSetting != null && partitionSetting.has("upperbound")) { - String upperBound = partitionSetting.getString("upperbound"); - List<PartitionValue> upperValues = Lists.newArrayList(new PartitionValue(upperBound)); - PartitionKeyDesc partitionKeyDesc = new PartitionKeyDesc(upperValues); - // use index name as partition name - SingleRangePartitionDesc desc = new SingleRangePartitionDesc(false, - indexName, partitionKeyDesc, null); - PartitionKey partitionKey = PartitionKey.createPartitionKey( - desc.getPartitionKeyDesc().getUpperValues(), - ((RangePartitionInfo) partitionInfo).getPartitionColumns()); - desc.analyze(((RangePartitionInfo) partitionInfo).getPartitionColumns().size(), null); - indexState.setPartitionDesc(desc); - indexState.setPartitionKey(partitionKey); - } - } - return indexState; - } - public void addShardRouting(int shardId, List<EsShardRouting> singleShardRouting) { shardRoutings.put(shardId, singleShardRouting); } - + public String getIndexName() { Review comment: `getIndexName` still in use ---------------------------------------------------------------- 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