Skip to content

Commit

Permalink
Add compaction statics in log
Browse files Browse the repository at this point in the history
  • Loading branch information
yiguolei committed May 15, 2019
1 parent bdef591 commit 5d9e185
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion be/src/olap/base_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ bool BaseCompaction::_check_whether_satisfy_policy(bool is_manual_trigger,
OLAPStatus BaseCompaction::_do_base_compaction(VersionHash new_base_version_hash,
vector<ColumnData*>* base_data_sources,
uint64_t* row_count) {
OlapStopWatch watch;
// 1. 生成新base文件对应的olap index
SegmentGroup* new_base = new (std::nothrow) SegmentGroup(_table.get(),
_new_base_version,
Expand Down Expand Up @@ -399,7 +400,9 @@ OLAPStatus BaseCompaction::_do_base_compaction(VersionHash new_base_version_hash
<< "source_rows=" << source_rows
<< ", merged_rows=" << merged_rows
<< ", filted_rows=" << filted_rows
<< ", new_index_rows=" << new_base->num_rows();
<< ", new_index_rows=" << new_base->num_rows()
<< ", merged_version_num=" << _need_merged_versions.size()
<< ", time=" << watch.get_elapse_time_us();
}

LOG(INFO) << "succeed to do base compaction. table=" << _table->full_name()
Expand Down
5 changes: 4 additions & 1 deletion be/src/olap/cumulative_compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ bool CumulativeCompaction::_find_previous_version(const Version current_version,

OLAPStatus CumulativeCompaction::_do_cumulative_compaction() {
OLAPStatus res = OLAP_SUCCESS;
OlapStopWatch watch;
Merger merger(_table, _new_segment_group, READER_CUMULATIVE_COMPACTION);

// 1. merge delta files into new cumulative file
Expand Down Expand Up @@ -412,7 +413,9 @@ OLAPStatus CumulativeCompaction::_do_cumulative_compaction() {
LOG(INFO) << "all row nums. source_rows=" << source_rows
<< ", merged_rows=" << merged_rows
<< ", filted_rows=" << filted_rows
<< ", new_index_rows=" << _new_segment_group->num_rows();
<< ", new_index_rows=" << _new_segment_group->num_rows()
<< ", merged_version_num=" << _need_merged_versions.size()
<< ", time=" << watch.get_elapse_time_us();;
}

// 3. add new cumulative file into table
Expand Down
6 changes: 2 additions & 4 deletions be/src/olap/olap_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ OLAPStatus OLAPEngine::_start_bg_worker() {
[this] {
_unused_index_thread_callback(nullptr);
});

uint32_t file_system_num = get_file_system_count();
// convert store map to vector
std::vector<OlapStore*> store_vec;
for (auto& tmp_store : _store_map) {
store_vec.push_back(tmp_store.second);
}
int32_t store_num = store_vec.size();
// start be and ce threads for merge data
int32_t base_compaction_num_threads = config::base_compaction_num_threads_per_disk * file_system_num;
int32_t base_compaction_num_threads = config::base_compaction_num_threads_per_disk * store_num;
_base_compaction_threads.reserve(base_compaction_num_threads);
for (uint32_t i = 0; i < base_compaction_num_threads; ++i) {
_base_compaction_threads.emplace_back(
Expand All @@ -75,7 +73,7 @@ OLAPStatus OLAPEngine::_start_bg_worker() {
});
}

int32_t cumulative_compaction_num_threads = config::cumulative_compaction_num_threads_per_disk * file_system_num;
int32_t cumulative_compaction_num_threads = config::cumulative_compaction_num_threads_per_disk * store_num;
_cumulative_compaction_threads.reserve(cumulative_compaction_num_threads);
for (uint32_t i = 0; i < cumulative_compaction_num_threads; ++i) {
_cumulative_compaction_threads.emplace_back(
Expand Down

0 comments on commit 5d9e185

Please sign in to comment.