From 6184d33011bfc523d4983ae10baf3f5878fd3f0a Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 17 Jun 2022 15:55:59 +0800 Subject: [PATCH] fix: comment & ttl --- include/common/tglobal.h | 2 +- include/util/version.h | 2 +- source/client/src/clientMain.c | 2 +- source/common/src/tglobal.c | 2 +- source/dnode/mgmt/exe/dmMain.c | 2 +- source/dnode/mnode/impl/src/mndMain.c | 2 +- source/dnode/mnode/impl/src/mndProfile.c | 2 +- source/dnode/mnode/impl/src/mndTelem.c | 2 +- source/libs/function/src/udfd.c | 2 +- source/libs/parser/src/parInsert.c | 1 + source/util/src/version.c.in | 2 +- tests/system-test/2-query/ttl_comment.py | 27 +++++++++++++++++++++++- tools/shell/src/shellArguments.c | 4 ++-- tools/shell/src/shellUtil.c | 2 +- 14 files changed, 40 insertions(+), 14 deletions(-) diff --git a/include/common/tglobal.h b/include/common/tglobal.h index 9b301f5d10..1b44b6d7ea 100644 --- a/include/common/tglobal.h +++ b/include/common/tglobal.h @@ -108,7 +108,7 @@ extern float tsStreamComputDelayRatio; // the delayed computing ration of the extern int64_t tsMaxRetentWindow; // build info -extern char td_version[]; +extern char version[]; extern char compatible_version[]; extern char gitinfo[]; extern char buildinfo[]; diff --git a/include/util/version.h b/include/util/version.h index ef6bfdc182..bac29e5baf 100644 --- a/include/util/version.h +++ b/include/util/version.h @@ -20,7 +20,7 @@ extern "C" { #endif -extern char td_version[]; +extern char version[]; extern char compatible_version[]; extern char gitinfo[]; extern char buildinfo[]; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index bdea03520a..83b481658e 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -397,7 +397,7 @@ const char *taos_data_type(int type) { } } -const char *taos_get_client_info() { return td_version; } +const char *taos_get_client_info() { return version; } int taos_affected_rows(TAOS_RES *res) { if (res == NULL || TD_RES_TMQ(res)) { diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 68a445db6a..fbb4f78425 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -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 machine", info.machine, 1) != 0) return -1; - if (cfgAddString(pCfg, "version", td_version, 1) != 0) return -1; + if (cfgAddString(pCfg, "version", 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, "buildinfo", buildinfo, 1) != 0) return -1; diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index 05e246ffe8..2b0f6a01a0 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -114,7 +114,7 @@ static void dmPrintVersion() { #else char *releaseName = "community"; #endif - printf("%s version: %s compatible_version: %s\n", releaseName, td_version, compatible_version); + printf("%s version: %s compatible_version: %s\n", releaseName, version, compatible_version); printf("gitinfo: %s\n", gitinfo); printf("buildInfo: %s\n", buildinfo); } diff --git a/source/dnode/mnode/impl/src/mndMain.c b/source/dnode/mnode/impl/src/mndMain.c index 4a1f0695a9..13650d9e5a 100644 --- a/source/dnode/mnode/impl/src/mndMain.c +++ b/source/dnode/mnode/impl/src/mndMain.c @@ -642,7 +642,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr } // cluster info - tstrncpy(pClusterInfo->version, td_version, sizeof(pClusterInfo->version)); + tstrncpy(pClusterInfo->version, version, sizeof(pClusterInfo->version)); pClusterInfo->monitor_interval = tsMonitorInterval; pClusterInfo->connections_total = mndGetNumOfConnections(pMnode); diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index f5a046ae52..4cfcf389aa 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -232,7 +232,7 @@ static int32_t mndProcessConnectReq(SRpcMsg *pReq) { connectRsp.connType = connReq.connType; connectRsp.dnodeNum = mndGetDnodeSize(pMnode); - snprintf(connectRsp.sVersion, sizeof(connectRsp.sVersion), "ver:%s\nbuild:%s\ngitinfo:%s", td_version, buildinfo, + snprintf(connectRsp.sVersion, sizeof(connectRsp.sVersion), "ver:%s\nbuild:%s\ngitinfo:%s", version, buildinfo, gitinfo); mndGetMnodeEpSet(pMnode, &connectRsp.epSet); diff --git a/source/dnode/mnode/impl/src/mndTelem.c b/source/dnode/mnode/impl/src/mndTelem.c index d11e0c214f..27814fe5be 100644 --- a/source/dnode/mnode/impl/src/mndTelem.c +++ b/source/dnode/mnode/impl/src/mndTelem.c @@ -110,7 +110,7 @@ static char* mndBuildTelemetryReport(SMnode* pMnode) { snprintf(tmp, sizeof(tmp), "%" PRId64 " kB", tsTotalMemoryKB); tjsonAddStringToObject(pJson, "memory", tmp); - tjsonAddStringToObject(pJson, "version", td_version); + tjsonAddStringToObject(pJson, "version", version); tjsonAddStringToObject(pJson, "buildInfo", buildinfo); tjsonAddStringToObject(pJson, "gitInfo", gitinfo); tjsonAddStringToObject(pJson, "email", pMgmt->email); diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 4d648539a9..02c485fa83 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -785,7 +785,7 @@ static void udfdPrintVersion() { #else char *releaseName = "community"; #endif - printf("%s version: %s compatible_version: %s\n", releaseName, td_version, compatible_version); + printf("%s version: %s compatible_version: %s\n", releaseName, version, compatible_version); printf("gitinfo: %s\n", gitinfo); printf("buildInfo: %s\n", buildinfo); } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index 626960bf10..c8b78fcc8b 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -803,6 +803,7 @@ static void buildCreateTbReq(SVCreateTbReq* pTbReq, const char* tname, STag* pTa pTbReq->name = strdup(tname); pTbReq->ctb.suid = suid; pTbReq->ctb.pTag = (uint8_t*)pTag; + pTbReq->commentLen = -1; return; } diff --git a/source/util/src/version.c.in b/source/util/src/version.c.in index 4d00ba90c0..be1a4a4048 100644 --- a/source/util/src/version.c.in +++ b/source/util/src/version.c.in @@ -1,4 +1,4 @@ -char td_version[12] = "${TD_VER_NUMBER}"; +char version[12] = "${TD_VER_NUMBER}"; char compatible_version[12] = "${TD_VER_COMPATIBLE}"; char gitinfo[48] = "${TD_VER_GIT}"; char buildinfo[64] = "Built at ${TD_VER_DATE}"; diff --git a/tests/system-test/2-query/ttl_comment.py b/tests/system-test/2-query/ttl_comment.py index f303b67907..8fc582c587 100644 --- a/tests/system-test/2-query/ttl_comment.py +++ b/tests/system-test/2-query/ttl_comment.py @@ -132,17 +132,21 @@ class TDTestCase: print("============== STEP 3 ===== test child table") - tdSql.execute("create table child_table1 using super_table1 tags(1)") + tdSql.execute("create table child_table1 using super_table1 tags(1) ttl 10") 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.execute("insert into child_table4 using super_table1 tags(1) values(now, 1)") + tdSql.query("show tables like 'child_table1'") tdSql.checkData(0, 0, 'child_table1') + tdSql.checkData(0, 7, 10) tdSql.checkData(0, 8, None) tdSql.query("show tables like 'child_table2'") tdSql.checkData(0, 0, 'child_table2') + tdSql.checkData(0, 7, 0) tdSql.checkData(0, 8, '') @@ -150,6 +154,11 @@ class TDTestCase: tdSql.checkData(0, 0, 'child_table3') tdSql.checkData(0, 8, 'child') + tdSql.query("show tables like 'child_table4'") + tdSql.checkData(0, 0, 'child_table4') + tdSql.checkData(0, 7, 0) + tdSql.checkData(0, 8, None) + tdSql.execute("alter table child_table1 comment 'nihao'") tdSql.query("show tables like 'child_table1'") @@ -171,6 +180,22 @@ class TDTestCase: tdSql.checkData(0, 0, 'child_table3') tdSql.checkData(0, 8, 'tdengine') + + tdSql.execute("alter table child_table4 comment 'tdengine'") + tdSql.query("show tables like 'child_table4'") + tdSql.checkData(0, 0, 'child_table4') + tdSql.checkData(0, 8, 'tdengine') + + tdSql.execute("alter table child_table4 ttl 9") + tdSql.query("show tables like 'child_table4'") + tdSql.checkData(0, 0, 'child_table4') + tdSql.checkData(0, 7, 9) + + tdSql.execute("alter table child_table3 ttl 9") + tdSql.query("show tables like 'child_table3'") + tdSql.checkData(0, 0, 'child_table3') + tdSql.checkData(0, 7, 9) + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 861ae99f64..cd6613b17a 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -67,7 +67,7 @@ void shellPrintHelp() { #include #include -const char *argp_program_version = td_version; +const char *argp_program_version = version; const char *argp_program_bug_address = SHELL_EMAIL; static struct argp_option shellOptions[] = { @@ -342,7 +342,7 @@ int32_t shellParseArgs(int32_t argc, char *argv[]) { shell.info.promptHeader = "taos> "; shell.info.promptContinue = " -> "; shell.info.promptSize = 6; - snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), "version: %s", td_version); + snprintf(shell.info.programVersion, sizeof(shell.info.programVersion), "version: %s", version); #if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32) shell.info.osname = "Windows"; diff --git a/tools/shell/src/shellUtil.c b/tools/shell/src/shellUtil.c index fecb112896..1529ac0e52 100644 --- a/tools/shell/src/shellUtil.c +++ b/tools/shell/src/shellUtil.c @@ -68,7 +68,7 @@ int32_t shellCheckIntSize() { return 0; } -void shellPrintVersion() { printf("version: %s\n", td_version); } +void shellPrintVersion() { printf("version: %s\n", version); } void shellGenerateAuth() { char secretEncrypt[TSDB_PASSWORD_LEN + 1] = {0}; -- GitLab