From 06ac5328ec801a07c18e38416e823814ef40934e Mon Sep 17 00:00:00 2001 From: Bomin Zhang Date: Sat, 6 Jun 2020 16:55:31 +0800 Subject: [PATCH] td-449: fix invalid write --- src/cq/src/cqMain.c | 7 ++++--- tests/script/general/stream/table_replica1_vnoden.sim | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cq/src/cqMain.c b/src/cq/src/cqMain.c index 23455b6f50..edb588b554 100644 --- a/src/cq/src/cqMain.c +++ b/src/cq/src/cqMain.c @@ -175,7 +175,7 @@ void *cqCreate(void *handle, uint64_t uid, int tid, char *sqlStr, STSchema *pSch strcpy(pObj->sqlStr, sqlStr); pObj->pSchema = tdDupSchema(pSchema); - pObj->rowSize = pSchema->tlen; + pObj->rowSize = schemaTLen(pSchema); cTrace("vgId:%d, id:%d CQ:%s is created", pContext->vgId, pObj->tid, pObj->sqlStr); @@ -272,13 +272,14 @@ static void cqProcessStreamRes(void *param, TAOS_RES *tres, TAOS_ROW row) { pBlk->sversion = htonl(pSchema->version); pBlk->padding = 0; + pHead->len = sizeof(SSubmitMsg) + sizeof(SSubmitBlk) + dataRowLen(trow); + pMsg->header.vgId = htonl(pContext->vgId); - pMsg->header.contLen = htonl(size - sizeof(SWalHead)); + pMsg->header.contLen = htonl(pHead->len); pMsg->length = pMsg->header.contLen; pMsg->numOfBlocks = htonl(1); pHead->msgType = TSDB_MSG_TYPE_SUBMIT; - pHead->len = size - sizeof(SWalHead); pHead->version = 0; // write into vnode write queue diff --git a/tests/script/general/stream/table_replica1_vnoden.sim b/tests/script/general/stream/table_replica1_vnoden.sim index 44d4008dbd..e1d5a9babf 100644 --- a/tests/script/general/stream/table_replica1_vnoden.sim +++ b/tests/script/general/stream/table_replica1_vnoden.sim @@ -196,8 +196,8 @@ $st = $stPrefix . as sql create table $st as select count(tbcol) as c from $tb interval(1d) print =============== step16 -print sleep 22 seconds -sleep 22000 +print sleep 120 seconds +sleep 120000 print =============== step17 $st = $stPrefix . c1 -- GitLab