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

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


The following commit(s) were added to refs/heads/master by this push:
     new 239df5860b [enhancement](tablet_meta_lock) add more trace for write 
lock of tablet's _meta_lock (#25095)
239df5860b is described below

commit 239df5860b1ab916accba67e57024f07d52ca3f8
Author: zhannngchen <48427519+zhannngc...@users.noreply.github.com>
AuthorDate: Sun Oct 8 10:28:10 2023 +0800

    [enhancement](tablet_meta_lock) add more trace for write lock of tablet's 
_meta_lock (#25095)
---
 be/src/olap/compaction.cpp         | 1 +
 be/src/olap/full_compaction.cpp    | 1 +
 be/src/olap/rowset_builder.cpp     | 2 ++
 be/src/olap/tablet.cpp             | 5 +++++
 be/src/olap/task/index_builder.cpp | 2 ++
 5 files changed, 11 insertions(+)

diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp
index 1f8eb66337..268c62847b 100644
--- a/be/src/olap/compaction.cpp
+++ b/be/src/olap/compaction.cpp
@@ -714,6 +714,7 @@ Status Compaction::modify_rowsets(const Merger::Statistics* 
stats) {
         }
     } else {
         std::lock_guard<std::shared_mutex> wrlock(_tablet->get_header_lock());
+        SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
         RETURN_IF_ERROR(_tablet->modify_rowsets(output_rowsets, 
_input_rowsets, true));
     }
 
diff --git a/be/src/olap/full_compaction.cpp b/be/src/olap/full_compaction.cpp
index 913956a921..88e084ba40 100644
--- a/be/src/olap/full_compaction.cpp
+++ b/be/src/olap/full_compaction.cpp
@@ -169,6 +169,7 @@ Status 
FullCompaction::_full_compaction_update_delete_bitmap(const RowsetSharedP
 
     std::lock_guard rowset_update_lock(_tablet->get_rowset_update_lock());
     std::lock_guard header_lock(_tablet->get_header_lock());
+    SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
     for (const auto& it : _tablet->rowset_map()) {
         const int64_t& cur_version = it.first.first;
         const RowsetSharedPtr& published_rowset = it.second;
diff --git a/be/src/olap/rowset_builder.cpp b/be/src/olap/rowset_builder.cpp
index 82486898c3..e599d96a8f 100644
--- a/be/src/olap/rowset_builder.cpp
+++ b/be/src/olap/rowset_builder.cpp
@@ -49,6 +49,7 @@
 #include "util/ref_count_closure.h"
 #include "util/stopwatch.hpp"
 #include "util/time.h"
+#include "util/trace.h"
 #include "vec/core/block.h"
 
 namespace doris {
@@ -113,6 +114,7 @@ Status RowsetBuilder::init() {
     // get rowset ids snapshot
     if (_tablet->enable_unique_key_merge_on_write()) {
         std::lock_guard<std::shared_mutex> lck(_tablet->get_header_lock());
+        SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
         int64_t cur_max_version = _tablet->max_version_unlocked().second;
         // tablet is under alter process. The delete bitmap will be calculated 
after conversion.
         if (_tablet->tablet_state() == TABLET_NOTREADY &&
diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp
index 064aa97392..ecb1021beb 100644
--- a/be/src/olap/tablet.cpp
+++ b/be/src/olap/tablet.cpp
@@ -652,6 +652,7 @@ RowsetSharedPtr Tablet::_rowset_with_largest_size() {
 Status Tablet::add_inc_rowset(const RowsetSharedPtr& rowset) {
     DCHECK(rowset != nullptr);
     std::lock_guard<std::shared_mutex> wrlock(_meta_lock);
+    SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
     if (_contains_rowset(rowset->rowset_id())) {
         return Status::OK();
     }
@@ -1837,6 +1838,7 @@ std::vector<Version> Tablet::get_all_versions() {
     std::vector<Version> local_versions;
     {
         std::lock_guard<std::shared_mutex> wrlock(_meta_lock);
+        SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
         for (const auto& it : _rs_version_map) {
             local_versions.emplace_back(it.first);
         }
@@ -2083,6 +2085,7 @@ Status Tablet::_cooldown_data() {
     if (old_rowset->num_segments() < 1) {
         // Empty rowset, just reset rowset's resource_id
         std::lock_guard meta_wlock(_meta_lock);
+        SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
         old_rowset->rowset_meta()->set_fs(dest_fs);
         LOG(INFO) << "cooldown empty rowset " << old_rowset->version() << " "
                   << old_rowset->rowset_id().to_string() << " to " << 
dest_fs->root_path().native()
@@ -2122,6 +2125,7 @@ Status Tablet::_cooldown_data() {
 
     {
         std::unique_lock meta_wlock(_meta_lock);
+        SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
         if (tablet_state() == TABLET_RUNNING) {
             delete_rowsets({std::move(old_rowset)}, false);
             add_rowsets({std::move(new_rowset)});
@@ -2641,6 +2645,7 @@ TabletSchemaSPtr Tablet::tablet_schema() const {
 
 void Tablet::update_max_version_schema(const TabletSchemaSPtr& tablet_schema) {
     std::lock_guard wrlock(_meta_lock);
+    SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
     // Double Check for concurrent update
     if (!_max_version_schema ||
         tablet_schema->schema_version() > 
_max_version_schema->schema_version()) {
diff --git a/be/src/olap/task/index_builder.cpp 
b/be/src/olap/task/index_builder.cpp
index 5f0c1be76e..9f2e19e0a3 100644
--- a/be/src/olap/task/index_builder.cpp
+++ b/be/src/olap/task/index_builder.cpp
@@ -26,6 +26,7 @@
 #include "olap/tablet_schema.h"
 #include "runtime/memory/mem_tracker.h"
 #include "runtime/thread_context.h"
+#include "util/trace.h"
 
 namespace doris {
 
@@ -489,6 +490,7 @@ Status IndexBuilder::modify_rowsets(const 
Merger::Statistics* stats) {
         _tablet->enable_unique_key_merge_on_write()) {
         std::lock_guard<std::mutex> 
rowset_update_wlock(_tablet->get_rowset_update_lock());
         std::lock_guard<std::shared_mutex> 
meta_wlock(_tablet->get_header_lock());
+        SCOPED_SIMPLE_TRACE_IF_TIMEOUT(TRACE_TABLET_LOCK_THRESHOLD);
         DeleteBitmapPtr delete_bitmap = 
std::make_shared<DeleteBitmap>(_tablet->tablet_id());
         for (auto i = 0; i < _input_rowsets.size(); ++i) {
             RowsetId input_rowset_id = _input_rowsets[i]->rowset_id();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to