-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 slavaof serialize response bug #1583
Conversation
@@ -47,6 +47,7 @@ void PikaReplServerConn::HandleMetaSyncRequest(void* arg) { | |||
g_pika_server->BecomeMaster(); | |||
response.set_code(InnerMessage::kOk); | |||
InnerMessage::InnerResponse_MetaSync* meta_sync = response.mutable_meta_sync(); | |||
meta_sync->set_classic_mode(g_pika_conf->classic_mode()); | |||
for (const auto& db_struct : db_structs) { | |||
InnerMessage::InnerResponse_MetaSync_DBInfo* db_info = meta_sync->add_dbs_info(); | |||
db_info->set_db_name(db_struct.db_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code patch modifies the HandleMetaSyncRequest()
function. It adds a line of code that sets the "classic_mode" flag in the response message with the value retrieved from the Pika configuration object, and then loops through all the database structures to add their names to the response.
As for potential bug risks, it's hard to say without seeing more of the surrounding code and understanding the wider context and usage. However, assuming that there are no issues or edge cases with the handling of the response message and the configuration object, this patch seems straightforward and shouldn't introduce any new bugs.
One potential improvement suggestion would be to double-check that the "classic_mode" flag is being correctly set in the Pika configuration object before it is used here. Additionally, it could be helpful to add some comments around this new code to explain its purpose, especially if other developers may need to modify it in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: liuyuecai <[email protected]>
* feat: supported 'ptype' command * Simplified command `type` and `ptype` code * Remove the capacity judgment * fix slavaof serialize response bug (#1583) Co-authored-by: liuyuecai <[email protected]> * fix (#1587) (#1588) * fix unit test:type/set (#1577) * Fix memory leaks in HandleBGWorkerWriteDB and HandleMetaSyncResponse (#1590) * fix memory leaks in PikaReplBgWorker::HandleBGWorkerWriteDB(void* arg) and PikaReplClientConn::HandleMetaSyncResponse(void* arg). * add address/thread sanitizer to CMakeLists --------- Co-authored-by: cjh <[email protected]> * refactor: replace pstd/env with std::filesystem (#1470) * fix bug issue 1554: using unique_ptr.reset to fix the SIGABRT error (#1595) using unique_ptr.reset to fix the SIGABRT error && using time-wait lock to notify quickly * fix: incorrect manner of terminating the process (#1596) * fix issue#1597: add rocksdb dependency to pstd (#1599) * fix g++15 compile failure * add rocksdb dependency to pstd --------- Co-authored-by: J1senn <[email protected]> * fix_info_command * fix: gcc13 compile failed (#1601) * ci: add unit test to github action (#1604) * ci: add unit test in github workflow * chore:change `PLATFORM` field logic (#1615) * fix issue 1517: scan 命令不支持 type 参数 (#1582) * fix: the unit test of type/set (#1617) * test: optimize the return results of srandmember to avoid approximate results * fix: use last_seed for random engine * [fix issue1621] fix deadlock (#1620) * [fix] fix deadlock * [fix] fix * command `type` and `ptype` add unit test * fix member variable initialization * Update issue templates * feat: supported 'ptype' command * fix unit test:type/set (#1577) * fix issue#1597: add rocksdb dependency to pstd (#1599) * fix g++15 compile failure * add rocksdb dependency to pstd --------- Co-authored-by: J1senn <[email protected]> * fix: gcc13 compile failed (#1601) * fix: the unit test of type/set (#1617) * test: optimize the return results of srandmember to avoid approximate results * fix: use last_seed for random engine * Modify other modules to use the new `type` function * fix function repeat --------- Co-authored-by: Yuecai Liu <[email protected]> Co-authored-by: liuyuecai <[email protected]> Co-authored-by: Peter Chan <[email protected]> Co-authored-by: chenbt <[email protected]> Co-authored-by: Junhua Chen <[email protected]> Co-authored-by: cjh <[email protected]> Co-authored-by: kang jinci <[email protected]> Co-authored-by: Xin.Zh <[email protected]> Co-authored-by: machinly <[email protected]> Co-authored-by: A2ureStone <[email protected]> Co-authored-by: J1senn <[email protected]> Co-authored-by: chejinge <[email protected]> Co-authored-by: baerwang <[email protected]> Co-authored-by: ptbxzrt <[email protected]> Co-authored-by: 你不要过来啊 <[email protected]>
Co-authored-by: liuyuecai <[email protected]>
* feat: supported 'ptype' command * Simplified command `type` and `ptype` code * Remove the capacity judgment * fix slavaof serialize response bug (OpenAtomFoundation#1583) Co-authored-by: liuyuecai <[email protected]> * fix (OpenAtomFoundation#1587) (OpenAtomFoundation#1588) * fix unit test:type/set (OpenAtomFoundation#1577) * Fix memory leaks in HandleBGWorkerWriteDB and HandleMetaSyncResponse (OpenAtomFoundation#1590) * fix memory leaks in PikaReplBgWorker::HandleBGWorkerWriteDB(void* arg) and PikaReplClientConn::HandleMetaSyncResponse(void* arg). * add address/thread sanitizer to CMakeLists --------- Co-authored-by: cjh <[email protected]> * refactor: replace pstd/env with std::filesystem (OpenAtomFoundation#1470) * fix bug issue 1554: using unique_ptr.reset to fix the SIGABRT error (OpenAtomFoundation#1595) using unique_ptr.reset to fix the SIGABRT error && using time-wait lock to notify quickly * fix: incorrect manner of terminating the process (OpenAtomFoundation#1596) * fix issue#1597: add rocksdb dependency to pstd (OpenAtomFoundation#1599) * fix g++15 compile failure * add rocksdb dependency to pstd --------- Co-authored-by: J1senn <[email protected]> * fix_info_command * fix: gcc13 compile failed (OpenAtomFoundation#1601) * ci: add unit test to github action (OpenAtomFoundation#1604) * ci: add unit test in github workflow * chore:change `PLATFORM` field logic (OpenAtomFoundation#1615) * fix issue 1517: scan 命令不支持 type 参数 (OpenAtomFoundation#1582) * fix: the unit test of type/set (OpenAtomFoundation#1617) * test: optimize the return results of srandmember to avoid approximate results * fix: use last_seed for random engine * [fix issue1621] fix deadlock (OpenAtomFoundation#1620) * [fix] fix deadlock * [fix] fix * command `type` and `ptype` add unit test * fix member variable initialization * Update issue templates * feat: supported 'ptype' command * fix unit test:type/set (OpenAtomFoundation#1577) * fix issue#1597: add rocksdb dependency to pstd (OpenAtomFoundation#1599) * fix g++15 compile failure * add rocksdb dependency to pstd --------- Co-authored-by: J1senn <[email protected]> * fix: gcc13 compile failed (OpenAtomFoundation#1601) * fix: the unit test of type/set (OpenAtomFoundation#1617) * test: optimize the return results of srandmember to avoid approximate results * fix: use last_seed for random engine * Modify other modules to use the new `type` function * fix function repeat --------- Co-authored-by: Yuecai Liu <[email protected]> Co-authored-by: liuyuecai <[email protected]> Co-authored-by: Peter Chan <[email protected]> Co-authored-by: chenbt <[email protected]> Co-authored-by: Junhua Chen <[email protected]> Co-authored-by: cjh <[email protected]> Co-authored-by: kang jinci <[email protected]> Co-authored-by: Xin.Zh <[email protected]> Co-authored-by: machinly <[email protected]> Co-authored-by: A2ureStone <[email protected]> Co-authored-by: J1senn <[email protected]> Co-authored-by: chejinge <[email protected]> Co-authored-by: baerwang <[email protected]> Co-authored-by: ptbxzrt <[email protected]> Co-authored-by: 你不要过来啊 <[email protected]>
Co-authored-by: liuyuecai <[email protected]>
* feat: supported 'ptype' command * Simplified command `type` and `ptype` code * Remove the capacity judgment * fix slavaof serialize response bug (OpenAtomFoundation#1583) Co-authored-by: liuyuecai <[email protected]> * fix (OpenAtomFoundation#1587) (OpenAtomFoundation#1588) * fix unit test:type/set (OpenAtomFoundation#1577) * Fix memory leaks in HandleBGWorkerWriteDB and HandleMetaSyncResponse (OpenAtomFoundation#1590) * fix memory leaks in PikaReplBgWorker::HandleBGWorkerWriteDB(void* arg) and PikaReplClientConn::HandleMetaSyncResponse(void* arg). * add address/thread sanitizer to CMakeLists --------- Co-authored-by: cjh <[email protected]> * refactor: replace pstd/env with std::filesystem (OpenAtomFoundation#1470) * fix bug issue 1554: using unique_ptr.reset to fix the SIGABRT error (OpenAtomFoundation#1595) using unique_ptr.reset to fix the SIGABRT error && using time-wait lock to notify quickly * fix: incorrect manner of terminating the process (OpenAtomFoundation#1596) * fix issue#1597: add rocksdb dependency to pstd (OpenAtomFoundation#1599) * fix g++15 compile failure * add rocksdb dependency to pstd --------- Co-authored-by: J1senn <[email protected]> * fix_info_command * fix: gcc13 compile failed (OpenAtomFoundation#1601) * ci: add unit test to github action (OpenAtomFoundation#1604) * ci: add unit test in github workflow * chore:change `PLATFORM` field logic (OpenAtomFoundation#1615) * fix issue 1517: scan 命令不支持 type 参数 (OpenAtomFoundation#1582) * fix: the unit test of type/set (OpenAtomFoundation#1617) * test: optimize the return results of srandmember to avoid approximate results * fix: use last_seed for random engine * [fix issue1621] fix deadlock (OpenAtomFoundation#1620) * [fix] fix deadlock * [fix] fix * command `type` and `ptype` add unit test * fix member variable initialization * Update issue templates * feat: supported 'ptype' command * fix unit test:type/set (OpenAtomFoundation#1577) * fix issue#1597: add rocksdb dependency to pstd (OpenAtomFoundation#1599) * fix g++15 compile failure * add rocksdb dependency to pstd --------- Co-authored-by: J1senn <[email protected]> * fix: gcc13 compile failed (OpenAtomFoundation#1601) * fix: the unit test of type/set (OpenAtomFoundation#1617) * test: optimize the return results of srandmember to avoid approximate results * fix: use last_seed for random engine * Modify other modules to use the new `type` function * fix function repeat --------- Co-authored-by: Yuecai Liu <[email protected]> Co-authored-by: liuyuecai <[email protected]> Co-authored-by: Peter Chan <[email protected]> Co-authored-by: chenbt <[email protected]> Co-authored-by: Junhua Chen <[email protected]> Co-authored-by: cjh <[email protected]> Co-authored-by: kang jinci <[email protected]> Co-authored-by: Xin.Zh <[email protected]> Co-authored-by: machinly <[email protected]> Co-authored-by: A2ureStone <[email protected]> Co-authored-by: J1senn <[email protected]> Co-authored-by: chejinge <[email protected]> Co-authored-by: baerwang <[email protected]> Co-authored-by: ptbxzrt <[email protected]> Co-authored-by: 你不要过来啊 <[email protected]>
fix #1563