diff --git a/conanfile.py b/conanfile.py index 7e3da73..ad037f5 100644 --- a/conanfile.py +++ b/conanfile.py @@ -9,7 +9,7 @@ class HomeBlocksConan(ConanFile): name = "homeblocks" - version = "5.0.0" + version = "5.0.2" homepage = "https://github.com/eBay/HomeBlocks" description = "Block Store built on HomeStore" diff --git a/src/lib/homeblks_impl.cpp b/src/lib/homeblks_impl.cpp index 640a51b..27dae43 100644 --- a/src/lib/homeblks_impl.cpp +++ b/src/lib/homeblks_impl.cpp @@ -422,6 +422,7 @@ void HomeBlocksImpl::on_hb_meta_blk_found(sisl::byte_view const& buf, void* cook if (sb_->test_flag(SB_FLAGS_GRACEFUL_SHUTDOWN)) { // if it is a gracefuln shutdown, this flag should be set again in shutdown routine; sb_->clear_flag(SB_FLAGS_GRACEFUL_SHUTDOWN); + gracefully_shutdown_ = true; LOGI("System was shutdown gracefully"); } else if (sb_->test_flag(SB_FLAGS_RESTRICTED)) { is_restricted_.store(true); diff --git a/src/lib/homeblks_impl.hpp b/src/lib/homeblks_impl.hpp index c9a9a82..cefeb19 100644 --- a/src/lib/homeblks_impl.hpp +++ b/src/lib/homeblks_impl.hpp @@ -78,6 +78,7 @@ class HomeBlocksImpl : public HomeBlocks, public VolumeManager, public std::enab std::unordered_map< std::string, shared< VolumeIndexTable > > idx_tbl_map_; bool recovery_done_{false}; + bool gracefully_shutdown_{false}; std::mutex sb_lock_; // this lock is only used when FC is triggered; superblk< homeblks_sb_t > sb_; peer_id_t our_uuid_; @@ -161,6 +162,7 @@ class HomeBlocksImpl : public HomeBlocks, public VolumeManager, public std::enab void exit_fc(VolumePtr& vol); bool is_restricted() const { return is_restricted_.load(); } hs_chunk_size_cfg_t get_chunk_size() const; + bool is_graceful_shutdown() const { return gracefully_shutdown_; } public: // public static APIs; diff --git a/src/lib/volume_mgr.cpp b/src/lib/volume_mgr.cpp index 0c1a4ba..03ce435 100644 --- a/src/lib/volume_mgr.cpp +++ b/src/lib/volume_mgr.cpp @@ -313,6 +313,12 @@ void HomeBlocksImpl::submit_io_batch() { homestore::data_service().submit_io_bat void HomeBlocksImpl::on_write(int64_t lsn, const sisl::blob& header, const sisl::blob& key, const std::vector< homestore::MultiBlkId >& new_blkids, cintrusive< homestore::repl_req_ctx >& ctx) { + + // We are not expecting log reply for a graceful restart; + // if we are in recovery path, we must be recovering from a crash. + DEBUG_ASSERT(ctx != nullptr || !is_graceful_shutdown(), + "repl ctx is null (recovery path) in graceful shutdown scenario, this is not expected!"); + repl_result_ctx< VolumeManager::NullResult >* repl_ctx{nullptr}; if (ctx) { repl_ctx = boost::static_pointer_cast< repl_result_ctx< VolumeManager::NullResult > >(ctx).get(); } auto msg_header = r_cast< MsgHeader* >(const_cast< uint8_t* >(header.cbytes()));