fix: keep option of database with precision ns

This commit is contained in:
kailixu 2022-12-08 11:56:29 +08:00
parent 8d247f3f7a
commit 4a6f41f7f1
2 changed files with 2 additions and 4 deletions

View File

@ -309,6 +309,7 @@ typedef enum ELogicConditionType {
#define TSDB_DEFAULT_DURATION_PER_FILE (10 * 1440)
#define TSDB_MIN_KEEP (1 * 1440) // data in db to be reserved. unit minute
#define TSDB_MAX_KEEP (365000 * 1440) // data in db to be reserved.
#define TSDB_MAX_KEEP_NS (29200 * 1440) // data in db to be reserved.
#define TSDB_DEFAULT_KEEP (3650 * 1440) // ten years
#define TSDB_MIN_MINROWS_FBLOCK 10
#define TSDB_MAX_MINROWS_FBLOCK 1000

View File

@ -3881,10 +3881,7 @@ static int32_t checkDbKeepOption(STranslateContext* pCxt, SDatabaseOptions* pOpt
int64_t tsdbMaxKeep = TSDB_MAX_KEEP;
if (pOptions->precision == TSDB_TIME_PRECISION_NANO) {
int64_t now = taosGetTimestampSec();
if (now < 0) now = 0;
tsdbMaxKeep = now / 60 + 292 * 365 * 1440;
tsdbMaxKeep = TMIN(tsdbMaxKeep, TSDB_MAX_KEEP);
tsdbMaxKeep = TSDB_MAX_KEEP_NS;
}
if (pOptions->keep[0] < TSDB_MIN_KEEP || pOptions->keep[1] < TSDB_MIN_KEEP || pOptions->keep[2] < TSDB_MIN_KEEP ||