From 5bd53986c1aa5bca3094c53505349765ffe46e41 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 12 Jun 2024 19:49:19 +0800 Subject: [PATCH 1/8] fix: csv file read need copy end char --- src/benchCommandOpt.c | 6 +----- src/benchData.c | 15 ++++++++++++--- src/benchInsert.c | 1 + src/taosdump.c | 9 ++------- 4 files changed, 16 insertions(+), 15 deletions(-) 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 From da62305a2f2b4a879fddd456be1f2275fe979ac9 Mon Sep 17 00:00:00 2001 From: Alex Duan <51781608+DuanKuanJun@users.noreply.github.com> Date: Thu, 13 Jun 2024 19:18:47 +0800 Subject: [PATCH 2/8] Update benchCommandOpt.c --- src/benchCommandOpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/benchCommandOpt.c b/src/benchCommandOpt.c index 43b3dbe5..bf9d5d24 100644 --- a/src/benchCommandOpt.c +++ b/src/benchCommandOpt.c @@ -50,7 +50,7 @@ void printVersion() { // version printf("taosBenchmark version: %s\ngit: %s\n", taosBenchmark_ver, taosBenchmark_commit); #ifdef LINUX - printf("build: %s\n ", buildinfo); + printf("build: %s\n", buildinfo); #endif if (strlen(taosBenchmark_status) > 0) { printf("status: %s\n", taosBenchmark_status); From 57c3b0c3b992cfc60364ea7134e2a7379651ca5b Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 26 Jun 2024 11:04:52 +0800 Subject: [PATCH 3/8] fix: window build error --- .github/workflows/3.0-windows-build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/3.0-windows-build.yml b/.github/workflows/3.0-windows-build.yml index 8bc58fad..68a27bf8 100644 --- a/.github/workflows/3.0-windows-build.yml +++ b/.github/workflows/3.0-windows-build.yml @@ -5,12 +5,10 @@ on: - cron: "10 16 * * *" push: branches: - - develop - 3.0 - main pull_request: branches: - - develop - 3.0 - main @@ -122,7 +120,11 @@ jobs: with: toolchain: stable - - uses: ilammy/msvc-dev-cmd@v1 + - uses: actions/checkout@v2 + name: Setup MSVC build environment + env: + PATH: ${{ runner.tool_cache }}/msvc/2019/hostx64/x64/bin + run: echo "Setup MSVC environment" - name: Build & Install TDengine if: From d9178d22dc818025573204d4bdfda233469fe4b5 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 26 Jun 2024 11:15:45 +0800 Subject: [PATCH 4/8] fix: window build no found window --- .github/workflows/3.0-windows-build.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/3.0-windows-build.yml b/.github/workflows/3.0-windows-build.yml index 68a27bf8..a1538e39 100644 --- a/.github/workflows/3.0-windows-build.yml +++ b/.github/workflows/3.0-windows-build.yml @@ -120,12 +120,6 @@ jobs: with: toolchain: stable - - uses: actions/checkout@v2 - name: Setup MSVC build environment - env: - PATH: ${{ runner.tool_cache }}/msvc/2019/hostx64/x64/bin - run: echo "Setup MSVC environment" - - name: Build & Install TDengine if: (steps.changed-files-specific.outputs.any_changed == 'true' From e6a6e46ddb0f68e6448dba92c50af92435799324 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 26 Jun 2024 11:42:29 +0800 Subject: [PATCH 5/8] fix: window plat build error --- .github/workflows/3.0-windows-build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/3.0-windows-build.yml b/.github/workflows/3.0-windows-build.yml index a1538e39..5deb3954 100644 --- a/.github/workflows/3.0-windows-build.yml +++ b/.github/workflows/3.0-windows-build.yml @@ -120,6 +120,12 @@ jobs: with: toolchain: stable + - name: Setup Visual Studio Build Tools + uses: microsoft/setup-msbuild@v1.0.2 + with: + vs-version: 2019 + components: 'Microsoft.VisualStudio.Workload.NativeDesktop,Microsoft.VisualStudio.Component.VC.Tools.x86.x64' + - name: Build & Install TDengine if: (steps.changed-files-specific.outputs.any_changed == 'true' From 315d4c7944f1a88490d7b677d413031bc7238773 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 26 Jun 2024 11:44:18 +0800 Subject: [PATCH 6/8] fix: window plat build error1 --- .github/workflows/3.0-windows-build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/3.0-windows-build.yml b/.github/workflows/3.0-windows-build.yml index 5deb3954..a41ba970 100644 --- a/.github/workflows/3.0-windows-build.yml +++ b/.github/workflows/3.0-windows-build.yml @@ -120,11 +120,11 @@ jobs: with: toolchain: stable - - name: Setup Visual Studio Build Tools - uses: microsoft/setup-msbuild@v1.0.2 - with: - vs-version: 2019 - components: 'Microsoft.VisualStudio.Workload.NativeDesktop,Microsoft.VisualStudio.Component.VC.Tools.x86.x64' + - name: Setup Visual Studio Build Tools + uses: microsoft/setup-msbuild@v1.0.2 + with: + vs-version: 2019 + components: 'Microsoft.VisualStudio.Workload.NativeDesktop,Microsoft.VisualStudio.Component.VC.Tools.x86.x64' - name: Build & Install TDengine if: From 690b6db8cc8eb5a9acc0a1321202553416febdcc Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 26 Jun 2024 13:11:29 +0800 Subject: [PATCH 7/8] fix: window plat build error1 --- .github/workflows/3.0-windows-build.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/3.0-windows-build.yml b/.github/workflows/3.0-windows-build.yml index a41ba970..68a0feeb 100644 --- a/.github/workflows/3.0-windows-build.yml +++ b/.github/workflows/3.0-windows-build.yml @@ -120,11 +120,7 @@ jobs: with: toolchain: stable - - name: Setup Visual Studio Build Tools - uses: microsoft/setup-msbuild@v1.0.2 - with: - vs-version: 2019 - components: 'Microsoft.VisualStudio.Workload.NativeDesktop,Microsoft.VisualStudio.Component.VC.Tools.x86.x64' + - uses: ilammy/msvc-dev-cmd@v1 - name: Build & Install TDengine if: From 24c9c236751494adf0153d6b7f88ae266435f0de Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Wed, 26 Jun 2024 14:08:35 +0800 Subject: [PATCH 8/8] fix: remove buffer zero --- src/benchInsert.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/benchInsert.c b/src/benchInsert.c index 002ace31..83e91f38 100644 --- a/src/benchInsert.c +++ b/src/benchInsert.c @@ -993,7 +993,6 @@ 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) { float speed = (pThreadInfo->tables_created - lastTotalCreate) * 1000 / (currentPrintTime - lastPrintTime);