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

WIP: mongo client #2130

Closed
wants to merge 4 commits into from
Closed

Conversation

TousakaRin
Copy link
Contributor

@TousakaRin TousakaRin commented Feb 21, 2023

What problem does this PR solve?

原PR: mongo client

Issue Number:

#1807

Problem Summary:

What is changed and the side effects?

Changed:

原PR:

  • 引入了bson库并将相关操作封装到butil
  • 在mongo.{h|cpp} 中为 Mongodb 的 curd 操作增加了对应的protobuff message
  • 为 mongo protocol 增加了客户端的支持
  • 为 mongo 多副本集群增加了 mongo naming service,定期更新集群中的主节点

后续修改:

  • 去掉了原PR中一些不必要的缩进修改,避免diff被干扰
  • 将 MongoQueryRequest/MongoInsertRequest 等消息做了简单抽象
  • 让 mongo_protocol.cpp 的相关代码更简洁
  • 支持直接使用 Makefile 编译

已知的问题/讨论:

  • debian/ubuntu下bson库的目录及文件带着'-1.0'这样的后缀,会导致从config_brpc._sh报错,目前手动去掉这个后缀在work around, 后续修复
  • mongo 协议自身前后不兼容,brpc 现在已有的服务端的支持版本很旧,而且意义不明(应该不会有人再在自己写个mongodb了吧), 原来的pr是按照较新的协议实现的,eg, 新版协议仅支持OP_MSG 和 OP_COMPRESSED,OP_MSG的枚举值还变了,这样的话服务端代码可能也要更新
  • MongoRquest/MongoResponse的消息名字和服务端的pb定义重名了,这里因为不太清楚服务端支持的mongo协议的背景,先就没有做修改
  • 协议解析部分看issue是通过抓包测出来的,目前看支持的不太全,我尽量找找文档或者官方client的处理吧。
  • 一些todo和缩进没来得及全部处理完

Side effects:

  • Performance effects(性能影响):
    no
  • Breaking backward compatibility(向后兼容性):
    影响使用 mongo procotol 的服务

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.(请遵循贡献者准则).

@wwbmmm
Copy link
Contributor

wwbmmm commented Feb 21, 2023

master修复了CI失败,可以rebase一下

@TousakaRin TousakaRin closed this Mar 20, 2023
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.

3 participants