diff --git a/src/server/engine_shard.cc b/src/server/engine_shard.cc index 3c1c978c1..53de0b720 100644 --- a/src/server/engine_shard.cc +++ b/src/server/engine_shard.cc @@ -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(); @@ -810,6 +810,12 @@ auto EngineShard::AnalyzeTxQueue() const -> TxQueueInfo { auto& db_slice = namespaces.GetDefaultNamespace().GetCurrentDbSlice(); + { + auto value = queue->At(cur); + Transaction* trx = std::get(value); + info.head.debug_id_info = trx->DebugId(); + } + do { auto value = queue->At(cur); Transaction* trx = std::get(value); diff --git a/src/server/engine_shard.h b/src/server/engine_shard.h index a38f0f98f..a42cbb309 100644 --- a/src/server/engine_shard.h +++ b/src/server/engine_shard.h @@ -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 @@ -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 + TxQueueItem head; }; TxQueueInfo AnalyzeTxQueue() const; diff --git a/src/server/transaction.cc b/src/server/transaction.cc index 2a17557aa..cb5935ac4 100644 --- a/src/server/transaction.cc +++ b/src/server/transaction.cc @@ -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; }