Skip to content

Commit

Permalink
Merge branch 'forbid-mod-mv-related-column' of https://github.com/Tan…
Browse files Browse the repository at this point in the history
…gSiyang2001/doris into forbid-mod-mv-related-column
  • Loading branch information
TangSiyang2001 committed Jan 27, 2025
2 parents 73af84f + 316d6e4 commit b358486
Show file tree
Hide file tree
Showing 434 changed files with 10,358 additions and 3,165 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ cloud/cmake-build*/
cloud/ut_build*/

## tools
tools/ssb-tools/ssb-data/
tools/ssb-tools/ssb-dbgen/
tools/ssb-tools/bin/ssb-data/
tools/ssb-tools/bin/ssb-dbgen/
tools/ssb-tools/bin/*.tar.gz
tools/**/TPC-H_Tools_v*.zip
tools/**/TPC-H_Tools_v*/
tools/**/tpc-h_v*.docx
Expand Down
3 changes: 3 additions & 0 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@ endif ()
# use this to avoid some runtime tracker. reuse BE_TEST symbol, no need another.
if (BUILD_BENCHMARK)
add_definitions(-DBE_TEST)
# The separate BENCHMARK marker is introduced here because
# some BE UTs mock certain functions, and BENCHMARK cannot find their definitions.
add_definitions(-DBE_BENCHMARK)
endif()

get_directory_property(COMPILER_FLAGS COMPILE_OPTIONS)
Expand Down
31 changes: 0 additions & 31 deletions be/src/cloud/cloud_storage_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,42 +300,11 @@ Status CloudStorageEngine::start_bg_threads(std::shared_ptr<WorkloadGroup> wg_sp
"StorageEngine", "lease_compaction_thread",
[this]() { this->_lease_compaction_thread_callback(); }, &_bg_threads.emplace_back()));

if (config::file_cache_ttl_valid_check_interval_second != 0) {
RETURN_IF_ERROR(Thread::create(
"StorageEngine", "check_file_cache_ttl_block_valid_thread",
[this]() { this->_check_file_cache_ttl_block_valid(); },
&_bg_threads.emplace_back()));
LOG(INFO) << "check file cache ttl block valid thread started";
}

LOG(INFO) << "lease compaction thread started";

return Status::OK();
}

void CloudStorageEngine::_check_file_cache_ttl_block_valid() {
int64_t interval_seconds = config::file_cache_ttl_valid_check_interval_second / 2;
auto check_ttl = [](const std::weak_ptr<CloudTablet>& tablet_wk) {
auto tablet = tablet_wk.lock();
if (!tablet) return;
if (tablet->tablet_meta()->ttl_seconds() == 0) return;
auto rowsets = tablet->get_snapshot_rowset();
for (const auto& rowset : rowsets) {
int64_t ttl_seconds = tablet->tablet_meta()->ttl_seconds();
if (rowset->newest_write_timestamp() + ttl_seconds <= UnixSeconds()) continue;
for (uint32_t seg_id = 0; seg_id < rowset->num_segments(); seg_id++) {
auto hash = Segment::file_cache_key(rowset->rowset_id().to_string(), seg_id);
auto* file_cache = io::FileCacheFactory::instance()->get_by_path(hash);
file_cache->update_ttl_atime(hash);
}
}
};
while (!_stop_background_threads_latch.wait_for(std::chrono::seconds(interval_seconds))) {
auto weak_tablets = tablet_mgr().get_weak_tablets();
std::for_each(weak_tablets.begin(), weak_tablets.end(), check_ttl);
}
}

void CloudStorageEngine::sync_storage_vault() {
cloud::StorageVaultInfos vault_infos;
bool enable_storage_vault = false;
Expand Down
1 change: 0 additions & 1 deletion be/src/cloud/cloud_storage_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class CloudStorageEngine final : public BaseStorageEngine {
ThreadPool& calc_tablet_delete_bitmap_task_thread_pool() const {
return *_calc_tablet_delete_bitmap_task_thread_pool;
}
void _check_file_cache_ttl_block_valid();

std::optional<StorageResource> get_storage_resource(const std::string& vault_id) {
VLOG_DEBUG << "Getting storage resource for vault_id: " << vault_id;
Expand Down
17 changes: 14 additions & 3 deletions be/src/cloud/cloud_tablet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,16 +860,21 @@ Status CloudTablet::calc_delete_bitmap_for_compaction(
}

// 2. calc delete bitmap for incremental data
int64_t t1 = MonotonicMicros();
RETURN_IF_ERROR(_engine.meta_mgr().get_delete_bitmap_update_lock(
*this, COMPACTION_DELETE_BITMAP_LOCK_ID, initiator));
int64_t t2 = MonotonicMicros();
RETURN_IF_ERROR(_engine.meta_mgr().sync_tablet_rowsets(this));
int64_t t3 = MonotonicMicros();

calc_compaction_output_rowset_delete_bitmap(
input_rowsets, rowid_conversion, version.second, UINT64_MAX, missed_rows.get(),
location_map.get(), tablet_meta()->delete_bitmap(), output_rowset_delete_bitmap.get());
int64_t t4 = MonotonicMicros();
if (location_map) {
RETURN_IF_ERROR(check_rowid_conversion(output_rowset, *location_map));
}
int64_t t5 = MonotonicMicros();
if (missed_rows) {
DCHECK_EQ(missed_rows->size(), missed_rows_size);
if (missed_rows->size() != missed_rows_size) {
Expand All @@ -879,9 +884,15 @@ Status CloudTablet::calc_delete_bitmap_for_compaction(
}

// 3. store delete bitmap
RETURN_IF_ERROR(_engine.meta_mgr().update_delete_bitmap(*this, -1, initiator,
output_rowset_delete_bitmap.get()));
return Status::OK();
auto st = _engine.meta_mgr().update_delete_bitmap(*this, -1, initiator,
output_rowset_delete_bitmap.get());
int64_t t6 = MonotonicMicros();
LOG(INFO) << "calc_delete_bitmap_for_compaction, tablet_id=" << tablet_id()
<< ", get lock cost " << (t2 - t1) << " us, sync rowsets cost " << (t3 - t2)
<< " us, calc delete bitmap cost " << (t4 - t3) << " us, check rowid conversion cost "
<< (t5 - t4) << " us, store delete bitmap cost " << (t6 - t5)
<< " us, st=" << st.to_string();
return st;
}

Status CloudTablet::sync_meta() {
Expand Down
4 changes: 3 additions & 1 deletion be/src/cloud/cloud_tablet_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ void CloudTabletMgr::vacuum_stale_rowsets(const CountDownLatch& stop_latch) {

num_vacuumed += t->delete_expired_stale_rowsets();
}
LOG_INFO("finish vacuum stale rowsets").tag("num_vacuumed", num_vacuumed);
LOG_INFO("finish vacuum stale rowsets")
.tag("num_vacuumed", num_vacuumed)
.tag("num_tablets", tablets_to_vacuum.size());
}

std::vector<std::weak_ptr<CloudTablet>> CloudTabletMgr::get_weak_tablets() {
Expand Down
2 changes: 1 addition & 1 deletion be/src/clucene
42 changes: 42 additions & 0 deletions be/src/common/be_mock_util.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// 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

// #define BE_TEST

#ifdef BE_TEST
#define MOCK_FUNCTION virtual
#else
#define MOCK_FUNCTION
#endif

#ifdef BE_TEST
#define MOCK_DEFINE(str) str
#else
#define MOCK_DEFINE(str)
#endif

#ifdef BE_TEST
#define MOCK_REMOVE(str)
#else
#define MOCK_REMOVE(str) str
#endif

/*
#include "common/be_mock_util.h"
*/
5 changes: 2 additions & 3 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ DEFINE_Validator(doris_scanner_thread_pool_thread_num, [](const int config) -> b
return true;
});
DEFINE_Int32(doris_scanner_min_thread_pool_thread_num, "8");
DEFINE_Int32(remote_split_source_batch_size, "10240");
DEFINE_Int32(remote_split_source_batch_size, "1000");
DEFINE_Int32(doris_max_remote_scanner_thread_pool_thread_num, "-1");
// number of olap scanner thread pool queue size
DEFINE_Int32(doris_scanner_thread_pool_queue_size, "102400");
Expand Down Expand Up @@ -1050,16 +1050,15 @@ DEFINE_mInt32(file_cache_enter_disk_resource_limit_mode_percent, "88");
DEFINE_mInt32(file_cache_exit_disk_resource_limit_mode_percent, "80");
DEFINE_mBool(enable_read_cache_file_directly, "false");
DEFINE_mBool(file_cache_enable_evict_from_other_queue_by_size, "true");
DEFINE_mInt64(file_cache_ttl_valid_check_interval_second, "0"); // zero for not checking
// If true, evict the ttl cache using LRU when full.
// Otherwise, only expiration can evict ttl and new data won't add to cache when full.
DEFINE_Bool(enable_ttl_cache_evict_using_lru, "true");
DEFINE_mBool(enbale_dump_error_file, "false");
// limit the max size of error log on disk
DEFINE_mInt64(file_cache_error_log_limit_bytes, "209715200"); // 200MB
DEFINE_mInt64(cache_lock_long_tail_threshold, "1000");
DEFINE_Int64(file_cache_recycle_keys_size, "1000000");
DEFINE_mBool(enable_file_cache_keep_base_compaction_output, "false");
DEFINE_mInt64(file_cache_remove_block_qps_limit, "1000");

DEFINE_mInt32(index_cache_entry_stay_time_after_lookup_s, "1800");
DEFINE_mInt32(inverted_index_cache_stale_sweep_time_sec, "600");
Expand Down
4 changes: 1 addition & 3 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -1090,23 +1090,21 @@ DECLARE_Int32(file_cache_enter_disk_resource_limit_mode_percent);
DECLARE_Int32(file_cache_exit_disk_resource_limit_mode_percent);
DECLARE_mBool(enable_read_cache_file_directly);
DECLARE_Bool(file_cache_enable_evict_from_other_queue_by_size);
DECLARE_mInt64(file_cache_ttl_valid_check_interval_second);
// If true, evict the ttl cache using LRU when full.
// Otherwise, only expiration can evict ttl and new data won't add to cache when full.
DECLARE_Bool(enable_ttl_cache_evict_using_lru);
DECLARE_mBool(enbale_dump_error_file);
// limit the max size of error log on disk
DECLARE_mInt64(file_cache_error_log_limit_bytes);
DECLARE_mInt64(cache_lock_long_tail_threshold);
DECLARE_Int64(file_cache_recycle_keys_size);
// Base compaction may retrieve and produce some less frequently accessed data,
// potentially affecting the file cache hit rate.
// This configuration determines whether to retain the output within the file cache.
// Make your choice based on the following considerations:
// If your file cache is ample enough to accommodate all the data in your database,
// enable this option; otherwise, it is recommended to leave it disabled.
DECLARE_mBool(enable_file_cache_keep_base_compaction_output);

DECLARE_mInt64(file_cache_remove_block_qps_limit);
// inverted index searcher cache
// cache entry stay time after lookup
DECLARE_mInt32(index_cache_entry_stay_time_after_lookup_s);
Expand Down
Loading

0 comments on commit b358486

Please sign in to comment.