Skip to content

Commit

Permalink
Merge branch 'apache:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
xyfsjq authored Oct 15, 2024
2 parents a39b962 + 074ed3d commit db00ba7
Show file tree
Hide file tree
Showing 376 changed files with 11,808 additions and 5,964 deletions.
24 changes: 24 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,30 @@ github:
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_approving_review_count: 1

branch-3.0:
required_status_checks:
# if strict is true, means "Require branches to be up to date before merging".
strict: false
contexts:
- License Check
- Clang Formatter
- CheckStyle
- Build Broker
- ShellCheck
- Build Third Party Libraries (Linux)
- Build Third Party Libraries (macOS)
- FE UT (Doris FE UT)
- BE UT (Doris BE UT)
- Cloud UT (Doris Cloud UT)
- COMPILE (DORIS_COMPILE)
- P0 Regression (Doris Regression)
- External Regression (Doris External Regression)
- cloud_p0 (Doris Cloud Regression)
required_pull_request_reviews:
dismiss_stale_reviews: true
required_approving_review_count: 1

branch-1.1-lts:
required_status_checks:
# if strict is true, means "Require branches to be up to date before merging".
Expand Down
11 changes: 8 additions & 3 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ DEFINE_mInt64(stacktrace_in_alloc_large_memory_bytes, "2147483648");

DEFINE_mInt64(crash_in_alloc_large_memory_bytes, "-1");

// If memory tracker value is inaccurate, BE will crash. usually used in test environments, default value is false.
// The actual meaning of this parameter is `debug_memory`.
// 1. crash in memory tracker inaccurate, if memory tracker value is inaccurate, BE will crash.
// usually used in test environments, default value is false.
// 2. print more memory logs.
DEFINE_mBool(crash_in_memory_tracker_inaccurate, "false");

// default is true. if any memory tracking in Orphan mem tracker will report error.
Expand Down Expand Up @@ -393,7 +396,7 @@ DEFINE_mInt64(base_compaction_max_compaction_score, "20");
DEFINE_mDouble(base_compaction_min_data_ratio, "0.3");
DEFINE_mInt64(base_compaction_dup_key_max_file_size_mbytes, "1024");

DEFINE_Bool(enable_skip_tablet_compaction, "true");
DEFINE_Bool(enable_skip_tablet_compaction, "false");
// output rowset of cumulative compaction total disk size exceed this config size,
// this rowset will be given to base compaction, unit is m byte.
DEFINE_mInt64(compaction_promotion_size_mbytes, "1024");
Expand Down Expand Up @@ -898,7 +901,7 @@ DEFINE_mInt32(orc_natural_read_size_mb, "8");
DEFINE_mInt64(big_column_size_buffer, "65535");
DEFINE_mInt64(small_column_size_buffer, "100");

// rf will decide whether the next sampling_frequency blocks need to be filtered based on the filtering rate of the current block.
// Perform the always_true check at intervals determined by runtime_filter_sampling_frequency
DEFINE_mInt32(runtime_filter_sampling_frequency, "64");

// cooldown task configs
Expand Down Expand Up @@ -1345,6 +1348,8 @@ DEFINE_mInt32(lz4_compression_block_size, "262144");

DEFINE_mBool(enable_pipeline_task_leakage_detect, "false");

DEFINE_mInt32(check_score_rounds_num, "1000");

DEFINE_Int32(query_cache_size, "512");

// clang-format off
Expand Down
7 changes: 6 additions & 1 deletion be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ DECLARE_mInt64(stacktrace_in_alloc_large_memory_bytes);
// modify this parameter to crash when large memory allocation occur will help
DECLARE_mInt64(crash_in_alloc_large_memory_bytes);

// If memory tracker value is inaccurate, BE will crash. usually used in test environments, default value is false.
// The actual meaning of this parameter is `debug_memory`.
// 1. crash in memory tracker inaccurate, if memory tracker value is inaccurate, BE will crash.
// usually used in test environments, default value is false.
// 2. print more memory logs.
DECLARE_mBool(crash_in_memory_tracker_inaccurate);

// default is true. if any memory tracking in Orphan mem tracker will report error.
Expand Down Expand Up @@ -1430,6 +1433,8 @@ DECLARE_mInt32(lz4_compression_block_size);

DECLARE_mBool(enable_pipeline_task_leakage_detect);

DECLARE_mInt32(check_score_rounds_num);

// MB
DECLARE_Int32(query_cache_size);

Expand Down
30 changes: 11 additions & 19 deletions be/src/common/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,37 @@
// IWYU pragma: no_include <bits/std_abs.h>
#include <butil/iobuf.h>
#include <math.h>
#include <signal.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
// IWYU pragma: no_include <bits/chrono.h>
#include <chrono> // IWYU pragma: keep
#include <map>
#include <ostream>
#include <set>
#include <string>

#include "cloud/config.h"
#include "common/config.h"
#include "common/logging.h"
#include "common/status.h"
#include "olap/memtable_memory_limiter.h"
#include "olap/options.h"
#include "olap/storage_engine.h"
#include "olap/tablet_manager.h"
#include "runtime/be_proc_monitor.h"
#include "runtime/client_cache.h"
#include "runtime/exec_env.h"
#include "runtime/fragment_mgr.h"
#include "runtime/memory/global_memory_arbitrator.h"
#include "runtime/memory/mem_tracker.h"
#include "runtime/memory/mem_tracker_limiter.h"
#include "runtime/memory/memory_reclamation.h"
#include "runtime/process_profile.h"
#include "runtime/runtime_query_statistics_mgr.h"
#include "runtime/workload_group/workload_group_manager.h"
#include "util/algorithm_util.h"
#include "util/cpu_info.h"
#include "util/debug_util.h"
#include "util/disk_info.h"
#include "util/doris_metrics.h"
#include "util/mem_info.h"
#include "util/metrics.h"
#include "util/network_util.h"
#include "util/perf_counters.h"
#include "util/system_metrics.h"
#include "util/thrift_util.h"
#include "util/time.h"

namespace doris {
Expand Down Expand Up @@ -233,9 +222,8 @@ void refresh_memory_state_after_memory_change() {
if (abs(last_print_proc_mem - PerfCounters::get_vm_rss()) > 268435456) {
last_print_proc_mem = PerfCounters::get_vm_rss();
doris::MemTrackerLimiter::clean_tracker_limiter_group();
doris::MemTrackerLimiter::enable_print_log_process_usage();
// Refresh mem tracker each type counter.
doris::MemTrackerLimiter::refresh_global_counter();
doris::ProcessProfile::instance()->memory_profile()->enable_print_log_process_usage();
doris::ProcessProfile::instance()->memory_profile()->refresh_memory_overview_profile();
LOG(INFO) << doris::GlobalMemoryArbitrator::
process_mem_log_str(); // print mem log when memory state by 256M
}
Expand Down Expand Up @@ -339,10 +327,12 @@ void Daemon::memory_gc_thread() {
memory_full_gc_sleep_time_ms = memory_gc_sleep_time_ms;
memory_minor_gc_sleep_time_ms = memory_gc_sleep_time_ms;
LOG(INFO) << fmt::format("[MemoryGC] start full GC, {}.", mem_info);
doris::MemTrackerLimiter::print_log_process_usage();
doris::ProcessProfile::instance()->memory_profile()->print_log_process_usage();
if (doris::MemoryReclamation::process_full_gc(std::move(mem_info))) {
// If there is not enough memory to be gc, the process memory usage will not be printed in the next continuous gc.
doris::MemTrackerLimiter::enable_print_log_process_usage();
doris::ProcessProfile::instance()
->memory_profile()
->enable_print_log_process_usage();
}
} else if (memory_minor_gc_sleep_time_ms <= 0 &&
(sys_mem_available < doris::MemInfo::sys_mem_available_warning_water_mark() ||
Expand All @@ -352,9 +342,11 @@ void Daemon::memory_gc_thread() {
doris::GlobalMemoryArbitrator::process_soft_limit_exceeded_errmsg_str();
memory_minor_gc_sleep_time_ms = memory_gc_sleep_time_ms;
LOG(INFO) << fmt::format("[MemoryGC] start minor GC, {}.", mem_info);
doris::MemTrackerLimiter::print_log_process_usage();
doris::ProcessProfile::instance()->memory_profile()->print_log_process_usage();
if (doris::MemoryReclamation::process_minor_gc(std::move(mem_info))) {
doris::MemTrackerLimiter::enable_print_log_process_usage();
doris::ProcessProfile::instance()
->memory_profile()
->enable_print_log_process_usage();
}
} else {
if (memory_full_gc_sleep_time_ms > 0) {
Expand Down
3 changes: 3 additions & 0 deletions be/src/exec/schema_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "exec/schema_scanner/schema_collations_scanner.h"
#include "exec/schema_scanner/schema_columns_scanner.h"
#include "exec/schema_scanner/schema_dummy_scanner.h"
#include "exec/schema_scanner/schema_file_cache_statistics.h"
#include "exec/schema_scanner/schema_files_scanner.h"
#include "exec/schema_scanner/schema_metadata_name_ids_scanner.h"
#include "exec/schema_scanner/schema_partitions_scanner.h"
Expand Down Expand Up @@ -224,6 +225,8 @@ std::unique_ptr<SchemaScanner> SchemaScanner::create(TSchemaTableType::type type
return SchemaBackendWorkloadGroupResourceUsage::create_unique();
case TSchemaTableType::SCH_TABLE_PROPERTIES:
return SchemaTablePropertiesScanner::create_unique();
case TSchemaTableType::SCH_FILE_CACHE_STATISTICS:
return SchemaFileCacheStatisticsScanner::create_unique();
case TSchemaTableType::SCH_CATALOG_META_CACHE_STATISTICS:
return SchemaCatalogMetaCacheStatsScanner::create_unique();
default:
Expand Down
13 changes: 12 additions & 1 deletion be/src/exec/schema_scanner/schema_columns_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ std::string SchemaColumnsScanner::_to_mysql_data_type_string(TColumnDesc& desc)
case TPrimitiveType::STRUCT: {
return "struct";
}
case TPrimitiveType::IPV4:
return "ipv4";
case TPrimitiveType::IPV6:
return "ipv6";
case TPrimitiveType::VARIANT:
return "variant";
default:
return "unknown";
}
Expand Down Expand Up @@ -272,7 +278,12 @@ std::string SchemaColumnsScanner::_type_to_string(TColumnDesc& desc) {
ret += ">";
return ret;
}

case TPrimitiveType::IPV4:
return "ipv4";
case TPrimitiveType::IPV6:
return "ipv6";
case TPrimitiveType::VARIANT:
return "variant";
default:
return "unknown";
}
Expand Down
88 changes: 88 additions & 0 deletions be/src/exec/schema_scanner/schema_file_cache_statistics.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// 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 "exec/schema_scanner/schema_file_cache_statistics.h"

#include "io/cache/block_file_cache_factory.h"
#include "runtime/exec_env.h"
#include "runtime/runtime_state.h"
#include "vec/common/string_ref.h"
#include "vec/core/block.h"
#include "vec/data_types/data_type_factory.hpp"

namespace doris {

std::vector<SchemaScanner::ColumnDesc> SchemaFileCacheStatisticsScanner::_s_tbls_columns = {
// name, type, size
{"BE_ID", TYPE_BIGINT, sizeof(int64_t), false},
{"BE_IP", TYPE_STRING, sizeof(StringRef), false},
{"CACHE_PATH", TYPE_STRING, sizeof(StringRef), false},
{"METRIC_NAME", TYPE_STRING, sizeof(StringRef), false},
{"METRIC_VALUE", TYPE_STRING, sizeof(StringRef), false}};

SchemaFileCacheStatisticsScanner::SchemaFileCacheStatisticsScanner()
: SchemaScanner(_s_tbls_columns, TSchemaTableType::SCH_FILE_CACHE_STATISTICS) {}

SchemaFileCacheStatisticsScanner::~SchemaFileCacheStatisticsScanner() {}

Status SchemaFileCacheStatisticsScanner::start(RuntimeState* state) {
_block_rows_limit = state->batch_size();
return Status::OK();
}

Status SchemaFileCacheStatisticsScanner::get_next_block_internal(vectorized::Block* block,
bool* eos) {
if (!_is_init) {
return Status::InternalError("Used before initialized.");
}

if (nullptr == block || nullptr == eos) {
return Status::InternalError("input pointer is nullptr.");
}

if (_stats_block == nullptr) {
_stats_block = vectorized::Block::create_unique();

for (int i = 0; i < _s_tbls_columns.size(); ++i) {
TypeDescriptor descriptor(_s_tbls_columns[i].type);
auto data_type =
vectorized::DataTypeFactory::instance().create_data_type(descriptor, true);
_stats_block->insert(vectorized::ColumnWithTypeAndName(
data_type->create_column(), data_type, _s_tbls_columns[i].name));
}

_stats_block->reserve(_block_rows_limit);

ExecEnv::GetInstance()->file_cache_factory()->get_cache_stats_block(_stats_block.get());
_total_rows = _stats_block->rows();
}

if (_row_idx == _total_rows) {
*eos = true;
return Status::OK();
}

int current_batch_rows = std::min(_block_rows_limit, _total_rows - _row_idx);
vectorized::MutableBlock mblock = vectorized::MutableBlock::build_mutable_block(block);
RETURN_IF_ERROR(mblock.add_rows(_stats_block.get(), _row_idx, current_batch_rows));
_row_idx += current_batch_rows;

*eos = _row_idx == _total_rows;
return Status::OK();
}

} // namespace doris
49 changes: 49 additions & 0 deletions be/src/exec/schema_scanner/schema_file_cache_statistics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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.

#pragma once

#include <vector>

#include "common/status.h"
#include "exec/schema_scanner.h"

namespace doris {
class RuntimeState;
namespace vectorized {
class Block;
} // namespace vectorized

class SchemaFileCacheStatisticsScanner : public SchemaScanner {
ENABLE_FACTORY_CREATOR(SchemaFileCacheStatisticsScanner);

public:
SchemaFileCacheStatisticsScanner();
~SchemaFileCacheStatisticsScanner() override;

Status start(RuntimeState* state) override;
Status get_next_block_internal(vectorized::Block* block, bool* eos) override;

static std::vector<SchemaScanner::ColumnDesc> _s_tbls_columns;

private:
int _block_rows_limit = 4096;
int _row_idx = 0;
int _total_rows = 0;
std::unique_ptr<vectorized::Block> _stats_block = nullptr;
};
}; // namespace doris
Loading

0 comments on commit db00ba7

Please sign in to comment.