1
0
Fork 0
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:
Kostas Kyrimis 2024-11-04 09:41:18 +02:00 committed by GitHub
parent e4b468d953
commit e103254cf9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View file

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

View file

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

View file

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