EmmyMiao87 commented on a change in pull request #5418: URL: https://github.com/apache/incubator-doris/pull/5418#discussion_r582447517
########## File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java ########## @@ -1425,7 +1428,26 @@ private StorageInfo getStorageInfo(URL url) throws IOException { connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(HTTP_TIMEOUT_SECOND * 1000); connection.setReadTimeout(HTTP_TIMEOUT_SECOND * 1000); - return mapper.readValue(connection.getInputStream(), StorageInfo.class); + + String response; + try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + String line; + StringBuilder sb = new StringBuilder(); + while ((line = bufferedReader.readLine()) != null) { + sb.append(line); + } + response = sb.toString(); + } + + // For http v2, the response body for "/info" api changed from Review comment: The indentation here is strange. ########## File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java ########## @@ -1394,7 +1397,7 @@ private void getNewImage(Pair<String, Integer> helperNode) throws IOException { MetaHelper.complete(filename, dir); } } catch (Exception e) { - return; + throw new IOException(e); Review comment: Could you please add some Error Log in here. ########## File path: fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java ########## @@ -1425,7 +1428,26 @@ private StorageInfo getStorageInfo(URL url) throws IOException { connection = (HttpURLConnection) url.openConnection(); connection.setConnectTimeout(HTTP_TIMEOUT_SECOND * 1000); connection.setReadTimeout(HTTP_TIMEOUT_SECOND * 1000); - return mapper.readValue(connection.getInputStream(), StorageInfo.class); + + String response; + try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { + String line; + StringBuilder sb = new StringBuilder(); + while ((line = bufferedReader.readLine()) != null) { + sb.append(line); + } + response = sb.toString(); + } + + // For http v2, the response body for "/info" api changed from + // StorageInfo to StorageInfoV2. + // So we need to make it compatible with old api. + try { + return mapper.readValue(response, StorageInfo.class); + } catch (Exception e) { + // try new response body Review comment: same as above ########## File path: fe/fe-core/src/main/java/org/apache/doris/persist/StorageInfoV2.java ########## @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.doris.persist; + +/** + * This class is wrapper of StorageInfo. + * Because for http v2, the response body of "/info" api changed to: Review comment: Because after version 0.13, Doris use http v2 instead of http v1 ---------------------------------------------------------------- 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