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

rpc: remove uri resolver; move partition resolver to replication/client #205

Merged
merged 6 commits into from
Dec 24, 2018

Conversation

shengofsun
Copy link
Contributor

@shengofsun shengofsun commented Dec 17, 2018

大家可以仔细看看这个pr,比如说客户端的内存泄露什么的。

我自己机器上在跑killtest,目前看貌似内存还挺平稳。明天我追加一下跑一晚上的内存测试结果。

这个pr的内容有:

  • 把uri resolver这个feature给删了;相应的,partition resolver作为一个client功能被放到了replication下面。
  • 梳理了一下storage_engine的client接口,删了些没用的字段。

好处:

  1. core和dist做了彻底的解耦,这样所有分布式相关的代码都可以挪到dist下面了。
  2. 以后你们新加集群,就不需要在配置模板里加"[uri-resolver.dsn.xxx]"这种section了

@neverchanje
Copy link
Contributor

👍

@shengofsun
Copy link
Contributor Author

zk老是下载失败,ci总是过不了,真惨……

@shengofsun
Copy link
Contributor Author

内存我跑了下应该没问题。

@shengofsun
Copy link
Contributor Author

issues in comments are fixed

const char *app_path);

template <typename TReq, typename TCallback>
dsn::rpc_response_task_ptr call_op(dsn::task_code code,
Copy link
Contributor

Choose a reason for hiding this comment

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

这个改名叫 call_replica 是不是合适一点。call_op 还不如简单叫 call。

Copy link
Contributor Author

@shengofsun shengofsun Dec 20, 2018

Choose a reason for hiding this comment

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

java那边叫operate,叫call_op是为了蹭那边的“operate”……

Copy link
Contributor

Choose a reason for hiding this comment

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

我觉得 java 叫 operator 这个名字也很一般...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我觉得叫op也挺好的啊,各种操作,不就是个op嘛……

Copy link
Member

Choose a reason for hiding this comment

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

其实叫什么真的无所谓了。
不过我个人觉得呢,连同下面的call_task,都叫call得了(反正函数重载)。
就没这么多纠结了,哈哈哈...

@neverchanje
Copy link
Contributor

我这边没啥其他问题,挺好的,后面就是要改 pegasus 的 rrdb client 了 👍

@shengofsun
Copy link
Contributor Author

shengofsun/pegasus@b594e2f
这是pegasus的fix,后面我再提pr,可以先看下

@neverchanje
Copy link
Contributor

上面的comments你可以再看下

@shengofsun
Copy link
Contributor Author

@neverchanje 函数名啥的就不改了吧,pegasus那边也得跟着改。

neverchanje
neverchanje previously approved these changes Dec 22, 2018
static dsn::ref_ptr<partition_resolver>
get_resolver(const char *cluster_name,
const std::vector<dsn::rpc_address> &meta_list,
const char *app_path);
Copy link
Member

Choose a reason for hiding this comment

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

app_path 直接改为 app_name 吧。以前有uri,说path还情有可原,现在没有uri了,总觉得怪怪的,也不好理解。

}

typedef partition_resolver *(*factory)(rpc_address &, const char *);
void call_task(const dsn::rpc_response_task_ptr &task);
Copy link
Member

Choose a reason for hiding this comment

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

建议对public的方法都增加注释,表名这个函数是做什么的,产生什么效果。
毕竟人家也是include头文件中的public方法嘛。

{
if (req->header->gpid.value() != 0 && err != ERR_OK && err != ERR_HANDLER_NOT_FOUND &&
err != ERR_APP_NOT_EXIST && err != ERR_OPERATION_DISABLED) {

Copy link
Member

Choose a reason for hiding this comment

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

多余的空行


rpc_response_task_ptr ctask =
dynamic_cast<rpc_response_task *>(task::get_current_task());
partition_resolver *r = this;
Copy link
Member

Choose a reason for hiding this comment

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

这里是不是用 partition_resolver_ptr 好点?如果直接用裸指针, partition_resolver的生命周期在回调函数里面得不到保证,可能变成非法访问。

const char *app_path);

template <typename TReq, typename TCallback>
dsn::rpc_response_task_ptr call_op(dsn::task_code code,
Copy link
Member

Choose a reason for hiding this comment

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

其实叫什么真的无所谓了。
不过我个人觉得呢,连同下面的call_task,都叫call得了(反正函数重载)。
就没这么多纠结了,哈哈哈...

qinzuoyan
qinzuoyan previously approved these changes Dec 24, 2018
@neverchanje neverchanje merged commit 38d7c02 into XiaoMi:master Dec 24, 2018
@shengofsun shengofsun deleted the refactor-resolver branch December 25, 2018 01:42
vagetablechicken pushed a commit to vagetablechicken/rdsn that referenced this pull request Jan 22, 2019
@qinzuoyan qinzuoyan mentioned this pull request Feb 11, 2019
28 tasks
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.

3 participants