From 7b2557f3e7bc993db94404de6a765d495acc35f5 Mon Sep 17 00:00:00 2001 From: Lyon <88232613+pikasTech@users.noreply.github.com> Date: Mon, 16 Oct 2023 09:06:35 +0800 Subject: [PATCH] [kvdb] interrupt iteraotor when read_section_info fails (#251) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * interrupt iteraotor when read_section_info failed * Update src/fdb_kvdb.c Co-authored-by: 朱天龙 (Armink) * Update src/fdb_kvdb.c Co-authored-by: 朱天龙 (Armink) --------- Co-authored-by: 朱天龙 (Armink) --- src/fdb_kvdb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fdb_kvdb.c b/src/fdb_kvdb.c index 5680383..da83953 100644 --- a/src/fdb_kvdb.c +++ b/src/fdb_kvdb.c @@ -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)) {