mirror of
https://github.com/armink/FlashDB.git
synced 2026-09-27 10:44:29 +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
|
#endif
|
||||||
|
|
||||||
/* software version number */
|
/* software version number */
|
||||||
#define FDB_SW_VERSION "1.1.0"
|
#define FDB_SW_VERSION "1.1.1"
|
||||||
#define FDB_SW_VERSION_NUM 0x10100
|
#define FDB_SW_VERSION_NUM 0x10101
|
||||||
|
|
||||||
/* the KV max name length must less then it */
|
/* the KV max name length must less then it */
|
||||||
#ifndef FDB_KV_NAME_MAX
|
#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) {
|
if (check_sec_arg.empty_num > 0) {
|
||||||
latest_addr = check_sec_arg.empty_addr;
|
latest_addr = check_sec_arg.empty_addr;
|
||||||
} else {
|
} else {
|
||||||
latest_addr = db->cur_sec.addr;
|
if (db->rollover) {
|
||||||
/* There is no empty sector. */
|
latest_addr = db->cur_sec.addr;
|
||||||
latest_addr = db->cur_sec.addr = db_max_size(db) - db_sec_size(db);
|
} 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 */
|
/* 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)) {
|
if (latest_addr + db_sec_size(db) >= db_max_size(db)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user