mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 10:25:47 +02:00
chore: do not preempt on db_slice::RegisterOnChange (#3388)
For big value serialization it is required to support preemption when db_slice::RegisterOnChange is called to avoid UB when a code path is iterating over the change_cb_ and preempts because it serializes a big value. As this is problematic and can lead to data inconsistencies I replace the std::vector with std::list and bound the iteration of change_cb_ on paths that preempt. * replace std::vector with std::list for change_cb_ * bound iteration of change_cb_ on paths that preempt --------- Signed-off-by: kostas <kostas@dragonflydb.io>
This commit is contained in:
parent
4b851be57a
commit
a95cf2e857
2 changed files with 13 additions and 8 deletions
|
@ -571,7 +571,7 @@ class DbSlice {
|
|||
mutable absl::flat_hash_set<uint64_t> uniq_fps_;
|
||||
|
||||
// ordered from the smallest to largest version.
|
||||
std::vector<std::pair<uint64_t, ChangeCallback>> change_cb_;
|
||||
std::list<std::pair<uint64_t, ChangeCallback>> change_cb_;
|
||||
|
||||
// Used in temporary computations in Find item and CbFinish
|
||||
mutable absl::flat_hash_set<CompactObjectView> fetched_items_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue