From 56b3f9550406a1c7e48aa9b275298c9efc8b48b8 Mon Sep 17 00:00:00 2001 From: cheniujh <41671101+cheniujh@users.noreply.github.com> Date: Thu, 20 Jun 2024 17:51:24 +0800 Subject: [PATCH] fix: Pika can not exec full-sync when multi slaves connect to the same master within a short time (#2746) * use int64_t instead of int32_t --------- Co-authored-by: cjh <1271435567@qq.com> --- src/pika_server.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pika_server.cc b/src/pika_server.cc index 2c19ca8e16..3ed9217688 100644 --- a/src/pika_server.cc +++ b/src/pika_server.cc @@ -833,7 +833,8 @@ void PikaServer::TryDBSync(const std::string& ip, int port, const std::string& d std::string logger_filename = sync_db->Logger()->filename(); if (pstd::IsDir(bgsave_info.path) != 0 || !pstd::FileExists(NewFileName(logger_filename, bgsave_info.offset.b_offset.filenum)) || - top - bgsave_info.offset.b_offset.filenum > kDBSyncMaxGap) { + static_cast(top) - static_cast(bgsave_info.offset.b_offset.filenum) > + static_cast(kDBSyncMaxGap)) { // Need Bgsave first db->BgSaveDB(); }