Skip to content

Commit

Permalink
Merge branch 'apache:master' into fix
Browse files Browse the repository at this point in the history
  • Loading branch information
biohazard4321 authored Jul 31, 2024
2 parents e573abf + 814c74b commit 0ee7785
Show file tree
Hide file tree
Showing 1,218 changed files with 28,074 additions and 7,757 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/labeler/scope-label-conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ meta-change:
- fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java
- gensrc/thrift/*
- gensrc/proto/*

doing:
- *
47 changes: 47 additions & 0 deletions .github/workflows/lfs-warning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# 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.
#
---
name: 'Check Large File'

on: [push, pull_request_target]

jobs:
large-file-checker:
name: "Check large file"
runs-on: ubuntu-latest
steps:
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
uses: actions/checkout@v3
with:
persist-credentials: false
submodules: recursive

- name: "Checkout lfs-warning commit"
run: |
rm -rf ./.github/actions/lfs-warning
git clone https://github.com/ppremk/lfs-warning .github/actions/lfs-warning
pushd .github/actions/lfs-warning &>/dev/null
git checkout 4b98a8a5e6c429c23c34eee02d71553bca216425
popd &>/dev/null
- name: "Check Large File"
uses: ./.github/actions/lfs-warning
with:
token: ${{ secrets.GITHUB_TOKEN }}
filesizelimit: 1MB

24 changes: 16 additions & 8 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ else()
find_package(Boost ${BOOST_VERSION} COMPONENTS system container)
endif()

# Set if use libazure or not
option(BUILD_AZURE "ON for building azure support for BE or OFF for not" OFF)
message(STATUS "build azure: ${BUILD_AZURE}")
if(BUILD_AZURE STREQUAL "ON")
add_definitions(-DUSE_AZURE)
endif()


set(GPERFTOOLS_HOME "${THIRDPARTY_DIR}/gperftools")

include (cmake/thirdparty.cmake)
Expand Down Expand Up @@ -365,29 +373,29 @@ endif()
# For CMAKE_BUILD_TYPE=Debug
if (OS_MACOSX AND ARCH_ARM)
# Using -O0 may meet ARM64 branch out of range errors when linking with tcmalloc.
set(CXX_FLAGS_DEBUG "${CXX_GCC_FLAGS} -Og")
set(CXX_FLAGS_DEBUG "-Og")
else()
set(CXX_FLAGS_DEBUG "${CXX_GCC_FLAGS} -O0")
set(CXX_FLAGS_DEBUG "-O0")
endif()

# For CMAKE_BUILD_TYPE=Release
# -O3: Enable all compiler optimizations
# -DNDEBUG: Turn off dchecks/asserts/debug only code.
set(CXX_FLAGS_RELEASE "${CXX_GCC_FLAGS} -O3 -DNDEBUG")
set(CXX_FLAGS_ASAN "${CXX_GCC_FLAGS} -O0 -fsanitize=address -fsanitize=undefined -fno-strict-aliasing -fno-sanitize=alignment,signed-integer-overflow,float-cast-overflow -DUNDEFINED_BEHAVIOR_SANITIZER -DADDRESS_SANITIZER")
set(CXX_FLAGS_LSAN "${CXX_GCC_FLAGS} -O0 -fsanitize=leak -DLEAK_SANITIZER")
set(CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CXX_FLAGS_ASAN "-O0 -fsanitize=address -fsanitize=undefined -fno-strict-aliasing -fno-sanitize=alignment,signed-integer-overflow,float-cast-overflow -DUNDEFINED_BEHAVIOR_SANITIZER -DADDRESS_SANITIZER")
set(CXX_FLAGS_LSAN "-O0 -fsanitize=leak -DLEAK_SANITIZER")
## Use for BE-UT
set(CXX_FLAGS_ASAN_UT "${CXX_GCC_FLAGS} -O0 -fsanitize=address -DADDRESS_SANITIZER")
set(CXX_FLAGS_ASAN_UT "-O0 -fsanitize=address -DADDRESS_SANITIZER")

# Set the flags to the undefined behavior sanitizer, also known as "ubsan"
# Turn on sanitizer and debug symbols to get stack traces:
set(CXX_FLAGS_UBSAN "${CXX_GCC_FLAGS} -O0 -fno-wrapv -mcmodel=medium -fsanitize=undefined -DUNDEFINED_BEHAVIOR_SANITIZER")
set(CXX_FLAGS_UBSAN "-O0 -fno-wrapv -mcmodel=medium -fsanitize=undefined -DUNDEFINED_BEHAVIOR_SANITIZER")

# Set the flags to the thread sanitizer, also known as "tsan"
# Turn on sanitizer and debug symbols to get stack traces:
# Use -Wno-builtin-declaration-mismatch to mute warnings like "new declaration ‘__tsan_atomic16 __tsan_atomic16_fetch_nand(..."
# If use -O0 to compile, BE will stack overflow when start. https://github.com/apache/doris/issues/8868
set(CXX_FLAGS_TSAN "${CXX_GCC_FLAGS} -O1 -fsanitize=thread -DTHREAD_SANITIZER -Wno-missing-declarations")
set(CXX_FLAGS_TSAN "-O1 -fsanitize=thread -DTHREAD_SANITIZER -Wno-missing-declarations")

# Set compile flags based on the build type.
if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
Expand Down
10 changes: 6 additions & 4 deletions be/cmake/thirdparty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,12 @@ if (NOT OS_MACOSX)
add_thirdparty(aws-s2n LIBNAME "lib/libs2n.a")
endif()

add_thirdparty(azure-core)
add_thirdparty(azure-identity)
add_thirdparty(azure-storage-blobs)
add_thirdparty(azure-storage-common)
if(BUILD_AZURE STREQUAL "ON")
add_thirdparty(azure-core)
add_thirdparty(azure-identity)
add_thirdparty(azure-storage-blobs)
add_thirdparty(azure-storage-common)
endif()

add_thirdparty(minizip LIB64)
add_thirdparty(simdjson LIB64)
Expand Down
4 changes: 3 additions & 1 deletion be/src/agent/be_exec_version_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,16 @@ class BeExecVersionManager {
* b. clear old version of version 3->4
* c. change FunctionIsIPAddressInRange from AlwaysNotNullable to DependOnArguments
* d. change some agg function nullable property: PR #37215
* e. change variant serde to fix PR #38413
*/
constexpr inline int BeExecVersionManager::max_be_exec_version = 5;
constexpr inline int BeExecVersionManager::max_be_exec_version = 6;
constexpr inline int BeExecVersionManager::min_be_exec_version = 0;

/// functional
constexpr inline int BITMAP_SERDE = 3;
constexpr inline int USE_NEW_SERDE = 4; // release on DORIS version 2.1
constexpr inline int OLD_WAL_SERDE = 3; // use to solve compatibility issues, see pr #32299
constexpr inline int AGG_FUNCTION_NULLABLE = 5; // change some agg nullable property: PR #37215
constexpr inline int VARIANT_SERDE = 6; // change variant serde to fix PR #38413

} // namespace doris
3 changes: 3 additions & 0 deletions be/src/agent/workload_group_listener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ void WorkloadGroupListener::handle_topic_info(const std::vector<TopicInfo>& topi
// 4 create and update task scheduler
wg->upsert_task_scheduler(&workload_group_info, _exec_env);

// 5 upsert io throttle
wg->upsert_scan_io_throttle(&workload_group_info);

LOG(INFO) << "[topic_publish_wg]update workload group finish, wg info="
<< wg->debug_string() << ", enable_cpu_hard_limit="
<< (_exec_env->workload_group_mgr()->enable_cpu_hard_limit() ? "true" : "false")
Expand Down
2 changes: 1 addition & 1 deletion be/src/clucene
8 changes: 5 additions & 3 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,7 @@ DEFINE_mInt32(memory_gc_sleep_time_ms, "1000");
// Sleep time in milliseconds between memtbale flush mgr refresh iterations
DEFINE_mInt64(memtable_mem_tracker_refresh_interval_ms, "5");

// Sleep time in milliseconds between refresh iterations of workload group memory statistics
DEFINE_mInt64(wg_mem_refresh_interval_ms, "50");
DEFINE_mInt64(wg_weighted_memory_ratio_refresh_interval_ms, "50");

// percent of (active memtables size / all memtables size) when reach hard limit
DEFINE_mInt32(memtable_hard_limit_active_percent, "50");
Expand Down Expand Up @@ -635,6 +634,8 @@ DEFINE_Int32(load_process_safe_mem_permit_percent, "5");
// result buffer cancelled time (unit: second)
DEFINE_mInt32(result_buffer_cancelled_interval_time, "300");

DEFINE_mInt32(arrow_flight_result_sink_buffer_size_rows, "32768");

// the increased frequency of priority for remaining tasks in BlockingPriorityQueue
DEFINE_mInt32(priority_queue_remaining_tasks_increased_frequency, "512");

Expand Down Expand Up @@ -937,7 +938,8 @@ DEFINE_mInt32(cold_data_compaction_interval_sec, "1800");

DEFINE_String(tmp_file_dir, "tmp");

DEFINE_Int32(s3_transfer_executor_pool_size, "2");
DEFINE_Int32(min_s3_file_system_thread_num, "16");
DEFINE_Int32(max_s3_file_system_thread_num, "64");

DEFINE_Bool(enable_time_lut, "true");
DEFINE_mBool(enable_simdjson_reader, "true");
Expand Down
10 changes: 7 additions & 3 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ DECLARE_mInt32(memory_gc_sleep_time_ms);
// Sleep time in milliseconds between memtbale flush mgr memory refresh iterations
DECLARE_mInt64(memtable_mem_tracker_refresh_interval_ms);

// Sleep time in milliseconds between refresh iterations of workload group memory statistics
DECLARE_mInt64(wg_mem_refresh_interval_ms);
// Sleep time in milliseconds between refresh iterations of workload group weighted memory ratio
DECLARE_mInt64(wg_weighted_memory_ratio_refresh_interval_ms);

// percent of (active memtables size / all memtables size) when reach hard limit
DECLARE_mInt32(memtable_hard_limit_active_percent);
Expand Down Expand Up @@ -692,6 +692,9 @@ DECLARE_Int32(load_process_safe_mem_permit_percent);
// result buffer cancelled time (unit: second)
DECLARE_mInt32(result_buffer_cancelled_interval_time);

// arrow flight result sink buffer rows size, default 4096 * 8
DECLARE_mInt32(arrow_flight_result_sink_buffer_size_rows);

// the increased frequency of priority for remaining tasks in BlockingPriorityQueue
DECLARE_mInt32(priority_queue_remaining_tasks_increased_frequency);

Expand Down Expand Up @@ -992,7 +995,8 @@ DECLARE_mInt32(confirm_unused_remote_files_interval_sec);
DECLARE_Int32(cold_data_compaction_thread_num);
DECLARE_mInt32(cold_data_compaction_interval_sec);

DECLARE_Int32(s3_transfer_executor_pool_size);
DECLARE_Int32(min_s3_file_system_thread_num);
DECLARE_Int32(max_s3_file_system_thread_num);

DECLARE_Bool(enable_time_lut);
DECLARE_mBool(enable_simdjson_reader);
Expand Down
12 changes: 7 additions & 5 deletions be/src/common/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ void Daemon::memory_maintenance_thread() {
DorisMetrics::instance()->system_metrics()->update_allocator_metrics();
}
#endif
MemInfo::refresh_memory_bvar();

// Update and print memory stat when the memory changes by 256M.
if (abs(last_print_proc_mem - PerfCounters::get_vm_rss()) > 268435456) {
Expand Down Expand Up @@ -392,11 +393,11 @@ void Daemon::je_purge_dirty_pages_thread() const {
} while (true);
}

void Daemon::wg_mem_used_refresh_thread() {
// Refresh memory usage and limit of workload groups
void Daemon::wg_weighted_memory_ratio_refresh_thread() {
// Refresh weighted memory ratio of workload groups
while (!_stop_background_threads_latch.wait_for(
std::chrono::milliseconds(config::wg_mem_refresh_interval_ms))) {
doris::ExecEnv::GetInstance()->workload_group_mgr()->refresh_wg_memory_info();
std::chrono::milliseconds(config::wg_weighted_memory_ratio_refresh_interval_ms))) {
doris::ExecEnv::GetInstance()->workload_group_mgr()->refresh_wg_weighted_memory_limit();
}
}

Expand Down Expand Up @@ -441,7 +442,8 @@ void Daemon::start() {
CHECK(st.ok()) << st;

st = Thread::create(
"Daemon", "wg_mem_refresh_thread", [this]() { this->wg_mem_used_refresh_thread(); },
"Daemon", "wg_weighted_memory_ratio_refresh_thread",
[this]() { this->wg_weighted_memory_ratio_refresh_thread(); },
&_threads.emplace_back());

if (config::enable_be_proc_monitor) {
Expand Down
2 changes: 1 addition & 1 deletion be/src/common/daemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Daemon {
void calculate_metrics_thread();
void je_purge_dirty_pages_thread() const;
void report_runtime_query_statistics_thread();
void wg_mem_used_refresh_thread();
void wg_weighted_memory_ratio_refresh_thread();
void be_proc_monitor_thread();

CountDownLatch _stop_background_threads_latch;
Expand Down
23 changes: 23 additions & 0 deletions be/src/common/exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,26 @@ inline const std::string& Exception::to_string() const {
} \
} \
} while (0);

#define HANDLE_EXCEPTION_IF_CATCH_EXCEPTION(stmt, exception_handler) \
do { \
try { \
doris::enable_thread_catch_bad_alloc++; \
Defer defer {[&]() { doris::enable_thread_catch_bad_alloc--; }}; \
{ \
Status _status_ = (stmt); \
if (UNLIKELY(!_status_.ok())) { \
exception_handler(doris::Exception()); \
return _status_; \
} \
} \
} catch (const doris::Exception& e) { \
exception_handler(e); \
if (e.code() == doris::ErrorCode::MEM_ALLOC_FAILED) { \
return Status::MemoryLimitExceeded(fmt::format( \
"PreCatch error code:{}, {}, __FILE__:{}, __LINE__:{}, __FUNCTION__:{}", \
e.code(), e.to_string(), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
} \
return Status::Error<false>(e.code(), e.to_string()); \
} \
} while (0);
3 changes: 3 additions & 0 deletions be/src/exec/olap_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "vec/io/io_helper.h"
#include "vec/runtime/ipv4_value.h"
#include "vec/runtime/ipv6_value.h"
#include "vec/runtime/time_value.h"
#include "vec/runtime/vdatetime_value.h"

namespace doris {
Expand All @@ -70,6 +71,8 @@ std::string cast_to_string(T value, int scale) {
std::stringstream ss;
ss << buf;
return ss.str();
} else if constexpr (primitive_type == TYPE_TIMEV2) {
return TimeValue::to_string(value, scale);
} else if constexpr (primitive_type == TYPE_IPV4) {
return IPv4Value::to_string(value);
} else if constexpr (primitive_type == TYPE_IPV6) {
Expand Down
Loading

0 comments on commit 0ee7785

Please sign in to comment.