imay closed pull request #443: Parse thrift port from cluster state
URL: https://github.com/apache/incubator-doris/pull/443
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/fe/src/main/java/org/apache/doris/catalog/Catalog.java 
b/fe/src/main/java/org/apache/doris/catalog/Catalog.java
index 1c7efab6..6e633b4c 100644
--- a/fe/src/main/java/org/apache/doris/catalog/Catalog.java
+++ b/fe/src/main/java/org/apache/doris/catalog/Catalog.java
@@ -3875,10 +3875,10 @@ public static void getDdlStmt(Table table, List<String> 
createTableStmt, List<St
 
             // properties
             sb.append("\nPROPERTIES (\n");
-            sb.append("\"host\" = 
\"").append(esTable.getHosts()).append("\",\n");
+            sb.append("\"hosts\" = 
\"").append(esTable.getHosts()).append("\",\n");
             sb.append("\"user\" = 
\"").append(esTable.getUserName()).append("\",\n");
             sb.append("\"password\" = \"").append(hidePassword ? "" : 
esTable.getPasswd()).append("\",\n");
-            sb.append("\"index\" = 
\"").append(esTable.getIndexName()).append("\"\n");
+            sb.append("\"index\" = 
\"").append(esTable.getIndexName()).append("\",\n");
             sb.append("\"type\" = 
\"").append(esTable.getMappingType()).append("\"\n");
             sb.append(");");
         }
diff --git a/fe/src/main/java/org/apache/doris/catalog/EsTable.java 
b/fe/src/main/java/org/apache/doris/catalog/EsTable.java
index d6d703ea..565ecd2b 100644
--- a/fe/src/main/java/org/apache/doris/catalog/EsTable.java
+++ b/fe/src/main/java/org/apache/doris/catalog/EsTable.java
@@ -74,7 +74,7 @@ public EsTable(long id, String name, List<Column> schema,
     private void validate(Map<String, String> properties) throws DdlException {
         if (properties == null) {
             throw new DdlException("Please set properties of elasticsearch 
table, "
-                    + "they are: hosts, thrift_port, http_port, user, 
password, index");
+                    + "they are: hosts, user, password, index");
         }
 
         hosts = properties.get(HOSTS);
diff --git a/fe/src/main/java/org/apache/doris/external/EsShardRouting.java 
b/fe/src/main/java/org/apache/doris/external/EsShardRouting.java
index d42725c6..721edc9a 100644
--- a/fe/src/main/java/org/apache/doris/external/EsShardRouting.java
+++ b/fe/src/main/java/org/apache/doris/external/EsShardRouting.java
@@ -41,8 +41,9 @@ public static EsShardRouting parseShardRoutingV55(String 
indexName, String shard
         String nodeId = shardInfo.getString("node");
         JSONObject nodeInfo = nodesMap.getJSONObject(nodeId);
         String[] transportAddr = 
nodeInfo.getString("transport_address").split(":");
-        // TODO(ygl) should get thrift port from node info
-        TNetworkAddress addr = new TNetworkAddress(transportAddr[0], 
Integer.valueOf(transportAddr[1]));
+        // get thrift port from node info
+        String thriftPort = 
nodeInfo.getJSONObject("attributes").getString("thrift_port");
+        TNetworkAddress addr = new TNetworkAddress(transportAddr[0], 
Integer.valueOf(thriftPort));
         boolean isPrimary = shardInfo.getBoolean("primary");
         return new EsShardRouting(indexName, Integer.valueOf(shardKey), 
                 isPrimary, addr);


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to