git-hulk commented on code in PR #1999:
URL: https://github.com/apache/kvrocks/pull/1999#discussion_r1451367936
##########
src/commands/cmd_server.cc:
##########
@@ -1221,6 +1221,39 @@ class CommandAnalyze : public Commander {
std::vector<std::string> command_args_;
};
+class CommandReset : public Commander {
+ public:
+ Status Execute(Server *srv, Connection *conn, std::string *output) override {
+ // 1. Discards the current MULTI transaction block, if one exists.
+ if (conn->IsFlagEnabled(Connection::kMultiExec)) {
+ conn->ResetMultiExec();
+ }
+ // 2. Unwatches all keys WATCHed by the connection.
+ srv->ResetWatchedKeys(conn);
+ // 3. Disables CLIENT TRACKING, if in use. (not yet supported)
+ // 4. Sets the connection to READWRITE mode.
+ // 5. Cancels the connection's ASKING mode, if previously set. (not yet
supported)
+ // 6. Sets CLIENT REPLY to ON. (not yet supported)
+ // 9. Exits MONITOR mode, when applicable.
+ if (conn->IsFlagEnabled(Connection::kMonitor)) {
+ conn->Owner()->QuitMonitorConn(conn);
+ }
+ // 10. Aborts Pub/Sub's subscription state (SUBSCRIBE and PSUBSCRIBE),
when appropriate.
+ if (conn->SubscriptionsCount() != 0) {
+ conn->UnsubscribeAll();
+ }
+ if (conn->PSubscriptionsCount() != 0) {
+ conn->PUnsubscribeAll();
+ }
Review Comment:
@chrisxu333 Maybe I was wrong. We didn't remove the READABLE event from fd
after entering the monitor/subscriber mode on the server side. So it may be
good for the current implementation. You can print some logs or use debug mode
to confirm this.
--
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]