wy-ei opened a new pull request, #1476: URL: https://github.com/apache/incubator-kvrocks/pull/1476
## fix the format error in monitor response If the payload of a request has `\r\n`, the response forwarded to monitoring client is in bad format since simple string can't contains CRLF in RESP. I found this issue when I execute monitor command in redis-cli and set content of a `.c` file as value in another redis-cli: ```c $ redis-cli -p 6666 127.0.0.1:6666> monitor OK 1685165694.988910 [__namespace 127.0.0.1:55614] "set" "a" "#include <stdio.h> Error: Protocol error, got "\r" as reply type byte ``` ``` $ redis-cli -p 6666 -x set a < ./main.c ``` In the redis code the monitor response sending to client has been escaped by `sdscatrepr`: https://github.com/redis/redis/blob/e775b34e813654ead5be899faa065f1c31753040/src/replication.c#L560 https://github.com/redis/redis/blob/e775b34e813654ead5be899faa065f1c31753040/src/sds.c#L986 I implement a function `StringRepr` in `string_util` to do the escap which did the same escape with `sdscatrepr`. ## improve the performance of monitor the content of monitor response is formated in worker, if more than one worker exists, the content will be formated several times. We can format the response in `Server::FeedMonitorConns` and pass the response to `Worker::FeedMonitorConns`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
