“5f25e3fd065f7e7cfde608fc3bfa399160afaaf6”上不存在“projects/Xtra-Computing/imports.yml”
未验证 提交 e0939dcd 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #13666 from taosdata/fix/TS-1500-V26

fix: super table info not removed after dropped by another client
......@@ -294,6 +294,7 @@ typedef struct {
SQueryInfo *active; // current active query info
int32_t batchSize; // for parameter ('?') binding and batch processing
int32_t resColumnId;
SArray *hashedTableNames;
} SSqlCmd;
typedef struct {
......
......@@ -341,6 +341,11 @@ void tscAsyncResultOnError(SSqlObj* pSql) {
}
int tscSendMsgToServer(SSqlObj *pSql);
void tscClearTableMeta(SSqlObj *pSql);
static void freeElem(void* p) {
tfree(*(char**)p);
}
void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
SSqlObj* pSql = (SSqlObj*)taosAcquireRef(tscObjRef, (int64_t)param);
......@@ -360,10 +365,23 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
size_t sz = strlen(tscGetErrorMsgPayload(&sub->cmd));
tscAllocPayload(&pSql->cmd, (int)sz + 1);
memcpy(tscGetErrorMsgPayload(&pSql->cmd), tscGetErrorMsgPayload(&sub->cmd), sz);
}
} else if (code == TSDB_CODE_MND_INVALID_TABLE_NAME) {
if (sub->cmd.command == TSDB_SQL_MULTI_META && pSql->cmd.hashedTableNames) {
tscClearTableMeta(pSql);
taosArrayDestroyEx(&pSql->cmd.hashedTableNames, freeElem);
pSql->cmd.hashedTableNames = NULL;
}
}
goto _error;
}
if (sub->cmd.command == TSDB_SQL_MULTI_META) {
if (pSql->cmd.hashedTableNames) {
taosArrayDestroyEx(&pSql->cmd.hashedTableNames, freeElem);
pSql->cmd.hashedTableNames = NULL;
}
}
tscDebug("0x%"PRIx64" get %s successfully", pSql->self, msg);
if (pSql->pStream == NULL) {
SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd);
......@@ -426,3 +444,13 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
tscAsyncResultOnError(pSql);
taosReleaseRef(tscObjRef, pSql->self);
}
void tscClearTableMeta(SSqlObj *pSql) {
SSqlCmd* pCmd = &pSql->cmd;
int32_t n = taosArrayGetSize(pCmd->hashedTableNames);
for (int32_t i = 0; i < n; i++) {
char *t = taosArrayGetP(pCmd->hashedTableNames, i);
taosHashRemove(UTIL_GET_TABLEMETA(pSql), t, strlen(t));
}
}
......@@ -10083,6 +10083,15 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char* t = strdup(name);
taosArrayPush(pVgroupList, &t);
tscDebug("0x%"PRIx64" failed to retrieve stable %s vgroup id list in cache, try fetch from mnode", pSql->self, name);
if (pCmd->hashedTableNames == NULL) {
pCmd->hashedTableNames = taosArrayInit(4, POINTER_BYTES);
}
if (pCmd->hashedTableNames) {
char* tb = strdup(name);
taosArrayPush(pCmd->hashedTableNames, &tb);
}
} else {
tFilePage* pdata = (tFilePage*) pv;
pVgroupIdList = taosArrayInit((size_t) pdata->num, sizeof(int32_t));
......
......@@ -740,6 +740,7 @@
4,,system-test,python3 ./test.py -f 2-query/TD-11561.py
4,,system-test,python3 test.py -f 1-insert/stmt_error.py
4,,pytest,python3 test.py -f user/pass_len.py
4,,pytest,python3 test.py -f client/dropTable.py
4,,pytest,python3 test.py -f TimeZone/TestCaseTimeZone.py
4,,pytest,python3 test.py -f tag_lite/unsignedBigint.py
4,,pytest,python3 test.py -f tag_lite/tinyint.py
......
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import taos
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
import multiprocessing as mp
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor())
self.ts = 1609430400000
def run(self):
tdSql.prepare()
os.system("taos -s 'create table db.st(ts timestamp, c1 int, c2 float) tags(t1 int)' ")
os.system("taos -s 'create table db.t1 using db.st tags(1)' ")
os.system("taos -s 'insert into t1 values(%d, 1, 1.11)'" % self.ts)
os.system("taos -s 'desc db.st'")
tdSql.query("desc db.st")
tdSql.checkRows(4)
os.system("taos -s 'drop table db.st'")
tdSql.error("select * from db.st")
tdSql.error("desc db.st")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册