git-hulk commented on code in PR #1855:
URL: https://github.com/apache/kvrocks/pull/1855#discussion_r1375346412


##########
src/server/worker.cc:
##########
@@ -344,6 +344,31 @@ redis::Connection *Worker::removeConnection(int fd) {
   return conn;
 }
 
+// MigrateConnection moves the connection to another worker
+// when reducing the number of workers.
+//
+// To make it simple, we would close the connection if it's
+// blocked on a key or stream.
+void Worker::MigrateConnection(Worker *target, redis::Connection *conn) {
+  if (!target || !conn) return;
+  if (conn->current_cmd != nullptr && conn->current_cmd->IsBlocking()) {
+    // don't need to close the connection since destroy worker thread will 
close it
+    return;
+  }
+

Review Comment:
   It's not since Config::Set is an exclusive command, so it won't receive any 
other commands before this process was finished.



-- 
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]

Reply via email to