thrift: Keep sharded query processor reference on controller

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2020-10-07 21:22:44 +03:00
parent cf172cf656
commit c887d0df4c
3 changed files with 8 additions and 5 deletions

View File

@@ -1209,7 +1209,7 @@ int main(int ac, char** av) {
api::unset_transport_controller(ctx).get();
});
::thrift_controller thrift_ctl(db, auth_service);
::thrift_controller thrift_ctl(db, auth_service, qp);
ss.register_client_shutdown_hook("rpc server", [&thrift_ctl] {
thrift_ctl.stop().get();

View File

@@ -27,10 +27,11 @@
static logging::logger clogger("thrift_controller");
thrift_controller::thrift_controller(distributed<database>& db, sharded<auth::service>& auth)
thrift_controller::thrift_controller(distributed<database>& db, sharded<auth::service>& auth, sharded<cql3::query_processor>& qp)
: _ops_sem(1)
, _db(db)
, _auth_service(auth) {
, _auth_service(auth)
, _qp(qp) {
}
future<> thrift_controller::start_server() {
@@ -61,7 +62,7 @@ future<> thrift_controller::do_start_server() {
tsc.timeout_config = make_timeout_config(cfg);
tsc.max_request_size = cfg.thrift_max_message_length_in_mb() * (uint64_t(1) << 20);
return gms::inet_address::lookup(addr, family, preferred).then([this, tserver, addr, port, keepalive, tsc] (gms::inet_address ip) {
return tserver->start(std::ref(_db), std::ref(cql3::get_query_processor()), std::ref(_auth_service), tsc).then([tserver, port, addr, ip, keepalive] {
return tserver->start(std::ref(_db), std::ref(_qp), std::ref(_auth_service), tsc).then([tserver, port, addr, ip, keepalive] {
// #293 - do not stop anything
//engine().at_exit([tserver] {
// return tserver->stop();

View File

@@ -30,6 +30,7 @@ using namespace seastar;
class thrift_server;
class database;
namespace auth { class service; }
namespace cql3 { class query_processor; }
class thrift_controller {
std::unique_ptr<distributed<thrift_server>> _server;
@@ -38,12 +39,13 @@ class thrift_controller {
distributed<database>& _db;
sharded<auth::service>& _auth_service;
sharded<cql3::query_processor>& _qp;
future<> do_start_server();
future<> do_stop_server();
public:
thrift_controller(distributed<database>&, sharded<auth::service>&);
thrift_controller(distributed<database>&, sharded<auth::service>&, sharded<cql3::query_processor>&);
future<> start_server();
future<> stop_server();
future<> stop();