Rename cluster_client to osd_messenger

sync-io-test
Vitaliy Filippov 2020-06-04 12:57:48 +03:00
parent 05ea97119f
commit 2f6cf605a1
6 changed files with 38 additions and 38 deletions

View File

@ -14,8 +14,8 @@ libblockstore.so: $(BLOCKSTORE_OBJS)
libfio_blockstore.so: ./libblockstore.so fio_engine.cpp json11.o
g++ $(CXXFLAGS) -shared -o libfio_blockstore.so fio_engine.cpp json11.o ./libblockstore.so -ltcmalloc_minimal -luring
OSD_OBJS := osd.o osd_secondary.o osd_receive.o osd_send.o osd_peering.o osd_flush.o osd_peering_pg.o \
osd_primary.o osd_primary_subops.o etcd_state_client.o cluster_client.o osd_cluster.o http_client.o pg_states.o \
OSD_OBJS := osd.o osd_secondary.o msgr_receive.o msgr_send.o osd_peering.o osd_flush.o osd_peering_pg.o \
osd_primary.o osd_primary_subops.o etcd_state_client.o messenger.o osd_cluster.o http_client.o pg_states.o \
osd_rmw.o json11.o base64.o timerfd_manager.o
osd: ./libblockstore.so osd_main.cpp osd.h osd_ops.h $(OSD_OBJS)
@ -72,7 +72,7 @@ blockstore_sync.o: blockstore_sync.cpp allocator.h blockstore.h blockstore_flush
g++ $(CXXFLAGS) -c -o $@ $<
blockstore_write.o: blockstore_write.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
g++ $(CXXFLAGS) -c -o $@ $<
cluster_client.o: cluster_client.cpp cluster_client.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
messenger.o: messenger.cpp messenger.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
dump_journal.o: dump_journal.cpp allocator.h blockstore.h blockstore_flush.h blockstore_impl.h blockstore_init.h blockstore_journal.h cpp-btree/btree_map.h crc32c.h object_id.h ringloop.h
g++ $(CXXFLAGS) -c -o $@ $<
@ -84,33 +84,33 @@ fio_sec_osd.o: fio_sec_osd.cpp fio/fio.h fio/optgroup.h object_id.h osd_id.h osd
g++ $(CXXFLAGS) -c -o $@ $<
http_client.o: http_client.cpp http_client.h json11/json11.hpp timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd.o: osd.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
osd.o: osd.cpp blockstore.h messenger.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_cluster.o: osd_cluster.cpp base64.h blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
osd_cluster.o: osd_cluster.cpp base64.h blockstore.h messenger.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_flush.o: osd_flush.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
osd_flush.o: osd_flush.cpp blockstore.h messenger.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_main.o: osd_main.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
osd_main.o: osd_main.cpp blockstore.h messenger.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_peering.o: osd_peering.cpp base64.h blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
osd_peering.o: osd_peering.cpp base64.h blockstore.h messenger.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_peering_pg.o: osd_peering_pg.cpp cpp-btree/btree_map.h object_id.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_peering_pg_test.o: osd_peering_pg_test.cpp cpp-btree/btree_map.h object_id.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_primary.o: osd_primary.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h osd_primary.h osd_rmw.h pg_states.h ringloop.h timerfd_manager.h
osd_primary.o: osd_primary.cpp blockstore.h messenger.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h osd_primary.h osd_rmw.h pg_states.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_primary_subops.o: osd_primary_subops.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h osd_primary.h osd_rmw.h pg_states.h ringloop.h timerfd_manager.h
osd_primary_subops.o: osd_primary_subops.cpp blockstore.h messenger.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h osd_primary.h osd_rmw.h pg_states.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_receive.o: osd_receive.cpp cluster_client.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
msgr_receive.o: msgr_receive.cpp messenger.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_rmw.o: osd_rmw.cpp object_id.h osd_id.h osd_rmw.h xor.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_rmw_test.o: osd_rmw_test.cpp object_id.h osd_id.h osd_rmw.cpp osd_rmw.h test_pattern.h xor.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_secondary.o: osd_secondary.cpp blockstore.h cluster_client.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
osd_secondary.o: osd_secondary.cpp blockstore.h messenger.h cpp-btree/btree_map.h etcd_state_client.h http_client.h json11/json11.hpp object_id.h osd.h osd_id.h osd_ops.h osd_peering_pg.h pg_states.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_send.o: osd_send.cpp cluster_client.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
msgr_send.o: msgr_send.cpp messenger.h json11/json11.hpp object_id.h osd_id.h osd_ops.h ringloop.h timerfd_manager.h
g++ $(CXXFLAGS) -c -o $@ $<
osd_test.o: osd_test.cpp object_id.h osd_id.h osd_ops.h rw_blocking.h test_pattern.h
g++ $(CXXFLAGS) -c -o $@ $<

View File

@ -4,7 +4,7 @@
#include <sys/epoll.h>
#include <netinet/tcp.h>
#include "cluster_client.h"
#include "messenger.h"
osd_op_t::~osd_op_t()
{
@ -22,7 +22,7 @@ osd_op_t::~osd_op_t()
}
}
void cluster_client_t::connect_peer(uint64_t peer_osd, json11::Json address_list, int port)
void osd_messenger_t::connect_peer(uint64_t peer_osd, json11::Json address_list, int port)
{
if (wanted_peers.find(peer_osd) == wanted_peers.end())
{
@ -44,7 +44,7 @@ void cluster_client_t::connect_peer(uint64_t peer_osd, json11::Json address_list
}
}
void cluster_client_t::try_connect_peer(uint64_t peer_osd)
void osd_messenger_t::try_connect_peer(uint64_t peer_osd)
{
auto wp_it = wanted_peers.find(peer_osd);
if (wp_it == wanted_peers.end())
@ -66,7 +66,7 @@ void cluster_client_t::try_connect_peer(uint64_t peer_osd)
try_connect_peer_addr(peer_osd, wp.cur_addr.c_str(), wp.cur_port);
}
void cluster_client_t::try_connect_peer_addr(osd_num_t peer_osd, const char *peer_host, int peer_port)
void osd_messenger_t::try_connect_peer_addr(osd_num_t peer_osd, const char *peer_host, int peer_port)
{
struct sockaddr_in addr;
int r;
@ -119,7 +119,7 @@ void cluster_client_t::try_connect_peer_addr(osd_num_t peer_osd, const char *pee
});
}
void cluster_client_t::handle_connect_epoll(int peer_fd)
void osd_messenger_t::handle_connect_epoll(int peer_fd)
{
auto & cl = clients[peer_fd];
if (cl.connect_timeout_id >= 0)
@ -152,7 +152,7 @@ void cluster_client_t::handle_connect_epoll(int peer_fd)
check_peer_config(cl);
}
void cluster_client_t::handle_peer_epoll(int peer_fd, int epoll_events)
void osd_messenger_t::handle_peer_epoll(int peer_fd, int epoll_events)
{
// Mark client as ready (i.e. some data is available)
if (epoll_events & EPOLLRDHUP)
@ -174,7 +174,7 @@ void cluster_client_t::handle_peer_epoll(int peer_fd, int epoll_events)
}
}
void cluster_client_t::on_connect_peer(osd_num_t peer_osd, int peer_fd)
void osd_messenger_t::on_connect_peer(osd_num_t peer_osd, int peer_fd)
{
auto & wp = wanted_peers.at(peer_osd);
wp.connecting = false;
@ -210,7 +210,7 @@ void cluster_client_t::on_connect_peer(osd_num_t peer_osd, int peer_fd)
repeer_pgs(peer_osd);
}
void cluster_client_t::check_peer_config(osd_client_t & cl)
void osd_messenger_t::check_peer_config(osd_client_t & cl)
{
osd_op_t *op = new osd_op_t();
op->op_type = OSD_OP_OUT;
@ -264,7 +264,7 @@ void cluster_client_t::check_peer_config(osd_client_t & cl)
outbox_push(op);
}
void cluster_client_t::cancel_osd_ops(osd_client_t & cl)
void osd_messenger_t::cancel_osd_ops(osd_client_t & cl)
{
for (auto p: cl.sent_ops)
{
@ -283,7 +283,7 @@ void cluster_client_t::cancel_osd_ops(osd_client_t & cl)
}
}
void cluster_client_t::cancel_op(osd_op_t *op)
void osd_messenger_t::cancel_op(osd_op_t *op)
{
if (op->op_type == OSD_OP_OUT)
{
@ -301,7 +301,7 @@ void cluster_client_t::cancel_op(osd_op_t *op)
}
}
void cluster_client_t::stop_client(int peer_fd)
void osd_messenger_t::stop_client(int peer_fd)
{
assert(peer_fd != 0);
auto it = clients.find(peer_fd);

View File

@ -158,7 +158,7 @@ struct osd_op_stats_t
uint64_t subop_stat_count[OSD_OP_MAX+1] = { 0 };
};
struct cluster_client_t
struct osd_messenger_t
{
timerfd_manager_t *tfd;
ring_loop_t *ringloop;

View File

@ -1,6 +1,6 @@
#include "cluster_client.h"
#include "messenger.h"
void cluster_client_t::read_requests()
void osd_messenger_t::read_requests()
{
for (int i = 0; i < read_ready_clients.size(); i++)
{
@ -31,7 +31,7 @@ void cluster_client_t::read_requests()
read_ready_clients.clear();
}
bool cluster_client_t::handle_read(int result, int peer_fd)
bool osd_messenger_t::handle_read(int result, int peer_fd)
{
auto cl_it = clients.find(peer_fd);
if (cl_it != clients.end())
@ -111,7 +111,7 @@ bool cluster_client_t::handle_read(int result, int peer_fd)
return false;
}
void cluster_client_t::handle_finished_read(osd_client_t & cl)
void osd_messenger_t::handle_finished_read(osd_client_t & cl)
{
if (cl.read_state == CL_READ_HDR)
{
@ -159,7 +159,7 @@ void cluster_client_t::handle_finished_read(osd_client_t & cl)
}
}
void cluster_client_t::handle_op_hdr(osd_client_t *cl)
void osd_messenger_t::handle_op_hdr(osd_client_t *cl)
{
osd_op_t *cur_op = cl->read_op;
if (cur_op->req.hdr.opcode == OSD_OP_SECONDARY_READ)
@ -209,7 +209,7 @@ void cluster_client_t::handle_op_hdr(osd_client_t *cl)
}
}
void cluster_client_t::handle_reply_hdr(osd_client_t *cl)
void osd_messenger_t::handle_reply_hdr(osd_client_t *cl)
{
osd_op_t *cur_op = cl->read_op;
auto req_it = cl->sent_ops.find(cur_op->req.hdr.id);

View File

@ -1,6 +1,6 @@
#include "cluster_client.h"
#include "messenger.h"
void cluster_client_t::outbox_push(osd_op_t *cur_op)
void osd_messenger_t::outbox_push(osd_op_t *cur_op)
{
assert(cur_op->peer_fd);
auto & cl = clients.at(cur_op->peer_fd);
@ -39,7 +39,7 @@ void cluster_client_t::outbox_push(osd_op_t *cur_op)
}
}
bool cluster_client_t::try_send(osd_client_t & cl)
bool osd_messenger_t::try_send(osd_client_t & cl)
{
int peer_fd = cl.peer_fd;
io_uring_sqe* sqe = ringloop->get_sqe();
@ -89,7 +89,7 @@ bool cluster_client_t::try_send(osd_client_t & cl)
return true;
}
void cluster_client_t::send_replies()
void osd_messenger_t::send_replies()
{
for (int i = 0; i < write_ready_clients.size(); i++)
{
@ -103,7 +103,7 @@ void cluster_client_t::send_replies()
write_ready_clients.clear();
}
void cluster_client_t::handle_send(int result, int peer_fd)
void osd_messenger_t::handle_send(int result, int peer_fd)
{
auto cl_it = clients.find(peer_fd);
if (cl_it != clients.end())

4
osd.h
View File

@ -17,7 +17,7 @@
#include "ringloop.h"
#include "timerfd_manager.h"
#include "osd_peering_pg.h"
#include "cluster_client.h"
#include "messenger.h"
#include "etcd_state_client.h"
#define OSD_LOADING_PGS 0x01
@ -78,7 +78,7 @@ class osd_t
// cluster state
etcd_state_client_t st_cli;
cluster_client_t c_cli;
osd_messenger_t c_cli;
int etcd_failed_attempts = 0;
std::string etcd_lease_id;
json11::Json self_state;