Skip to content
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

[config](be) add be config migration_lock_timeout_ms #38000

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions be/src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ DEFINE_mInt32(migration_remaining_size_threshold_mb, "10");
// If the task runs longer than this time, the task will be terminated, in seconds.
// timeout = std::max(migration_task_timeout_secs, tablet size / 1MB/s)
DEFINE_mInt32(migration_task_timeout_secs, "300");
// timeout for try_lock migration lock
DEFINE_Int64(migration_lock_timeout_ms, "1000");

// Port to start debug webserver on
DEFINE_Int32(webserver_port, "8040");
Expand Down
2 changes: 2 additions & 0 deletions be/src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ DECLARE_mInt32(migration_remaining_size_threshold_mb);
// If the task runs longer than this time, the task will be terminated, in seconds.
// timeout = std::max(migration_task_timeout_secs, tablet size / 1MB/s)
DECLARE_mInt32(migration_task_timeout_secs);
// timeout for try_lock migration lock
DECLARE_Int64(migration_lock_timeout_ms);

// Port to start debug webserver on
DECLARE_Int32(webserver_port);
Expand Down
6 changes: 4 additions & 2 deletions be/src/olap/rowset_builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ Status RowsetBuilder::check_tablet_version_count() {

Status RowsetBuilder::prepare_txn() {
std::shared_lock base_migration_lock(tablet()->get_migration_lock(), std::defer_lock);
if (!base_migration_lock.try_lock_for(std::chrono::milliseconds(30))) {
return Status::Error<TRY_LOCK_FAILED>("try migration lock failed");
if (!base_migration_lock.try_lock_for(
std::chrono::milliseconds(config::migration_lock_timeout_ms))) {
return Status::Error<TRY_LOCK_FAILED>("try_lock migration lock failed after {}ms",
config::migration_lock_timeout_ms);
}
std::lock_guard<std::mutex> push_lock(tablet()->get_push_lock());
return _engine.txn_manager()->prepare_txn(_req.partition_id, *tablet(), _req.txn_id,
Expand Down
Loading