diff --git a/src/client/src/tscAsync.c b/src/client/src/tscAsync.c index 41e935441fd11428420efc98dc53616b7d2317dc..c693df1f3b31878f251a3a28a350f9d8a2ff9c5e 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 377cb24b1d5b1c92c702cd113c4feea185617911..92a2198a8089d2ab3e288ca52657df89fbcd5e43 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 3e517c6fa682ce28ee2416aee3672a8628f953cf..cc8e9e86e37dea8de50d624435662c1e21ff4a94 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); } diff --git a/src/vnode/inc/vnodeRead.h b/src/vnode/inc/vnodeRead.h index f5375d6ab0c19277e2c39a987fd4428fae1885e1..0e9655f837e311fd8d7d8779ce915e5b152be288 100644 --- a/src/vnode/inc/vnodeRead.h +++ b/src/vnode/inc/vnodeRead.h @@ -27,7 +27,7 @@ void vnodeCleanupRead(void); int32_t vnodeWriteToRQueue(void *pVnode, void *pCont, int32_t contLen, int8_t qtype, void *rparam); void vnodeFreeFromRQueue(void *pVnode, SVReadMsg *pRead); int32_t vnodeProcessRead(void *pVnode, SVReadMsg *pRead); -void vnodeWaitReadCompleted(void *pVnode); +void vnodeWaitReadCompleted(SVnodeObj *pVnode); #ifdef __cplusplus } diff --git a/src/vnode/inc/vnodeWrite.h b/src/vnode/inc/vnodeWrite.h index 5238e45b81fc7955e592970fd6634199940470e0..e996bc0b06f4563b24e5ebdfc90420b9e67df003 100644 --- a/src/vnode/inc/vnodeWrite.h +++ b/src/vnode/inc/vnodeWrite.h @@ -27,7 +27,7 @@ void vnodeCleanupWrite(void); int32_t vnodeWriteToWQueue(void *pVnode, void *pHead, int32_t qtype, void *pRpcMsg); void vnodeFreeFromWQueue(void *pVnode, SVWriteMsg *pWrite); int32_t vnodeProcessWrite(void *pVnode, void *pHead, int32_t qtype, void *pRspRet); -void vnodeWaitWriteCompleted(void *pVnode); +void vnodeWaitWriteCompleted(SVnodeObj *pVnode); #ifdef __cplusplus } diff --git a/src/vnode/src/vnodeMain.c b/src/vnode/src/vnodeMain.c index eb43fba0798085d84c793a145b082325e6d56a15..5f6f3fe105a9f0e4933db830dc42a6b597ea2ee1 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/vnodeRead.c b/src/vnode/src/vnodeRead.c index c864bc995bb58e81535111b1f2c7654699578930..acb1fc78f6554dc7cd4b984107a7bc1b95315b67 100644 --- a/src/vnode/src/vnodeRead.c +++ b/src/vnode/src/vnodeRead.c @@ -436,4 +436,9 @@ int32_t vnodeNotifyCurrentQhandle(void *handle, void *qhandle, int32_t vgId) { return rpcReportProgress(handle, (char *)pMsg, sizeof(SRetrieveTableMsg)); } -void vnodeWaitReadCompleted(void *pVnode) {} \ No newline at end of file +void vnodeWaitReadCompleted(SVnodeObj *pVnode) { + while (pVnode->queuedRMsg > 0) { + vTrace("vgId:%d, queued rmsg num:%d", pVnode->vgId, pVnode->queuedRMsg); + taosMsleep(10); + } +} \ No newline at end of file diff --git a/src/vnode/src/vnodeStatus.c b/src/vnode/src/vnodeStatus.c index ce7ddd11b529c7da22519af3c657e4e898aea2ea..11f79fb372e45199626ccdb9d97c6a4065de7296 100644 --- a/src/vnode/src/vnodeStatus.c +++ b/src/vnode/src/vnodeStatus.c @@ -18,6 +18,8 @@ #include "taosmsg.h" #include "query.h" #include "vnodeStatus.h" +#include "vnodeRead.h" +#include "vnodeWrite.h" char* vnodeStatus[] = { "init", @@ -75,6 +77,11 @@ bool vnodeSetClosingStatus(SVnodeObj* pVnode) { } } + // release local resources only after cutting off outside connections + qQueryMgmtNotifyClosed(pVnode->qMgmt); + vnodeWaitReadCompleted(pVnode); + vnodeWaitWriteCompleted(pVnode); + return true; } @@ -116,6 +123,11 @@ bool vnodeSetResetStatus(SVnodeObj* pVnode) { } } + // release local resources only after cutting off outside connections + qQueryMgmtNotifyClosed(pVnode->qMgmt); + vnodeWaitReadCompleted(pVnode); + vnodeWaitWriteCompleted(pVnode); + return true; } diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 5c2e871eb646a006484bcdc34995bda70a3ede8d..4f6ce9d2e431d4998252741bf475d1549af0eb7a 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -345,4 +345,9 @@ static int32_t vnodePerformFlowCtrl(SVWriteMsg *pWrite) { } } -void vnodeWaitWriteCompleted(void *pVnode) {} \ No newline at end of file +void vnodeWaitWriteCompleted(SVnodeObj *pVnode) { + while (pVnode->queuedWMsg > 0) { + vTrace("vgId:%d, queued wmsg num:%d", pVnode->vgId, pVnode->queuedWMsg); + taosMsleep(10); + } +}