diff --git a/include/dnode/snode/snode.h b/include/dnode/snode/snode.h index 4202859359e2fcb014b662956dcdc973f54a8c6c..3a93d16733ed4691a484b8cff1064533d6fdf70a 100644 --- a/include/dnode/snode/snode.h +++ b/include/dnode/snode/snode.h @@ -29,6 +29,7 @@ typedef struct SMgmtWrapper SMgmtWrapper; typedef struct SSnode SSnode; typedef struct { + int32_t reserved; } SSnodeLoad; typedef struct { diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 2aebd67c56c53d98bffe515313a5567840ee2d7e..dfb0a8fcf53858988d0d8dd8030e2d4e8b19399b 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -460,7 +460,7 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i STscObj* pTscObj = (STscObj*)taos; SRequestObj* pRequest = NULL; SQuery* pQueryNode = NULL; - char* pStr = NULL; + char* astStr = NULL; terrno = TSDB_CODE_SUCCESS; if (taos == NULL || topicName == NULL || sql == NULL) { @@ -488,17 +488,17 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i // todo check for invalid sql statement and return with error code - CHECK_CODE_GOTO(nodesNodeToString(pQueryNode->pRoot, false, &pStr, NULL), _return); + CHECK_CODE_GOTO(nodesNodeToString(pQueryNode->pRoot, false, &astStr, NULL), _return); /*printf("%s\n", pStr);*/ - SName name = { .acctId = pTscObj->acctId, .type = TSDB_TABLE_NAME_T }; + SName name = {.acctId = pTscObj->acctId, .type = TSDB_TABLE_NAME_T}; strcpy(name.dbname, pRequest->pDb); strcpy(name.tname, topicName); SCMCreateTopicReq req = { .igExists = 1, - .ast = (char*)pStr, + .ast = (char*)astStr, .sql = (char*)sql, }; tNameExtractFullName(&name, req.name); @@ -512,7 +512,11 @@ TAOS_RES* tmq_create_topic(TAOS* taos, const char* topicName, const char* sql, i tSerializeSCMCreateTopicReq(buf, tlen, &req); /*printf("formatted: %s\n", dagStr);*/ - pRequest->body.requestMsg = (SDataBuf){.pData = buf, .len = tlen, .handle = NULL}; + pRequest->body.requestMsg = (SDataBuf){ + .pData = buf, + .len = tlen, + .handle = NULL, + }; pRequest->type = TDMT_MND_CREATE_TOPIC; SMsgSendInfo* sendInfo = buildMsgInfoImpl(pRequest); diff --git a/tests/test/c/tmqDemo.c b/tests/test/c/tmqDemo.c index 609f8d6b694d69218b8a54eddd4cbf435628d37d..08e49a7efe04f962ef43c2e61c9a7d704332a49b 100644 --- a/tests/test/c/tmqDemo.c +++ b/tests/test/c/tmqDemo.c @@ -306,8 +306,9 @@ int32_t init_env() { } //const char* sql = "select * from tu1"; - sprintf(sqlStr, "select * from %s%d", g_stConfInfo.stbName, 0); - pRes = tmq_create_topic(pConn, "test_stb_topic_1", sqlStr, strlen(sqlStr)); + sprintf(sqlStr, "create topic test_stb_topic_1 as select * from %s%d", g_stConfInfo.stbName, 0); + /*pRes = tmq_create_topic(pConn, "test_stb_topic_1", sqlStr, strlen(sqlStr));*/ + pRes = taos_query(pConn, sqlStr); if (taos_errno(pRes) != 0) { printf("failed to create topic test_stb_topic_1, reason:%s\n", taos_errstr(pRes)); return -1;