mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 16:46:47 +00:00
shm: ResetContent(): reset data after recreating the metadata
This commit is contained in:
parent
e7f30e89f2
commit
cc5df280e5
|
@ -678,6 +678,9 @@ void Monitor::ResetContent(const ShmId& shmIdT, bool verbose /* = true */)
|
||||||
size_t size = segment.get_segment_manager()->get_size();
|
size_t size = segment.get_segment_manager()->get_size();
|
||||||
new(ptr) segment_manager<char, simple_seq_fit<mutex_family, offset_ptr<void>>, null_index>(size);
|
new(ptr) segment_manager<char, simple_seq_fit<mutex_family, offset_ptr<void>>, null_index>(size);
|
||||||
}
|
}
|
||||||
|
if (verbose) {
|
||||||
|
cout << "Done." << endl;
|
||||||
|
}
|
||||||
} catch (bie& e) {
|
} catch (bie& e) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
cout << "Error resetting content of segment '" << std::string("fmq_" + shmId + "_m_" + to_string(s.first)) << "': " << e.what() << endl;
|
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<SegmentConfig>
|
||||||
|
|
||||||
std::string shmId = shmIdT.shmId;
|
std::string shmId = shmIdT.shmId;
|
||||||
std::string managementSegmentName("fmq_" + shmId + "_mng");
|
std::string managementSegmentName("fmq_" + shmId + "_mng");
|
||||||
// reset managed segments
|
|
||||||
ResetContent(shmIdT, verbose);
|
|
||||||
// delete management segment
|
// delete management segment
|
||||||
|
cout << "deleting management segment" << endl;
|
||||||
Remove<bipc::shared_memory_object>(managementSegmentName, verbose);
|
Remove<bipc::shared_memory_object>(managementSegmentName, verbose);
|
||||||
// recreate management segment
|
// recreate management segment
|
||||||
|
cout << "recreating management segment..." << endl;
|
||||||
managed_shared_memory mngSegment(create_only, managementSegmentName.c_str(), kManagementSegmentSize);
|
managed_shared_memory mngSegment(create_only, managementSegmentName.c_str(), kManagementSegmentSize);
|
||||||
|
cout << "done." << endl;
|
||||||
// fill management segment with segment & region infos
|
// fill management segment with segment & region infos
|
||||||
|
cout << "filling management segment with managed segment configs..." << endl;
|
||||||
for (const auto& s : segmentCfgs) {
|
for (const auto& s : segmentCfgs) {
|
||||||
if (s.allocationAlgorithm == "rbtree_best_fit") {
|
if (s.allocationAlgorithm == "rbtree_best_fit") {
|
||||||
Segment::Register(shmId, s.id, 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<SegmentConfig>
|
||||||
throw MonitorError("Unknown allocation algorithm provided: " + s.allocationAlgorithm);
|
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) {
|
for (const auto& r : regionCfgs) {
|
||||||
fair::mq::shmem::UnmanagedRegion::Register(shmId, r);
|
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<SegmentConfig>& segmentCfgs, const std::vector<RegionConfig>& regionCfgs, bool verbose /* = true */)
|
void Monitor::ResetContent(const SessionId& sessionId, const std::vector<SegmentConfig>& segmentCfgs, const std::vector<RegionConfig>& regionCfgs, bool verbose /* = true */)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user