Skip to content

Commit

Permalink
Renamed rpc_port to state_transfer_port globally
Browse files Browse the repository at this point in the history
Since it's not likely that we will completely eliminate TCP sockets from
ViewManager any time soon (see issues #118 and #157), we should at least
make our usage of TCP less confusing. The port named "rpc_port" in all
of our configuration files is actually not used for RPC operations at
all, but for transferring Views and object state between nodes during a
view change. Renaming this port will make it clear that there is no RPC
activity going over TCP.
  • Loading branch information
etremel committed May 15, 2020
1 parent bc88308 commit 5aa1e1a
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 113 deletions.
34 changes: 17 additions & 17 deletions README.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions include/derecho/conf/conf.hpp
Expand Up @@ -26,14 +26,14 @@ class Conf {
#define CONF_DERECHO_LOCAL_ID "DERECHO/local_id"
#define CONF_DERECHO_LOCAL_IP "DERECHO/local_ip"
#define CONF_DERECHO_GMS_PORT "DERECHO/gms_port"
#define CONF_DERECHO_RPC_PORT "DERECHO/rpc_port"
#define CONF_DERECHO_STATE_TRANSFER_PORT "DERECHO/state_transfer_port"
#define CONF_DERECHO_SST_PORT "DERECHO/sst_port"
#define CONF_DERECHO_RDMC_PORT "DERECHO/rdmc_port"
#define CONF_DERECHO_EXTERNAL_PORT "DERECHO/external_port"
#define CONF_DERECHO_HEARTBEAT_MS "DERECHO/heartbeat_ms"
#define CONF_DERECHO_SST_POLL_CQ_TIMEOUT_MS "DERECHO/sst_poll_cq_timeout_ms"
#define CONF_DERECHO_RESTART_TIMEOUT_MS "DERECHO/restart_timeout_ms"
#define CONF_DERECHO_ENABLE_BACKUP_RESTART_LEADERS "DERECHO/enable_backup_restart_leaders"
#define CONF_DERECHO_ENABLE_BACKUP_RESTART_LEADERS "DERECHO/enable_backup_restart_leaders"
#define CONF_DERECHO_DISABLE_PARTITIONING_SAFETY "DERECHO/disable_partitioning_safety"

#define CONF_DERECHO_MAX_P2P_REQUEST_PAYLOAD_SIZE "DERECHO/max_p2p_request_payload_size"
Expand Down Expand Up @@ -70,7 +70,7 @@ class Conf {
{CONF_DERECHO_LOCAL_ID, "0"},
{CONF_DERECHO_LOCAL_IP, "127.0.0.1"},
{CONF_DERECHO_GMS_PORT, "23580"},
{CONF_DERECHO_RPC_PORT, "28366"},
{CONF_DERECHO_STATE_TRANSFER_PORT, "28366"},
{CONF_DERECHO_SST_PORT, "37683"},
{CONF_DERECHO_RDMC_PORT, "31675"},
{CONF_DERECHO_EXTERNAL_PORT, "32645"},
Expand Down Expand Up @@ -217,8 +217,8 @@ const bool getConfBoolean(const std::string& key);
const bool hasCustomizedConfKey(const std::string& key);

/**
* Splits a string into a vector of strings using a delimiting string. This is
* helpful for parsing "list-like" config options, which are comma-delimited
* Splits a string into a vector of strings using a delimiting string. This is
* helpful for parsing "list-like" config options, which are comma-delimited
* sequences of strings or numbers (so the default delimiter is ",").
* @param str The string to split
* @param delimiter The string to use as the delimiter for splitting
Expand Down
8 changes: 4 additions & 4 deletions include/derecho/core/detail/derecho_sst.hpp
Expand Up @@ -95,7 +95,7 @@ class DerechoSST : public sst::SST<DerechoSST> {
SSTFieldVector<uint32_t> joiner_ips;
/** joiner_xxx_ports are the port numbers for the joining nodes. */
SSTFieldVector<uint16_t> joiner_gms_ports;
SSTFieldVector<uint16_t> joiner_rpc_ports;
SSTFieldVector<uint16_t> joiner_state_transfer_ports;
SSTFieldVector<uint16_t> joiner_sst_ports;
SSTFieldVector<uint16_t> joiner_rdmc_ports;
SSTFieldVector<uint16_t> joiner_external_ports;
Expand Down Expand Up @@ -162,7 +162,7 @@ class DerechoSST : public sst::SST<DerechoSST> {
changes(100 + parameters.members.size()), //The extra 100 entries allows for more joins at startup, when the group is very small
joiner_ips(100 + parameters.members.size()),
joiner_gms_ports(100 + parameters.members.size()),
joiner_rpc_ports(100 + parameters.members.size()),
joiner_state_transfer_ports(100 + parameters.members.size()),
joiner_sst_ports(100 + parameters.members.size()),
joiner_rdmc_ports(100 + parameters.members.size()),
joiner_external_ports(100 + parameters.members.size()),
Expand All @@ -174,7 +174,7 @@ class DerechoSST : public sst::SST<DerechoSST> {
local_stability_frontier(num_subgroups) {
SSTInit(seq_num, delivered_num,
persisted_num, vid, suspected, changes, joiner_ips,
joiner_gms_ports, joiner_rpc_ports, joiner_sst_ports, joiner_rdmc_ports, joiner_external_ports,
joiner_gms_ports, joiner_state_transfer_ports, joiner_sst_ports, joiner_rdmc_ports, joiner_external_ports,
num_changes, num_committed, num_acked, num_installed,
num_received, wedged, global_min, global_min_ready,
slots, num_received_sst, local_stability_frontier, rip);
Expand All @@ -197,7 +197,7 @@ class DerechoSST : public sst::SST<DerechoSST> {
}
memset(const_cast<uint32_t*>(joiner_ips[row]), 0, joiner_ips.size());
memset(const_cast<uint16_t*>(joiner_gms_ports[row]), 0, joiner_gms_ports.size());
memset(const_cast<uint16_t*>(joiner_rpc_ports[row]), 0, joiner_rpc_ports.size());
memset(const_cast<uint16_t*>(joiner_state_transfer_ports[row]), 0, joiner_state_transfer_ports.size());
memset(const_cast<uint16_t*>(joiner_sst_ports[row]), 0, joiner_sst_ports.size());
memset(const_cast<uint16_t*>(joiner_rdmc_ports[row]), 0, joiner_rdmc_ports.size());
memset(const_cast<uint16_t*>(joiner_external_ports[row]), 0, joiner_external_ports.size());
Expand Down
26 changes: 13 additions & 13 deletions include/derecho/core/detail/multicast_group.hpp
Expand Up @@ -67,7 +67,7 @@ struct DerechoParams : public mutils::ByteRepresentable {
unsigned int window_size;
unsigned int heartbeat_ms;
rdmc::send_algorithm rdmc_send_algorithm;
uint32_t rpc_port;
uint32_t state_transfer_port;

static uint64_t compute_max_msg_size(
const uint64_t max_payload_size,
Expand Down Expand Up @@ -103,14 +103,14 @@ struct DerechoParams : public mutils::ByteRepresentable {
unsigned int window_size,
unsigned int heartbeat_ms,
rdmc::send_algorithm rdmc_send_algorithm,
uint32_t rpc_port)
uint32_t state_transfer_port)
: max_reply_msg_size(max_reply_payload_size + sizeof(header)),
sst_max_msg_size(max_smc_payload_size + sizeof(header)),
block_size(block_size),
window_size(window_size),
heartbeat_ms(heartbeat_ms),
rdmc_send_algorithm(rdmc_send_algorithm),
rpc_port(rpc_port) {
state_transfer_port(state_transfer_port) {
//if this is initialized above, DerechoParams turns abstract. idk why.
max_msg_size = compute_max_msg_size(max_payload_size, block_size,
max_payload_size > max_smc_payload_size);
Expand All @@ -129,7 +129,7 @@ struct DerechoParams : public mutils::ByteRepresentable {
std::string prefix = "SUBGROUP/" + profile + "/";
for(auto& field : Conf::subgroupProfileFields) {
if(!hasCustomizedConfKey(prefix + field)) {
std::cout << "key" << (prefix + field)
std::cout << "key" << (prefix + field)
<< " not found in SUBGROUP section of derecho conf. "
" Look at derecho-sample.cfg for more information."
<< std::endl;
Expand All @@ -138,29 +138,29 @@ struct DerechoParams : public mutils::ByteRepresentable {
}

uint64_t max_payload_size = getConfUInt64(prefix + Conf::subgroupProfileFields[0]);
uint64_t max_reply_payload_size = getConfUInt64(prefix + Conf::subgroupProfileFields[1]);
uint64_t max_reply_payload_size = getConfUInt64(prefix + Conf::subgroupProfileFields[1]);
uint64_t max_smc_payload_size = getConfUInt64(prefix + Conf::subgroupProfileFields[2]);
uint64_t block_size = getConfUInt64(prefix + Conf::subgroupProfileFields[3]);
uint32_t window_size = getConfUInt32(prefix + Conf::subgroupProfileFields[4]);
uint32_t timeout_ms = getConfUInt32(CONF_DERECHO_HEARTBEAT_MS);
const std::string& algorithm = getConfString(prefix + Conf::subgroupProfileFields[5]);
uint32_t rpc_port = getConfUInt32(CONF_DERECHO_RPC_PORT);
uint32_t state_transfer_port = getConfUInt32(CONF_DERECHO_STATE_TRANSFER_PORT);

return DerechoParams{
max_payload_size,
max_reply_payload_size,
max_reply_payload_size,
max_smc_payload_size,
block_size,
window_size,
timeout_ms,
DerechoParams::send_algorithm_from_string(algorithm),
rpc_port,
state_transfer_port,
};
}

DEFAULT_SERIALIZATION_SUPPORT(DerechoParams, max_msg_size, max_reply_msg_size,
sst_max_msg_size, block_size, window_size,
heartbeat_ms, rdmc_send_algorithm, rpc_port);
heartbeat_ms, rdmc_send_algorithm, state_transfer_port);
};

/**
Expand Down Expand Up @@ -368,7 +368,7 @@ class MulticastGroup {
* @param msg_ts The timestamp of the message
*/
void deliver_message(RDMCMessage& msg, const subgroup_id_t& subgroup_num,
const persistent::version_t& version, const uint64_t& msg_timestamp);
const persistent::version_t& version, const uint64_t& msg_timestamp);

/**
* Same as the other deliver_message, but for the SSTMessage type
Expand All @@ -378,7 +378,7 @@ class MulticastGroup {
* @param msg_ts The timestamp of this message
*/
void deliver_message(SSTMessage& msg, const subgroup_id_t& subgroup_num,
const persistent::version_t& version, const uint64_t& msg_timestamp);
const persistent::version_t& version, const uint64_t& msg_timestamp);

/**
* Enqueues a single message for persistence with the persistence manager.
Expand All @@ -393,7 +393,7 @@ class MulticastGroup {
* false if the message is a null message
*/
bool version_message(RDMCMessage& msg, const subgroup_id_t& subgroup_num,
const persistent::version_t& version, const uint64_t& msg_timestamp);
const persistent::version_t& version, const uint64_t& msg_timestamp);
/**
* Same as the other version_message, but for the SSTMessage type.
* @param msg The message that should cause a new version to be registered
Expand All @@ -405,7 +405,7 @@ class MulticastGroup {
* false if the message is a null message
*/
bool version_message(SSTMessage& msg, const subgroup_id_t& subgroup_num,
const persistent::version_t& version, const uint64_t& msg_timestamp);
const persistent::version_t& version, const uint64_t& msg_timestamp);

uint32_t get_num_senders(const std::vector<int>& shard_senders) {
uint32_t num = 0;
Expand Down
16 changes: 8 additions & 8 deletions include/derecho/core/detail/view_manager.hpp
Expand Up @@ -191,13 +191,13 @@ class ViewManager {
* Contains a TCP connection to each member of the group, for the purpose
* of transferring new Views and state information (serialized Replicated
* Objects) to new members during a view change. Each socket is connected
* to the (badly-named) RPC port of the corresponding member.
* to the transfer port of the corresponding member.
*/
tcp::tcp_connections tcp_sockets;

/**
/**
* The socket that made the initial connection to the restart leader, if this
* node is a non-leader. This is only used during the initial startup phase;
* node is a non-leader. This is only used during the initial startup phase;
* after the Group constructor finishes and start() is called, it will be null.
*/
std::unique_ptr<tcp::socket> leader_connection;
Expand Down Expand Up @@ -257,7 +257,7 @@ class ViewManager {

/**
* On a graceful exit, nodes will be agree to leave at some point, where
* the view manager should stop throw exception on "failure". Set
* the view manager should stop throw exception on "failure". Set
* 'bSilence' to keep the view manager calm on detecting intended node
* "failure."
*/
Expand Down Expand Up @@ -483,7 +483,7 @@ class ViewManager {
/* ---------------------------------------------------------------------------------- */

/* ------------------------ Setup/constructor helpers ------------------------------- */
/**
/**
* The initial start-up procedure (basically a constructor) for the case
* where there is no logged state on disk and the group is doing a "fresh
* start." At the end of this function this node has constructed or received
Expand All @@ -500,7 +500,7 @@ class ViewManager {
/** Constructor helper for the leader when it first starts; waits for enough
* new nodes to join to make the first view adequately provisioned. */
void await_first_view();
/**
/**
* Constructor helper for non-leader nodes; encapsulates receiving and
* deserializing a View, DerechoParams, and state-transfer leaders (old
* shard leaders) from the leader.
Expand All @@ -514,7 +514,7 @@ class ViewManager {
void initialize_rdmc_sst();
/**
* Helper for joining an existing group; receives the View and parameters from the leader.
* @return true if the leader successfully sent the View, false if the leader crashed
* @return true if the leader successfully sent the View, false if the leader crashed
* (i.e. a socket operation to it failed) before completing the process
*/
bool receive_initial_view();
Expand Down Expand Up @@ -640,7 +640,7 @@ class ViewManager {
* Constructor for either the leader or non-leader of a group.
* @param subgroup_info The set of functions defining subgroup membership
* for this group.
* @param subgroup_type_order A vector of type_index in the same order as
* @param subgroup_type_order A vector of type_index in the same order as
* the template parameters to the Group class
* @param any_persistent_objects True if any of the subgroup types in this
* group use Persistent<T> fields, false otherwise
Expand Down
18 changes: 9 additions & 9 deletions include/derecho/core/view.hpp
Expand Up @@ -24,7 +24,7 @@ namespace derecho {
* values corresponds to a "port" field in the IpAndPorts struct.
*/
enum class PortType { GMS, //!< GMS
RPC, //!< RPC
TRANSFER, //!< TRANSFER
SST, //!< SST
RDMC, //!< RDMC
EXTERNAL }; //!< EXTERNAL
Expand All @@ -35,7 +35,7 @@ enum class PortType { GMS, //!< GMS
struct IpAndPorts : public mutils::ByteRepresentable {
ip_addr_t ip_address;
uint16_t gms_port;
uint16_t rpc_port;
uint16_t state_transfer_port;
uint16_t sst_port;
uint16_t rdmc_port;
uint16_t external_port;
Expand All @@ -47,28 +47,28 @@ struct IpAndPorts : public mutils::ByteRepresentable {
*/
IpAndPorts(const ip_addr_t& ip_address,
const uint16_t gms_port,
const uint16_t rpc_port,
const uint16_t state_transfer_port,
const uint16_t sst_port,
const uint16_t rdmc_port,
const uint16_t external_port)
: ip_address(ip_address),
gms_port(gms_port),
rpc_port(rpc_port),
state_transfer_port(state_transfer_port),
sst_port(sst_port),
rdmc_port(rdmc_port),
external_port(external_port) {}
IpAndPorts() : ip_address{}, gms_port(0), rpc_port(0), sst_port(0), rdmc_port(0), external_port(0) {}
IpAndPorts() : ip_address{}, gms_port(0), state_transfer_port(0), sst_port(0), rdmc_port(0), external_port(0) {}

DEFAULT_SERIALIZATION_SUPPORT(IpAndPorts, ip_address, gms_port, rpc_port,
DEFAULT_SERIALIZATION_SUPPORT(IpAndPorts, ip_address, gms_port, state_transfer_port,
sst_port, rdmc_port, external_port);

inline bool operator==(const IpAndPorts& o) const {
return std::tie(ip_address,
gms_port, rpc_port,
gms_port, state_transfer_port,
sst_port, rdmc_port,
external_port)
== std::tie(o.ip_address,
o.gms_port, o.rpc_port,
o.gms_port, o.state_transfer_port,
o.sst_port, o.rdmc_port,
o.external_port);
}
Expand Down Expand Up @@ -182,7 +182,7 @@ class View : public mutils::ByteRepresentable {
* position in this vector. */
std::vector<std::type_index> subgroup_type_order;
/** Maps the (type, index) pairs used by users to identify subgroups to the
* internal subgroup IDs generated by ViewManager during SST setup.
* internal subgroup IDs generated by ViewManager during SST setup.
* The order of ids in the vector follows the order in which the user created
* those subgroups of the same type.
*/
Expand Down
6 changes: 3 additions & 3 deletions scripts/travis-ci/derecho0.cfg
Expand Up @@ -11,8 +11,8 @@ local_id = 0
local_ip = 127.0.0.1
# derecho gms port
gms_port = 23580
# derecho rpc port
rpc_port = 28366
# derecho state-transfer port
state_transfer_port = 28366
# sst tcp port
sst_port = 37683
# rdmc tcp port
Expand Down Expand Up @@ -76,7 +76,7 @@ provider = sockets
# For verbs provider, domain is the device name (ibv_devices)
domain = lo

# 3. tx_depth
# 3. tx_depth
# tx_depth applies to hints->tx_attr->size, where hint is a struct fi_info object.
# see https://ofiwg.github.io/libfabric/master/man/fi_getinfo.3.html
tx_depth = 256
Expand Down
6 changes: 3 additions & 3 deletions scripts/travis-ci/derecho1.cfg
Expand Up @@ -11,8 +11,8 @@ local_id = 1
local_ip = 127.0.0.1
# derecho gms port
gms_port = 33580
# derecho rpc port
rpc_port = 38366
# derecho state-transfer port
state_transfer_port = 38366
# sst tcp port
sst_port = 47683
# rdmc tcp port
Expand Down Expand Up @@ -76,7 +76,7 @@ provider = sockets
# For verbs provider, domain is the device name (ibv_devices)
domain = lo

# 3. tx_depth
# 3. tx_depth
# tx_depth applies to hints->tx_attr->size, where hint is a struct fi_info object.
# see https://ofiwg.github.io/libfabric/master/man/fi_getinfo.3.html
tx_depth = 256
Expand Down
8 changes: 4 additions & 4 deletions src/conf/conf.cpp
Expand Up @@ -38,7 +38,7 @@ struct option Conf::long_options[] = {
MAKE_LONG_OPT_ENTRY(CONF_DERECHO_LOCAL_ID),
MAKE_LONG_OPT_ENTRY(CONF_DERECHO_LOCAL_IP),
MAKE_LONG_OPT_ENTRY(CONF_DERECHO_GMS_PORT),
MAKE_LONG_OPT_ENTRY(CONF_DERECHO_RPC_PORT),
MAKE_LONG_OPT_ENTRY(CONF_DERECHO_STATE_TRANSFER_PORT),
MAKE_LONG_OPT_ENTRY(CONF_DERECHO_SST_PORT),
MAKE_LONG_OPT_ENTRY(CONF_DERECHO_RDMC_PORT),
MAKE_LONG_OPT_ENTRY(CONF_DERECHO_EXTERNAL_PORT),
Expand Down Expand Up @@ -159,11 +159,11 @@ const bool hasCustomizedConfKey(const std::string& key) {

std::vector<std::string> split_string(const std::string& str, const std::string& delimiter) {
std::vector<std::string> result;
std::size_t lastpos = 0;
std::size_t nextpos = 0;
std::size_t lastpos = 0;
std::size_t nextpos = 0;
while((nextpos = str.find(delimiter, lastpos)) != std::string::npos) {
result.emplace_back(str.substr(lastpos, nextpos));
lastpos = nextpos + delimiter.length();
lastpos = nextpos + delimiter.length();
}
result.emplace_back(str.substr(lastpos));
return result;
Expand Down

0 comments on commit 5aa1e1a

Please sign in to comment.