Coverage Report

Created: 2026-04-18 15:51

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/util/brpc_closure.h
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#pragma once
19
20
#include <google/protobuf/stubs/common.h>
21
22
#include <type_traits>
23
#include <utility>
24
25
#include "runtime/query_context.h"
26
#include "runtime/thread_context.h"
27
#include "service/brpc.h" // IWYU pragma: keep
28
29
namespace doris {
30
31
template <typename T>
32
concept HasStatus = requires(T* response) { response->status(); };
33
34
template <typename Response>
35
class DummyBrpcCallback {
36
    ENABLE_FACTORY_CREATOR(DummyBrpcCallback);
37
38
public:
39
    using ResponseType = Response;
40
2.11M
    DummyBrpcCallback() {
41
2.11M
        cntl_ = std::make_shared<brpc::Controller>();
42
2.11M
        call_id_ = cntl_->call_id();
43
2.11M
        response_ = std::make_shared<Response>();
44
2.11M
    }
_ZN5doris17DummyBrpcCallbackINS_23PSyncFilterSizeResponseEEC2Ev
Line
Count
Source
40
96
    DummyBrpcCallback() {
41
96
        cntl_ = std::make_shared<brpc::Controller>();
42
96
        call_id_ = cntl_->call_id();
43
96
        response_ = std::make_shared<Response>();
44
96
    }
_ZN5doris17DummyBrpcCallbackINS_22PPublishFilterResponseEEC2Ev
Line
Count
Source
40
1.62k
    DummyBrpcCallback() {
41
1.62k
        cntl_ = std::make_shared<brpc::Controller>();
42
1.62k
        call_id_ = cntl_->call_id();
43
1.62k
        response_ = std::make_shared<Response>();
44
1.62k
    }
_ZN5doris17DummyBrpcCallbackINS_23PSendFilterSizeResponseEEC2Ev
Line
Count
Source
40
104
    DummyBrpcCallback() {
41
104
        cntl_ = std::make_shared<brpc::Controller>();
42
104
        call_id_ = cntl_->call_id();
43
104
        response_ = std::make_shared<Response>();
44
104
    }
_ZN5doris17DummyBrpcCallbackINS_20PMergeFilterResponseEEC2Ev
Line
Count
Source
40
2.69k
    DummyBrpcCallback() {
41
2.69k
        cntl_ = std::make_shared<brpc::Controller>();
42
2.69k
        call_id_ = cntl_->call_id();
43
2.69k
        response_ = std::make_shared<Response>();
44
2.69k
    }
_ZN5doris17DummyBrpcCallbackINS_27PTabletWriterAddBlockResultEEC2Ev
Line
Count
Source
40
54.1k
    DummyBrpcCallback() {
41
54.1k
        cntl_ = std::make_shared<brpc::Controller>();
42
54.1k
        call_id_ = cntl_->call_id();
43
54.1k
        response_ = std::make_shared<Response>();
44
54.1k
    }
_ZN5doris17DummyBrpcCallbackINS_23PTabletWriterOpenResultEEC2Ev
Line
Count
Source
40
53.9k
    DummyBrpcCallback() {
41
53.9k
        cntl_ = std::make_shared<brpc::Controller>();
42
53.9k
        call_id_ = cntl_->call_id();
43
53.9k
        response_ = std::make_shared<Response>();
44
53.9k
    }
_ZN5doris17DummyBrpcCallbackINS_25PTabletWriterCancelResultEEC2Ev
Line
Count
Source
40
126
    DummyBrpcCallback() {
41
126
        cntl_ = std::make_shared<brpc::Controller>();
42
126
        call_id_ = cntl_->call_id();
43
126
        response_ = std::make_shared<Response>();
44
126
    }
_ZN5doris17DummyBrpcCallbackINS_19PTransmitDataResultEEC2Ev
Line
Count
Source
40
2.00M
    DummyBrpcCallback() {
41
2.00M
        cntl_ = std::make_shared<brpc::Controller>();
42
2.00M
        call_id_ = cntl_->call_id();
43
2.00M
        response_ = std::make_shared<Response>();
44
2.00M
    }
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_29PFetchArrowFlightSchemaResultEEC2Ev
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_21PFetchArrowDataResultEEC2Ev
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_27PTabletWriteSlaveDoneResultEEC2Ev
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_23PTabletWriteSlaveResultEEC2Ev
45
46
2.13M
    virtual ~DummyBrpcCallback() = default;
_ZN5doris17DummyBrpcCallbackINS_23PSyncFilterSizeResponseEED2Ev
Line
Count
Source
46
96
    virtual ~DummyBrpcCallback() = default;
_ZN5doris17DummyBrpcCallbackINS_22PPublishFilterResponseEED2Ev
Line
Count
Source
46
1.62k
    virtual ~DummyBrpcCallback() = default;
_ZN5doris17DummyBrpcCallbackINS_23PSendFilterSizeResponseEED2Ev
Line
Count
Source
46
104
    virtual ~DummyBrpcCallback() = default;
_ZN5doris17DummyBrpcCallbackINS_20PMergeFilterResponseEED2Ev
Line
Count
Source
46
2.69k
    virtual ~DummyBrpcCallback() = default;
_ZN5doris17DummyBrpcCallbackINS_27PTabletWriterAddBlockResultEED2Ev
Line
Count
Source
46
54.2k
    virtual ~DummyBrpcCallback() = default;
_ZN5doris17DummyBrpcCallbackINS_23PTabletWriterOpenResultEED2Ev
Line
Count
Source
46
54.4k
    virtual ~DummyBrpcCallback() = default;
_ZN5doris17DummyBrpcCallbackINS_25PTabletWriterCancelResultEED2Ev
Line
Count
Source
46
126
    virtual ~DummyBrpcCallback() = default;
_ZN5doris17DummyBrpcCallbackINS_19PTransmitDataResultEED2Ev
Line
Count
Source
46
2.02M
    virtual ~DummyBrpcCallback() = default;
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_29PFetchArrowFlightSchemaResultEED2Ev
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_21PFetchArrowDataResultEED2Ev
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_27PTabletWriteSlaveDoneResultEED2Ev
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_23PTabletWriteSlaveResultEED2Ev
47
48
54.3k
    virtual void call() {}
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_19PTransmitDataResultEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_23PSyncFilterSizeResponseEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_22PPublishFilterResponseEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_23PSendFilterSizeResponseEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_20PMergeFilterResponseEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_27PTabletWriterAddBlockResultEE4callEv
_ZN5doris17DummyBrpcCallbackINS_23PTabletWriterOpenResultEE4callEv
Line
Count
Source
48
54.3k
    virtual void call() {}
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_25PTabletWriterCancelResultEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_29PFetchArrowFlightSchemaResultEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_21PFetchArrowDataResultEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_27PTabletWriteSlaveDoneResultEE4callEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_23PTabletWriteSlaveResultEE4callEv
49
50
54.4k
    virtual void join() { brpc::Join(call_id_); }
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_19PTransmitDataResultEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_23PSyncFilterSizeResponseEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_22PPublishFilterResponseEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_23PSendFilterSizeResponseEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_20PMergeFilterResponseEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_27PTabletWriterAddBlockResultEE4joinEv
_ZN5doris17DummyBrpcCallbackINS_23PTabletWriterOpenResultEE4joinEv
Line
Count
Source
50
54.4k
    virtual void join() { brpc::Join(call_id_); }
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_25PTabletWriterCancelResultEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_29PFetchArrowFlightSchemaResultEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_21PFetchArrowDataResultEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_27PTabletWriteSlaveDoneResultEE4joinEv
Unexecuted instantiation: _ZN5doris17DummyBrpcCallbackINS_23PTabletWriteSlaveResultEE4joinEv
51
52
    // according to brpc doc, we MUST save the call_id before rpc done. use this id to join.
53
    // if a rpc is already done then we get the id and join, it's wrong.
54
    brpc::CallId call_id_;
55
    // controller has to be the same lifecycle with the closure, because brpc may use
56
    // it in any stage of the rpc.
57
    std::shared_ptr<brpc::Controller> cntl_;
58
    // We do not know if brpc will use request or response after brpc method returns.
59
    // So that we need keep a shared ptr here to ensure that brpc could use req/rep
60
    // at any stage.
61
    std::shared_ptr<Response> response_;
62
};
63
64
template <typename Response>
65
class HandleErrorBrpcCallback : public DummyBrpcCallback<Response> {
66
    ENABLE_FACTORY_CREATOR(HandleErrorBrpcCallback);
67
68
public:
69
    using ResponseType = Response;
70
    // input context must be held by caller
71
    HandleErrorBrpcCallback(std::weak_ptr<QueryContext> context = {})
72
4.41k
            : _context(std::move(context)) {}
_ZN5doris23HandleErrorBrpcCallbackINS_23PSyncFilterSizeResponseEEC2ESt8weak_ptrINS_12QueryContextEE
Line
Count
Source
72
96
            : _context(std::move(context)) {}
_ZN5doris23HandleErrorBrpcCallbackINS_22PPublishFilterResponseEEC2ESt8weak_ptrINS_12QueryContextEE
Line
Count
Source
72
1.62k
            : _context(std::move(context)) {}
_ZN5doris23HandleErrorBrpcCallbackINS_20PMergeFilterResponseEEC2ESt8weak_ptrINS_12QueryContextEE
Line
Count
Source
72
2.69k
            : _context(std::move(context)) {}
73
74
4.41k
    ~HandleErrorBrpcCallback() override = default;
_ZN5doris23HandleErrorBrpcCallbackINS_23PSyncFilterSizeResponseEED2Ev
Line
Count
Source
74
96
    ~HandleErrorBrpcCallback() override = default;
_ZN5doris23HandleErrorBrpcCallbackINS_22PPublishFilterResponseEED2Ev
Line
Count
Source
74
1.62k
    ~HandleErrorBrpcCallback() override = default;
_ZN5doris23HandleErrorBrpcCallbackINS_20PMergeFilterResponseEED2Ev
Line
Count
Source
74
2.69k
    ~HandleErrorBrpcCallback() override = default;
75
76
4.39k
    void call() override {
77
4.39k
        if (this->cntl_->Failed()) {
78
3
            LOG(WARNING) << fmt::format("RPC meet failed: {}", this->cntl_->ErrorText());
79
3
            if (auto ctx = _context.lock()) {
80
1
                ctx->cancel(Status::NetworkError("RPC meet failed: {}", this->cntl_->ErrorText()));
81
1
            }
82
3
            return;
83
3
        }
84
4.39k
        if constexpr (HasStatus<Response>) {
85
4.39k
            if (Status status = Status::create(this->response_->status()); !status.ok()) {
86
50
                if (!status.is<ErrorCode::END_OF_FILE>()) {
87
2
                    LOG(WARNING) << "RPC meet error status: " << status;
88
2
                    if (auto ctx = _context.lock()) {
89
1
                        ctx->cancel(std::move(status));
90
1
                    }
91
2
                }
92
50
            }
93
4.39k
        }
94
4.39k
    }
_ZN5doris23HandleErrorBrpcCallbackINS_23PSyncFilterSizeResponseEE4callEv
Line
Count
Source
76
96
    void call() override {
77
96
        if (this->cntl_->Failed()) {
78
0
            LOG(WARNING) << fmt::format("RPC meet failed: {}", this->cntl_->ErrorText());
79
0
            if (auto ctx = _context.lock()) {
80
0
                ctx->cancel(Status::NetworkError("RPC meet failed: {}", this->cntl_->ErrorText()));
81
0
            }
82
0
            return;
83
0
        }
84
96
        if constexpr (HasStatus<Response>) {
85
96
            if (Status status = Status::create(this->response_->status()); !status.ok()) {
86
0
                if (!status.is<ErrorCode::END_OF_FILE>()) {
87
0
                    LOG(WARNING) << "RPC meet error status: " << status;
88
0
                    if (auto ctx = _context.lock()) {
89
0
                        ctx->cancel(std::move(status));
90
0
                    }
91
0
                }
92
0
            }
93
96
        }
94
96
    }
_ZN5doris23HandleErrorBrpcCallbackINS_22PPublishFilterResponseEE4callEv
Line
Count
Source
76
1.61k
    void call() override {
77
1.61k
        if (this->cntl_->Failed()) {
78
0
            LOG(WARNING) << fmt::format("RPC meet failed: {}", this->cntl_->ErrorText());
79
0
            if (auto ctx = _context.lock()) {
80
0
                ctx->cancel(Status::NetworkError("RPC meet failed: {}", this->cntl_->ErrorText()));
81
0
            }
82
0
            return;
83
0
        }
84
1.61k
        if constexpr (HasStatus<Response>) {
85
1.61k
            if (Status status = Status::create(this->response_->status()); !status.ok()) {
86
0
                if (!status.is<ErrorCode::END_OF_FILE>()) {
87
0
                    LOG(WARNING) << "RPC meet error status: " << status;
88
0
                    if (auto ctx = _context.lock()) {
89
0
                        ctx->cancel(std::move(status));
90
0
                    }
91
0
                }
92
0
            }
93
1.61k
        }
94
1.61k
    }
_ZN5doris23HandleErrorBrpcCallbackINS_20PMergeFilterResponseEE4callEv
Line
Count
Source
76
2.68k
    void call() override {
77
2.68k
        if (this->cntl_->Failed()) {
78
3
            LOG(WARNING) << fmt::format("RPC meet failed: {}", this->cntl_->ErrorText());
79
3
            if (auto ctx = _context.lock()) {
80
1
                ctx->cancel(Status::NetworkError("RPC meet failed: {}", this->cntl_->ErrorText()));
81
1
            }
82
3
            return;
83
3
        }
84
2.67k
        if constexpr (HasStatus<Response>) {
85
2.67k
            if (Status status = Status::create(this->response_->status()); !status.ok()) {
86
50
                if (!status.is<ErrorCode::END_OF_FILE>()) {
87
2
                    LOG(WARNING) << "RPC meet error status: " << status;
88
2
                    if (auto ctx = _context.lock()) {
89
1
                        ctx->cancel(std::move(status));
90
1
                    }
91
2
                }
92
50
            }
93
2.67k
        }
94
2.67k
    }
95
96
private:
97
    std::weak_ptr<QueryContext> _context;
98
};
99
100
// The closure will be deleted after callback.
101
// It could only be created by using shared ptr or unique ptr.
102
// Example:
103
//  std::unique_ptr<AutoReleaseClosure> a(b);
104
//  brpc_call(a.release());
105
// the closure doesn't own the callback, so the callback MUST be kept alive outside.
106
// closure only keep a weak ref. if outside owner destroyed (like query finish), the callback will be ignored.
107
template <typename Request, typename Callback>
108
class AutoReleaseClosure : public google::protobuf::Closure {
109
    using ResponseType = typename Callback::ResponseType;
110
    ENABLE_FACTORY_CREATOR(AutoReleaseClosure);
111
112
public:
113
    AutoReleaseClosure(std::shared_ptr<Request> req, std::shared_ptr<Callback> callback)
114
2.14M
            : request_(std::move(req)), callback_(callback) {
115
2.14M
        this->cntl_ = callback->cntl_;
116
2.14M
        this->response_ = callback->response_;
117
2.14M
    }
_ZN5doris18AutoReleaseClosureINS_22PSyncFilterSizeRequestENS_23HandleErrorBrpcCallbackINS_23PSyncFilterSizeResponseEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Line
Count
Source
114
96
            : request_(std::move(req)), callback_(callback) {
115
96
        this->cntl_ = callback->cntl_;
116
96
        this->response_ = callback->response_;
117
96
    }
_ZN5doris18AutoReleaseClosureINS_23PPublishFilterRequestV2ENS_23HandleErrorBrpcCallbackINS_22PPublishFilterResponseEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Line
Count
Source
114
1.62k
            : request_(std::move(req)), callback_(callback) {
115
1.62k
        this->cntl_ = callback->cntl_;
116
1.62k
        this->response_ = callback->response_;
117
1.62k
    }
_ZN5doris18AutoReleaseClosureINS_22PSendFilterSizeRequestENS_16SyncSizeCallbackEEC2ESt10shared_ptrIS1_ES4_IS2_E
Line
Count
Source
114
97
            : request_(std::move(req)), callback_(callback) {
115
97
        this->cntl_ = callback->cntl_;
116
97
        this->response_ = callback->response_;
117
97
    }
_ZN5doris18AutoReleaseClosureINS_19PMergeFilterRequestENS_23HandleErrorBrpcCallbackINS_20PMergeFilterResponseEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Line
Count
Source
114
2.68k
            : request_(std::move(req)), callback_(callback) {
115
2.68k
        this->cntl_ = callback->cntl_;
116
2.68k
        this->response_ = callback->response_;
117
2.68k
    }
_ZN5doris18AutoReleaseClosureINS_24PTabletWriterOpenRequestENS_17DummyBrpcCallbackINS_23PTabletWriterOpenResultEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Line
Count
Source
114
54.1k
            : request_(std::move(req)), callback_(callback) {
115
54.1k
        this->cntl_ = callback->cntl_;
116
54.1k
        this->response_ = callback->response_;
117
54.1k
    }
_ZN5doris18AutoReleaseClosureINS_28PTabletWriterAddBlockRequestENS_18WriteBlockCallbackINS_27PTabletWriterAddBlockResultEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Line
Count
Source
114
56.4k
            : request_(std::move(req)), callback_(callback) {
115
56.4k
        this->cntl_ = callback->cntl_;
116
56.4k
        this->response_ = callback->response_;
117
56.4k
    }
_ZN5doris18AutoReleaseClosureINS_26PTabletWriterCancelRequestENS_17DummyBrpcCallbackINS_25PTabletWriterCancelResultEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Line
Count
Source
114
126
            : request_(std::move(req)), callback_(callback) {
115
126
        this->cntl_ = callback->cntl_;
116
126
        this->response_ = callback->response_;
117
126
    }
_ZN5doris18AutoReleaseClosureINS_19PTransmitDataParamsENS_20ExchangeSendCallbackINS_19PTransmitDataResultEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Line
Count
Source
114
2.02M
            : request_(std::move(req)), callback_(callback) {
115
2.02M
        this->cntl_ = callback->cntl_;
116
2.02M
        this->response_ = callback->response_;
117
2.02M
    }
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_30PFetchArrowFlightSchemaRequestENS_17DummyBrpcCallbackINS_29PFetchArrowFlightSchemaResultEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_22PFetchArrowDataRequestENS_17DummyBrpcCallbackINS_21PFetchArrowDataResultEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_28PTabletWriteSlaveDoneRequestENS_17DummyBrpcCallbackINS_27PTabletWriteSlaveDoneResultEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_24PTabletWriteSlaveRequestENS_17DummyBrpcCallbackINS_23PTabletWriteSlaveResultEEEEC2ESt10shared_ptrIS1_ES6_IS4_E
118
119
2.12M
    ~AutoReleaseClosure() override = default;
_ZN5doris18AutoReleaseClosureINS_22PSyncFilterSizeRequestENS_23HandleErrorBrpcCallbackINS_23PSyncFilterSizeResponseEEEED2Ev
Line
Count
Source
119
96
    ~AutoReleaseClosure() override = default;
_ZN5doris18AutoReleaseClosureINS_23PPublishFilterRequestV2ENS_23HandleErrorBrpcCallbackINS_22PPublishFilterResponseEEEED2Ev
Line
Count
Source
119
1.62k
    ~AutoReleaseClosure() override = default;
_ZN5doris18AutoReleaseClosureINS_22PSendFilterSizeRequestENS_16SyncSizeCallbackEED2Ev
Line
Count
Source
119
97
    ~AutoReleaseClosure() override = default;
_ZN5doris18AutoReleaseClosureINS_19PMergeFilterRequestENS_23HandleErrorBrpcCallbackINS_20PMergeFilterResponseEEEED2Ev
Line
Count
Source
119
2.68k
    ~AutoReleaseClosure() override = default;
_ZN5doris18AutoReleaseClosureINS_24PTabletWriterOpenRequestENS_17DummyBrpcCallbackINS_23PTabletWriterOpenResultEEEED2Ev
Line
Count
Source
119
54.3k
    ~AutoReleaseClosure() override = default;
_ZN5doris18AutoReleaseClosureINS_28PTabletWriterAddBlockRequestENS_18WriteBlockCallbackINS_27PTabletWriterAddBlockResultEEEED2Ev
Line
Count
Source
119
56.4k
    ~AutoReleaseClosure() override = default;
_ZN5doris18AutoReleaseClosureINS_26PTabletWriterCancelRequestENS_17DummyBrpcCallbackINS_25PTabletWriterCancelResultEEEED2Ev
Line
Count
Source
119
126
    ~AutoReleaseClosure() override = default;
_ZN5doris18AutoReleaseClosureINS_19PTransmitDataParamsENS_20ExchangeSendCallbackINS_19PTransmitDataResultEEEED2Ev
Line
Count
Source
119
2.01M
    ~AutoReleaseClosure() override = default;
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_30PFetchArrowFlightSchemaRequestENS_17DummyBrpcCallbackINS_29PFetchArrowFlightSchemaResultEEEED2Ev
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_22PFetchArrowDataRequestENS_17DummyBrpcCallbackINS_21PFetchArrowDataResultEEEED2Ev
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_28PTabletWriteSlaveDoneRequestENS_17DummyBrpcCallbackINS_27PTabletWriteSlaveDoneResultEEEED2Ev
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_24PTabletWriteSlaveRequestENS_17DummyBrpcCallbackINS_23PTabletWriteSlaveResultEEEED2Ev
120
121
    // Will delete itself. all operations should be done in callback's call(). Run() only do one thing.
122
2.13M
    void Run() override {
123
2.13M
        Defer defer {[&]() { delete this; }};
_ZZN5doris18AutoReleaseClosureINS_22PSyncFilterSizeRequestENS_23HandleErrorBrpcCallbackINS_23PSyncFilterSizeResponseEEEE3RunEvENKUlvE_clEv
Line
Count
Source
123
96
        Defer defer {[&]() { delete this; }};
_ZZN5doris18AutoReleaseClosureINS_23PPublishFilterRequestV2ENS_23HandleErrorBrpcCallbackINS_22PPublishFilterResponseEEEE3RunEvENKUlvE_clEv
Line
Count
Source
123
1.62k
        Defer defer {[&]() { delete this; }};
_ZZN5doris18AutoReleaseClosureINS_22PSendFilterSizeRequestENS_16SyncSizeCallbackEE3RunEvENKUlvE_clEv
Line
Count
Source
123
97
        Defer defer {[&]() { delete this; }};
_ZZN5doris18AutoReleaseClosureINS_19PMergeFilterRequestENS_23HandleErrorBrpcCallbackINS_20PMergeFilterResponseEEEE3RunEvENKUlvE_clEv
Line
Count
Source
123
2.68k
        Defer defer {[&]() { delete this; }};
_ZZN5doris18AutoReleaseClosureINS_24PTabletWriterOpenRequestENS_17DummyBrpcCallbackINS_23PTabletWriterOpenResultEEEE3RunEvENKUlvE_clEv
Line
Count
Source
123
54.4k
        Defer defer {[&]() { delete this; }};
_ZZN5doris18AutoReleaseClosureINS_28PTabletWriterAddBlockRequestENS_18WriteBlockCallbackINS_27PTabletWriterAddBlockResultEEEE3RunEvENKUlvE_clEv
Line
Count
Source
123
56.4k
        Defer defer {[&]() { delete this; }};
_ZZN5doris18AutoReleaseClosureINS_26PTabletWriterCancelRequestENS_17DummyBrpcCallbackINS_25PTabletWriterCancelResultEEEE3RunEvENKUlvE_clEv
Line
Count
Source
123
126
        Defer defer {[&]() { delete this; }};
_ZZN5doris18AutoReleaseClosureINS_19PTransmitDataParamsENS_20ExchangeSendCallbackINS_19PTransmitDataResultEEEE3RunEvENKUlvE_clEv
Line
Count
Source
123
2.01M
        Defer defer {[&]() { delete this; }};
Unexecuted instantiation: _ZZN5doris18AutoReleaseClosureINS_30PFetchArrowFlightSchemaRequestENS_17DummyBrpcCallbackINS_29PFetchArrowFlightSchemaResultEEEE3RunEvENKUlvE_clEv
Unexecuted instantiation: _ZZN5doris18AutoReleaseClosureINS_22PFetchArrowDataRequestENS_17DummyBrpcCallbackINS_21PFetchArrowDataResultEEEE3RunEvENKUlvE_clEv
Unexecuted instantiation: _ZZN5doris18AutoReleaseClosureINS_28PTabletWriteSlaveDoneRequestENS_17DummyBrpcCallbackINS_27PTabletWriteSlaveDoneResultEEEE3RunEvENKUlvE_clEv
Unexecuted instantiation: _ZZN5doris18AutoReleaseClosureINS_24PTabletWriteSlaveRequestENS_17DummyBrpcCallbackINS_23PTabletWriteSlaveResultEEEE3RunEvENKUlvE_clEv
124
2.13M
        if (auto tmp = callback_.lock()) {
125
2.13M
            tmp->call();
126
2.13M
        }
127
2.13M
    }
_ZN5doris18AutoReleaseClosureINS_22PSyncFilterSizeRequestENS_23HandleErrorBrpcCallbackINS_23PSyncFilterSizeResponseEEEE3RunEv
Line
Count
Source
122
96
    void Run() override {
123
96
        Defer defer {[&]() { delete this; }};
124
96
        if (auto tmp = callback_.lock()) {
125
96
            tmp->call();
126
96
        }
127
96
    }
_ZN5doris18AutoReleaseClosureINS_23PPublishFilterRequestV2ENS_23HandleErrorBrpcCallbackINS_22PPublishFilterResponseEEEE3RunEv
Line
Count
Source
122
1.62k
    void Run() override {
123
1.62k
        Defer defer {[&]() { delete this; }};
124
1.62k
        if (auto tmp = callback_.lock()) {
125
1.62k
            tmp->call();
126
1.62k
        }
127
1.62k
    }
_ZN5doris18AutoReleaseClosureINS_22PSendFilterSizeRequestENS_16SyncSizeCallbackEE3RunEv
Line
Count
Source
122
97
    void Run() override {
123
97
        Defer defer {[&]() { delete this; }};
124
97
        if (auto tmp = callback_.lock()) {
125
96
            tmp->call();
126
96
        }
127
97
    }
_ZN5doris18AutoReleaseClosureINS_19PMergeFilterRequestENS_23HandleErrorBrpcCallbackINS_20PMergeFilterResponseEEEE3RunEv
Line
Count
Source
122
2.68k
    void Run() override {
123
2.68k
        Defer defer {[&]() { delete this; }};
124
2.68k
        if (auto tmp = callback_.lock()) {
125
2.67k
            tmp->call();
126
2.67k
        }
127
2.68k
    }
_ZN5doris18AutoReleaseClosureINS_24PTabletWriterOpenRequestENS_17DummyBrpcCallbackINS_23PTabletWriterOpenResultEEEE3RunEv
Line
Count
Source
122
54.3k
    void Run() override {
123
54.3k
        Defer defer {[&]() { delete this; }};
124
54.4k
        if (auto tmp = callback_.lock()) {
125
54.4k
            tmp->call();
126
54.4k
        }
127
54.3k
    }
_ZN5doris18AutoReleaseClosureINS_28PTabletWriterAddBlockRequestENS_18WriteBlockCallbackINS_27PTabletWriterAddBlockResultEEEE3RunEv
Line
Count
Source
122
56.4k
    void Run() override {
123
56.4k
        Defer defer {[&]() { delete this; }};
124
56.4k
        if (auto tmp = callback_.lock()) {
125
56.4k
            tmp->call();
126
56.4k
        }
127
56.4k
    }
_ZN5doris18AutoReleaseClosureINS_26PTabletWriterCancelRequestENS_17DummyBrpcCallbackINS_25PTabletWriterCancelResultEEEE3RunEv
Line
Count
Source
122
126
    void Run() override {
123
126
        Defer defer {[&]() { delete this; }};
124
126
        if (auto tmp = callback_.lock()) {
125
0
            tmp->call();
126
0
        }
127
126
    }
_ZN5doris18AutoReleaseClosureINS_19PTransmitDataParamsENS_20ExchangeSendCallbackINS_19PTransmitDataResultEEEE3RunEv
Line
Count
Source
122
2.01M
    void Run() override {
123
2.01M
        Defer defer {[&]() { delete this; }};
124
2.02M
        if (auto tmp = callback_.lock()) {
125
2.02M
            tmp->call();
126
2.02M
        }
127
2.01M
    }
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_30PFetchArrowFlightSchemaRequestENS_17DummyBrpcCallbackINS_29PFetchArrowFlightSchemaResultEEEE3RunEv
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_22PFetchArrowDataRequestENS_17DummyBrpcCallbackINS_21PFetchArrowDataResultEEEE3RunEv
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_28PTabletWriteSlaveDoneRequestENS_17DummyBrpcCallbackINS_27PTabletWriteSlaveDoneResultEEEE3RunEv
Unexecuted instantiation: _ZN5doris18AutoReleaseClosureINS_24PTabletWriteSlaveRequestENS_17DummyBrpcCallbackINS_23PTabletWriteSlaveResultEEEE3RunEv
128
129
    // controller has to be the same lifecycle with the closure, because brpc may use
130
    // it in any stage of the rpc.
131
    std::shared_ptr<brpc::Controller> cntl_;
132
    // We do not know if brpc will use request or response after brpc method returns.
133
    // So that we need keep a shared ptr here to ensure that brpc could use req/rep
134
    // at any stage.
135
    std::shared_ptr<Request> request_;
136
    std::shared_ptr<ResponseType> response_;
137
138
private:
139
    std::weak_ptr<Callback> callback_;
140
};
141
142
} // namespace doris