PragmaTwice commented on code in PR #3240:
URL: https://github.com/apache/kvrocks/pull/3240#discussion_r2484237312


##########
src/cluster/slot_migrate.cc:
##########
@@ -1325,16 +1370,44 @@ Status SlotMigrator::sendSnapshotByRawKV() {
 
   GET_OR_RET(sendMigrationBatch(&batch_sender));
 
-  auto elapsed = util::GetTimeStampMS() - start_ts;
-  info(
-      "[migrate] Succeed to migrate snapshot range, slot(s): {}, elapsed: {} 
ms, sent: {} bytes, rate: {:.2f} kb/s, "
-      "batches: {}, entries: {}",
-      slot_range.String(), elapsed, batch_sender.GetSentBytes(), 
batch_sender.GetRate(start_ts),
-      batch_sender.GetSentBatchesNum(), batch_sender.GetEntriesNum());
-
   return Status::OK();
 }
 
+int SlotMigrator::createConnectToDstNode() {
+  struct sockaddr_in addr {};
+  addr.sin_family = AF_INET;
+  addr.sin_port = htons(dst_port_);
+  if (inet_pton(AF_INET, dst_ip_.c_str(), &addr.sin_addr) != 1) {
+    error("Invalid dst IP: {}", dst_ip_);
+    return -1;
+  }
+
+  int fd = socket(AF_INET, SOCK_STREAM, 0);
+  if (fd < 0) {
+    error("socket() failed: {}", strerror(errno));
+    return -1;
+  }
+  int one = 1;
+  setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &one, sizeof(one));
+
+  if (::connect(fd, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
+    error("connect to {}:{} failed: {}", dst_ip_, dst_port_, strerror(errno));
+    close(fd);
+    return -1;
+  }
+
+  // add fd authOnDstNode

Review Comment:
   if you want to add a comment, make sure that it is readable to other people.



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