diff --git a/src/benchCommandOpt.c b/src/benchCommandOpt.c index cfff986c..43b3dbe5 100644 --- a/src/benchCommandOpt.c +++ b/src/benchCommandOpt.c @@ -28,10 +28,6 @@ extern char g_configDir[MAX_PATH_LEN]; #define TAOSBENCHMARK_STATUS "unknown" #endif -#ifndef TD_PRODUCT_NAME -#define TD_PRODUCT_NAME "TDengine" -#endif - // libtaos.so extern char buildinfo[]; @@ -52,7 +48,7 @@ void printVersion() { char taosBenchmark_status[] = TAOSBENCHMARK_STATUS; // version - printf("%s\ntaosBenchmark version: %s\ngit: %s\n", TD_PRODUCT_NAME, taosBenchmark_ver, taosBenchmark_commit); + printf("taosBenchmark version: %s\ngit: %s\n", taosBenchmark_ver, taosBenchmark_commit); #ifdef LINUX printf("build: %s\n ", buildinfo); #endif diff --git a/src/benchData.c b/src/benchData.c index 0cf5f26d..890ba1f5 100644 --- a/src/benchData.c +++ b/src/benchData.c @@ -323,8 +323,17 @@ static int generateSampleFromCsv(char *buffer, char* file, FILE* fp, int32_t len continue; } - if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { - line[--readLen] = 0; + int32_t pos = (int32_t)(readLen - 1); + if(pos > 0) { + if (('\r' == line[pos]) || ('\n' == line[pos])) { + line[pos] = 0; + } + } + pos = (int32_t)(readLen - 2); + if(pos > 0) { + if (('\r' == line[pos]) || ('\n' == line[pos])) { + line[pos] = 0; + } } if (readLen == 0) { @@ -339,7 +348,7 @@ static int generateSampleFromCsv(char *buffer, char* file, FILE* fp, int32_t len continue; } - memcpy(buffer + getRows * length, line, readLen); + memcpy(buffer + getRows * length, line, readLen + 1); getRows++; if (getRows == size) { diff --git a/src/benchInsert.c b/src/benchInsert.c index e2f9853d..32f01a97 100644 --- a/src/benchInsert.c +++ b/src/benchInsert.c @@ -984,6 +984,7 @@ static void *createTable(void *sarg) { pThreadInfo->tables_created += batchNum; batchNum = 0; + memset(pThreadInfo->buffer, 0, TSDB_MAX_ALLOWED_SQL_LEN); uint64_t currentPrintTime = toolsGetTimestampMs(); if (currentPrintTime - lastPrintTime > PRINT_STAT_INTERVAL) { infoPrint( diff --git a/src/taosdump.c b/src/taosdump.c index 334f76d7..3c14c405 100644 --- a/src/taosdump.c +++ b/src/taosdump.c @@ -82,10 +82,6 @@ #define TAOSDUMP_STATUS "unknown" #endif -#ifndef TD_PRODUCT_NAME -#define TD_PRODUCT_NAME "TDengine" -#endif - // use 256 as normal buffer length #define BUFFER_LEN 256 @@ -673,7 +669,7 @@ static void printVersion(FILE *file) { char taosdump_commit[] = TAOSDUMP_COMMIT_SHA1; - fprintf(file,"%s\ntaosdump version: %s\ngit: %s\n", TD_PRODUCT_NAME, taostools_ver, taosdump_commit); + fprintf(file,"taosdump version: %s\ngit: %s\n", taostools_ver, taosdump_commit); #ifdef LINUX printf("build: %s\n ", buildinfo); #endif @@ -2181,7 +2177,6 @@ static int64_t getTbCountOfStbNative(const char *dbName, const char *stbName) { int32_t code = taos_errno(res); if (code != 0) { cleanIfQueryFailed(__func__, __LINE__, command, res); - free(command); taos_close(taos); return -1; } @@ -9980,7 +9975,7 @@ int readNextTableDesWS(void* ws_res, TableDes* tbDes, int *idx, int *cnt) { // read next table tags to tbDes int readNextTableDesNative(void* res, TableDes* tbDes) { // tbname, tagName , tagValue - TAOS_ROW row; + TAOS_ROW row = NULL; int index = 0; while( index < tbDes->tags && NULL != (row = taos_fetch_row(res))) { // tbname changed check