提交 9ef8f245 编写于 作者: Z zhaoyanggh

change error print message

上级 ddb147c6
...@@ -1471,7 +1471,7 @@ void setParaFromArg() { ...@@ -1471,7 +1471,7 @@ void setParaFromArg() {
TSDB_DATA_TYPE_INT; TSDB_DATA_TYPE_INT;
tstrncpy(g_Dbs.db[0].superTbls[0].columns[i].dataType, "INT", tstrncpy(g_Dbs.db[0].superTbls[0].columns[i].dataType, "INT",
min(DATATYPE_BUFF_LEN, strlen("INT") + 1)); min(DATATYPE_BUFF_LEN, strlen("INT") + 1));
g_Dbs.db[0].superTbls[0].columns[i].dataLen = 0; g_Dbs.db[0].superTbls[0].columns[i].dataLen = sizeof(int32_t);
g_Dbs.db[0].superTbls[0].columnCount++; g_Dbs.db[0].superTbls[0].columnCount++;
} }
} }
...@@ -1479,7 +1479,7 @@ void setParaFromArg() { ...@@ -1479,7 +1479,7 @@ void setParaFromArg() {
tstrncpy(g_Dbs.db[0].superTbls[0].tags[0].dataType, "INT", tstrncpy(g_Dbs.db[0].superTbls[0].tags[0].dataType, "INT",
min(DATATYPE_BUFF_LEN, strlen("INT") + 1)); min(DATATYPE_BUFF_LEN, strlen("INT") + 1));
g_Dbs.db[0].superTbls[0].tags[0].data_type = TSDB_DATA_TYPE_INT; g_Dbs.db[0].superTbls[0].tags[0].data_type = TSDB_DATA_TYPE_INT;
g_Dbs.db[0].superTbls[0].tags[0].dataLen = 0; g_Dbs.db[0].superTbls[0].tags[0].dataLen = sizeof(int32_t);
tstrncpy(g_Dbs.db[0].superTbls[0].tags[1].dataType, "BINARY", tstrncpy(g_Dbs.db[0].superTbls[0].tags[1].dataType, "BINARY",
min(DATATYPE_BUFF_LEN, strlen("BINARY") + 1)); min(DATATYPE_BUFF_LEN, strlen("BINARY") + 1));
...@@ -1524,8 +1524,7 @@ void querySqlFile(TAOS *taos, char *sqlFile) { ...@@ -1524,8 +1524,7 @@ void querySqlFile(TAOS *taos, char *sqlFile) {
memcpy(cmd + cmd_len, line, read_len); memcpy(cmd + cmd_len, line, read_len);
if (0 != queryDbExec(taos, cmd, NO_INSERT_TYPE, false)) { if (0 != queryDbExec(taos, cmd, NO_INSERT_TYPE, false)) {
errorPrint("%s() LN%d, queryDbExec %s failed!\n", __func__, errorPrint("queryDbExec %s failed!\n", cmd);
__LINE__, cmd);
tmfree(cmd); tmfree(cmd);
tmfree(line); tmfree(line);
tmfclose(fp); tmfclose(fp);
......
此差异已折叠。
...@@ -446,8 +446,7 @@ int getMetaFromInsertJsonFile(cJSON *root) { ...@@ -446,8 +446,7 @@ int getMetaFromInsertJsonFile(cJSON *root) {
} else if (!prepareRand) { } else if (!prepareRand) {
g_args.prepared_rand = DEFAULT_PREPARED_RAND; g_args.prepared_rand = DEFAULT_PREPARED_RAND;
} else { } else {
errorPrint("%s() LN%d, failed to read json, prepared_rand not found\n", errorPrint("%s", "failed to read json, prepared_rand not found\n");
__func__, __LINE__);
goto PARSE_OVER; goto PARSE_OVER;
} }
...@@ -1222,7 +1221,7 @@ int getMetaFromQueryJsonFile(cJSON *root) { ...@@ -1222,7 +1221,7 @@ int getMetaFromQueryJsonFile(cJSON *root) {
cJSON *gQueryTimes = cJSON_GetObjectItem(root, "query_times"); cJSON *gQueryTimes = cJSON_GetObjectItem(root, "query_times");
if (gQueryTimes && gQueryTimes->type == cJSON_Number) { if (gQueryTimes && gQueryTimes->type == cJSON_Number) {
if (gQueryTimes->valueint <= 0) { if (gQueryTimes->valueint <= 0) {
errorPrint("%s()", errorPrint("%s",
"failed to read json, query_times input mistake\n"); "failed to read json, query_times input mistake\n");
goto PARSE_OVER; goto PARSE_OVER;
} }
...@@ -1740,8 +1739,7 @@ int testMetaFile() { ...@@ -1740,8 +1739,7 @@ int testMetaFile() {
} }
return subscribeTestProcess(); return subscribeTestProcess();
} else { } else {
errorPrint("%s() LN%d, unsupport test mode (%d)\n", __func__, __LINE__, errorPrint("unsupport test mode (%d)\n", g_args.test_mode);
g_args.test_mode);
return -1; return -1;
} }
return 0; return 0;
......
...@@ -115,8 +115,8 @@ int getDbFromServer(TAOS *taos, SDbInfo **dbInfos) { ...@@ -115,8 +115,8 @@ int getDbFromServer(TAOS *taos, SDbInfo **dbInfos) {
count++; count++;
if (count > MAX_DATABASE_COUNT) { if (count > MAX_DATABASE_COUNT) {
errorPrint("%s() LN%d, The database count overflow than %d\n", errorPrint("The database count overflow than %d\n",
__func__, __LINE__, MAX_DATABASE_COUNT); MAX_DATABASE_COUNT);
break; break;
} }
} }
...@@ -202,8 +202,7 @@ int xDumpResultToFile(const char *fname, TAOS_RES *tres) { ...@@ -202,8 +202,7 @@ int xDumpResultToFile(const char *fname, TAOS_RES *tres) {
FILE *fp = fopen(fname, "at"); FILE *fp = fopen(fname, "at");
if (fp == NULL) { if (fp == NULL) {
errorPrint("%s() LN%d, failed to open file: %s\n", __func__, __LINE__, errorPrint("failed to open file: %s\n", fname);
fname);
return -1; return -1;
} }
...@@ -983,11 +982,7 @@ void printfQuerySystemInfo(TAOS *taos) { ...@@ -983,11 +982,7 @@ void printfQuerySystemInfo(TAOS *taos) {
res = taos_query(taos, "show databases;"); res = taos_query(taos, "show databases;");
SDbInfo **dbInfos = SDbInfo **dbInfos =
(SDbInfo **)calloc(MAX_DATABASE_COUNT, sizeof(SDbInfo *)); (SDbInfo **)calloc(MAX_DATABASE_COUNT, sizeof(SDbInfo *));
if (dbInfos == NULL) { assert(dbInfos);
errorPrint("%s() LN%d, failed to allocate memory\n", __func__,
__LINE__);
return;
}
int dbCount = getDbFromServer(taos, dbInfos); int dbCount = getDbFromServer(taos, dbInfos);
if (dbCount <= 0) { if (dbCount <= 0) {
free(dbInfos); free(dbInfos);
......
...@@ -19,8 +19,8 @@ void selectAndGetResult(threadInfo *pThreadInfo, char *command) { ...@@ -19,8 +19,8 @@ void selectAndGetResult(threadInfo *pThreadInfo, char *command) {
if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", strlen("taosc"))) { if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", strlen("taosc"))) {
TAOS_RES *res = taos_query(pThreadInfo->taos, command); TAOS_RES *res = taos_query(pThreadInfo->taos, command);
if (res == NULL || taos_errno(res) != 0) { if (res == NULL || taos_errno(res) != 0) {
errorPrint("%s() LN%d, failed to execute sql:%s, reason:%s\n", errorPrint("failed to execute sql:%s, reason:%s\n", command,
__func__, __LINE__, command, taos_errstr(res)); taos_errstr(res));
taos_free_result(res); taos_free_result(res);
return; return;
} }
...@@ -38,8 +38,7 @@ void selectAndGetResult(threadInfo *pThreadInfo, char *command) { ...@@ -38,8 +38,7 @@ void selectAndGetResult(threadInfo *pThreadInfo, char *command) {
} }
} else { } else {
errorPrint("%s() LN%d, unknown query mode: %s\n", __func__, __LINE__, errorPrint("unknown query mode: %s\n", g_queryInfo.queryMode);
g_queryInfo.queryMode);
} }
} }
......
...@@ -380,22 +380,19 @@ int subscribeTestProcess() { ...@@ -380,22 +380,19 @@ int subscribeTestProcess() {
__LINE__, g_queryInfo.specifiedQueryInfo.sqlCount); __LINE__, g_queryInfo.specifiedQueryInfo.sqlCount);
} else { } else {
if (g_queryInfo.specifiedQueryInfo.concurrent <= 0) { if (g_queryInfo.specifiedQueryInfo.concurrent <= 0) {
errorPrint("%s() LN%d, specified query sqlCount %d.\n", __func__, errorPrint("specified query sqlCount %d.\n",
__LINE__, g_queryInfo.specifiedQueryInfo.sqlCount); g_queryInfo.specifiedQueryInfo.sqlCount);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
pids = calloc(1, g_queryInfo.specifiedQueryInfo.sqlCount * pids = calloc(1, g_queryInfo.specifiedQueryInfo.sqlCount *
g_queryInfo.specifiedQueryInfo.concurrent * g_queryInfo.specifiedQueryInfo.concurrent *
sizeof(pthread_t)); sizeof(pthread_t));
assert(pids);
infos = calloc(1, g_queryInfo.specifiedQueryInfo.sqlCount * infos = calloc(1, g_queryInfo.specifiedQueryInfo.sqlCount *
g_queryInfo.specifiedQueryInfo.concurrent * g_queryInfo.specifiedQueryInfo.concurrent *
sizeof(threadInfo)); sizeof(threadInfo));
if ((NULL == pids) || (NULL == infos)) { assert(infos);
errorPrint("%s() LN%d, malloc failed for create threads\n",
__func__, __LINE__);
exit(EXIT_FAILURE);
}
for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqlCount; i++) { for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqlCount; i++) {
for (int j = 0; j < g_queryInfo.specifiedQueryInfo.concurrent; for (int j = 0; j < g_queryInfo.specifiedQueryInfo.concurrent;
...@@ -423,15 +420,11 @@ int subscribeTestProcess() { ...@@ -423,15 +420,11 @@ int subscribeTestProcess() {
pidsOfStable = calloc(1, g_queryInfo.superQueryInfo.sqlCount * pidsOfStable = calloc(1, g_queryInfo.superQueryInfo.sqlCount *
g_queryInfo.superQueryInfo.threadCnt * g_queryInfo.superQueryInfo.threadCnt *
sizeof(pthread_t)); sizeof(pthread_t));
assert(pidsOfStable);
infosOfStable = calloc(1, g_queryInfo.superQueryInfo.sqlCount * infosOfStable = calloc(1, g_queryInfo.superQueryInfo.sqlCount *
g_queryInfo.superQueryInfo.threadCnt * g_queryInfo.superQueryInfo.threadCnt *
sizeof(threadInfo)); sizeof(threadInfo));
if ((NULL == pidsOfStable) || (NULL == infosOfStable)) { assert(infosOfStable);
errorPrint("%s() LN%d, malloc failed for create threads\n",
__func__, __LINE__);
// taos_close(taos);
exit(EXIT_FAILURE);
}
int64_t ntables = g_queryInfo.superQueryInfo.childTblCount; int64_t ntables = g_queryInfo.superQueryInfo.childTblCount;
int threads = g_queryInfo.superQueryInfo.threadCnt; int threads = g_queryInfo.superQueryInfo.threadCnt;
......
...@@ -202,8 +202,14 @@ int getChildNameOfSuperTableWithLimitAndOffset(TAOS *taos, char *dbName, ...@@ -202,8 +202,14 @@ int getChildNameOfSuperTableWithLimitAndOffset(TAOS *taos, char *dbName,
TAOS_RES *res; TAOS_RES *res;
TAOS_ROW row = NULL; TAOS_ROW row = NULL;
int64_t childTblCount = (limit < 0) ? DEFAULT_CHILDTABLES : limit;
char *childTblName = *childTblNameOfSuperTbl; int64_t count = 0;
char * childTblName = *childTblNameOfSuperTbl;
char * pTblName = childTblName;
if (childTblName == NULL) {
childTblName = (char *)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN);
assert(childTblName);
}
snprintf(limitBuf, 100, " limit %" PRId64 " offset %" PRIu64 "", limit, snprintf(limitBuf, 100, " limit %" PRId64 " offset %" PRIu64 "", limit,
offset); offset);
...@@ -219,31 +225,16 @@ int getChildNameOfSuperTableWithLimitAndOffset(TAOS *taos, char *dbName, ...@@ -219,31 +225,16 @@ int getChildNameOfSuperTableWithLimitAndOffset(TAOS *taos, char *dbName,
if (code != 0) { if (code != 0) {
taos_free_result(res); taos_free_result(res);
taos_close(taos); taos_close(taos);
errorPrint("%s() LN%d, failed to run command %s, reason: %s\n", errorPrint("failed to run command %s, reason: %s\n", command,
__func__, __LINE__, command, taos_errstr(res)); taos_errstr(res));
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
int64_t childTblCount = (limit < 0) ? DEFAULT_CHILDTABLES : limit;
int64_t count = 0;
if (childTblName == NULL) {
childTblName = (char *)calloc(1, childTblCount * TSDB_TABLE_NAME_LEN);
if (NULL == childTblName) {
taos_free_result(res);
taos_close(taos);
errorPrint("%s() LN%d, failed to allocate memory!\n", __func__,
__LINE__);
exit(EXIT_FAILURE);
}
}
char *pTblName = childTblName;
while ((row = taos_fetch_row(res)) != NULL) { while ((row = taos_fetch_row(res)) != NULL) {
int32_t *len = taos_fetch_lengths(res); int32_t *len = taos_fetch_lengths(res);
if (0 == strlen((char *)row[0])) { if (0 == strlen((char *)row[0])) {
errorPrint("%s() LN%d, No.%" PRId64 " table return empty name\n", errorPrint("No.%" PRId64 " table return empty name\n", count);
__func__, __LINE__, count);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
...@@ -577,8 +568,7 @@ int postProceSql(char *host, uint16_t port, char *sqlstr, ...@@ -577,8 +568,7 @@ int postProceSql(char *host, uint16_t port, char *sqlstr,
free(request_buf); free(request_buf);
if (NULL == strstr(response_buf, resHttpOk)) { if (NULL == strstr(response_buf, resHttpOk)) {
errorPrint("%s() LN%d, Response:\n%s\n", __func__, __LINE__, errorPrint("Response:\n%s\n", response_buf);
response_buf);
return -1; return -1;
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册