From 45fb658cec54b1c377c31d04fb70f90b98d5b9ee Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Wed, 28 Sep 2022 19:06:43 +0800 Subject: [PATCH 1/5] fix: fix rows missed in query result issue --- source/dnode/vnode/src/tsdb/tsdbRead.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 2ea6a57b9e..c3cb5f9eb8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -486,7 +486,7 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd pReader->pTsdb = getTsdbByRetentions(pVnode, pCond->twindows.skey, pVnode->config.tsdbCfg.retentions, idstr, &level); pReader->suid = pCond->suid; pReader->order = pCond->order; - pReader->capacity = 4096; + pReader->capacity = capacity; pReader->idStr = (idstr != NULL) ? strdup(idstr) : NULL; pReader->verRange = getQueryVerRange(pVnode, pCond, level); pReader->type = pCond->type; @@ -841,14 +841,18 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn bool asc = ASCENDING_TRAVERSE(pReader->order); int32_t step = asc ? 1 : -1; - if (asc && pReader->window.skey <= pBlock->minKey.ts) { - pDumpInfo->rowIndex = 0; - } else if (!asc && pReader->window.ekey >= pBlock->maxKey.ts) { - pDumpInfo->rowIndex = pBlock->nRow - 1; - } else { - int32_t pos = asc ? pBlock->nRow - 1 : 0; - int32_t order = (pReader->order == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC; - pDumpInfo->rowIndex = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, pReader->window.skey, order); + + if ((pDumpInfo->rowIndex == 0 && asc) || (pDumpInfo->rowIndex == pBlock->nRow - 1 && (!asc))) { + if (asc && pReader->window.skey <= pBlock->minKey.ts) { + //pDumpInfo->rowIndex = 0; + } else + if (!asc && pReader->window.ekey >= pBlock->maxKey.ts) { + //pDumpInfo->rowIndex = pBlock->nRow - 1; + } else { + int32_t pos = asc ? pBlock->nRow - 1 : 0; + int32_t order = (pReader->order == TSDB_ORDER_ASC) ? TSDB_ORDER_DESC : TSDB_ORDER_ASC; + pDumpInfo->rowIndex = doBinarySearchKey(pBlockData->aTSKEY, pBlock->nRow, pos, pReader->window.skey, order); + } } // time window check @@ -932,8 +936,8 @@ static int32_t copyBlockDataToSDataBlock(STsdbReader* pReader, STableBlockScanIn pDumpInfo->rowIndex += step * remain; if (pDumpInfo->rowIndex >= 0 && pDumpInfo->rowIndex < pBlock->nRow) { - int64_t ts = pBlockData->aTSKEY[pDumpInfo->rowIndex]; - setBlockAllDumped(pDumpInfo, ts, pReader->order); +// int64_t ts = pBlockData->aTSKEY[pDumpInfo->rowIndex]; +// setBlockAllDumped(pDumpInfo, ts, pReader->order); } else { int64_t k = asc ? pBlock->maxKey.ts : pBlock->minKey.ts; setBlockAllDumped(pDumpInfo, k, pReader->order); From 0e734f7aee14dcef638d1a4d0c3464a0c3ff3bdf Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 29 Sep 2022 10:39:22 +0800 Subject: [PATCH 2/5] fix:timestamp out of range --- utils/test/c/sml_test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/utils/test/c/sml_test.c b/utils/test/c/sml_test.c index ca3d464da7..56ba622a9c 100644 --- a/utils/test/c/sml_test.c +++ b/utils/test/c/sml_test.c @@ -879,7 +879,7 @@ int sml_16960_Test() { "{" "\"timestamp\":" "" - "{ \"value\": 1349020800000, \"type\": \"ms\" }" + "{ \"value\": 1664418955000, \"type\": \"ms\" }" "," "\"value\":" "" @@ -916,7 +916,7 @@ int sml_16960_Test() { "{" "\"timestamp\":" "" - "{ \"value\": 1349020800001, \"type\": \"ms\" }" + "{ \"value\": 1664418955001, \"type\": \"ms\" }" "," "\"value\":" "" @@ -953,7 +953,7 @@ int sml_16960_Test() { "{" "\"timestamp\":" "" - "{ \"value\": 1349020800002, \"type\": \"ms\" }" + "{ \"value\": 1664418955002, \"type\": \"ms\" }" "," "\"value\":" "" @@ -990,7 +990,7 @@ int sml_16960_Test() { "{" "\"timestamp\":" "" - "{ \"value\": 1349020800003, \"type\": \"ms\" }" + "{ \"value\": 1664418955003, \"type\": \"ms\" }" "," "\"value\":" "" @@ -1027,7 +1027,7 @@ int sml_16960_Test() { "{" "\"timestamp\":" "" - "{ \"value\": 1349020800004, \"type\": \"ms\" }" + "{ \"value\": 1664418955004, \"type\": \"ms\" }" "," "\"value\":" "" From 7aa2ffc4a8d7ac63a66ed8b99b843b35a9150244 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 29 Sep 2022 11:09:23 +0800 Subject: [PATCH 3/5] docs: remove influx_max_line_bytes for 3.0 (#17137) --- docs/en/14-reference/_telegraf.mdx | 1 - docs/en/25-application/01-telegraf.md | 1 - docs/zh/14-reference/_telegraf.mdx | 1 - docs/zh/25-application/01-telegraf.md | 1 - 4 files changed, 4 deletions(-) diff --git a/docs/en/14-reference/_telegraf.mdx b/docs/en/14-reference/_telegraf.mdx index e32fb25693..bcf1a0893f 100644 --- a/docs/en/14-reference/_telegraf.mdx +++ b/docs/en/14-reference/_telegraf.mdx @@ -22,5 +22,4 @@ An example is as follows. username = "root" password = "taosdata" data_format = "influx" - influx_max_line_bytes = 250 ``` diff --git a/docs/en/25-application/01-telegraf.md b/docs/en/25-application/01-telegraf.md index 59491152bc..f700326449 100644 --- a/docs/en/25-application/01-telegraf.md +++ b/docs/en/25-application/01-telegraf.md @@ -60,7 +60,6 @@ For the configuration method, add the following text to `/etc/telegraf/telegraf. username = "" password = "" data_format = "influx" - influx_max_line_bytes = 250 ``` Then restart telegraf: diff --git a/docs/zh/14-reference/_telegraf.mdx b/docs/zh/14-reference/_telegraf.mdx index bae46d6606..3f92e5dde0 100644 --- a/docs/zh/14-reference/_telegraf.mdx +++ b/docs/zh/14-reference/_telegraf.mdx @@ -22,6 +22,5 @@ username = "root" password = "taosdata" data_format = "influx" - influx_max_line_bytes = 250 ``` diff --git a/docs/zh/25-application/01-telegraf.md b/docs/zh/25-application/01-telegraf.md index 4e9597f964..6338264d17 100644 --- a/docs/zh/25-application/01-telegraf.md +++ b/docs/zh/25-application/01-telegraf.md @@ -61,7 +61,6 @@ IT 运维监测数据通常都是对时间特性比较敏感的数据,例如 username = "" password = "" data_format = "influx" - influx_max_line_bytes = 250 ``` 然后重启 Telegraf: From 4c00225e9fe24c07f59048e7762fe7eb53d04753 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Thu, 29 Sep 2022 11:26:58 +0800 Subject: [PATCH 4/5] fix: fix coverity scan issue in tudf.c and udfd.c --- source/libs/function/src/tudf.c | 2 ++ source/libs/function/src/udfd.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/source/libs/function/src/tudf.c b/source/libs/function/src/tudf.c index 62427e0488..060a92f864 100644 --- a/source/libs/function/src/tudf.c +++ b/source/libs/function/src/tudf.c @@ -1656,6 +1656,8 @@ int32_t doSetupUdf(char udfName[], UdfcFuncHandle *funcHandle) { int32_t errCode = udfcRunUdfUvTask(task, UV_TASK_CONNECT); if (errCode != 0) { fnError("failed to connect to pipe. udfName: %s, pipe: %s", udfName, (&gUdfdProxy)->udfdPipeName); + taosMemoryFree(task->session); + taosMemoryFree(task); return TSDB_CODE_UDF_PIPE_CONNECT_ERR; } diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 636f006d6e..8ff0dc15a5 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -960,7 +960,7 @@ int32_t udfdInitResidentFuncs() { char* token; while ((token = strtok_r(pSave, ",", &pSave)) != NULL) { char func[TSDB_FUNC_NAME_LEN] = {0}; - strncpy(func, token, strlen(token)); + strncpy(func, token, sizeof(func)); taosArrayPush(global.residentFuncs, func); } From aaf325489be5b4386d749c06f3e90217a08ff259 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 29 Sep 2022 12:53:06 +0800 Subject: [PATCH 5/5] docs: remove influx_max_line_bytes for 3.0 (#17139)