mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-12 10:55:46 +02:00
feat: introduce transaction statistics in the info output (#2328)
1. How many transactions we processed by type 2. How many transactions we processed by width (number of unique shards). Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
1376295799
commit
bbe3d9303b
14 changed files with 179 additions and 82 deletions
|
@ -82,7 +82,7 @@ std::string TestConnection::RemoteEndpointStr() const {
|
|||
}
|
||||
|
||||
void TransactionSuspension::Start() {
|
||||
CommandId cid{"TEST", CO::WRITE | CO::GLOBAL_TRANS, -1, 0, 0, acl::NONE};
|
||||
static CommandId cid{"TEST", CO::WRITE | CO::GLOBAL_TRANS, -1, 0, 0, acl::NONE};
|
||||
|
||||
transaction_ = new dfly::Transaction{&cid};
|
||||
|
||||
|
@ -317,6 +317,14 @@ unsigned BaseFamilyTest::NumLocked() {
|
|||
return count;
|
||||
}
|
||||
|
||||
void BaseFamilyTest::ClearMetrics() {
|
||||
shard_set->pool()->Await([](auto*) {
|
||||
ServerState::Stats stats;
|
||||
stats.tx_width_freq_arr = new uint64_t[shard_set->size()];
|
||||
ServerState::tlocal()->stats = std::move(stats);
|
||||
});
|
||||
}
|
||||
|
||||
void BaseFamilyTest::WaitUntilLocked(DbIndex db_index, string_view key, double timeout) {
|
||||
auto step = 50us;
|
||||
auto timeout_micro = chrono::duration_cast<chrono::microseconds>(1000ms * timeout);
|
||||
|
@ -659,8 +667,9 @@ void BaseFamilyTest::ExpectConditionWithinTimeout(const std::function<bool()>& c
|
|||
|
||||
Fiber BaseFamilyTest::ExpectConditionWithSuspension(const std::function<bool()>& condition) {
|
||||
TransactionSuspension tx;
|
||||
tx.Start();
|
||||
auto fb = pp_->at(0)->LaunchFiber([condition, tx = std::move(tx)]() mutable {
|
||||
pp_->at(0)->Await([&] { tx.Start(); });
|
||||
|
||||
auto fb = pp_->at(0)->LaunchFiber(Launch::dispatch, [condition, tx = std::move(tx)]() mutable {
|
||||
ExpectConditionWithinTimeout(condition);
|
||||
tx.Terminate();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue