You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* The oldest address is 0 by default.
* The new oldest sector is found when sector status change from empty to full or using.
*/
if (*last_sector_status == FDB_SECTOR_STORE_EMPTY
&& (sector->status.store == FDB_SECTOR_STORE_FULL || sector->status.store == FDB_SECTOR_STORE_USING)) {
*sector_oldest_addr = sector->addr;
}
测试情况说明:
1)数据库挂载了4个扇区,一扇区写入本条数据后满(0x1F,且脏),二扇区为空(0x7F),三扇区状态满(0x1F,且脏;最旧),四扇区状态满(0x1F,且脏);
2)触发垃圾回收并进行,此时4个扇区存储状态分别为:满(0x1F)、使用中(0x3F)、满(0x1F,迁移中)、满(0x1F);
3)掉电;
4)上电后4个扇区的存储状态仍为:满(0x1F)、使用中(0x3F)、满(0x1F,迁移中)、满(0x1F),上述if条件不满足,db_oldest_addr(db) = 0;
5)检测到存在垃圾回收被中断的扇区,恢复垃圾回收,对最旧扇区即一扇区进行数据迁移;
6)由于掉电前垃圾回收的扇区为三扇区,掉电后被更改为一扇区,导致二扇区无法完成一扇区的全部数据迁移;
7)一扇区被擦除,有效数据丢失。
以上情况发生会导致有效数据被擦除。
是不是可以在if条件里增加是否处于恢复性检查状态的判断?db->in_recovery_check == true
The text was updated successfully, but these errors were encountered: