mirror of
https://github.com/armink/FlashDB.git
synced 2026-08-18 09:28:01 +08:00
[tsdb] Fixed a bug (#108) when tsl is full on rollover mode. Thx @kenny-33 @illusionkiller .
This commit is contained in:
+2
-2
@@ -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
|
||||
|
||||
+6
-3
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user