mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
feat(server): Convert DbSlice
's AddOr*
to return AutoUpdater
(#2290)
* fix(server): Use AutoUpdater with AddOr* methods * Remove explicit calls * `operator=` * return *this * PostUpdate twice * exp it * bitops * remove explicit `Run()` * Explicitly `delete` copy ops * Remove `AddOrSkip()`
This commit is contained in:
parent
aaf01d4244
commit
dcedd1645e
15 changed files with 208 additions and 245 deletions
|
@ -2364,9 +2364,9 @@ void RdbLoader::LoadItemsBuffer(DbIndex db_ind, const ItemsBuf& ib) {
|
|||
continue;
|
||||
|
||||
try {
|
||||
auto [it, added] = db_slice.AddOrUpdate(db_cntx, item->key, std::move(pv), item->expire_ms);
|
||||
it->first.SetSticky(item->is_sticky);
|
||||
if (!added) {
|
||||
auto res = db_slice.AddOrUpdate(db_cntx, item->key, std::move(pv), item->expire_ms);
|
||||
res.it->first.SetSticky(item->is_sticky);
|
||||
if (!res.is_new) {
|
||||
LOG(WARNING) << "RDB has duplicated key '" << item->key << "' in DB " << db_ind;
|
||||
}
|
||||
} catch (const std::bad_alloc&) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue