Skip to content

Commit

Permalink
[feat][store] Add bvar for dingo_storage_workers_task_count to monitor
Browse files Browse the repository at this point in the history
the task num in workers.

Signed-off-by: Ketor <d.ketor@gmail.com>
  • Loading branch information
ketor committed Oct 14, 2023
1 parent ea26ffd commit 10d02db
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/server/index_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1824,6 +1824,7 @@ class TxnGetTask : public TaskRunnable {
std::string Type() override { return "TXN_GET"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down Expand Up @@ -2038,6 +2039,7 @@ class TxnScanTask : public TaskRunnable {
std::string Type() override { return "TXN_SCAN"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down Expand Up @@ -2398,6 +2400,7 @@ class TxnPrewriteTask : public TaskRunnable {
std::string Type() override { return "TXN_PREWRITE"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnPrewriteTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -2607,6 +2610,7 @@ class TxnCommitTask : public TaskRunnable {
std::string Type() override { return "TXN_COMMIT"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnCommitTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -2805,6 +2809,7 @@ class TxnCheckTxnStatusTask : public TaskRunnable {
std::string Type() override { return "TXN_CHECK"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnCheckTxnStatusTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -3007,6 +3012,7 @@ class TxnResolveLockTask : public TaskRunnable {
std::string Type() override { return "TXN_RESOLVE"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnResolveLockTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -3196,6 +3202,7 @@ class TxnBatchGetTask : public TaskRunnable {
std::string Type() override { return "TXN_BATCH_GET"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down Expand Up @@ -3417,6 +3424,7 @@ class TxnBatchRollbackTask : public TaskRunnable {
std::string Type() override { return "TXN_ROLLBACK"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnBatchRollbackTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -3620,6 +3628,7 @@ class TxnScanLockTask : public TaskRunnable {
std::string Type() override { return "TXN_SCAN_LOCK"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down Expand Up @@ -3792,6 +3801,7 @@ class TxnHeartBeatTask : public TaskRunnable {
std::string Type() override { return "TXN_HB"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnHeartBeatTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -3958,6 +3968,7 @@ class TxnGcTask : public TaskRunnable {
std::string Type() override { return "TXN_GC"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnGcTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -4133,6 +4144,7 @@ class TxnDeleteRangeTask : public TaskRunnable {
std::string Type() override { return "TXN_DELETE_RANGE"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnDeleteRangeTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -4302,6 +4314,7 @@ class TxnDumpTask : public TaskRunnable {
std::string Type() override { return "TXN_DUMP"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down
13 changes: 13 additions & 0 deletions src/server/store_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,7 @@ class TxnGetTask : public TaskRunnable {
std::string Type() override { return "TXN_GET"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down Expand Up @@ -2283,6 +2284,7 @@ class TxnScanTask : public TaskRunnable {
std::string Type() override { return "TXN_SCAN"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down Expand Up @@ -2512,6 +2514,7 @@ class TxnPrewriteTask : public TaskRunnable {
std::string Type() override { return "TXN_PREWRITE"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnPrewriteTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -2724,6 +2727,7 @@ class TxnCommitTask : public TaskRunnable {
std::string Type() override { return "TXN_COMMIT"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnCommitTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -2919,6 +2923,7 @@ class TxnCheckTxnStatusTask : public TaskRunnable {
std::string Type() override { return "TXN_CHECK"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnCheckTxnStatusTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -3118,6 +3123,7 @@ class TxnResolveLockTask : public TaskRunnable {
std::string Type() override { return "TXN_RESOLVE"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnResolveLockTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -3305,6 +3311,7 @@ class TxnBatchGetTask : public TaskRunnable {
std::string Type() override { return "TXN_BATCH_GET"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down Expand Up @@ -3484,6 +3491,7 @@ class TxnBatchRollbackTask : public TaskRunnable {
std::string Type() override { return "TXN_ROLLBACK"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnBatchRollbackTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -3685,6 +3693,7 @@ class TxnScanLockTask : public TaskRunnable {
std::string Type() override { return "TXN_SCAN_LOCK"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down Expand Up @@ -3857,6 +3866,7 @@ class TxnHeartBeatTask : public TaskRunnable {
std::string Type() override { return "TXN_HB"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnHeartBeatTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -4026,6 +4036,7 @@ class TxnGcTask : public TaskRunnable {
std::string Type() override { return "TXN_GC"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnGcTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -4203,6 +4214,7 @@ class TxnDeleteRangeTask : public TaskRunnable {
std::string Type() override { return "TXN_DELETE_RANGE"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
DINGO_LOG(DEBUG) << "TxnDeleteRangeTask execute start, request: " << request_->ShortDebugString();

brpc::ClosureGuard done_guard(done_);
Expand Down Expand Up @@ -4370,6 +4382,7 @@ class TxnDumpTask : public TaskRunnable {
std::string Type() override { return "TXN_DUMP"; }

void Run() override {
ON_SCOPE_EXIT([this]() { storage_->DecTaskCount(); });
brpc::ClosureGuard done_guard(done_);

// check if region_epoch is match
Expand Down

0 comments on commit 10d02db

Please sign in to comment.