From 3e560be2c0f132f653b4c905db375cffac5b4424 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 9 Jun 2021 15:47:00 +0800 Subject: [PATCH 1/2] fix bug --- src/client/src/tscSub.c | 10 ++++++++-- src/tsdb/src/tsdbRead.c | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 327ccd0294..a6d09b5d8d 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -264,7 +264,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { SSqlCmd* pCmd = &pSql->cmd; - pSub->lastSyncTime = taosGetTimestampMs(); + TSDB_QUERY_CLEAR_TYPE(tscGetQueryInfoDetail(pCmd, 0)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY); STableMetaInfo *pTableMetaInfo = tscGetTableMetaInfoFromCmd(pCmd, pCmd->clauseIndex, 0); if (UTIL_TABLE_IS_NORMAL_TABLE(pTableMetaInfo)) { @@ -275,6 +275,8 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { taosArrayClear(pSub->progress); taosArrayPush(pSub->progress, &target); } + + pSub->lastSyncTime = taosGetTimestampMs(); return 1; } @@ -304,7 +306,11 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { } taosArrayDestroy(tables); - TSDB_QUERY_SET_TYPE(tscGetQueryInfoDetail(pCmd, 0)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY); + if (pTableMetaInfo->pVgroupTables && taosArrayGetSize(pTableMetaInfo->pVgroupTables) > 0) { + TSDB_QUERY_SET_TYPE(tscGetQueryInfoDetail(pCmd, 0)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY); + } + + pSub->lastSyncTime = taosGetTimestampMs(); return 1; } diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index 1cc0780b9d..4d36c740b4 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -3319,6 +3319,9 @@ int32_t tsdbGetTableGroupFromIdList(STsdbRepo* tsdb, SArray* pTableIdList, STabl if (pTable->type == TSDB_SUPER_TABLE) { tsdbError("direct query on super tale is not allowed, table uid:%"PRIu64", tid:%d", id->uid, id->tid); terrno = TSDB_CODE_QRY_INVALID_MSG; + tsdbUnlockRepoMeta(tsdb); + taosArrayDestroy(group); + return terrno; } tsdbRefTable(pTable); From dc47e229d8738cc9c46d7edb685d60e61ff53255 Mon Sep 17 00:00:00 2001 From: dapan1121 <89396746@qq.com> Date: Wed, 9 Jun 2021 16:00:37 +0800 Subject: [PATCH 2/2] add pointer protection --- src/util/src/ttokenizer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/src/ttokenizer.c b/src/util/src/ttokenizer.c index 3448e8e2ba..b02ba96f07 100644 --- a/src/util/src/ttokenizer.c +++ b/src/util/src/ttokenizer.c @@ -275,6 +275,10 @@ static int32_t tKeywordCode(const char* z, int n) { } } + if (keywordHashTable == NULL) { + return TK_ILLEGAL; + } + SKeyword** pKey = (SKeyword**)taosHashGet(keywordHashTable, key, n); return (pKey != NULL)? (*pKey)->type:TK_ID; }