Skip to content

Commit

Permalink
chore: added a comment
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
  • Loading branch information
romange committed Nov 13, 2024
1 parent 36dcf06 commit 08772bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
10 changes: 1 addition & 9 deletions src/server/db_slice.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,14 @@ unsigned PrimeEvictionPolicy::Evict(const PrimeTable::HotspotBuckets& eb, PrimeT
return 1;
}

// Helper class to cache and restore fetched_items_ of DbSlice for flows that preempt
// because some other transaction might conclude and clear the fetched_items_ with OnCbFinish()
// Deprecated and should be removed.
class FetchedItemsRestorer {
public:
// using RestoreType = absl::flat_hash_set<CompactObjectView>;
template <typename U> explicit FetchedItemsRestorer(U&& u) {
// cached_ = std::move(*dst_to_restore_);
}

~FetchedItemsRestorer() {
// *dst_to_restore_ = std::move(cached_);
}

private:
// RestoreType cached_;
// RestoreType* dst_to_restore_;
};

} // namespace
Expand Down
7 changes: 7 additions & 0 deletions src/server/db_slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,13 @@ class DbSlice {
std::list<std::pair<uint64_t, ChangeCallback>> change_cb_;

// Used in temporary computations in Find item and CbFinish
// This set is used to hold fingerprints of key accessed during the run of
// a transaction callback (not the whole transaction).
// We track them to avoid bumping them again (in any direction) so that the iterators to
// the fetched keys will not be invalidated. We must do it for atomic operations,
// for operations that preempt in the middle we have another mechanism -
// auto laundering iterators, so in case of preemption we do not mind that fetched_items are
// cleared or changed.
mutable absl::flat_hash_set<uint64_t, FpHasher> fetched_items_;

// Registered by shard indices on when first document index is created.
Expand Down

0 comments on commit 08772bf

Please sign in to comment.