feat:add ttl/comment function & fix global version shadows a variable
This commit is contained in:
parent
2bd2996e74
commit
8ace8dfd8b
|
@ -108,7 +108,7 @@ extern float tsStreamComputDelayRatio; // the delayed computing ration of the
|
||||||
extern int64_t tsMaxRetentWindow;
|
extern int64_t tsMaxRetentWindow;
|
||||||
|
|
||||||
// build info
|
// build info
|
||||||
extern char version[];
|
extern char td_version[];
|
||||||
extern char compatible_version[];
|
extern char compatible_version[];
|
||||||
extern char gitinfo[];
|
extern char gitinfo[];
|
||||||
extern char buildinfo[];
|
extern char buildinfo[];
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char version[];
|
extern char td_version[];
|
||||||
extern char compatible_version[];
|
extern char compatible_version[];
|
||||||
extern char gitinfo[];
|
extern char gitinfo[];
|
||||||
extern char buildinfo[];
|
extern char buildinfo[];
|
||||||
|
|
|
@ -397,7 +397,7 @@ const char *taos_data_type(int type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *taos_get_client_info() { return version; }
|
const char *taos_get_client_info() { return td_version; }
|
||||||
|
|
||||||
int taos_affected_rows(TAOS_RES *res) {
|
int taos_affected_rows(TAOS_RES *res) {
|
||||||
if (res == NULL || TD_RES_TMQ(res)) {
|
if (res == NULL || TD_RES_TMQ(res)) {
|
||||||
|
|
|
@ -362,7 +362,7 @@ static int32_t taosAddSystemCfg(SConfig *pCfg) {
|
||||||
if (cfgAddString(pCfg, "os version", info.version, 1) != 0) return -1;
|
if (cfgAddString(pCfg, "os version", info.version, 1) != 0) return -1;
|
||||||
if (cfgAddString(pCfg, "os machine", info.machine, 1) != 0) return -1;
|
if (cfgAddString(pCfg, "os machine", info.machine, 1) != 0) return -1;
|
||||||
|
|
||||||
if (cfgAddString(pCfg, "version", version, 1) != 0) return -1;
|
if (cfgAddString(pCfg, "version", td_version, 1) != 0) return -1;
|
||||||
if (cfgAddString(pCfg, "compatible_version", compatible_version, 1) != 0) return -1;
|
if (cfgAddString(pCfg, "compatible_version", compatible_version, 1) != 0) return -1;
|
||||||
if (cfgAddString(pCfg, "gitinfo", gitinfo, 1) != 0) return -1;
|
if (cfgAddString(pCfg, "gitinfo", gitinfo, 1) != 0) return -1;
|
||||||
if (cfgAddString(pCfg, "buildinfo", buildinfo, 1) != 0) return -1;
|
if (cfgAddString(pCfg, "buildinfo", buildinfo, 1) != 0) return -1;
|
||||||
|
|
|
@ -114,7 +114,7 @@ static void dmPrintVersion() {
|
||||||
#else
|
#else
|
||||||
char *releaseName = "community";
|
char *releaseName = "community";
|
||||||
#endif
|
#endif
|
||||||
printf("%s version: %s compatible_version: %s\n", releaseName, version, compatible_version);
|
printf("%s version: %s compatible_version: %s\n", releaseName, td_version, compatible_version);
|
||||||
printf("gitinfo: %s\n", gitinfo);
|
printf("gitinfo: %s\n", gitinfo);
|
||||||
printf("buildInfo: %s\n", buildinfo);
|
printf("buildInfo: %s\n", buildinfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ static void *mndThreadFp(void *param) {
|
||||||
setThreadName("mnode-timer");
|
setThreadName("mnode-timer");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (lastTime % (100) == 0) { // sleep 1 day for ttl
|
if (lastTime % (864000) == 0) { // sleep 1 day for ttl
|
||||||
mndPushTtlTime(pMnode);
|
mndPushTtlTime(pMnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,7 +642,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
|
||||||
}
|
}
|
||||||
|
|
||||||
// cluster info
|
// cluster info
|
||||||
tstrncpy(pClusterInfo->version, version, sizeof(pClusterInfo->version));
|
tstrncpy(pClusterInfo->version, td_version, sizeof(pClusterInfo->version));
|
||||||
pClusterInfo->monitor_interval = tsMonitorInterval;
|
pClusterInfo->monitor_interval = tsMonitorInterval;
|
||||||
pClusterInfo->connections_total = mndGetNumOfConnections(pMnode);
|
pClusterInfo->connections_total = mndGetNumOfConnections(pMnode);
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) {
|
||||||
connectRsp.connType = connReq.connType;
|
connectRsp.connType = connReq.connType;
|
||||||
connectRsp.dnodeNum = mndGetDnodeSize(pMnode);
|
connectRsp.dnodeNum = mndGetDnodeSize(pMnode);
|
||||||
|
|
||||||
snprintf(connectRsp.sVersion, sizeof(connectRsp.sVersion), "ver:%s\nbuild:%s\ngitinfo:%s", version, buildinfo,
|
snprintf(connectRsp.sVersion, sizeof(connectRsp.sVersion), "ver:%s\nbuild:%s\ngitinfo:%s", td_version, buildinfo,
|
||||||
gitinfo);
|
gitinfo);
|
||||||
mndGetMnodeEpSet(pMnode, &connectRsp.epSet);
|
mndGetMnodeEpSet(pMnode, &connectRsp.epSet);
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOld->commentLen < pNew->commentLen) {
|
if (pOld->commentLen < pNew->commentLen && pNew->commentLen > 0) {
|
||||||
void *comment = taosMemoryMalloc(pNew->commentLen + 1);
|
void *comment = taosMemoryMalloc(pNew->commentLen + 1);
|
||||||
if (comment != NULL) {
|
if (comment != NULL) {
|
||||||
taosMemoryFree(pOld->comment);
|
taosMemoryFree(pOld->comment);
|
||||||
|
@ -291,6 +291,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
|
||||||
taosWUnLockLatch(&pOld->lock);
|
taosWUnLockLatch(&pOld->lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pOld->commentLen = pNew->commentLen;
|
||||||
|
|
||||||
if (pOld->ast1Len < pNew->ast1Len) {
|
if (pOld->ast1Len < pNew->ast1Len) {
|
||||||
void *pAst1 = taosMemoryMalloc(pNew->ast1Len);
|
void *pAst1 = taosMemoryMalloc(pNew->ast1Len);
|
||||||
|
@ -325,7 +326,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOld, SStbObj *pNew) {
|
||||||
pOld->numOfTags = pNew->numOfTags;
|
pOld->numOfTags = pNew->numOfTags;
|
||||||
memcpy(pOld->pColumns, pNew->pColumns, pOld->numOfColumns * sizeof(SSchema));
|
memcpy(pOld->pColumns, pNew->pColumns, pOld->numOfColumns * sizeof(SSchema));
|
||||||
memcpy(pOld->pTags, pNew->pTags, pOld->numOfTags * sizeof(SSchema));
|
memcpy(pOld->pTags, pNew->pTags, pOld->numOfTags * sizeof(SSchema));
|
||||||
if (pNew->commentLen != 0) {
|
if (pNew->commentLen > 0) {
|
||||||
memcpy(pOld->comment, pNew->comment, pNew->commentLen + 1);
|
memcpy(pOld->comment, pNew->comment, pNew->commentLen + 1);
|
||||||
}
|
}
|
||||||
if (pNew->ast1Len != 0) {
|
if (pNew->ast1Len != 0) {
|
||||||
|
|
|
@ -110,7 +110,7 @@ static char* mndBuildTelemetryReport(SMnode* pMnode) {
|
||||||
snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB);
|
snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB);
|
||||||
tjsonAddStringToObject(pJson, "memory", tmp);
|
tjsonAddStringToObject(pJson, "memory", tmp);
|
||||||
|
|
||||||
tjsonAddStringToObject(pJson, "version", version);
|
tjsonAddStringToObject(pJson, "version", td_version);
|
||||||
tjsonAddStringToObject(pJson, "buildInfo", buildinfo);
|
tjsonAddStringToObject(pJson, "buildInfo", buildinfo);
|
||||||
tjsonAddStringToObject(pJson, "gitInfo", gitinfo);
|
tjsonAddStringToObject(pJson, "gitInfo", gitinfo);
|
||||||
tjsonAddStringToObject(pJson, "email", pMgmt->email);
|
tjsonAddStringToObject(pJson, "email", pMgmt->email);
|
||||||
|
|
|
@ -400,8 +400,8 @@ static void metaBuildTtlIdxKey(STtlIdxKey *ttlKey, const SMetaEntry *pME){
|
||||||
|
|
||||||
if (ttlDays <= 0) return;
|
if (ttlDays <= 0) return;
|
||||||
|
|
||||||
// ttlKey->dtime = ctime / 1000 + ttlDays * 24 * 60 * 60;
|
ttlKey->dtime = ctime / 1000 + ttlDays * 24 * 60 * 60;
|
||||||
ttlKey->dtime = ctime / 1000 + ttlDays;
|
// ttlKey->dtime = ctime / 1000 + ttlDays;
|
||||||
ttlKey->uid = pME->uid;
|
ttlKey->uid = pME->uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,6 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
tDecoderInit(&dc, entry.pBuf, nData);
|
tDecoderInit(&dc, entry.pBuf, nData);
|
||||||
ret = metaDecodeEntry(&dc, &entry);
|
ret = metaDecodeEntry(&dc, &entry);
|
||||||
ASSERT(ret == 0);
|
ASSERT(ret == 0);
|
||||||
tDecoderClear(&dc);
|
|
||||||
|
|
||||||
if (entry.type != TSDB_NORMAL_TABLE) {
|
if (entry.type != TSDB_NORMAL_TABLE) {
|
||||||
terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION;
|
terrno = TSDB_CODE_VND_INVALID_TABLE_ACTION;
|
||||||
|
@ -597,12 +596,16 @@ static int metaAlterTableColumn(SMeta *pMeta, int64_t version, SVAlterTbReq *pAl
|
||||||
if (pNewSchema) taosMemoryFree(pNewSchema);
|
if (pNewSchema) taosMemoryFree(pNewSchema);
|
||||||
tdbTbcClose(pTbDbc);
|
tdbTbcClose(pTbDbc);
|
||||||
tdbTbcClose(pUidIdxc);
|
tdbTbcClose(pUidIdxc);
|
||||||
|
tDecoderClear(&dc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
if (entry.pBuf) taosMemoryFree(entry.pBuf);
|
if (entry.pBuf) taosMemoryFree(entry.pBuf);
|
||||||
tdbTbcClose(pTbDbc);
|
tdbTbcClose(pTbDbc);
|
||||||
tdbTbcClose(pUidIdxc);
|
tdbTbcClose(pUidIdxc);
|
||||||
|
tDecoderClear(&dc);
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -800,7 +803,6 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
||||||
tDecoderInit(&dc, entry.pBuf, nData);
|
tDecoderInit(&dc, entry.pBuf, nData);
|
||||||
ret = metaDecodeEntry(&dc, &entry);
|
ret = metaDecodeEntry(&dc, &entry);
|
||||||
ASSERT(ret == 0);
|
ASSERT(ret == 0);
|
||||||
tDecoderClear(&dc);
|
|
||||||
|
|
||||||
entry.version = version;
|
entry.version = version;
|
||||||
metaWLock(pMeta);
|
metaWLock(pMeta);
|
||||||
|
@ -834,6 +836,7 @@ static int metaUpdateTableOptions(SMeta *pMeta, int64_t version, SVAlterTbReq *p
|
||||||
|
|
||||||
tdbTbcClose(pTbDbc);
|
tdbTbcClose(pTbDbc);
|
||||||
tdbTbcClose(pUidIdxc);
|
tdbTbcClose(pUidIdxc);
|
||||||
|
tDecoderClear(&dc);
|
||||||
if (entry.pBuf) taosMemoryFree(entry.pBuf);
|
if (entry.pBuf) taosMemoryFree(entry.pBuf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -785,7 +785,7 @@ static void udfdPrintVersion() {
|
||||||
#else
|
#else
|
||||||
char *releaseName = "community";
|
char *releaseName = "community";
|
||||||
#endif
|
#endif
|
||||||
printf("%s version: %s compatible_version: %s\n", releaseName, version, compatible_version);
|
printf("%s version: %s compatible_version: %s\n", releaseName, td_version, compatible_version);
|
||||||
printf("gitinfo: %s\n", gitinfo);
|
printf("gitinfo: %s\n", gitinfo);
|
||||||
printf("buildInfo: %s\n", buildinfo);
|
printf("buildInfo: %s\n", buildinfo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -895,9 +895,15 @@ SNode* setTableOption(SAstCreateContext* pCxt, SNode* pOptions, ETableOptionType
|
||||||
case TABLE_OPTION_ROLLUP:
|
case TABLE_OPTION_ROLLUP:
|
||||||
((STableOptions*)pOptions)->pRollupFuncs = pVal;
|
((STableOptions*)pOptions)->pRollupFuncs = pVal;
|
||||||
break;
|
break;
|
||||||
case TABLE_OPTION_TTL:
|
case TABLE_OPTION_TTL:{
|
||||||
((STableOptions*)pOptions)->ttl = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
int64_t ttl = taosStr2Int64(((SToken*)pVal)->z, NULL, 10);
|
||||||
|
if (ttl > INT32_MAX){
|
||||||
|
ttl = INT32_MAX;
|
||||||
|
}
|
||||||
|
// ttl can not be smaller than 0, because there is a limitation in sql.y (TTL NK_INTEGER)
|
||||||
|
((STableOptions*)pOptions)->ttl = ttl;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case TABLE_OPTION_SMA:
|
case TABLE_OPTION_SMA:
|
||||||
((STableOptions*)pOptions)->pSma = pVal;
|
((STableOptions*)pOptions)->pSma = pVal;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2810,9 +2810,6 @@ static int32_t checkCreateTable(STranslateContext* pCxt, SCreateTableStmt* pStmt
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = checkTableRollupOption(pCxt, pStmt->pOptions->pRollupFuncs);
|
code = checkTableRollupOption(pCxt, pStmt->pOptions->pRollupFuncs);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
|
||||||
code = checkRangeOption(pCxt, "ttl", pStmt->pOptions->ttl, TSDB_MIN_TABLE_TTL, INT32_MAX);
|
|
||||||
}
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = checkTableSmaOption(pCxt, pStmt);
|
code = checkTableSmaOption(pCxt, pStmt);
|
||||||
}
|
}
|
||||||
|
@ -4995,11 +4992,8 @@ static int32_t buildUpdateOptionsReq(STranslateContext* pCxt, SAlterTableStmt* p
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
if (-1 != pStmt->pOptions->ttl) {
|
if (-1 != pStmt->pOptions->ttl) {
|
||||||
code = checkRangeOption(pCxt, "ttl", pStmt->pOptions->ttl, TSDB_MIN_TABLE_TTL, INT32_MAX);
|
pReq->updateTTL = true;
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
pReq->newTTL = pStmt->pOptions->ttl;
|
||||||
pReq->updateTTL = true;
|
|
||||||
pReq->newTTL = pStmt->pOptions->ttl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code){
|
if (TSDB_CODE_SUCCESS == code){
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
char version[12] = "${TD_VER_NUMBER}";
|
char td_version[12] = "${TD_VER_NUMBER}";
|
||||||
char compatible_version[12] = "${TD_VER_COMPATIBLE}";
|
char compatible_version[12] = "${TD_VER_COMPATIBLE}";
|
||||||
char gitinfo[48] = "${TD_VER_GIT}";
|
char gitinfo[48] = "${TD_VER_GIT}";
|
||||||
char buildinfo[64] = "Built at ${TD_VER_DATE}";
|
char buildinfo[64] = "Built at ${TD_VER_DATE}";
|
||||||
|
|
|
@ -0,0 +1,181 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, db_test.stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import taos
|
||||||
|
from util.log import tdLog
|
||||||
|
from util.cases import tdCases
|
||||||
|
from util.sql import tdSql
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def caseDescription(self):
|
||||||
|
'''
|
||||||
|
ttl/comment test
|
||||||
|
'''
|
||||||
|
return
|
||||||
|
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
|
||||||
|
tdSql.error("create table ttl_table1(ts timestamp, i int) ttl 1.1")
|
||||||
|
tdSql.error("create table ttl_table2(ts timestamp, i int) ttl 1e1")
|
||||||
|
tdSql.error("create table ttl_table3(ts timestamp, i int) ttl -1")
|
||||||
|
|
||||||
|
print("============== STEP 1 ===== test normal table")
|
||||||
|
|
||||||
|
tdSql.execute("create table normal_table1(ts timestamp, i int)")
|
||||||
|
tdSql.execute("create table normal_table2(ts timestamp, i int) comment '' ttl 3")
|
||||||
|
tdSql.execute("create table normal_table3(ts timestamp, i int) ttl 2100000000020 comment 'hello'")
|
||||||
|
|
||||||
|
tdSql.query("show tables like 'normal_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table1')
|
||||||
|
tdSql.checkData(0, 7, 0)
|
||||||
|
tdSql.checkData(0, 8, None)
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("show tables like 'normal_table2'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table2')
|
||||||
|
tdSql.checkData(0, 7, 3)
|
||||||
|
tdSql.checkData(0, 8, '')
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("show tables like 'normal_table3'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table3')
|
||||||
|
tdSql.checkData(0, 7, 2147483647)
|
||||||
|
tdSql.checkData(0, 8, 'hello')
|
||||||
|
|
||||||
|
tdSql.execute("alter table normal_table1 comment 'nihao'")
|
||||||
|
tdSql.query("show tables like 'normal_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table1')
|
||||||
|
tdSql.checkData(0, 8, 'nihao')
|
||||||
|
|
||||||
|
tdSql.execute("alter table normal_table1 comment ''")
|
||||||
|
tdSql.query("show tables like 'normal_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table1')
|
||||||
|
tdSql.checkData(0, 8, '')
|
||||||
|
|
||||||
|
tdSql.execute("alter table normal_table2 comment 'fly'")
|
||||||
|
tdSql.query("show tables like 'normal_table2'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table2')
|
||||||
|
tdSql.checkData(0, 8, 'fly')
|
||||||
|
|
||||||
|
tdSql.execute("alter table normal_table3 comment 'fly'")
|
||||||
|
tdSql.query("show tables like 'normal_table3'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table3')
|
||||||
|
tdSql.checkData(0, 8, 'fly')
|
||||||
|
|
||||||
|
tdSql.execute("alter table normal_table1 ttl 1")
|
||||||
|
tdSql.query("show tables like 'normal_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table1')
|
||||||
|
tdSql.checkData(0, 7, 1)
|
||||||
|
|
||||||
|
tdSql.execute("alter table normal_table3 ttl 0")
|
||||||
|
tdSql.query("show tables like 'normal_table3'")
|
||||||
|
tdSql.checkData(0, 0, 'normal_table3')
|
||||||
|
tdSql.checkData(0, 7, 0)
|
||||||
|
|
||||||
|
|
||||||
|
print("============== STEP 2 ===== test super table")
|
||||||
|
|
||||||
|
tdSql.execute("create table super_table1(ts timestamp, i int) tags(t int)")
|
||||||
|
tdSql.execute("create table super_table2(ts timestamp, i int) tags(t int) comment ''")
|
||||||
|
tdSql.execute("create table super_table3(ts timestamp, i int) tags(t int) comment 'super'")
|
||||||
|
|
||||||
|
tdSql.query("show stables like 'super_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'super_table1')
|
||||||
|
tdSql.checkData(0, 6, None)
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("show stables like 'super_table2'")
|
||||||
|
tdSql.checkData(0, 0, 'super_table2')
|
||||||
|
tdSql.checkData(0, 6, '')
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("show stables like 'super_table3'")
|
||||||
|
tdSql.checkData(0, 0, 'super_table3')
|
||||||
|
tdSql.checkData(0, 6, 'super')
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.execute("alter table super_table1 comment 'nihao'")
|
||||||
|
tdSql.query("show stables like 'super_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'super_table1')
|
||||||
|
tdSql.checkData(0, 6, 'nihao')
|
||||||
|
|
||||||
|
tdSql.execute("alter table super_table1 comment ''")
|
||||||
|
tdSql.query("show stables like 'super_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'super_table1')
|
||||||
|
tdSql.checkData(0, 6, '')
|
||||||
|
|
||||||
|
tdSql.execute("alter table super_table2 comment 'fly'")
|
||||||
|
tdSql.query("show stables like 'super_table2'")
|
||||||
|
tdSql.checkData(0, 0, 'super_table2')
|
||||||
|
tdSql.checkData(0, 6, 'fly')
|
||||||
|
|
||||||
|
tdSql.execute("alter table super_table3 comment 'tdengine'")
|
||||||
|
tdSql.query("show stables like 'super_table3'")
|
||||||
|
tdSql.checkData(0, 0, 'super_table3')
|
||||||
|
tdSql.checkData(0, 6, 'tdengine')
|
||||||
|
|
||||||
|
print("============== STEP 3 ===== test child table")
|
||||||
|
|
||||||
|
tdSql.execute("create table child_table1 using super_table1 tags(1)")
|
||||||
|
tdSql.execute("create table child_table2 using super_table1 tags(1) comment ''")
|
||||||
|
tdSql.execute("create table child_table3 using super_table1 tags(1) comment 'child'")
|
||||||
|
|
||||||
|
tdSql.query("show tables like 'child_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'child_table1')
|
||||||
|
tdSql.checkData(0, 8, None)
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("show tables like 'child_table2'")
|
||||||
|
tdSql.checkData(0, 0, 'child_table2')
|
||||||
|
tdSql.checkData(0, 8, '')
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.query("show tables like 'child_table3'")
|
||||||
|
tdSql.checkData(0, 0, 'child_table3')
|
||||||
|
tdSql.checkData(0, 8, 'child')
|
||||||
|
|
||||||
|
|
||||||
|
tdSql.execute("alter table child_table1 comment 'nihao'")
|
||||||
|
tdSql.query("show tables like 'child_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'child_table1')
|
||||||
|
tdSql.checkData(0, 8, 'nihao')
|
||||||
|
|
||||||
|
tdSql.execute("alter table child_table1 comment ''")
|
||||||
|
tdSql.query("show tables like 'child_table1'")
|
||||||
|
tdSql.checkData(0, 0, 'child_table1')
|
||||||
|
tdSql.checkData(0, 8, '')
|
||||||
|
|
||||||
|
tdSql.execute("alter table child_table2 comment 'fly'")
|
||||||
|
tdSql.query("show tables like 'child_table2'")
|
||||||
|
tdSql.checkData(0, 0, 'child_table2')
|
||||||
|
tdSql.checkData(0, 8, 'fly')
|
||||||
|
|
||||||
|
tdSql.execute("alter table child_table3 comment 'tdengine'")
|
||||||
|
tdSql.query("show tables like 'child_table3'")
|
||||||
|
tdSql.checkData(0, 0, 'child_table3')
|
||||||
|
tdSql.checkData(0, 8, 'tdengine')
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
||||||
|
|
|
@ -67,7 +67,7 @@ void shellPrintHelp() {
|
||||||
#include <argp.h>
|
#include <argp.h>
|
||||||
#include <termio.h>
|
#include <termio.h>
|
||||||
|
|
||||||
const char *argp_program_version = version;
|
const char *argp_program_version = td_version;
|
||||||
const char *argp_program_bug_address = SHELL_EMAIL;
|
const char *argp_program_bug_address = SHELL_EMAIL;
|
||||||
|
|
||||||
static struct argp_option shellOptions[] = {
|
static struct argp_option shellOptions[] = {
|
||||||
|
@ -342,7 +342,7 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) {
|
||||||
shell.info.promptHeader = "taos> ";
|
shell.info.promptHeader = "taos> ";
|
||||||
shell.info.promptContinue = " -> ";
|
shell.info.promptContinue = " -> ";
|
||||||
shell.info.promptSize = 6;
|
shell.info.promptSize = 6;
|
||||||
snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), "version: %s", version);
|
snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), "version: %s", td_version);
|
||||||
|
|
||||||
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
|
||||||
shell.info.osname = "Windows";
|
shell.info.osname = "Windows";
|
||||||
|
|
|
@ -68,7 +68,7 @@ int32_t shellCheckIntSize() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void shellPrintVersion() { printf("version: %s\n", version); }
|
void shellPrintVersion() { printf("version: %s\n", td_version); }
|
||||||
|
|
||||||
void shellGenerateAuth() {
|
void shellGenerateAuth() {
|
||||||
char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0};
|
char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0};
|
||||||
|
|
Loading…
Reference in New Issue