Skip to content

redis-benchmark failed to fetch config from Pika #645

Closed
@zhouyuan

Description

Hi Pika developers,

Trying to do some basic tests with Pika with redis-benchmark here.
It sees recent redis-benchmark will try to get "save" and "appendonly" configurations before issue the requests. redis/redis@834809c
However in pika these two configurations are not used - an empty reply is sent back, which will prevent redis-benchmark to run successfully:

./src/redis-benchmark -h 192.168.160.115 -p 9221 -t set -d 1024
ERROR: failed to fetch CONFIG from 192.168.160.115:9221

I made a quick fix for this issue. This is not a perfect patch but it can make redis-benchmark happy.

diff --git a/src/pika_admin.cc b/src/pika_admin.cc
index bde46ad..7f823c8 100644
--- a/src/pika_admin.cc
+++ b/src/pika_admin.cc
@@ -1231,6 +1231,18 @@ void ConfigCmd::ConfigGet(std::string &ret) {
     EncodeInt32(&config_body, g_pika_conf->slave_priority());
   }

+  if (slash::stringmatch(pattern.data(), "save", 1)) {
+    elements += 2;
+    EncodeString(&config_body, "save");
+    EncodeString(&config_body, "");
+  }
+
+  if (slash::stringmatch(pattern.data(), "appendonly", 1)) {
+    elements += 2;
+    EncodeString(&config_body, "appendonly");
+    EncodeString(&config_body, "no");
+  }
+
   std::stringstream resp;
   resp << "*" << std::to_string(elements) << "\r\n" << config_body;
   ret = resp.str();

thanks, -yuan

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions