diff options
author | Håvard Pettersen <havardpe@yahooinc.com> | 2023-03-06 11:42:42 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@yahooinc.com> | 2023-03-06 15:11:11 +0000 |
commit | 793a0bbc6c8bedcf0ee5de51be687d760defcd57 (patch) | |
tree | 016f83e652b0734aa3555df9332c72f9a82ff424 /searchlib | |
parent | 9a95875744e88f29cb4a78f8bb31bab13e7cec4d (diff) |
use ref_counted in fnet
also get rid of some cleanup functions on reference counted classes
enable specifying low-level parameters to addref/subref (cnt/reserve)
Diffstat (limited to 'searchlib')
4 files changed, 24 insertions, 24 deletions
diff --git a/searchlib/src/tests/engine/proto_rpc_adapter/proto_rpc_adapter_test.cpp b/searchlib/src/tests/engine/proto_rpc_adapter/proto_rpc_adapter_test.cpp index 9c5e000c314..09fb0981a24 100644 --- a/searchlib/src/tests/engine/proto_rpc_adapter/proto_rpc_adapter_test.cpp +++ b/searchlib/src/tests/engine/proto_rpc_adapter/proto_rpc_adapter_test.cpp @@ -124,8 +124,8 @@ TEST_F(ProtoRpcAdapterTest, require_that_plain_rpc_ping_works) { req->SetMethodName("frt.rpc.ping"); target->InvokeSync(req, 60.0); EXPECT_TRUE(req->CheckReturnTypes("")); - req->SubRef(); - target->SubRef(); + req->internal_subref(); + target->internal_subref(); } TEST_F(ProtoRpcAdapterTest, require_that_proto_rpc_search_works) { @@ -145,9 +145,9 @@ TEST_F(ProtoRpcAdapterTest, require_that_proto_rpc_search_works) { EXPECT_EQ(std::string(rpc->GetErrorMessage()), std::string("Server not online")); adapter.set_online(); } - rpc->SubRef(); + rpc->internal_subref(); } - target->SubRef(); + target->internal_subref(); SearchProtocolMetrics &metrics = adapter.metrics(); EXPECT_EQ(metrics.query().latency.getCount(), 2); EXPECT_GT(metrics.query().latency.getTotal(), 0.0); @@ -180,9 +180,9 @@ TEST_F(ProtoRpcAdapterTest, require_that_proto_rpc_getDocsums_works) { EXPECT_EQ(std::string(rpc->GetErrorMessage()), std::string("Server not online")); adapter.set_online(); } - rpc->SubRef(); + rpc->internal_subref(); } - target->SubRef(); + target->internal_subref(); SearchProtocolMetrics &metrics = adapter.metrics(); EXPECT_EQ(metrics.query().latency.getCount(), 0); EXPECT_EQ(metrics.docsum().latency.getCount(), 2); @@ -208,9 +208,9 @@ TEST_F(ProtoRpcAdapterTest, require_that_proto_rpc_ping_works) { EXPECT_EQ(std::string(rpc->GetErrorMessage()), std::string("Server not online")); adapter.set_online(); } - rpc->SubRef(); + rpc->internal_subref(); } - target->SubRef(); + target->internal_subref(); SearchProtocolMetrics &metrics = adapter.metrics(); EXPECT_EQ(metrics.query().latency.getCount(), 0); EXPECT_EQ(metrics.docsum().latency.getCount(), 0); diff --git a/searchlib/src/vespa/searchlib/transactionlog/client_session.cpp b/searchlib/src/vespa/searchlib/transactionlog/client_session.cpp index c44edfcec86..f5cc3c0b247 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/client_session.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/client_session.cpp @@ -54,7 +54,7 @@ Session::commit(const vespalib::ConstBufferRef & buf) int retcode = _tlc.rpc(req); retval = (retcode == 0); if (retval) { - req->SubRef(); + req->internal_subref(); } else { vespalib::string msg; if (req->GetReturn() != nullptr) { @@ -62,7 +62,7 @@ Session::commit(const vespalib::ConstBufferRef & buf) } else { msg = vespalib::make_string("Clientside error %s: error(%d): %s", req->GetMethodName(), req->GetErrorCode(), req->GetErrorMessage()); } - req->SubRef(); + req->internal_subref(); throw std::runtime_error(vespalib::make_string("commit failed with code %d. server says: %s", retcode, msg.c_str())); } } @@ -81,7 +81,7 @@ Session::status(SerialNum & b, SerialNum & e, size_t & count) e = req->GetReturn()->GetValue(2)._intval64; count = req->GetReturn()->GetValue(3)._intval64; } - req->SubRef(); + req->internal_subref(); return (retval == 0); } @@ -93,7 +93,7 @@ Session::erase(const SerialNum & to) req->GetParams()->AddString(_domain.c_str()); req->GetParams()->AddInt64(to); int32_t retval(_tlc.rpc(req)); - req->SubRef(); + req->internal_subref(); if (retval == 1) { LOG(warning, "Prune to %" PRIu64 " denied since there were active visitors in that area", to); } @@ -113,7 +113,7 @@ Session::sync(const SerialNum &syncTo, SerialNum &syncedTo) if (retval == 0) { syncedTo = req->GetReturn()->GetValue(1)._intval64; } - req->SubRef(); + req->internal_subref(); return (retval == 0); } @@ -138,7 +138,7 @@ bool Session::init(FRT_RPCRequest *req) { int32_t retval(_tlc.rpc(req)); - req->SubRef(); + req->internal_subref(); if (retval > 0) { clear(); _sessionId = retval; @@ -171,7 +171,7 @@ Session::run() req->GetParams()->AddString(_domain.c_str()); req->GetParams()->AddInt32(_sessionId); int32_t retval(_tlc.rpc(req)); - req->SubRef(); + req->internal_subref(); return (retval == 0); } @@ -188,7 +188,7 @@ Session::close() if ( (retval = _tlc.rpc(req)) > 0) { std::this_thread::sleep_for(10ms); } - req->SubRef(); + req->internal_subref(); } while ( retval == 1 ); } return (retval == 0); diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp index 17f06b189c6..8916a4cf0b5 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.cpp @@ -80,7 +80,7 @@ void TransLogClient::disconnect() { if (_target) { - _target->SubRef(); + _target->internal_subref(); } } @@ -91,7 +91,7 @@ TransLogClient::create(const vespalib::string & domain) req->SetMethodName("createDomain"); req->GetParams()->AddString(domain.c_str()); int32_t retval(rpc(req)); - req->SubRef(); + req->internal_subref(); return (retval == 0); } @@ -102,7 +102,7 @@ TransLogClient::remove(const vespalib::string & domain) req->SetMethodName("deleteDomain"); req->GetParams()->AddString(domain.c_str()); int32_t retval(rpc(req)); - req->SubRef(); + req->internal_subref(); return (retval == 0); } @@ -113,7 +113,7 @@ TransLogClient::open(const vespalib::string & domain) req->SetMethodName("openDomain"); req->GetParams()->AddString(domain.c_str()); int32_t retval(rpc(req)); - req->SubRef(); + req->internal_subref(); if (retval == 0) { return std::make_unique<Session>(domain, *this); } @@ -138,7 +138,7 @@ TransLogClient::listDomains(std::vector<vespalib::string> & dir) dir.push_back(d); } } - req->SubRef(); + req->internal_subref(); return (retval == 0); } diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp index c96b0cdcd61..db02f4f037e 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp @@ -361,9 +361,9 @@ public: RPCDestination(FRT_Supervisor & supervisor, FNET_Connection * connection) : _supervisor(supervisor), _connection(connection), _ok(true) { - _connection->AddRef(); + _connection->internal_addref(); } - ~RPCDestination() override { _connection->SubRef(); } + ~RPCDestination() override { _connection->internal_subref(); } bool ok() const override { return _ok; @@ -395,7 +395,7 @@ private: if ( ! ((retval == client::RPC::OK) || (retval == FRTE_RPC_CONNECTION)) ) { LOG(error, "Return value != OK(%d) in send for method 'visitCallback'.", retval); } - req->SubRef(); + req->internal_subref(); return (retval == client::RPC::OK); } |