This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-1.2-lts in repository https://gitbox.apache.org/repos/asf/doris.git
commit 88096e09932a471994b3627114d5f2f2d814d02f Author: qiye <jianliang5...@gmail.com> AuthorDate: Fri Jan 20 09:31:57 2023 +0800 [fix](multi-catalog)Make ES catalog and resource compatible (#16096) close #16099 1. Make ES resource compatible with `username` property. Keep the same behavior with ES catalog. 2. Change ES catalog `username` to `user` to avoid confusion. 3. Add log in ESRestClient and make debug easier. --- .../main/java/org/apache/doris/catalog/EsResource.java | 15 ++++++++++++--- .../apache/doris/external/elasticsearch/EsRestClient.java | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/EsResource.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/EsResource.java index 513093d0ae..012ad119e3 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/EsResource.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/EsResource.java @@ -87,7 +87,7 @@ public class EsResource extends Resource { @Override protected void setProperties(Map<String, String> properties) throws DdlException { valid(properties, false); - this.properties = properties; + this.properties = processCompatibleProperties(properties); } public static void valid(Map<String, String> properties, boolean isAlter) throws DdlException { @@ -129,15 +129,24 @@ public class EsResource extends Resource { } } + private Map<String, String> processCompatibleProperties(Map<String, String> props) { + // Compatible with ES catalog properties + Map<String, String> properties = Maps.newHashMap(props); + if (properties.containsKey("username")) { + properties.put(EsResource.USER, properties.remove("username")); + } + return properties; + } + @Override public Map<String, String> getCopiedProperties() { - return Maps.newHashMap(properties); + return Maps.newHashMap(processCompatibleProperties(properties)); } @Override protected void getProcNodeData(BaseProcResult result) { String lowerCaseType = type.name().toLowerCase(); - for (Map.Entry<String, String> entry : properties.entrySet()) { + for (Map.Entry<String, String> entry : processCompatibleProperties(properties).entrySet()) { result.addRow(Lists.newArrayList(name, lowerCaseType, entry.getKey(), entry.getValue())); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java index 1627895936..c5618b8732 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java +++ b/fe/fe-core/src/main/java/org/apache/doris/external/elasticsearch/EsRestClient.java @@ -258,6 +258,8 @@ public class EsRestClient { try (Response response = executeResponse(httpClient, path)) { if (response.isSuccessful()) { return response.body().string(); + } else { + LOG.warn("request response code: {}, body: {}", response.code(), response.body().string()); } } catch (IOException e) { LOG.warn("request node [{}] [{}] failures {}, try next nodes", currentNode, path, e); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org