We set LIBHDFS3_CONF env in start_be.sh, so libhdfs3 will try to read this hdfs-site.xml, if file does not exist, it will throw error. But Doris does not handle this error, cause BE crash. This CL mainly changes: Modify start_be.sh to only set LIBHDFS3_CONF if hdfs-site.xml exist. Refactor the HDFSCommonBuilder so that it can return error correctly. Add BE IP info in status, so that we can get ip from error msg like: ERROR 1105 (HY000): errCode = 2, detailMessage = [INTERNAL_ERROR]failed to init reader for file 000.snappy.orc, err: [INTERNAL_ERROR][172.21.0.101]failed to init HDFSCommonBuilder, please check check be/conf/hdfs-site.xml The logic of prefer compute node is wrong, which causing the external table query can only assign up to 3 backends. This CL refactor this logic and also change some FE config: prefer_compute_node_for_external_table If set to true, query on external table will prefer to assign to compute node. And the max number of compute node is controlled by min_backend_num_for_external_table. If set to false, query on external table will assign to any node. min_backend_num_for_external_table Only take effect when prefer_compute_node_for_external_table is true. If the compute node number is less than this value, query on external table will try to get some mix node to assign, to let the total number of node reach this value. If the compute node number is larger than this value, query on external table will assign to compute node only.
76 lines
2.3 KiB
C++
76 lines
2.3 KiB
C++
// 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.
|
|
|
|
#include "common/status.h"
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "gen_cpp/Types_types.h"
|
|
|
|
namespace doris {
|
|
|
|
class StatusTest : public testing::Test {};
|
|
|
|
TEST_F(StatusTest, OK) {
|
|
// default
|
|
Status st;
|
|
EXPECT_TRUE(st.ok());
|
|
EXPECT_TRUE(st.to_string().find("[OK]") != std::string::npos);
|
|
// copy
|
|
{
|
|
Status other = st;
|
|
EXPECT_TRUE(other.ok());
|
|
}
|
|
// move assign
|
|
st = Status();
|
|
EXPECT_TRUE(st.ok());
|
|
// move construct
|
|
{
|
|
Status other = std::move(st);
|
|
EXPECT_TRUE(other.ok());
|
|
}
|
|
}
|
|
|
|
TEST_F(StatusTest, Error) {
|
|
// default
|
|
Status st = Status::InternalError("123");
|
|
EXPECT_FALSE(st.ok());
|
|
EXPECT_TRUE(st.to_string().find("[INTERNAL_ERROR]") != std::string::npos);
|
|
EXPECT_TRUE(st.to_string().find("123") != std::string::npos);
|
|
// copy
|
|
{
|
|
Status other = st;
|
|
EXPECT_FALSE(other.ok());
|
|
EXPECT_TRUE(other.to_string().find("[INTERNAL_ERROR]") != std::string::npos);
|
|
EXPECT_TRUE(other.to_string().find("123") != std::string::npos);
|
|
}
|
|
// move assign
|
|
st = Status::InternalError("456");
|
|
EXPECT_FALSE(st.ok());
|
|
EXPECT_TRUE(st.to_string().find("[INTERNAL_ERROR]") != std::string::npos);
|
|
EXPECT_TRUE(st.to_string().find("456") != std::string::npos);
|
|
// move construct
|
|
{
|
|
Status other = std::move(st);
|
|
EXPECT_FALSE(other.ok());
|
|
EXPECT_TRUE(other.to_string().find("[INTERNAL_ERROR]") != std::string::npos);
|
|
EXPECT_TRUE(other.to_string().find("456") != std::string::npos);
|
|
}
|
|
}
|
|
|
|
} // namespace doris
|