Skip to content

Commit

Permalink
[tsdb] Fixed a bug (armink#108) when tsl is full on rollover mode. Thx
Browse files Browse the repository at this point in the history
  • Loading branch information
armink committed Dec 26, 2021
1 parent bf3ac9e commit 83f1669
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions inc/fdb_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/fdb_tsdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 83f1669

Please sign in to comment.