mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
chore: add tx queue head debug info in AnalyzeTxQueue (#4026)
* add tx queue head debug info in AnalyzeTxQueue Signed-off-by: kostas <kostas@dragonflydb.io>
This commit is contained in:
parent
e4b468d953
commit
e103254cf9
3 changed files with 15 additions and 1 deletions
|
@ -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<Transaction*>(value);
|
||||
info.head.debug_id_info = trx->DebugId();
|
||||
}
|
||||
|
||||
do {
|
||||
auto value = queue->At(cur);
|
||||
Transaction* trx = std::get<Transaction*>(value);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue