Skip to content

mongodb 交互协议调整为 OP_MSG#1649

Merged
cloudwu merged 2 commits intocloudwu:masterfrom
ykxpb:dev.mongo_opmsg
Sep 20, 2022
Merged

mongodb 交互协议调整为 OP_MSG#1649
cloudwu merged 2 commits intocloudwu:masterfrom
ykxpb:dev.mongo_opmsg

Conversation

@ykxpb
Copy link
Copy Markdown
Contributor

@ykxpb ykxpb commented Sep 19, 2022

  1. 统一使用 OP_MSG 作为双向通信协议,删除其他 OP_CODE,不再支持 3.6 以前的 mongodb。
  2. 仅实现了 payload_type 0,payload_type 1 用于实现 batch insert,目前没有用到。

@cloudwu
Copy link
Copy Markdown
Owner

cloudwu commented Sep 19, 2022

我建议增加握手时的版本判断,在连接低版本时有明确的错误信息。

看了一下,似乎做起来比较麻烦?根据 https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol/

MongoDB 5.1 removes support for both OP_QUERY find operations and OP_QUERY commands. As an exception, OP_QUERY is still supported for running the hello and isMaster commands as part of the connection handshake.

还需要保留老的 OP_QUERY 用 hello 查询,而 hello 也是 3.6 加的。更早的是不是需要用 db.version() 查?而新版本不支持 OP_QUERY ,老版本不支持 OP_MSG ,所以是无解的?

@cloudwu cloudwu merged commit 44e2583 into cloudwu:master Sep 20, 2022
@cloudwu
Copy link
Copy Markdown
Owner

cloudwu commented Sep 20, 2022

相关讨论:#1619

@sniper00
Copy link
Copy Markdown
Contributor

unused function 'write_bytes'

@ykxpb
Copy link
Copy Markdown
Contributor Author

ykxpb commented Sep 20, 2022

unused function 'write_bytes'

inline 的函数编译器不会告警。。后面改一下。

@sniper00
Copy link
Copy Markdown
Contributor

unused function 'write_bytes'

inline 的函数编译器不会告警。。后面改一下。

用 clang 编译的

@ykxpb
Copy link
Copy Markdown
Contributor Author

ykxpb commented Sep 20, 2022

unused function 'write_bytes'

inline 的函数编译器不会告警。。后面改一下。

用 clang 编译的

gcc 好像有这个问题。。。我改一下。

unused function 'write_bytes'

inline 的函数编译器不会告警。。后面改一下。

用 clang 编译的

#1650 本地没有clang,帮忙看下这样改ok不?

@ykxpb
Copy link
Copy Markdown
Contributor Author

ykxpb commented Sep 20, 2022

unused function 'write_bytes'

inline 的函数编译器不会告警。。后面改一下。

用 clang 编译的

修改了,本地用clang-15跑没问题了

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