From 9ef9f5fd22d9f5387596b95b55d06a716b3ff460 Mon Sep 17 00:00:00 2001 From: yuwmao <148639999+yuwmao@users.noreply.github.com> Date: Tue, 24 Dec 2024 15:12:23 +0800 Subject: [PATCH] Adaptive changes for homestore/6.6.x (#246) * Avoid returning nullptr for cp_swtichover. HS will assume the consumer not participanting CP if nullptr returned. Signed-off-by: Xiaoxi Chen * Handle ReplServiceError::DATA_DUPLICATED --------- Signed-off-by: Xiaoxi Chen Co-authored-by: Xiaoxi Chen --- conanfile.py | 2 +- src/lib/homestore_backend/hs_cp_callbacks.cpp | 4 +++- src/lib/homestore_backend/hs_pg_manager.cpp | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/conanfile.py b/conanfile.py index cd72b59f..3e649fea 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class HomeObjectConan(ConanFile): name = "homeobject" - version = "2.1.18" + version = "2.1.19" homepage = "https://github.com/eBay/HomeObject" description = "Blob Store built on HomeReplication" diff --git a/src/lib/homestore_backend/hs_cp_callbacks.cpp b/src/lib/homestore_backend/hs_cp_callbacks.cpp index f50ce386..f54a0edd 100644 --- a/src/lib/homestore_backend/hs_cp_callbacks.cpp +++ b/src/lib/homestore_backend/hs_cp_callbacks.cpp @@ -23,7 +23,9 @@ using homestore::CPContext; namespace homeobject { -std::unique_ptr< CPContext > HSHomeObject::MyCPCallbacks::on_switchover_cp(CP* cur_cp, CP* new_cp) { return nullptr; } +std::unique_ptr< CPContext > HSHomeObject::MyCPCallbacks::on_switchover_cp(CP* cur_cp, CP* new_cp) { + return std::make_unique< CPContext >(new_cp); +} // when cp_flush is called, it means that all the dirty candidates are already in the dirty list. // new dirty candidates will arrive on next cp's context. diff --git a/src/lib/homestore_backend/hs_pg_manager.cpp b/src/lib/homestore_backend/hs_pg_manager.cpp index 50beffd5..da77684f 100644 --- a/src/lib/homestore_backend/hs_pg_manager.cpp +++ b/src/lib/homestore_backend/hs_pg_manager.cpp @@ -47,10 +47,13 @@ PGError toPgError(ReplServiceError const& e) { case ReplServiceError::OK: DEBUG_ASSERT(false, "Should not process OK!"); [[fallthrough]]; + case ReplServiceError::DATA_DUPLICATED: + [[fallthrough]]; case ReplServiceError::FAILED: return PGError::UNKNOWN; + default: + return PGError::UNKNOWN; } - return PGError::UNKNOWN; } [[maybe_unused]] static homestore::ReplDev& pg_repl_dev(PG const& pg) {