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

change error print message

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