Skip to content

Commit

Permalink
[fix][store] Fix scan and coprocessor latency recorder potential
Browse files Browse the repository at this point in the history
problems.
  • Loading branch information
Haijun Yu authored and ketor committed Feb 1, 2024
1 parent 5b81a90 commit 73d7f3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/coprocessor/coprocessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ Coprocessor::Coprocessor()
bvar_coprocessor_v1_object_running_num << 1;
bvar_coprocessor_v1_object_total_num << 1;
}
Coprocessor::~Coprocessor() { Close(); }
Coprocessor::~Coprocessor() {
Close();
bvar_coprocessor_v1_object_running_num << -1;
}

butil::Status Coprocessor::Open(const std::any& coprocessor) {
butil::Status status;
Expand Down Expand Up @@ -657,8 +660,6 @@ void Coprocessor::Close() {
if (result_serial_schemas_sorted_) {
result_serial_schemas_sorted_.reset();
}

bvar_coprocessor_v1_object_running_num << -1;
}

butil::Status Coprocessor::CompareSerialSchema(const pb::store::Coprocessor& coprocessor) {
Expand Down
8 changes: 5 additions & 3 deletions src/coprocessor/coprocessor_v2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ bvar::LatencyRecorder CoprocessorV2::coprocessor_v2_execute_latency("dingo_copro
bvar::Adder<uint64_t> CoprocessorV2::bvar_coprocessor_v2_execute_txn_running_num(
"dingo_coprocessor_v2_execute_txn_running_num");
bvar::Adder<uint64_t> CoprocessorV2::bvar_coprocessor_v2_execute_txn_total_num(
"bvar_coprocessor_v2_execute_txn_total_num");
"dingo_coprocessor_v2_execute_txn_total_num");
bvar::LatencyRecorder CoprocessorV2::coprocessor_v2_execute_txn_latency("dingo_coprocessor_v2_execute_txn_latency");
bvar::Adder<uint64_t> CoprocessorV2::bvar_coprocessor_v2_filter_running_num("dingo_coprocessor_v2_filter_running_num");
bvar::Adder<uint64_t> CoprocessorV2::bvar_coprocessor_v2_filter_total_num("dingo_coprocessor_v2_filter_total_num");
Expand All @@ -59,7 +59,10 @@ CoprocessorV2::CoprocessorV2() : bvar_guard_for_coprocessor_v2_latency_(&coproce
bvar_coprocessor_v2_object_running_num << 1;
bvar_coprocessor_v2_object_total_num << 1;
};
CoprocessorV2::~CoprocessorV2() { Close(); }
CoprocessorV2::~CoprocessorV2() {
Close();
bvar_coprocessor_v2_object_running_num << -1;
}

butil::Status CoprocessorV2::Open(const std::any& coprocessor) {
butil::Status status;
Expand Down Expand Up @@ -298,7 +301,6 @@ void CoprocessorV2::Close() {
original_record_decoder_.reset();
result_column_indexes_.clear();
rel_runner_.reset();
bvar_coprocessor_v2_object_running_num << -1;
}

butil::Status CoprocessorV2::DoExecute(const std::string& key, const std::string& value, bool* has_result_kv,
Expand Down

0 comments on commit 73d7f3e

Please sign in to comment.