未验证 提交 472a1aa9 编写于 作者: D dapan1121 提交者: GitHub

Merge pull request #8331 from taosdata/szhou/hotfix/td-10683

Szhou/hotfix/td 10683
...@@ -6792,16 +6792,21 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p ...@@ -6792,16 +6792,21 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDbInfo* p
tVariantListItem* p1 = (s > 1) ? taosArrayGet(pKeep, 1) : p0; tVariantListItem* p1 = (s > 1) ? taosArrayGet(pKeep, 1) : p0;
tVariantListItem* p2 = (s > 2) ? taosArrayGet(pKeep, 2) : p1; tVariantListItem* p2 = (s > 2) ? taosArrayGet(pKeep, 2) : p1;
if ((int32_t)p0->pVar.i64 <= 0 || (int32_t)p1->pVar.i64 <= 0 || (int32_t)p2->pVar.i64 <= 0) { int32_t daysToKeep0 = (int32_t)p0->pVar.i64;
int32_t daysToKeep1 = (int32_t)(int32_t)p1->pVar.i64;
int32_t daysToKeep2 = (int32_t)p2->pVar.i64;
if (daysToKeep0 <= 0 || daysToKeep1 <= 0 || daysToKeep2 <= 0 ||
daysToKeep0 > TSDB_MAX_KEEP || daysToKeep1 > TSDB_MAX_KEEP || daysToKeep2 > TSDB_MAX_KEEP) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
if (!(((int32_t)p0->pVar.i64 <= (int32_t)p1->pVar.i64) && ((int32_t)p1->pVar.i64 <= (int32_t)p2->pVar.i64))) {
if (!((daysToKeep0 <= daysToKeep1) && (daysToKeep1 <= daysToKeep2))) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
} }
pMsg->daysToKeep0 = htonl((int32_t)p0->pVar.i64); pMsg->daysToKeep0 = htonl(daysToKeep0);
pMsg->daysToKeep1 = htonl((int32_t)p1->pVar.i64); pMsg->daysToKeep1 = htonl(daysToKeep1);
pMsg->daysToKeep2 = htonl((int32_t)p2->pVar.i64); pMsg->daysToKeep2 = htonl(daysToKeep2);
} }
......
...@@ -139,7 +139,7 @@ typedef uint64_t TKEY; ...@@ -139,7 +139,7 @@ typedef uint64_t TKEY;
#define tdGetTKEY(key) (((TKEY)ABS(key)) | (TKEY_NEGATIVE_FLAG & (TKEY)(key))) #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 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 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)) #define TD_TO_TKEY(key) tdGetTKEY(((key) < MIN_TS_KEY) ? MIN_TS_KEY : (((key) > MAX_TS_KEY) ? MAX_TS_KEY : key))
......
...@@ -295,7 +295,7 @@ do { \ ...@@ -295,7 +295,7 @@ do { \
#define TSDB_DEFAULT_DAYS_PER_FILE 10 #define TSDB_DEFAULT_DAYS_PER_FILE 10
#define TSDB_MIN_KEEP 1 // data in db to be reserved. #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_KEEP 3650 // ten years
#define TSDB_DEFAULT_MIN_ROW_FBLOCK 100 #define TSDB_DEFAULT_MIN_ROW_FBLOCK 100
......
...@@ -647,7 +647,7 @@ static int tsdbScanAndConvertSubmitMsg(STsdbRepo *pRepo, SSubmitMsg *pMsg) { ...@@ -647,7 +647,7 @@ static int tsdbScanAndConvertSubmitMsg(STsdbRepo *pRepo, SSubmitMsg *pMsg) {
TSKEY now = taosGetTimestamp(pRepo->config.precision); TSKEY now = taosGetTimestamp(pRepo->config.precision);
TSKEY minKey = now - tsTickPerDay[pRepo->config.precision] * pRepo->config.keep; TSKEY minKey = now - tsTickPerDay[pRepo->config.precision] * pRepo->config.keep;
TSKEY maxKey = now + tsTickPerDay[pRepo->config.precision] * pRepo->config.daysPerFile; TSKEY maxKey = now + tsTickPerDay[pRepo->config.precision] * pRepo->config.daysPerFile;
terrno = TSDB_CODE_SUCCESS; terrno = TSDB_CODE_SUCCESS;
pMsg->length = htonl(pMsg->length); pMsg->length = htonl(pMsg->length);
pMsg->numOfBlocks = htonl(pMsg->numOfBlocks); pMsg->numOfBlocks = htonl(pMsg->numOfBlocks);
......
...@@ -31,6 +31,7 @@ class TDTestCase: ...@@ -31,6 +31,7 @@ class TDTestCase:
tdSql.prepare() tdSql.prepare()
tdSql.execute('reset query cache') tdSql.execute('reset query cache')
tdSql.execute('drop database if exists db') tdSql.execute('drop database if exists db')
tdSql.error('create database db keep 365000');
tdSql.execute('create database db precision "ns";') tdSql.execute('create database db precision "ns";')
tdSql.query('show databases;') tdSql.query('show databases;')
tdSql.checkData(0,16,'ns') tdSql.checkData(0,16,'ns')
...@@ -216,4 +217,4 @@ class TDTestCase: ...@@ -216,4 +217,4 @@ class TDTestCase:
tdCases.addWindows(__file__, TDTestCase()) tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase()) tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
...@@ -86,12 +86,13 @@ endi ...@@ -86,12 +86,13 @@ endi
if $data07 != 11,12,13 then if $data07 != 11,12,13 then
return -1 return -1
endi endi
sql alter database $db keep 365000,365000,365000 sql_error alter database $db keep 365000,365000,365000
sql alter database $db keep 36500,36500,36500
sql show databases sql show databases
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data07 != 365000,365000,365000 then if $data07 != 36500,36500,36500 then
return -1 return -1
endi endi
......
...@@ -79,15 +79,16 @@ endi ...@@ -79,15 +79,16 @@ endi
if $data07 != 13 then if $data07 != 13 then
return -1 return -1
endi endi
sql alter database $db keep 365000 sql alter database $db keep 36500
sql show databases sql show databases
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
if $data07 != 365000 then if $data07 != 36500 then
return -1 return -1
endi endi
sql_error alter database $db keep 365000
##### alter table test, simeplest case ##### alter table test, simeplest case
sql create table tb (ts timestamp, c1 int, c2 int, c3 int) sql create table tb (ts timestamp, c1 int, c2 int, c3 int)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册