| 381 | } |
| 382 | |
| 383 | void 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 | |
| 414 | std::size_t RefillGuard::snapshotBytes() const noexcept { |
| 415 | std::size_t bytes = 0; |
nothing calls this directly
no test coverage detected