This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 7af9dda7eec [config](be) add be config migration_lock_timeout_ms 
(#38000) (#38335)
7af9dda7eec is described below

commit 7af9dda7eec8af86e3dac937487cf8c8bf661b30
Author: Kaijie Chen <[email protected]>
AuthorDate: Thu Jul 25 17:29:07 2024 +0800

    [config](be) add be config migration_lock_timeout_ms (#38000) (#38335)
    
    backport #38000
---
 be/src/common/config.cpp     | 2 ++
 be/src/common/config.h       | 2 ++
 be/src/olap/delta_writer.cpp | 6 ++++--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/be/src/common/config.cpp b/be/src/common/config.cpp
index 39204ef3760..f1d7635882e 100644
--- a/be/src/common/config.cpp
+++ b/be/src/common/config.cpp
@@ -443,6 +443,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");
diff --git a/be/src/common/config.h b/be/src/common/config.h
index 1174a610c19..ccddc70d7e6 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -487,6 +487,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);
diff --git a/be/src/olap/delta_writer.cpp b/be/src/olap/delta_writer.cpp
index 937b6214525..1bb55879b41 100644
--- a/be/src/olap/delta_writer.cpp
+++ b/be/src/olap/delta_writer.cpp
@@ -190,8 +190,10 @@ Status DeltaWriter::init() {
 
     {
         std::shared_lock base_migration_rlock(_tablet->get_migration_lock(), 
std::defer_lock);
-        if (!base_migration_rlock.try_lock_for(std::chrono::milliseconds(30))) 
{
-            return Status::Error<TRY_LOCK_FAILED>("try migration lock failed");
+        if (!base_migration_rlock.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_IF_ERROR(_storage_engine->txn_manager()->prepare_txn(_req.partition_id, 
_tablet,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to