[improve](load) try lock 30ms to get base_migration_lock in rowset builder (#32243)

This commit is contained in:
Kaijie Chen
2024-04-10 22:04:49 +08:00
committed by yiguolei
parent 53336d6170
commit 1da1fac4ee

View File

@ -161,8 +161,8 @@ Status RowsetBuilder::check_tablet_version_count() {
}
Status RowsetBuilder::prepare_txn() {
std::shared_lock base_migration_lock(tablet()->get_migration_lock(), std::try_to_lock);
if (!base_migration_lock.owns_lock()) {
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");
}
std::lock_guard<std::mutex> push_lock(tablet()->get_push_lock());