From 2500771689761b2ababed459b5ac85957e519e83 Mon Sep 17 00:00:00 2001 From: Alexey Rybalchenko Date: Sat, 28 May 2022 14:05:41 +0200 Subject: [PATCH] shm: ResetContent(): reset data after recreating the metadata --- fairmq/shmem/Monitor.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fairmq/shmem/Monitor.cxx b/fairmq/shmem/Monitor.cxx index 65e0f595d..6c472e5e9 100644 --- a/fairmq/shmem/Monitor.cxx +++ b/fairmq/shmem/Monitor.cxx @@ -678,6 +678,9 @@ void Monitor::ResetContent(const ShmId& shmIdT, bool verbose /* = true */) size_t size = segment.get_segment_manager()->get_size(); new(ptr) segment_manager>, null_index>(size); } + if (verbose) { + cout << "Done." << endl; + } } catch (bie& e) { if (verbose) { cout << "Error resetting content of segment '" << std::string("fmq_" + shmId + "_m_" + to_string(s.first)) << "': " << e.what() << endl; @@ -722,13 +725,15 @@ void Monitor::ResetContent(const ShmId& shmIdT, const std::vector std::string shmId = shmIdT.shmId; std::string managementSegmentName("fmq_" + shmId + "_mng"); - // reset managed segments - ResetContent(shmIdT, verbose); // delete management segment + cout << "deleting management segment" << endl; Remove(managementSegmentName, verbose); // recreate management segment + cout << "recreating management segment..." << endl; managed_shared_memory mngSegment(create_only, managementSegmentName.c_str(), kManagementSegmentSize); + cout << "done." << endl; // fill management segment with segment & region infos + cout << "filling management segment with managed segment configs..." << endl; for (const auto& s : segmentCfgs) { if (s.allocationAlgorithm == "rbtree_best_fit") { Segment::Register(shmId, s.id, AllocationAlgorithm::rbtree_best_fit); @@ -739,9 +744,14 @@ void Monitor::ResetContent(const ShmId& shmIdT, const std::vector throw MonitorError("Unknown allocation algorithm provided: " + s.allocationAlgorithm); } } + cout << "done." << endl; + cout << "filling management segment with unmanaged region configs..." << endl; for (const auto& r : regionCfgs) { fair::mq::shmem::UnmanagedRegion::Register(shmId, r); } + cout << "done." << endl; + // reset managed segments + ResetContent(shmIdT, verbose); } void Monitor::ResetContent(const SessionId& sessionId, const std::vector& segmentCfgs, const std::vector& regionCfgs, bool verbose /* = true */)