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

[WIP] chore: add tx queue head debug info in AnalyzeTxQueue #4026

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion src/server/engine_shard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ bool EngineShard::ShouldThrottleForTiering() const { // see header for formula
(UsedMemory() > tiering_redline + tiered_storage_->CoolMemoryUsage());
}

auto EngineShard::AnalyzeTxQueue() const -> TxQueueInfo {
EngineShard::TxQueueInfo EngineShard::AnalyzeTxQueue() const {
const TxQueue* queue = txq();

ShardId sid = shard_id();
Expand All @@ -810,6 +810,12 @@ auto EngineShard::AnalyzeTxQueue() const -> TxQueueInfo {

auto& db_slice = namespaces.GetDefaultNamespace().GetCurrentDbSlice();

{
auto value = queue->At(cur);
Transaction* trx = std::get<Transaction*>(value);
info.head.debug_id_info = trx->DebugId();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tx_id + name of the command + shard count. Maybe we should also include per shard data, arguments etc ?

}

do {
auto value = queue->At(cur);
Transaction* trx = std::get<Transaction*>(value);
Expand Down
7 changes: 7 additions & 0 deletions src/server/engine_shard.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ class EngineShard {

void StopPeriodicFiber();

struct TxQueueItem {
std::string debug_id_info;
};

struct TxQueueInfo {
// Armed - those that the coordinator has armed with callbacks and wants them to run.
// Runnable - those that could run (they own the locks) but probably can not run due
Expand All @@ -174,6 +178,9 @@ class EngineShard {

// the lock fingerprint with maximum contention score.
uint64_t max_contention_lock;

// We can use a vector to hold debug info for all items in the txqueue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea here we might want to analyze the whole txqueue, so maybe it would be interesting extending DEBUG TX to include N transactions

TxQueueItem head;
};

TxQueueInfo AnalyzeTxQueue() const;
Expand Down
1 change: 1 addition & 0 deletions src/server/transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void AnalyzeTxQueue(const EngineShard* shard, const TxQueue* txq) {
absl::StrAppend(&msg, " continuation_tx: ", cont_tx->DebugId(), " ",
cont_tx->DEBUG_IsArmedInShard(shard->shard_id()) ? " armed" : "");
}
absl::StrAppend(&msg, "\nTxQueue head debug info ", info.head.debug_id_info);

LOG(WARNING) << msg;
}
Expand Down
Loading