[enhancement](tablet_meta_lock) add more trace for write lock of tablet's _meta_lock (#25095)

This commit is contained in:
zhannngchen
2023-10-08 10:28:10 +08:00
committed by GitHub
parent 961ca76bd3
commit 239df5860b
5 changed files with 11 additions and 0 deletions

View File

@ -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));
}

View File

@ -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;

View File

@ -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 &&

View File

@ -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()) {

View File

@ -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();