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

fix:Bind dbno to the client. #156

Merged

Conversation

dingxiaoshuai123
Copy link
Collaborator

将 dbindex 与 client 绑定在一起,执行命令的时候,传入 client 中的 index 去访问 db 。select 时,改变 client 中的 dbindex。

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Feb 1, 2024
src/client.h Outdated
@@ -211,7 +215,7 @@ class PClient : public std::enable_shared_from_this<PClient>, public CmdRes {

PProtoParser parser_;

int db_ = -1;
int db_;
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里是不是也给个默认值0, 我记得有的client 在连上后不会自动执行 select 0 命令的, 那这时候 应该默认选择 0 db

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PClient 的构造函数中将其初始化为0了,这里给不给默认都会在构造函数中设置其为0.
image

Copy link
Collaborator

Choose a reason for hiding this comment

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

OK

Copy link
Collaborator

Choose a reason for hiding this comment

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

感觉可以统一一下吧 之前雨哥说像这种简单变量最好是直接在这里给一个初始值

Copy link
Collaborator

Choose a reason for hiding this comment

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

这个db_改成dbno_?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok

@AlexStocks AlexStocks merged commit 8af88a4 into OpenAtomFoundation:unstable Feb 1, 2024
5 checks passed
@dingxiaoshuai123 dingxiaoshuai123 deleted the fix_whichdb branch February 27, 2024 05:16
dingxiaoshuai123 pushed a commit to dingxiaoshuai123/pikiwidb that referenced this pull request Mar 6, 2024
* add slot nums to config (OpenAtomFoundation#145)

* fix migrate list slot logic (OpenAtomFoundation#156)

* fix sadd slot (OpenAtomFoundation#157)

Co-authored-by: liuyuecai <[email protected]>

---------

Co-authored-by: liuyuecai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️ Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants