This is an automated email from the ASF dual-hosted git repository.
twice pushed a commit to branch 2.11
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
commit d97f03c76d14027058b640624aa61d4a10f6de1a
Author: Twice <tw...@gmail.com>
AuthorDate: Sat Feb 1 17:17:48 2025 +0800
fix(tls): remove SSL_sendfile path to avoid errors in replication fullsync (#2757)
---
src/commands/cmd_replication.cc | 13 ++++++++-----
src/common/io_util.cc | 5 +----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/commands/cmd_replication.cc b/src/commands/cmd_replication.cc
index 290b1261..ab288ca8 100644
--- a/src/commands/cmd_replication.cc
+++ b/src/commands/cmd_replication.cc
@@ -240,10 +240,10 @@ class CommandFetchMeta : public Commander {
return;
}
// Send full data file info
- if (util::SockSend(repl_fd, files + CRLF, bev).IsOK()) {
+ if (auto s = util::SockSend(repl_fd, files + CRLF, bev)) {
LOG(INFO) << "[replication] Succeed sending full data file info to " << ip;
} else {
- LOG(WARNING) << "[replication] Fail to send full data file info " << ip << ", error: " << strerror(errno);
+ LOG(WARNING) << "[replication] Fail to send full data file info " << ip << ", error: " << s.Msg();
}
auto now_secs = static_cast<time_t>(util::GetTimeStamp());
srv->storage->SetCheckpointAccessTimeSecs(now_secs);
@@ -295,11 +295,14 @@ class CommandFetchFile : public Commander {
if (!fd) break;
// Send file size and content
- if (util::SockSend(repl_fd, std::to_string(file_size) + CRLF, bev).IsOK() &&
- util::SockSendFile(repl_fd, *fd, file_size, bev).IsOK()) {
+ auto s = util::SockSend(repl_fd, std::to_string(file_size) + CRLF, bev);
+ if (s) {
+ s = util::SockSendFile(repl_fd, *fd, file_size, bev);
+ }
+ if (s) {
LOG(INFO) << "[replication] Succeed sending file " << file << " to " << ip;
} else {
- LOG(WARNING) << "[replication] Fail to send file " << file << " to " << ip << ", error: " << strerror(errno);
+ LOG(WARNING) << "[replication] Fail to send file " << file << " to " << ip << ", error: " << s.Msg();
break;
}
fd.Close();
diff --git a/src/common/io_util.cc b/src/common/io_util.cc
index 23cccc69..1136dbb1 100644
--- a/src/common/io_util.cc
+++ b/src/common/io_util.cc
@@ -274,11 +274,8 @@ Status SockSendFile(int out_fd, int in_fd, size_t size) { return SockSendFileImp
Status SockSendFile(int out_fd, int in_fd, size_t size, [[maybe_unused]] ssl_st *ssl) {
#ifdef ENABLE_OPENSSL
if (ssl) {
-#if OPENSSL_VERSION_NUMBER >= 0x30000000L
- return SockSendFileImpl<SSL_sendfile>(ssl, in_fd, size, 0);
-#else
+ // NOTE: SockSendFileImpl<SSL_sendfile> will cause errors, refer to #2756
return SockSendFileImpl<SendFileSSLImpl>(ssl, in_fd, size);
-#endif
}
#endif
return SockSendFile(out_fd, in_fd, size);