Skip to content

Commit f88b55d

Browse files
authored
Merge branch 'master' into add-report-tablet-metrics
2 parents b1b9831 + eea9d23 commit f88b55d

File tree

119 files changed

+5769
-1298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+5769
-1298
lines changed

.github/workflows/build-thirdparty.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ jobs:
132132
export PATH="$(find /usr/lib/jvm/java-8-openjdk* -maxdepth 1 -type d -name 'bin'):${PATH}"
133133
export JAVA_HOME="$(find /usr/lib/jvm/java-8-openjdk* -maxdepth 0)"
134134
export DORIS_TOOLCHAIN=gcc
135+
export CMAKE_POLICY_VERSION_MINIMUM=3.10
136+
export CUSTOM_CMAKE="/usr/local/bin/cmake"
135137
136138
cd thirdparty
137139
./build-thirdparty.sh -j "$(nproc)"
@@ -190,6 +192,8 @@ jobs:
190192
- name: Build
191193
run: |
192194
export MACOSX_DEPLOYMENT_TARGET=12.0
195+
export CMAKE_POLICY_VERSION_MINIMUM=3.10
196+
export CUSTOM_CMAKE="/usr/local/bin/cmake"
193197
194198
cd thirdparty
195199
./build-thirdparty.sh -j "$(nproc)"
@@ -248,6 +252,8 @@ jobs:
248252
- name: Build
249253
run: |
250254
export MACOSX_DEPLOYMENT_TARGET=12.0
255+
export CMAKE_POLICY_VERSION_MINIMUM=3.10
256+
export CUSTOM_CMAKE="/usr/local/bin/cmake"
251257
252258
cd thirdparty
253259
./build-thirdparty.sh -j "$(nproc)"

be/benchmark/benchmark_bit_pack.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void bit_pack(const T* input, uint8_t in_num, int bit_width, uint8_t* output) {
5050
}
5151

5252
static void BM_BitPack(benchmark::State& state) {
53-
int w = state.range(0);
53+
int w = (int)state.range(0);
5454
int n = 255;
5555

5656
std::default_random_engine e;
@@ -67,15 +67,15 @@ static void BM_BitPack(benchmark::State& state) {
6767
for (auto _ : state) {
6868
benchmark::DoNotOptimize(test_data.data());
6969
benchmark::DoNotOptimize(output.data());
70-
bit_pack(test_data.data(), n, w, output.data());
70+
bit_pack(test_data.data(), (uint8_t)n, w, output.data());
7171
benchmark::ClobberMemory();
7272
}
7373

7474
state.SetBytesProcessed(int64_t(state.iterations()) * size);
7575
}
7676

7777
static void BM_BitPackOptimized(benchmark::State& state) {
78-
int w = state.range(0);
78+
int w = (int)state.range(0);
7979
int n = 255;
8080

8181
std::default_random_engine e;
@@ -94,7 +94,7 @@ static void BM_BitPackOptimized(benchmark::State& state) {
9494
for (auto _ : state) {
9595
benchmark::DoNotOptimize(test_data.data());
9696
benchmark::DoNotOptimize(output.data());
97-
forEncoder.bit_pack(test_data.data(), n, w, output.data());
97+
forEncoder.bit_pack(test_data.data(), (uint8_t)n, w, output.data());
9898
benchmark::ClobberMemory();
9999
}
100100

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
#include <benchmark/benchmark.h>
19+
20+
#include "common/status.h"
21+
#include "exprs/block_bloom_filter.hpp"
22+
23+
namespace doris {
24+
static std::unique_ptr<BlockBloomFilter> create_bloom_filter(int batch, int log_space_bytes = 20) {
25+
auto bloom_filter = std::make_unique<BlockBloomFilter>();
26+
[[maybe_unused]] Status status = bloom_filter->init(log_space_bytes, 0);
27+
28+
for (int i = 0; i < batch; i++) {
29+
bloom_filter->insert(i);
30+
}
31+
32+
return bloom_filter;
33+
}
34+
} // namespace doris
35+
36+
static void BM_BBF_BucketInsert(benchmark::State& state) {
37+
const int batch = static_cast<int>(state.range(0));
38+
auto bf = doris::create_bloom_filter(batch);
39+
40+
for (auto _ : state) {
41+
for (int i = 0; i < batch; i++) {
42+
bf->insert(i);
43+
}
44+
}
45+
46+
state.SetItemsProcessed(state.iterations() * static_cast<int64_t>(batch));
47+
}
48+
49+
static void BM_BBF_BucketFind_Hit(benchmark::State& state) {
50+
const int batch = static_cast<int>(state.range(0));
51+
auto bf = doris::create_bloom_filter(batch);
52+
53+
for (auto _ : state) {
54+
bool acc = false;
55+
for (int i = 0; i < batch; i++) {
56+
acc ^= bf->find(i);
57+
}
58+
benchmark::DoNotOptimize(acc);
59+
}
60+
state.SetItemsProcessed(state.iterations() * static_cast<int64_t>(batch));
61+
}
62+
63+
static void BM_BBF_BucketFind_Miss(benchmark::State& state) {
64+
const int batch = static_cast<int>(state.range(0));
65+
auto bf = doris::create_bloom_filter(batch);
66+
67+
for (auto _ : state) {
68+
bool acc = false;
69+
for (int i = 0; i < batch; i++) {
70+
acc ^= bf->find(i + batch);
71+
}
72+
benchmark::DoNotOptimize(acc);
73+
}
74+
state.SetItemsProcessed(state.iterations() * static_cast<int64_t>(batch));
75+
}
76+
77+
BENCHMARK(BM_BBF_BucketInsert)
78+
->Unit(benchmark::kNanosecond)
79+
->Arg(1 << 12)
80+
->Arg(1 << 15)
81+
->Arg(1 << 18)
82+
->Repetitions(5)
83+
->DisplayAggregatesOnly();
84+
BENCHMARK(BM_BBF_BucketFind_Hit)
85+
->Unit(benchmark::kNanosecond)
86+
->Arg(1 << 12)
87+
->Arg(1 << 15)
88+
->Arg(1 << 18)
89+
->Repetitions(5)
90+
->DisplayAggregatesOnly();
91+
BENCHMARK(BM_BBF_BucketFind_Miss)
92+
->Unit(benchmark::kNanosecond)
93+
->Arg(1 << 12)
94+
->Arg(1 << 15)
95+
->Arg(1 << 18)
96+
->Repetitions(5)
97+
->DisplayAggregatesOnly();

be/benchmark/benchmark_main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <benchmark/benchmark.h>
1919

2020
#include "benchmark_bit_pack.hpp"
21+
#include "benchmark_block_bloom_filter.hpp"
2122
#include "benchmark_fastunion.hpp"
2223
#include "benchmark_hll_merge.hpp"
2324
#include "benchmark_string.hpp"

be/src/cloud/cloud_full_compaction.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,9 @@ Status CloudFullCompaction::_cloud_full_compaction_update_delete_bitmap(int64_t
349349
int64_t max_version = cloud_tablet()->max_version().second;
350350
DCHECK(max_version >= _output_rowset->version().second);
351351
if (max_version > _output_rowset->version().second) {
352-
RETURN_IF_ERROR(cloud_tablet()->capture_consistent_rowsets_unlocked(
353-
{_output_rowset->version().second + 1, max_version}, &tmp_rowsets));
352+
auto ret = DORIS_TRY(cloud_tablet()->capture_consistent_rowsets_unlocked(
353+
{_output_rowset->version().second + 1, max_version}, CaptureRowsetOps {}));
354+
tmp_rowsets = std::move(ret.rowsets);
354355
}
355356
for (const auto& it : tmp_rowsets) {
356357
int64_t cur_version = it->rowset_meta()->start_version();

be/src/cloud/cloud_schema_change_job.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Status CloudSchemaChangeJob::process_alter_tablet(const TAlterTabletReqV2& reque
150150
// [0-1] is a placeholder rowset, no need to convert
151151
RETURN_IF_ERROR(_base_tablet->capture_rs_readers({2, start_resp.alter_version()},
152152
&rs_splits,
153-
{.skip_missing_version = false,
153+
{.skip_missing_versions = false,
154154
.enable_prefer_cached_rowset = false,
155155
.query_freshness_tolerance_ms = -1}));
156156
}
@@ -199,7 +199,7 @@ Status CloudSchemaChangeJob::process_alter_tablet(const TAlterTabletReqV2& reque
199199
reader_context.sequence_id_idx = reader_context.tablet_schema->sequence_col_idx();
200200
reader_context.is_unique = _base_tablet->keys_type() == UNIQUE_KEYS;
201201
reader_context.batch_size = ALTER_TABLE_BATCH_SIZE;
202-
reader_context.delete_bitmap = &_base_tablet->tablet_meta()->delete_bitmap();
202+
reader_context.delete_bitmap = _base_tablet->tablet_meta()->delete_bitmap_ptr();
203203
reader_context.version = Version(0, start_resp.alter_version());
204204
std::vector<uint32_t> cluster_key_idxes;
205205
if (!_base_tablet_schema->cluster_key_uids().empty()) {
@@ -509,22 +509,21 @@ Status CloudSchemaChangeJob::_process_delete_bitmap(int64_t alter_version,
509509
}
510510

511511
// step 1, process incremental rowset without delete bitmap update lock
512-
std::vector<RowsetSharedPtr> incremental_rowsets;
513512
RETURN_IF_ERROR(_cloud_storage_engine.meta_mgr().sync_tablet_rowsets(tmp_tablet.get()));
514513
int64_t max_version = tmp_tablet->max_version().second;
515514
LOG(INFO) << "alter table for mow table, calculate delete bitmap of "
516515
<< "incremental rowsets without lock, version: " << start_calc_delete_bitmap_version
517516
<< "-" << max_version << " new_table_id: " << _new_tablet->tablet_id();
518517
if (max_version >= start_calc_delete_bitmap_version) {
519-
RETURN_IF_ERROR(tmp_tablet->capture_consistent_rowsets_unlocked(
520-
{start_calc_delete_bitmap_version, max_version}, &incremental_rowsets));
518+
auto ret = DORIS_TRY(tmp_tablet->capture_consistent_rowsets_unlocked(
519+
{start_calc_delete_bitmap_version, max_version}, CaptureRowsetOps {}));
521520
DBUG_EXECUTE_IF("CloudSchemaChangeJob::_process_delete_bitmap.after.capture_without_lock",
522521
DBUG_BLOCK);
523522
{
524523
std::unique_lock wlock(tmp_tablet->get_header_lock());
525524
tmp_tablet->add_rowsets(_output_rowsets, true, wlock);
526525
}
527-
for (auto rowset : incremental_rowsets) {
526+
for (auto rowset : ret.rowsets) {
528527
RETURN_IF_ERROR(CloudTablet::update_delete_bitmap_without_lock(tmp_tablet, rowset));
529528
}
530529
}
@@ -540,15 +539,14 @@ Status CloudSchemaChangeJob::_process_delete_bitmap(int64_t alter_version,
540539
LOG(INFO) << "alter table for mow table, calculate delete bitmap of "
541540
<< "incremental rowsets with lock, version: " << max_version + 1 << "-"
542541
<< new_max_version << " new_tablet_id: " << _new_tablet->tablet_id();
543-
std::vector<RowsetSharedPtr> new_incremental_rowsets;
544542
if (new_max_version > max_version) {
545-
RETURN_IF_ERROR(tmp_tablet->capture_consistent_rowsets_unlocked(
546-
{max_version + 1, new_max_version}, &new_incremental_rowsets));
543+
auto ret = DORIS_TRY(tmp_tablet->capture_consistent_rowsets_unlocked(
544+
{max_version + 1, new_max_version}, CaptureRowsetOps {}));
547545
{
548546
std::unique_lock wlock(tmp_tablet->get_header_lock());
549547
tmp_tablet->add_rowsets(_output_rowsets, true, wlock);
550548
}
551-
for (auto rowset : new_incremental_rowsets) {
549+
for (auto rowset : ret.rowsets) {
552550
RETURN_IF_ERROR(CloudTablet::update_delete_bitmap_without_lock(tmp_tablet, rowset));
553551
}
554552
}

0 commit comments

Comments
 (0)