From 87f1490a284feb793237632cd13c99769fedbb2c Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 5 Jan 2021 11:27:28 +0000 Subject: [PATCH 1/4] TD-2662 --- src/client/src/tscAsync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index b7b3441bd1..41e935441f 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -365,7 +365,7 @@ static void tscProcessAsyncError(SSchedMsg *pMsg) { void (*fp)() = pMsg->ahandle; terrno = *(int32_t*) pMsg->msg; tfree(pMsg->msg); - (*fp)(pMsg->thandle, NULL, *(int32_t*)pMsg->msg); + (*fp)(pMsg->thandle, NULL, terrno); } void tscQueueAsyncError(void(*fp), void *param, int32_t code) { From 888b8ec13c9384fe6f6f0e664afaf84e380978d8 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Fri, 8 Jan 2021 14:38:37 +0800 Subject: [PATCH 2/4] [TD-2627] add case for apercentile --- tests/pytest/functions/function_percentile.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/pytest/functions/function_percentile.py b/tests/pytest/functions/function_percentile.py index e63d65f2e6..9095b6672b 100644 --- a/tests/pytest/functions/function_percentile.py +++ b/tests/pytest/functions/function_percentile.py @@ -142,6 +142,15 @@ class TDTestCase: tdSql.error("select percentile(voltage, 20) from meters") tdSql.query("select apercentile(voltage, 20) from meters") print("apercentile result: %s" % tdSql.getData(0, 0)) + + # Test case for: https://jira.taosdata.com:18080/browse/TD-2609 + # modified for : https://jira.taosdata.com:18080/browse/TD-2627 + tdSql.execute("create table st(ts timestamp, k int)") + tdSql.execute("insert into st values(now, -100)(now+1a,-99)") + tdSql.query("select apercentile(k, 20) from st") + tdSql.checkData(0, 0, -100.00) + + def stop(self): tdSql.close() From b9056faded7eac11446f6dd84119fbb403ece84a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Fri, 8 Jan 2021 16:38:01 +0800 Subject: [PATCH 3/4] TD-2605 --- src/vnode/src/vnodeMain.c | 3 --- src/vnode/src/vnodeStatus.c | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index eb43fba079..5f6f3fe105 100644 --- a/src/vnode/src/vnodeMain.c +++ b/src/vnode/src/vnodeMain.c @@ -420,9 +420,6 @@ void vnodeCleanUp(SVnodeObj *pVnode) { vnodeSetClosingStatus(pVnode); - // release local resources only after cutting off outside connections - qQueryMgmtNotifyClosed(pVnode->qMgmt); - // stop replication module if (pVnode->sync > 0) { int64_t sync = pVnode->sync; diff --git a/src/vnode/src/vnodeStatus.c b/src/vnode/src/vnodeStatus.c index ce7ddd11b5..c016b78396 100644 --- a/src/vnode/src/vnodeStatus.c +++ b/src/vnode/src/vnodeStatus.c @@ -75,6 +75,9 @@ bool vnodeSetClosingStatus(SVnodeObj* pVnode) { } } + // release local resources only after cutting off outside connections + qQueryMgmtNotifyClosed(pVnode->qMgmt); + return true; } @@ -116,6 +119,9 @@ bool vnodeSetResetStatus(SVnodeObj* pVnode) { } } + // release local resources only after cutting off outside connections + qQueryMgmtNotifyClosed(pVnode->qMgmt); + return true; } From 09ad397d59cfc128361ed059ce4c161a43267f8a Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Fri, 8 Jan 2021 20:02:05 +0800 Subject: [PATCH 4/4] varargs/fix: DONOT use varargs functions without %s to print a string --- src/client/src/tscAsync.c | 2 +- src/client/src/tscSql.c | 2 +- src/plugins/http/src/httpSql.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 41e935441f..c693df1f3b 100644 --- a/src/client/src/tscAsync.c +++ b/src/client/src/tscAsync.c @@ -95,7 +95,7 @@ void taos_query_a(TAOS *taos, const char *sqlstr, __async_cb_func_t fp, void *pa return; } - nPrintTsc(sqlstr); + nPrintTsc("%s", sqlstr); SSqlObj *pSql = (SSqlObj *)calloc(1, sizeof(SSqlObj)); if (pSql == NULL) { diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 377cb24b1d..92a2198a80 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -327,7 +327,7 @@ TAOS_RES* taos_query_c(TAOS *taos, const char *sqlstr, uint32_t sqlLen, int64_t* return NULL; } - nPrintTsc(sqlstr); + nPrintTsc("%s", sqlstr); SSqlObj* pSql = calloc(1, sizeof(SSqlObj)); if (pSql == NULL) { diff --git a/src/plugins/http/src/httpSql.c b/src/plugins/http/src/httpSql.c index 3e517c6fa6..cc8e9e86e3 100644 --- a/src/plugins/http/src/httpSql.c +++ b/src/plugins/http/src/httpSql.c @@ -181,7 +181,7 @@ void httpProcessMultiSql(HttpContext *pContext) { char *sql = httpGetCmdsString(pContext, cmd->sql); httpTraceL("context:%p, fd:%d, user:%s, process pos:%d, start query, sql:%s", pContext, pContext->fd, pContext->user, multiCmds->pos, sql); - nPrintHttp(sql); + nPrintHttp("%s", sql); taos_query_a(pContext->session->taos, sql, httpProcessMultiSqlCallBack, (void *)pContext); } @@ -329,7 +329,7 @@ void httpProcessSingleSqlCmd(HttpContext *pContext) { } httpTraceL("context:%p, fd:%d, user:%s, start query, sql:%s", pContext, pContext->fd, pContext->user, sql); - nPrintHttp(sql); + nPrintHttp("%s", sql); taos_query_a(pSession->taos, sql, httpProcessSingleSqlCallBack, (void *)pContext); }