Hotfix/sangshuduo/td 3197 fix taosdemo coverity scan (#5602)
* [TD-3197] <fix>: fix taosdemo coverity scan issues. * [TD-3197] <fix>: fix taosdemo coverity scan issue. fix subscribeTest pids uninitialized. * [TD-3197] <fix>: fix taosdemo coverity scan issues. * [TD-3197] <fix>: fix coverity scan issues. check super tbl info pointer. * [TD-3197] <fix>: fix coverity scan issues. move sub tbl query thread join into loop * [TD-3197] <fix>: fix coverity scan issues. remove unused variable * [TD-3197] <fix>: fix coverity scan issues. use more secure random library * [TD-3197] <fix>: fix coverity scan issues. use strncpy for more safe * [TD-3197] <fix>: fix taosdemo coverity scan issue. replace arc4random with rand(). * [TD-3197] <fix>: fix coverity scan issues. check stb info pointer for start time * [TD-3197] <fix>: fix coverity scan issues. fix strcpy vulnerability * [TD-3197] <fix>: fix taosdemo coverity scan issue. modify taosdemoTest2. try to check database continously. Co-authored-by: Shuduo Sang <sdsang@taosdata.com>
This commit is contained in:
parent
f69557fb6c
commit
41741a599f
|
@ -69,7 +69,10 @@ enum TEST_MODE {
|
||||||
|
|
||||||
#define MAX_SQL_SIZE 65536
|
#define MAX_SQL_SIZE 65536
|
||||||
#define BUFFER_SIZE (65536*2)
|
#define BUFFER_SIZE (65536*2)
|
||||||
|
#define MAX_USERNAME_SIZE 64
|
||||||
|
#define MAX_PASSWORD_SIZE 64
|
||||||
#define MAX_DB_NAME_SIZE 64
|
#define MAX_DB_NAME_SIZE 64
|
||||||
|
#define MAX_HOSTNAME_SIZE 64
|
||||||
#define MAX_TB_NAME_SIZE 64
|
#define MAX_TB_NAME_SIZE 64
|
||||||
#define MAX_DATA_SIZE 16000
|
#define MAX_DATA_SIZE 16000
|
||||||
#define MAX_NUM_DATATYPE 10
|
#define MAX_NUM_DATATYPE 10
|
||||||
|
@ -324,10 +327,10 @@ typedef struct SDataBase_S {
|
||||||
|
|
||||||
typedef struct SDbs_S {
|
typedef struct SDbs_S {
|
||||||
char cfgDir[MAX_FILE_NAME_LEN+1];
|
char cfgDir[MAX_FILE_NAME_LEN+1];
|
||||||
char host[MAX_DB_NAME_SIZE];
|
char host[MAX_HOSTNAME_SIZE];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
char user[MAX_DB_NAME_SIZE];
|
char user[MAX_USERNAME_SIZE];
|
||||||
char password[MAX_DB_NAME_SIZE];
|
char password[MAX_PASSWORD_SIZE];
|
||||||
char resultFile[MAX_FILE_NAME_LEN+1];
|
char resultFile[MAX_FILE_NAME_LEN+1];
|
||||||
bool use_metric;
|
bool use_metric;
|
||||||
bool insert_only;
|
bool insert_only;
|
||||||
|
@ -378,10 +381,10 @@ typedef struct SubQueryInfo_S {
|
||||||
|
|
||||||
typedef struct SQueryMetaInfo_S {
|
typedef struct SQueryMetaInfo_S {
|
||||||
char cfgDir[MAX_FILE_NAME_LEN+1];
|
char cfgDir[MAX_FILE_NAME_LEN+1];
|
||||||
char host[MAX_DB_NAME_SIZE];
|
char host[MAX_HOSTNAME_SIZE];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
char user[MAX_DB_NAME_SIZE];
|
char user[MAX_USERNAME_SIZE];
|
||||||
char password[MAX_DB_NAME_SIZE];
|
char password[MAX_PASSWORD_SIZE];
|
||||||
char dbName[MAX_DB_NAME_SIZE+1];
|
char dbName[MAX_DB_NAME_SIZE+1];
|
||||||
char queryMode[MAX_TB_NAME_SIZE]; // taosc, restful
|
char queryMode[MAX_TB_NAME_SIZE]; // taosc, restful
|
||||||
|
|
||||||
|
@ -491,9 +494,12 @@ static void resetAfterAnsiEscape(void) {
|
||||||
printf("\x1b[0m");
|
printf("\x1b[0m");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
static int taosRandom()
|
static int taosRandom()
|
||||||
{
|
{
|
||||||
return random();
|
srand(time(NULL));
|
||||||
|
return rand();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2532,39 +2538,46 @@ static void* createTable(void *sarg)
|
||||||
g_args.tb_prefix, i,
|
g_args.tb_prefix, i,
|
||||||
winfo->cols);
|
winfo->cols);
|
||||||
} else {
|
} else {
|
||||||
if (0 == len) {
|
if (superTblInfo == NULL) {
|
||||||
batchNum = 0;
|
errorPrint("%s() LN%d, use metric, but super table info is NULL\n",
|
||||||
memset(buffer, 0, buff_len);
|
__func__, __LINE__);
|
||||||
len += snprintf(buffer + len,
|
|
||||||
buff_len - len, "create table ");
|
|
||||||
}
|
|
||||||
|
|
||||||
char* tagsValBuf = NULL;
|
|
||||||
if (0 == superTblInfo->tagSource) {
|
|
||||||
tagsValBuf = generateTagVaulesForStb(superTblInfo);
|
|
||||||
} else {
|
|
||||||
tagsValBuf = getTagValueFromTagSample(
|
|
||||||
superTblInfo,
|
|
||||||
i % superTblInfo->tagSampleCount);
|
|
||||||
}
|
|
||||||
if (NULL == tagsValBuf) {
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
return NULL;
|
exit(-1);
|
||||||
}
|
} else {
|
||||||
|
if (0 == len) {
|
||||||
len += snprintf(buffer + len,
|
batchNum = 0;
|
||||||
superTblInfo->maxSqlLen - len,
|
memset(buffer, 0, buff_len);
|
||||||
"if not exists %s.%s%d using %s.%s tags %s ",
|
len += snprintf(buffer + len,
|
||||||
winfo->db_name, superTblInfo->childTblPrefix,
|
buff_len - len, "create table ");
|
||||||
i, winfo->db_name,
|
}
|
||||||
superTblInfo->sTblName, tagsValBuf);
|
|
||||||
free(tagsValBuf);
|
char* tagsValBuf = NULL;
|
||||||
batchNum++;
|
if (0 == superTblInfo->tagSource) {
|
||||||
|
tagsValBuf = generateTagVaulesForStb(superTblInfo);
|
||||||
if ((batchNum < superTblInfo->batchCreateTableNum)
|
} else {
|
||||||
&& ((superTblInfo->maxSqlLen - len)
|
tagsValBuf = getTagValueFromTagSample(
|
||||||
>= (superTblInfo->lenOfTagOfOneRow + 256))) {
|
superTblInfo,
|
||||||
continue;
|
i % superTblInfo->tagSampleCount);
|
||||||
|
}
|
||||||
|
if (NULL == tagsValBuf) {
|
||||||
|
free(buffer);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
len += snprintf(buffer + len,
|
||||||
|
superTblInfo->maxSqlLen - len,
|
||||||
|
"if not exists %s.%s%d using %s.%s tags %s ",
|
||||||
|
winfo->db_name, superTblInfo->childTblPrefix,
|
||||||
|
i, winfo->db_name,
|
||||||
|
superTblInfo->sTblName, tagsValBuf);
|
||||||
|
free(tagsValBuf);
|
||||||
|
batchNum++;
|
||||||
|
|
||||||
|
if ((batchNum < superTblInfo->batchCreateTableNum)
|
||||||
|
&& ((superTblInfo->maxSqlLen - len)
|
||||||
|
>= (superTblInfo->lenOfTagOfOneRow + 256))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2699,10 +2712,10 @@ static void createChildTables() {
|
||||||
if ((strncasecmp(g_args.datatype[j], "BINARY", strlen("BINARY")) == 0)
|
if ((strncasecmp(g_args.datatype[j], "BINARY", strlen("BINARY")) == 0)
|
||||||
|| (strncasecmp(g_args.datatype[j],
|
|| (strncasecmp(g_args.datatype[j],
|
||||||
"NCHAR", strlen("NCHAR")) == 0)) {
|
"NCHAR", strlen("NCHAR")) == 0)) {
|
||||||
len = snprintf(tblColsBuf + len, MAX_SQL_SIZE - len,
|
snprintf(tblColsBuf + len, MAX_SQL_SIZE - len,
|
||||||
", COL%d %s(60)", j, g_args.datatype[j]);
|
", COL%d %s(60)", j, g_args.datatype[j]);
|
||||||
} else {
|
} else {
|
||||||
len = snprintf(tblColsBuf + len, MAX_SQL_SIZE - len,
|
snprintf(tblColsBuf + len, MAX_SQL_SIZE - len,
|
||||||
", COL%d %s", j, g_args.datatype[j]);
|
", COL%d %s", j, g_args.datatype[j]);
|
||||||
}
|
}
|
||||||
len = strlen(tblColsBuf);
|
len = strlen(tblColsBuf);
|
||||||
|
@ -3009,9 +3022,9 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
|
|
||||||
cJSON* host = cJSON_GetObjectItem(root, "host");
|
cJSON* host = cJSON_GetObjectItem(root, "host");
|
||||||
if (host && host->type == cJSON_String && host->valuestring != NULL) {
|
if (host && host->type == cJSON_String && host->valuestring != NULL) {
|
||||||
tstrncpy(g_Dbs.host, host->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.host, host->valuestring, MAX_HOSTNAME_SIZE);
|
||||||
} else if (!host) {
|
} else if (!host) {
|
||||||
tstrncpy(g_Dbs.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("ERROR: failed to read json, host not found\n");
|
printf("ERROR: failed to read json, host not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
|
@ -3026,16 +3039,16 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
|
||||||
|
|
||||||
cJSON* user = cJSON_GetObjectItem(root, "user");
|
cJSON* user = cJSON_GetObjectItem(root, "user");
|
||||||
if (user && user->type == cJSON_String && user->valuestring != NULL) {
|
if (user && user->type == cJSON_String && user->valuestring != NULL) {
|
||||||
tstrncpy(g_Dbs.user, user->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.user, user->valuestring, MAX_USERNAME_SIZE);
|
||||||
} else if (!user) {
|
} else if (!user) {
|
||||||
tstrncpy(g_Dbs.user, "root", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.user, "root", MAX_USERNAME_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON* password = cJSON_GetObjectItem(root, "password");
|
cJSON* password = cJSON_GetObjectItem(root, "password");
|
||||||
if (password && password->type == cJSON_String && password->valuestring != NULL) {
|
if (password && password->type == cJSON_String && password->valuestring != NULL) {
|
||||||
tstrncpy(g_Dbs.password, password->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.password, password->valuestring, MAX_PASSWORD_SIZE);
|
||||||
} else if (!password) {
|
} else if (!password) {
|
||||||
tstrncpy(g_Dbs.password, "taosdata", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.password, "taosdata", MAX_PASSWORD_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON* resultfile = cJSON_GetObjectItem(root, "result_file");
|
cJSON* resultfile = cJSON_GetObjectItem(root, "result_file");
|
||||||
|
@ -3673,9 +3686,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
|
|
||||||
cJSON* host = cJSON_GetObjectItem(root, "host");
|
cJSON* host = cJSON_GetObjectItem(root, "host");
|
||||||
if (host && host->type == cJSON_String && host->valuestring != NULL) {
|
if (host && host->type == cJSON_String && host->valuestring != NULL) {
|
||||||
tstrncpy(g_queryInfo.host, host->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.host, host->valuestring, MAX_HOSTNAME_SIZE);
|
||||||
} else if (!host) {
|
} else if (!host) {
|
||||||
tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
printf("ERROR: failed to read json, host not found\n");
|
printf("ERROR: failed to read json, host not found\n");
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
|
@ -3690,16 +3703,16 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
|
|
||||||
cJSON* user = cJSON_GetObjectItem(root, "user");
|
cJSON* user = cJSON_GetObjectItem(root, "user");
|
||||||
if (user && user->type == cJSON_String && user->valuestring != NULL) {
|
if (user && user->type == cJSON_String && user->valuestring != NULL) {
|
||||||
tstrncpy(g_queryInfo.user, user->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.user, user->valuestring, MAX_USERNAME_SIZE);
|
||||||
} else if (!user) {
|
} else if (!user) {
|
||||||
tstrncpy(g_queryInfo.user, "root", MAX_DB_NAME_SIZE); ;
|
tstrncpy(g_queryInfo.user, "root", MAX_USERNAME_SIZE); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON* password = cJSON_GetObjectItem(root, "password");
|
cJSON* password = cJSON_GetObjectItem(root, "password");
|
||||||
if (password && password->type == cJSON_String && password->valuestring != NULL) {
|
if (password && password->type == cJSON_String && password->valuestring != NULL) {
|
||||||
tstrncpy(g_queryInfo.password, password->valuestring, MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.password, password->valuestring, MAX_PASSWORD_SIZE);
|
||||||
} else if (!password) {
|
} else if (!password) {
|
||||||
tstrncpy(g_queryInfo.password, "taosdata", MAX_DB_NAME_SIZE);;
|
tstrncpy(g_queryInfo.password, "taosdata", MAX_PASSWORD_SIZE);;
|
||||||
}
|
}
|
||||||
|
|
||||||
cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no,
|
cJSON *answerPrompt = cJSON_GetObjectItem(root, "confirm_parameter_prompt"); // yes, no,
|
||||||
|
@ -4611,8 +4624,13 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
verbosePrint("[%d] %s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d\n",
|
verbosePrint("[%d] %s() LN%d i=%d batchPerTblTimes=%d batchPerTbl = %d\n",
|
||||||
pThreadInfo->threadID, __func__, __LINE__,
|
pThreadInfo->threadID, __func__, __LINE__,
|
||||||
i, batchPerTblTimes, batchPerTbl);
|
i, batchPerTblTimes, batchPerTbl);
|
||||||
if (0 == strncasecmp(superTblInfo->startTimestamp, "now", 3)) {
|
|
||||||
startTime = taosGetTimestamp(pThreadInfo->time_precision);
|
if (superTblInfo) {
|
||||||
|
if (0 == strncasecmp(superTblInfo->startTimestamp, "now", 3)) {
|
||||||
|
startTime = taosGetTimestamp(pThreadInfo->time_precision);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
startTime = 1500000000000;
|
||||||
}
|
}
|
||||||
generateDataTail(
|
generateDataTail(
|
||||||
tableName, tableSeq, pThreadInfo, superTblInfo,
|
tableName, tableSeq, pThreadInfo, superTblInfo,
|
||||||
|
@ -6056,7 +6074,12 @@ static int subscribeTestProcess() {
|
||||||
t_info->taos = NULL; // TODO: workaround to use separate taos connection;
|
t_info->taos = NULL; // TODO: workaround to use separate taos connection;
|
||||||
pthread_create(pidsOfSub + i, NULL, subSubscribeProcess, t_info);
|
pthread_create(pidsOfSub + i, NULL, subSubscribeProcess, t_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_queryInfo.subQueryInfo.threadCnt = threads;
|
g_queryInfo.subQueryInfo.threadCnt = threads;
|
||||||
|
|
||||||
|
for (int i = 0; i < g_queryInfo.subQueryInfo.threadCnt; i++) {
|
||||||
|
pthread_join(pidsOfSub[i], NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < g_queryInfo.superQueryInfo.concurrent; i++) {
|
for (int i = 0; i < g_queryInfo.superQueryInfo.concurrent; i++) {
|
||||||
|
@ -6066,10 +6089,6 @@ static int subscribeTestProcess() {
|
||||||
tmfree((char*)pids);
|
tmfree((char*)pids);
|
||||||
tmfree((char*)infos);
|
tmfree((char*)infos);
|
||||||
|
|
||||||
for (int i = 0; i < g_queryInfo.subQueryInfo.threadCnt; i++) {
|
|
||||||
pthread_join(pidsOfSub[i], NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
tmfree((char*)pidsOfSub);
|
tmfree((char*)pidsOfSub);
|
||||||
tmfree((char*)infosOfSub);
|
tmfree((char*)infosOfSub);
|
||||||
// taos_close(taos);
|
// taos_close(taos);
|
||||||
|
@ -6080,10 +6099,10 @@ static void initOfInsertMeta() {
|
||||||
memset(&g_Dbs, 0, sizeof(SDbs));
|
memset(&g_Dbs, 0, sizeof(SDbs));
|
||||||
|
|
||||||
// set default values
|
// set default values
|
||||||
tstrncpy(g_Dbs.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
|
||||||
g_Dbs.port = 6030;
|
g_Dbs.port = 6030;
|
||||||
tstrncpy(g_Dbs.user, TSDB_DEFAULT_USER, MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.user, TSDB_DEFAULT_USER, MAX_USERNAME_SIZE);
|
||||||
tstrncpy(g_Dbs.password, TSDB_DEFAULT_PASS, MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE);
|
||||||
g_Dbs.threadCount = 2;
|
g_Dbs.threadCount = 2;
|
||||||
|
|
||||||
g_Dbs.use_metric = g_args.use_metric;
|
g_Dbs.use_metric = g_args.use_metric;
|
||||||
|
@ -6093,25 +6112,25 @@ static void initOfQueryMeta() {
|
||||||
memset(&g_queryInfo, 0, sizeof(SQueryMetaInfo));
|
memset(&g_queryInfo, 0, sizeof(SQueryMetaInfo));
|
||||||
|
|
||||||
// set default values
|
// set default values
|
||||||
tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
|
||||||
g_queryInfo.port = 6030;
|
g_queryInfo.port = 6030;
|
||||||
tstrncpy(g_queryInfo.user, TSDB_DEFAULT_USER, MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.user, TSDB_DEFAULT_USER, MAX_USERNAME_SIZE);
|
||||||
tstrncpy(g_queryInfo.password, TSDB_DEFAULT_PASS, MAX_DB_NAME_SIZE);
|
tstrncpy(g_queryInfo.password, TSDB_DEFAULT_PASS, MAX_PASSWORD_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setParaFromArg(){
|
static void setParaFromArg(){
|
||||||
if (g_args.host) {
|
if (g_args.host) {
|
||||||
strcpy(g_Dbs.host, g_args.host);
|
tstrncpy(g_Dbs.host, g_args.host, MAX_HOSTNAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
tstrncpy(g_Dbs.host, "127.0.0.1", MAX_DB_NAME_SIZE);
|
tstrncpy(g_Dbs.host, "127.0.0.1", MAX_HOSTNAME_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_args.user) {
|
if (g_args.user) {
|
||||||
strcpy(g_Dbs.user, g_args.user);
|
tstrncpy(g_Dbs.user, g_args.user, MAX_USERNAME_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_args.password) {
|
if (g_args.password) {
|
||||||
strcpy(g_Dbs.password, g_args.password);
|
tstrncpy(g_Dbs.password, g_args.password, MAX_PASSWORD_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_args.port) {
|
if (g_args.port) {
|
||||||
|
@ -6331,12 +6350,12 @@ static void queryResult() {
|
||||||
rInfo->ntables = g_Dbs.db[0].superTbls[0].childTblCount;
|
rInfo->ntables = g_Dbs.db[0].superTbls[0].childTblCount;
|
||||||
rInfo->end_table_to = g_Dbs.db[0].superTbls[0].childTblCount - 1;
|
rInfo->end_table_to = g_Dbs.db[0].superTbls[0].childTblCount - 1;
|
||||||
rInfo->superTblInfo = &g_Dbs.db[0].superTbls[0];
|
rInfo->superTblInfo = &g_Dbs.db[0].superTbls[0];
|
||||||
strcpy(rInfo->tb_prefix,
|
tstrncpy(rInfo->tb_prefix,
|
||||||
g_Dbs.db[0].superTbls[0].childTblPrefix);
|
g_Dbs.db[0].superTbls[0].childTblPrefix, MAX_TB_NAME_SIZE);
|
||||||
} else {
|
} else {
|
||||||
rInfo->ntables = g_args.num_of_tables;
|
rInfo->ntables = g_args.num_of_tables;
|
||||||
rInfo->end_table_to = g_args.num_of_tables -1;
|
rInfo->end_table_to = g_args.num_of_tables -1;
|
||||||
strcpy(rInfo->tb_prefix, g_args.tb_prefix);
|
tstrncpy(rInfo->tb_prefix, g_args.tb_prefix, MAX_TB_NAME_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
rInfo->taos = taos_connect(
|
rInfo->taos = taos_connect(
|
||||||
|
@ -6352,7 +6371,7 @@ static void queryResult() {
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(rInfo->fp, g_Dbs.resultFile);
|
tstrncpy(rInfo->fp, g_Dbs.resultFile, MAX_FILE_NAME_LEN);
|
||||||
|
|
||||||
if (!g_Dbs.use_metric) {
|
if (!g_Dbs.use_metric) {
|
||||||
pthread_create(&read_id, NULL, readTable, rInfo);
|
pthread_create(&read_id, NULL, readTable, rInfo);
|
||||||
|
|
|
@ -36,7 +36,15 @@ class TDTestCase:
|
||||||
if(threadID == 1):
|
if(threadID == 1):
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
print("use test")
|
print("use test")
|
||||||
tdSql.execute("use test")
|
while True:
|
||||||
|
try:
|
||||||
|
tdSql.execute("use test")
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
tdLog.info("use database test failed")
|
||||||
|
time.sleep(1)
|
||||||
|
continue
|
||||||
|
|
||||||
# check if all the tables have heen created
|
# check if all the tables have heen created
|
||||||
while True:
|
while True:
|
||||||
tdSql.query("show tables")
|
tdSql.query("show tables")
|
||||||
|
|
Loading…
Reference in New Issue