mirror of
https://github.com/ceph/ceph
synced 2025-03-31 16:25:56 +00:00
crimson/net: add logic_name to indicate the msgr role for debugging
Signed-off-by: Yingxin <yingxin.cheng@intel.com>
This commit is contained in:
parent
7a2f4bf925
commit
25ae94fda9
@ -22,8 +22,9 @@
|
||||
|
||||
using namespace ceph::net;
|
||||
|
||||
SocketMessenger::SocketMessenger(const entity_name_t& myname)
|
||||
: Messenger{myname}
|
||||
SocketMessenger::SocketMessenger(const entity_name_t& myname,
|
||||
const std::string& logic_name)
|
||||
: Messenger{myname}, logic_name{logic_name}
|
||||
{}
|
||||
|
||||
void SocketMessenger::bind(const entity_addr_t& addr)
|
||||
|
@ -36,12 +36,15 @@ class SocketMessenger final : public Messenger {
|
||||
std::set<SocketConnectionRef> accepting_conns;
|
||||
using Throttle = ceph::thread::Throttle;
|
||||
ceph::net::PolicySet<Throttle> policy_set;
|
||||
// Distinguish messengers with meaningful names for debugging
|
||||
const std::string logic_name;
|
||||
|
||||
seastar::future<> accept(seastar::connected_socket socket,
|
||||
seastar::socket_address paddr);
|
||||
|
||||
public:
|
||||
SocketMessenger(const entity_name_t& myname);
|
||||
SocketMessenger(const entity_name_t& myname,
|
||||
const std::string& logic_name);
|
||||
|
||||
void bind(const entity_addr_t& addr) override;
|
||||
|
||||
@ -54,7 +57,8 @@ class SocketMessenger final : public Messenger {
|
||||
|
||||
void print(ostream& out) const override {
|
||||
out << get_myname()
|
||||
<< " " << get_myaddr();
|
||||
<< "(" << logic_name
|
||||
<< ") " << get_myaddr();
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -39,7 +39,7 @@ struct DummyAuthAuthorizer : public AuthAuthorizer {
|
||||
struct Server {
|
||||
ceph::thread::Throttle byte_throttler;
|
||||
static constexpr int64_t server_num = 0;
|
||||
ceph::net::SocketMessenger msgr{entity_name_t::OSD(server_num)};
|
||||
ceph::net::SocketMessenger msgr{entity_name_t::OSD(server_num), "server"};
|
||||
struct ServerDispatcher : ceph::net::Dispatcher {
|
||||
unsigned count = 0;
|
||||
seastar::condition_variable on_reply;
|
||||
@ -76,7 +76,7 @@ struct Server {
|
||||
struct Client {
|
||||
ceph::thread::Throttle byte_throttler;
|
||||
static constexpr int64_t client_num = 1;
|
||||
ceph::net::SocketMessenger msgr{entity_name_t::OSD(client_num)};
|
||||
ceph::net::SocketMessenger msgr{entity_name_t::OSD(client_num), "client"};
|
||||
struct ClientDispatcher : ceph::net::Dispatcher {
|
||||
unsigned count = 0;
|
||||
seastar::condition_variable on_reply;
|
||||
|
@ -22,7 +22,7 @@ static seastar::future<> test_echo(unsigned rounds,
|
||||
entity_addr_t addr;
|
||||
|
||||
struct {
|
||||
ceph::net::SocketMessenger messenger{entity_name_t::OSD(1)};
|
||||
ceph::net::SocketMessenger messenger{entity_name_t::OSD(1), "server1"};
|
||||
struct ServerDispatcher : ceph::net::Dispatcher {
|
||||
seastar::future<> ms_dispatch(ceph::net::ConnectionRef c,
|
||||
MessageRef m) override {
|
||||
@ -38,7 +38,7 @@ static seastar::future<> test_echo(unsigned rounds,
|
||||
struct {
|
||||
unsigned rounds;
|
||||
std::bernoulli_distribution keepalive_dist{};
|
||||
ceph::net::SocketMessenger messenger{entity_name_t::OSD(0)};
|
||||
ceph::net::SocketMessenger messenger{entity_name_t::OSD(0), "client1"};
|
||||
struct ClientDispatcher : ceph::net::Dispatcher {
|
||||
seastar::promise<MessageRef> reply;
|
||||
unsigned count = 0u;
|
||||
@ -127,7 +127,7 @@ static seastar::future<> test_concurrent_dispatch()
|
||||
entity_addr_t addr;
|
||||
|
||||
struct {
|
||||
ceph::net::SocketMessenger messenger{entity_name_t::OSD(1)};
|
||||
ceph::net::SocketMessenger messenger{entity_name_t::OSD(1), "server2"};
|
||||
class ServerDispatcher : public ceph::net::Dispatcher {
|
||||
int count = 0;
|
||||
seastar::promise<> on_second; // satisfied on second dispatch
|
||||
@ -151,7 +151,7 @@ static seastar::future<> test_concurrent_dispatch()
|
||||
} server;
|
||||
|
||||
struct {
|
||||
ceph::net::SocketMessenger messenger{entity_name_t::OSD(0)};
|
||||
ceph::net::SocketMessenger messenger{entity_name_t::OSD(0), "client2"};
|
||||
ceph::net::Dispatcher dispatcher;
|
||||
} client;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ static seastar::future<> test_monc()
|
||||
conf->cluster = cluster;
|
||||
return conf.parse_config_files(conf_file_list);
|
||||
}).then([] {
|
||||
return seastar::do_with(ceph::net::SocketMessenger{entity_name_t::OSD(0)},
|
||||
return seastar::do_with(ceph::net::SocketMessenger{entity_name_t::OSD(0), "monc"},
|
||||
[](ceph::net::Messenger& msgr) {
|
||||
auto& conf = ceph::common::local_conf();
|
||||
if (conf->ms_crc_data) {
|
||||
|
Loading…
Reference in New Issue
Block a user