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:
Shahar Mike 2023-12-17 15:00:10 +02:00 committed by GitHub
parent aaf01d4244
commit dcedd1645e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 208 additions and 245 deletions

View file

@ -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&) {