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 slavaof serialize response bug #1583

Merged
merged 1 commit into from
Jun 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/pika_repl_server_conn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link

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.

Expand Down