Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

refactor: move rpc handler on_query_configuration_by_index from meta_service to server_state #597

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

levy5307
Copy link
Contributor

In previous implementation, all rpc_handlers in meta server is registered in meta_service. And then the rpc request is forwarded to server_statebulk_load_service and so on, to handle this request.
In this pull request, the rpc handler on_query_configuration_by_index is put to server_state, no need to forward by meta_service

int check_leader(TRpcHolder rpc, /*out*/ rpc_address *forward_address);
template <typename TRpcHolder>
bool check_status(TRpcHolder rpc, /*out*/ rpc_address *forward_address = nullptr);
int check_leader(TRpcHolder rpc, rpc_address *forward_address)
Copy link
Contributor

Choose a reason for hiding this comment

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

What did this modification fix? Why move the implementation to the header file?

Copy link
Contributor Author

@levy5307 levy5307 Aug 20, 2020

Choose a reason for hiding this comment

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

If we don't move this to header file, the linker will produce error. It seems it can't do the template instantiation work if we don't move it to header file.

I moved the implementation of check_status and check_leader out of class meta_service, but they are still being put in the header file.

foreverneverer
foreverneverer previously approved these changes Aug 24, 2020
@levy5307 levy5307 marked this pull request as draft August 28, 2020 01:55
@levy5307 levy5307 marked this pull request as ready for review September 27, 2020 11:15
@levy5307 levy5307 marked this pull request as draft September 28, 2020 02:11
@levy5307 levy5307 marked this pull request as ready for review September 28, 2020 07:05
#include <set>

namespace dsn {

DEFINE_TASK_CODE(LPC_RPC_TIMEOUT, TASK_PRIORITY_COMMON, THREAD_POOL_DEFAULT)

DSN_DEFINE_bool("core",
Copy link
Member

Choose a reason for hiding this comment

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

what does this config item used for? when to config true and when false?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this configuration is used for unit test to disable register rpc handlers. Because in some unit tests, one same rpc handler will register twice more times, and this will produce coredump. So you can set this configuration to false to avoid this situation.

@levy5307 levy5307 marked this pull request as draft October 10, 2020 10:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants