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

Mongo client support #2171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TousakaRin
Copy link
Contributor

@TousakaRin TousakaRin commented Mar 20, 2023

What problem does this PR solve?

support mongo client
原pr:#1808
官方reference: https://www.mongodb.com/docs/manual/

目前能够demo插入和查询,还需要做的:

  • server端协议尚未测试, client 端没有压测,仅测试了单连接
  • 支持compressed消息,即OP_COMPRESSED
  • 支持naming service和load balancer
  • 让接口更友好,目前是让client直接拼bson命令,后续应该能够自动插入$db之类的option
  • 支持stable api,即legacy opcode
  • 修复/增加单测

Issue Number:
#1807

Problem Summary:

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):
    影响mongo protocol的server端的向后兼容。
    Mongo protocol 本身已经不再向前兼容


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@TousakaRin TousakaRin force-pushed the helei_mongo_rewrite branch 3 times, most recently from 6e1cd9c to e5a2355 Compare March 21, 2023 03:50
helei.sig11 added 2 commits March 21, 2023 14:15
Signed-off-by: helei.sig11 <helei.sig11@bytedance.com>
Signed-off-by: helei.sig11 <helei.sig11@bytedance.com>
@chenBright
Copy link
Contributor

Mongo client有专门的支持naming service和load balancer吗?不是用目前brpc已有的支持naming service和load balancer?

@TousakaRin
Copy link
Contributor Author

Mongo client有专门的支持naming service和load balancer吗?不是用目前brpc已有的支持naming service和load balancer?

mongodb 是支持主从和分片的,我觉得可以做成专用的lb和naming service,这块的细节还没怎么看

@@ -152,6 +152,7 @@ endif()

find_package(Protobuf REQUIRED)
find_package(Threads REQUIRED)
find_package (bson-1.0 1.7 REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

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

这个是不是做成一个可选的编译选项比较好

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, 整个mongo的client支持都做成一个编译选项吧

ProcessMongoRequest, NULL,
SerializeMongoRequest,
PackMongoRequest,
ProcessMongoRequest,
Copy link
Contributor

Choose a reason for hiding this comment

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

ProcessMongoRequest还要保留吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我觉得可以不支持server端了,mongo协议变动挺大的。要做前后兼容工作量有点大

LOG(WARNING) << "method count:" << srv_des->method_count()
<< " of MongoService should be equal to 1!";
LOG(WARNING) << "method count: " << srv_des->method_count()
<< "of MongoService should be equal to 1!";
Copy link
Contributor

Choose a reason for hiding this comment

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

这个空格不应该删吧

}

bool bson_get_double(bson_t* doc, const char *key, double *value) {
assert(doc);
Copy link
Contributor

Choose a reason for hiding this comment

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

这个可以用DCHECK?

@jiangdongzi
Copy link

不支持auth?

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.

None yet

4 participants