diff --git a/inc/fdb_def.h b/inc/fdb_def.h index 8c2ab8b..0e67321 100644 --- a/inc/fdb_def.h +++ b/inc/fdb_def.h @@ -17,8 +17,8 @@ extern "C" { #endif /* software version number */ -#define FDB_SW_VERSION "1.1.0" -#define FDB_SW_VERSION_NUM 0x10100 +#define FDB_SW_VERSION "1.1.1" +#define FDB_SW_VERSION_NUM 0x10101 /* the KV max name length must less then it */ #ifndef FDB_KV_NAME_MAX diff --git a/src/fdb_tsdb.c b/src/fdb_tsdb.c index 5ae0853..0182e50 100644 --- a/src/fdb_tsdb.c +++ b/src/fdb_tsdb.c @@ -775,9 +775,12 @@ fdb_err_t fdb_tsdb_init(fdb_tsdb_t db, const char *name, const char *path, fdb_g if (check_sec_arg.empty_num > 0) { latest_addr = check_sec_arg.empty_addr; } else { - latest_addr = db->cur_sec.addr; - /* There is no empty sector. */ - latest_addr = db->cur_sec.addr = db_max_size(db) - db_sec_size(db); + if (db->rollover) { + latest_addr = db->cur_sec.addr; + } else { + /* There is no empty sector. */ + latest_addr = db->cur_sec.addr = db_max_size(db) - db_sec_size(db); + } } /* db->cur_sec is the latest sector, and the next is the oldest sector */ if (latest_addr + db_sec_size(db) >= db_max_size(db)) {