Skip to content

Commit

Permalink
[tsdb] Improve fdb_tsl_query_count return value. Delete the tsl_appen…
Browse files Browse the repository at this point in the history
…d assert check.
  • Loading branch information
armink committed Oct 15, 2023
1 parent ab4c69f commit 1c68317
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/fdb_tsdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,13 @@ static fdb_err_t tsl_append(fdb_tsdb_t db, fdb_blob_t blob)
fdb_err_t result = FDB_NO_ERR;
fdb_time_t cur_time = db->get_time();

FDB_ASSERT(blob->size <= db->max_len);
/* check the append length, MUST less than the db->max_len */
if(blob->size > db->max_len)
{
FDB_INFO("Warning: append length (%" PRIdMAX ") is more than the db->max_len (%" PRIdMAX "). This tsl will be dropped.\n",
(intmax_t)blob->size, (intmax_t)(db->max_len));
return FDB_WRITE_ERR;
}

/* check the current timestamp, MUST more than the last save timestamp */
if (cur_time <= db->last_time) {
Expand Down Expand Up @@ -690,7 +696,7 @@ size_t fdb_tsl_query_count(fdb_tsdb_t db, fdb_time_t from, fdb_time_t to, fdb_ts

if (!db_init_ok(db)) {
FDB_INFO("Error: TSL (%s) isn't initialize OK.\n", db_name(db));
return FDB_INIT_FAILED;
return 0;
}

fdb_tsl_iter_by_time(db, from, to, query_count_cb, &arg);
Expand Down

0 comments on commit 1c68317

Please sign in to comment.