MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / rollback

Method rollback

pj_runtime/src/SessionManager.cpp:383–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381}
382
383void RefillGuard::rollback() {
384 // (a) Adapters drop any partial-refill chunk pointers cached via progress notifies.
385 session_->notifyDatasetAboutToBeReplaced(dataset_id_);
386 // (b) Scalar: drop partial refill chunks + retire topics it added, then move the
387 // prior chunks back into the stable ids.
388 session_->dataEngine().reattachDatasetChunks(dataset_id_, std::move(scalar_snapshot_));
389 // (c) Object: evict topics the refill ADDED (drops their store series + parser
390 // slots) BEFORE reattach, so reattach's own "current - prior" removal is a
391 // no-op. evictObjectTopics re-takes store_mutex_, so it must run OUTSIDE it —
392 // it does here (no ObjectStore lock held on this thread).
393 std::unordered_set<uint32_t> prior;
394 prior.reserve(prior_object_topic_ids_.size());
395 for (const ObjectTopicId id : prior_object_topic_ids_) {
396 prior.insert(id.id);
397 }
398 std::vector<ObjectTopicId> added;
399 for (const ObjectTopicId id : session_->objectStore().listTopics(dataset_id_)) {
400 if (prior.find(id.id) == prior.end()) {
401 added.push_back(id);
402 }
403 }
404 if (!added.empty()) {
405 session_->evictObjectTopics(added);
406 }
407 // (d) Object: move the prior entries back into the stable ids.
408 session_->objectStore().reattachDataset(dataset_id_, std::move(object_snapshot_));
409 // (e) UI: reflect the restored topic set (non-live).
410 const std::vector<TopicId> current = session_->dataEngine().listTopics(dataset_id_);
411 session_->notifyIngest(QVector<TopicId>(current.begin(), current.end()), /*live=*/false);
412}
413
414std::size_t RefillGuard::snapshotBytes() const noexcept {
415 std::size_t bytes = 0;

Callers

nothing calls this directly

Calls 14

reattachDatasetChunksMethod · 0.80
reserveMethod · 0.80
objectStoreMethod · 0.80
evictObjectTopicsMethod · 0.80
reattachDatasetMethod · 0.80
notifyIngestMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45
listTopicsMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected