Skip to content

Commit

Permalink
[kvdb] Clear cache before setting kv to default (#282)
Browse files Browse the repository at this point in the history
* fix: clear cache.

* Update fdb_kvdb.c, remove sector cache clear.

---------

Co-authored-by: shihang zhang <shihang.zhang.ext@siemens.com>
  • Loading branch information
shihang-zhang and shihang zhang authored Mar 22, 2024
1 parent 64b07d7 commit 24305a9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/fdb_kvdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,13 @@ fdb_err_t fdb_kv_set_default(fdb_kvdb_t db)

/* lock the KV cache */
db_lock(db);

#ifdef FDB_KV_USING_CACHE
for (i = 0; i < FDB_KV_CACHE_TABLE_SIZE; i++) {
db->kv_cache_table[i].addr = FDB_DATA_UNUSED;
}
#endif /* FDB_KV_USING_CACHE */

/* format all sectors */
for (addr = 0; addr < db_max_size(db); addr += db_sec_size(db)) {
result = format_sector(db, addr, SECTOR_NOT_COMBINED);
Expand Down

0 comments on commit 24305a9

Please sign in to comment.