[kvdb] interrupt iteraotor when read_section_info fails (#251)

* 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>
This commit is contained in:
Lyon 2023-10-16 09:06:35 +08:00 committed by GitHub
parent deae3d1d3f
commit 7b2557f3e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

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