Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_leader_id/get_replication_status into replicationService #294

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

xiaoxichen
Copy link
Collaborator

No description provided.

@xiaoxichen xiaoxichen requested a review from yamingk January 30, 2024 17:58
/// @brief get replication status. If called on follower member
/// this API can return empty result.
virtual std::vector<peer_info> get_replication_status(group_id_t group_id) const = 0;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a use case where we have this api in ReplicationService or can this be at every ReplDev itself, because we have ReplDev::is_leader() already and we could do ReplDev::get_leader() and get_replication_status() there right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes there is no strong requirement to have that in ReplicationService as in ReplicationService it also get the ReplDev and operate based on that.. was trying to have a wrapper so that client(external HS) doesnt need to get ReplDev to get the stats when they want to report metrics. However in HO we already keep the ReplDev ptr in HS_PG.

Will move those to ReplDev.

@codecov-commenter
Copy link

codecov-commenter commented Jan 31, 2024

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (4da2de4) 58.79% compared to head (fd29422) 58.88%.

Files Patch % Lines
src/lib/replication/repl_dev/raft_repl_dev.cpp 0.00% 11 Missing ⚠️
src/lib/replication/repl_dev/solo_repl_dev.h 0.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #294      +/-   ##
==========================================
+ Coverage   58.79%   58.88%   +0.09%     
==========================================
  Files         110      110              
  Lines        9249     9258       +9     
  Branches     1190     1189       -1     
==========================================
+ Hits         5438     5452      +14     
+ Misses       3286     3278       -8     
- Partials      525      528       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xiaoxichen xiaoxichen force-pushed the xiaoxi_dev branch 2 times, most recently from 8af95cf to df96a06 Compare January 31, 2024 17:38
@@ -65,6 +65,15 @@ using remote_blkid_list_t = folly::small_vector< RemoteBlkId, 4 >;
using replica_id_t = uuid_t;
using group_id_t = uuid_t;

struct peer_info {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason we can't use the same structure defined in nuraft_mes: https://github.com/eBay/nuraft_mesg/blob/main/include/nuraft_mesg/mesg_state_mgr.hpp#L31

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not exposing nuraft_mesg to the upper layer, so we probably have to redefine here.

Copy link
Collaborator Author

@xiaoxichen xiaoxichen Feb 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My thinking is althrough nuraft is our only serious implementation right now but as a generic API for all repl-dev I am trying to use more neutral structure/naming.

  1. the structure field (mostly last_log_idx_) is too implementation(raft) specific
  2. HS/HO we use replica_id_t, translate it from string to replica_id_t make it more consistent from the view of HO.

@@ -12,6 +12,7 @@
#include "replication/service/raft_repl_service.h"
#include "replication/repl_dev/raft_repl_dev.h"
#include "push_data_rpc_generated.h"
#include "boost/lexical_cast.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It is not mandatory, but common practice we decided to follow was to define the
STL defs, followed by external libraries both indicate by <> (instead of "") and then followed by local repo includes.

hkadayam
hkadayam previously approved these changes Feb 1, 2024
Copy link
Contributor

@hkadayam hkadayam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One additional minor comment from me, otherwise look good to me.

Copy link
Contributor

@JacksonYao287 JacksonYao287 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xiaoxichen xiaoxichen merged commit ec25d4c into eBay:master Feb 1, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants