fix: skip empty objects on load and replication (#3514)

* skip empty objects in rdb save
* skip empty objects in rdb load
* delete empty keys in FindReadOnly

---------

Signed-off-by: kostas <kostas@dragonflydb.io>
This commit is contained in:
Kostas Kyrimis 2024-08-20 09:44:41 +03:00 committed by GitHub
parent 84a697dd75
commit b979994025
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 185 additions and 12 deletions

View file

@ -292,9 +292,9 @@ class DbSlice {
ExpConstIterator exp_it;
};
ItAndExpConst FindReadOnly(const Context& cntx, std::string_view key) const;
ItAndExpConst FindReadOnly(const Context& cntx, std::string_view key);
OpResult<ConstIterator> FindReadOnly(const Context& cntx, std::string_view key,
unsigned req_obj_type) const;
unsigned req_obj_type);
struct AddOrFindResult {
Iterator it;
@ -515,6 +515,8 @@ class DbSlice {
void PreUpdate(DbIndex db_ind, Iterator it, std::string_view key);
void PostUpdate(DbIndex db_ind, Iterator it, std::string_view key, size_t orig_size);
bool DelEmptyPrimeValue(const Context& cntx, Iterator it);
OpResult<AddOrFindResult> AddOrUpdateInternal(const Context& cntx, std::string_view key,
PrimeValue obj, uint64_t expire_at_ms,
bool force_update);
@ -555,7 +557,7 @@ class DbSlice {
OpResult<PrimeItAndExp> FindInternal(const Context& cntx, std::string_view key,
std::optional<unsigned> req_obj_type,
UpdateStatsMode stats_mode) const;
UpdateStatsMode stats_mode);
OpResult<ItAndUpdater> FindMutableInternal(const Context& cntx, std::string_view key,
std::optional<unsigned> req_obj_type);