Skip to content

Commit

Permalink
[kvdb] interrupt iteraotor when read_section_info fails (#251)
Browse files Browse the repository at this point in the history
* interrupt iteraotor when read_section_info failed

* Update src/fdb_kvdb.c

Co-authored-by: 朱天龙 (Armink) <armink.ztl@gmail.com>

* Update src/fdb_kvdb.c

Co-authored-by: 朱天龙 (Armink) <armink.ztl@gmail.com>

---------

Co-authored-by: 朱天龙 (Armink) <armink.ztl@gmail.com>
  • Loading branch information
pikasTech and armink authored Oct 16, 2023
1 parent deae3d1 commit 7b2557f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/fdb_kvdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,10 +837,12 @@ static void sector_iterator(fdb_kvdb_t db, kv_sec_info_t sector, fdb_sector_stor
sec_addr = db_oldest_addr(db);
do {
traversed_len += db_sec_size(db);
read_sector_info(db, sec_addr, sector, false);
if (FDB_NO_ERR != read_sector_info(db, sec_addr, sector, false))
return;
if (status == FDB_SECTOR_STORE_UNUSED || status == sector->status.store) {
if (traversal_kv) {
read_sector_info(db, sec_addr, sector, true);
if (FDB_NO_ERR != read_sector_info(db, sec_addr, sector, true))
return;
}
/* iterator is interrupted when callback return true */
if (callback && callback(sector, arg1, arg2)) {
Expand Down

0 comments on commit 7b2557f

Please sign in to comment.