-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add wal function #6
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -85,6 +85,8 @@ Status LoadBlockQueue::get_block(vectorized::Block* block, bool* find_block, boo | |||||
_block_queue.pop_front(); | ||||||
_all_block_queues_bytes->fetch_sub(fblock->bytes(), std::memory_order_relaxed); | ||||||
_single_block_queue_bytes->fetch_sub(block->bytes(), std::memory_order_relaxed); | ||||||
//append block | ||||||
RETURN_IF_ERROR(append_block(0, 0, block, nullptr, nullptr)); | ||||||
} | ||||||
if (_block_queue.empty() && need_commit && _load_ids.empty()) { | ||||||
CHECK_EQ(_single_block_queue_bytes->load(), 0); | ||||||
|
@@ -130,8 +132,8 @@ void LoadBlockQueue::cancel(const Status& st) { | |||||
|
||||||
Status GroupCommitTable::get_first_block_load_queue( | ||||||
int64_t table_id, int64_t base_schema_version, const UniqueId& load_id, | ||||||
std::shared_ptr<vectorized::Block> block, | ||||||
std::shared_ptr<LoadBlockQueue>& load_block_queue) { | ||||||
std::shared_ptr<vectorized::Block> block, std::shared_ptr<LoadBlockQueue>& load_block_queue, | ||||||
int be_exe_version) { | ||||||
DCHECK(table_id == _table_id); | ||||||
{ | ||||||
std::unique_lock l(_lock); | ||||||
|
@@ -155,7 +157,8 @@ Status GroupCommitTable::get_first_block_load_queue( | |||||
if (!_need_plan_fragment) { | ||||||
_need_plan_fragment = true; | ||||||
RETURN_IF_ERROR(_thread_pool->submit_func([&] { | ||||||
[[maybe_unused]] auto st = _create_group_commit_load(load_block_queue); | ||||||
[[maybe_unused]] auto st = | ||||||
_create_group_commit_load(load_block_queue, be_exe_version); | ||||||
})); | ||||||
} | ||||||
_cv.wait_for(l, std::chrono::seconds(4)); | ||||||
|
@@ -175,7 +178,7 @@ Status GroupCommitTable::get_first_block_load_queue( | |||||
} | ||||||
|
||||||
Status GroupCommitTable::_create_group_commit_load( | ||||||
std::shared_ptr<LoadBlockQueue>& load_block_queue) { | ||||||
std::shared_ptr<LoadBlockQueue>& load_block_queue, int be_exe_version) { | ||||||
Status st = Status::OK(); | ||||||
std::unique_ptr<int, std::function<void(int*)>> finish_plan_func((int*)0x01, [&](int*) { | ||||||
if (!st.ok()) { | ||||||
|
@@ -251,6 +254,10 @@ Status GroupCommitTable::_create_group_commit_load( | |||||
if (_exec_env->wal_mgr()->is_running()) { | ||||||
_exec_env->wal_mgr()->add_wal_status_queue(_table_id, txn_id, | ||||||
WalManager::WAL_STATUS::PREPARE); | ||||||
//create wal | ||||||
RETURN_IF_ERROR( | ||||||
load_block_queue->create_wal(_db_id, _table_id, txn_id, label, _exec_env->wal_mgr(), | ||||||
params.desc_tbl.slotDescriptors, be_exe_version)); | ||||||
st = _exec_plan_fragment(_db_id, _table_id, label, txn_id, is_pipeline, params, | ||||||
pipeline_params); | ||||||
} else { | ||||||
|
@@ -310,6 +317,8 @@ Status GroupCommitTable::_finish_group_commit_load(int64_t db_id, int64_t table_ | |||||
auto it = _load_block_queues.find(instance_id); | ||||||
if (it != _load_block_queues.end()) { | ||||||
auto& load_block_queue = it->second; | ||||||
//close wal | ||||||
RETURN_IF_ERROR(load_block_queue->close_wal()); | ||||||
if (prepare_failed || !status.ok()) { | ||||||
load_block_queue->cancel(status); | ||||||
} | ||||||
|
@@ -418,7 +427,8 @@ void GroupCommitMgr::stop() { | |||||
Status GroupCommitMgr::get_first_block_load_queue( | ||||||
int64_t db_id, int64_t table_id, int64_t base_schema_version, const UniqueId& load_id, | ||||||
std::shared_ptr<vectorized::Block> block, | ||||||
std::shared_ptr<LoadBlockQueue>& load_block_queue) { | ||||||
std::shared_ptr<LoadBlockQueue>& load_block_queue, | ||||||
int be_exe_version) { | ||||||
std::shared_ptr<GroupCommitTable> group_commit_table; | ||||||
{ | ||||||
std::lock_guard wlock(_lock); | ||||||
|
@@ -430,7 +440,7 @@ Status GroupCommitMgr::get_first_block_load_queue( | |||||
group_commit_table = _table_map[table_id]; | ||||||
} | ||||||
return group_commit_table->get_first_block_load_queue(table_id, base_schema_version, load_id, | ||||||
block, load_block_queue); | ||||||
block, load_block_queue, be_exe_version); | ||||||
} | ||||||
|
||||||
Status GroupCommitMgr::get_load_block_queue(int64_t table_id, const TUniqueId& instance_id, | ||||||
|
@@ -447,4 +457,25 @@ Status GroupCommitMgr::get_load_block_queue(int64_t table_id, const TUniqueId& i | |||||
} | ||||||
return group_commit_table->get_load_block_queue(instance_id, load_block_queue); | ||||||
} | ||||||
Status LoadBlockQueue::create_wal(int64_t db_id, int64_t tb_id, int64_t wal_id, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: method 'create_wal' can be made static [readability-convert-member-functions-to-static]
Suggested change
|
||||||
const std::string& import_label, WalManager* wal_manager, | ||||||
std::vector<TSlotDescriptor>& slot_desc, int be_exe_version) { | ||||||
_v_wal_writer = std::make_shared<vectorized::VWalWriter>( | ||||||
db_id, tb_id, txn_id, label, wal_manager, slot_desc, be_exe_version); | ||||||
RETURN_IF_ERROR(_v_wal_writer->init()); | ||||||
return Status::OK(); | ||||||
hust-hhb marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
} | ||||||
Status LoadBlockQueue::append_block(int64_t num_rows, int64_t filter_rows, vectorized::Block* block, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: method 'append_block' can be made static [readability-convert-member-functions-to-static] be/src/runtime/group_commit_mgr.h:61: - Status append_block(int64_t num_rows, int64_t filter_rows, vectorized::Block* block,
+ static Status append_block(int64_t num_rows, int64_t filter_rows, vectorized::Block* block, |
||||||
vectorized::OlapTableBlockConvertor* block_convertor, | ||||||
vectorized::OlapTabletFinder* tablet_finder) { | ||||||
RETURN_IF_ERROR(_v_wal_writer->append_block(num_rows, filter_rows, block, block_convertor, | ||||||
tablet_finder)); | ||||||
return Status::OK(); | ||||||
} | ||||||
Status LoadBlockQueue::close_wal() { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: method 'close_wal' can be made static [readability-convert-member-functions-to-static] be/src/runtime/group_commit_mgr.h:64: - Status close_wal();
+ static Status close_wal(); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: method 'close_wal' can be made static [readability-convert-member-functions-to-static] be/src/runtime/group_commit_mgr.h:60: - Status close_wal();
+ static Status close_wal(); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: method 'close_wal' can be made static [readability-convert-member-functions-to-static] be/src/runtime/group_commit_mgr.h:59: - Status close_wal();
+ static Status close_wal(); |
||||||
if (_v_wal_writer != nullptr) { | ||||||
RETURN_IF_ERROR(_v_wal_writer->close()); | ||||||
} | ||||||
return Status::OK(); | ||||||
} | ||||||
} // namespace doris |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'gen_cpp/PaloInternalService_types.h' file not found [clang-diagnostic-error]