提交 c879506a 编写于 作者: S shenglian zhou

[TD-10683]<fix>:set TSTD_MAX_KEEP to 36500 and set MIN_TS_KEY to take into...

[TD-10683]<fix>:set TSTD_MAX_KEEP to 36500 and set MIN_TS_KEY to take into account DELETE account in TKEY
上级 1041396a
......@@ -139,7 +139,7 @@ typedef uint64_t TKEY;
#define tdGetTKEY(key) (((TKEY)ABS(key)) | (TKEY_NEGATIVE_FLAG & (TKEY)(key)))
#define tdGetKey(tkey) (((TSKEY)((tkey)&TKEY_VALUE_FILTER)) * (TKEY_IS_NEGATIVE(tkey) ? -1 : 1))
#define MIN_TS_KEY ((TSKEY)0x8000000000000001)
#define MIN_TS_KEY ((TSKEY)0xc000000000000001)
#define MAX_TS_KEY ((TSKEY)0x3fffffffffffffff)
#define TD_TO_TKEY(key) tdGetTKEY(((key) < MIN_TS_KEY) ? MIN_TS_KEY : (((key) > MAX_TS_KEY) ? MAX_TS_KEY : key))
......
......@@ -290,7 +290,7 @@ do { \
#define TSDB_DEFAULT_DAYS_PER_FILE 10
#define TSDB_MIN_KEEP 1 // data in db to be reserved.
#define TSDB_MAX_KEEP 365000 // data in db to be reserved.
#define TSDB_MAX_KEEP 36500 // data in db to be reserved.
#define TSDB_DEFAULT_KEEP 3650 // ten years
#define TSDB_DEFAULT_MIN_ROW_FBLOCK 100
......
......@@ -647,6 +647,9 @@ static int tsdbScanAndConvertSubmitMsg(STsdbRepo *pRepo, SSubmitMsg *pMsg) {
TSKEY now = taosGetTimestamp(pRepo->config.precision);
TSKEY minKey = now - tsTickPerDay[pRepo->config.precision] * pRepo->config.keep;
TSKEY maxKey = now + tsTickPerDay[pRepo->config.precision] * pRepo->config.daysPerFile;
if (minKey >= now) minKey = MIN_TS_KEY;
if (maxKey <= now) maxKey = MAX_TS_KEY;
terrno = TSDB_CODE_SUCCESS;
pMsg->length = htonl(pMsg->length);
......
......@@ -31,6 +31,7 @@ class TDTestCase:
tdSql.prepare()
tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db')
tdSql.error('create database db keep 365000');
tdSql.execute('create database db precision "ns";')
tdSql.query('show databases;')
tdSql.checkData(0,16,'ns')
......@@ -216,4 +217,4 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
tdCases.addLinux(__file__, TDTestCase())
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册