Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yiicenne
TDengine
提交
cbbb0593
TDengine
项目概览
yiicenne
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cbbb0593
编写于
7月 25, 2021
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-225]fix bug found by regression test.
上级
6e015f2c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
40 deletion
+27
-40
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+9
-10
src/client/src/tscServer.c
src/client/src/tscServer.c
+15
-20
src/common/inc/tcmdtype.h
src/common/inc/tcmdtype.h
+1
-4
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+2
-6
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
cbbb0593
...
...
@@ -7237,7 +7237,7 @@ void tscPrintSelNodeList(SSqlObj* pSql, int32_t subClauseIndex) {
}
tmpLen
=
sprintf
(
tmpBuf
,
"%s(uid:%"
PRI
d
64
", %d)"
,
name
,
pExpr
->
base
.
uid
,
pExpr
->
base
.
colInfo
.
colId
);
sprintf
(
tmpBuf
,
"%s(uid:%"
PRI
u
64
", %d)"
,
name
,
pExpr
->
base
.
uid
,
pExpr
->
base
.
colInfo
.
colId
);
if
(
tmpLen
+
offset
>=
totalBufSize
-
1
)
break
;
...
...
@@ -8135,9 +8135,6 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tscDebug
(
"0x%"
PRIx64
" retrieve table meta %s from local buf"
,
pSql
->
self
,
name
);
// avoid mem leak, may should update pTableMeta
const
char
*
pTableName
=
tNameGetTableName
(
pname
);
size_t
nameLen
=
strlen
(
pTableName
);
void
*
pVgroupIdList
=
NULL
;
if
(
pTableMeta
->
tableType
==
TSDB_CHILD_TABLE
)
{
code
=
tscCreateTableMetaFromSTableMeta
(
pTableMeta
,
name
,
pSql
->
pBuf
);
...
...
@@ -8150,11 +8147,12 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
}
else
if
(
pTableMeta
->
tableType
==
TSDB_SUPER_TABLE
)
{
// the vgroup list of super table is not kept in local buffer, so here need retrieve it from the mnode each time
void
*
pv
=
taosCacheAcquireByKey
(
tscVgroupListBuf
,
pTableName
,
nameLen
);
tscDebug
(
"0x%"
PRIx64
" try to acquire cached super table %s vgroup id list"
,
pSql
->
self
,
name
);
void
*
pv
=
taosCacheAcquireByKey
(
tscVgroupListBuf
,
name
,
len
);
if
(
pv
==
NULL
)
{
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
,
pTableN
ame
);
tscDebug
(
"0x%"
PRIx64
" failed to retrieve stable %s vgroup id list in cache, try fetch from mnode"
,
pSql
->
self
,
n
ame
);
}
else
{
tFilePage
*
pdata
=
(
tFilePage
*
)
pv
;
pVgroupIdList
=
taosArrayInit
((
size_t
)
pdata
->
num
,
sizeof
(
int32_t
));
...
...
@@ -8167,10 +8165,10 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
}
if
(
taosHashGet
(
pCmd
->
pTableMetaMap
,
pTableName
,
nameL
en
)
==
NULL
)
{
if
(
taosHashGet
(
pCmd
->
pTableMetaMap
,
name
,
l
en
)
==
NULL
)
{
STableMeta
*
pMeta
=
tscTableMetaDup
(
pTableMeta
);
STableMetaVgroupInfo
tvi
=
{
.
pTableMeta
=
pMeta
,
.
vgroupIdList
=
pVgroupIdList
};
taosHashPut
(
pCmd
->
pTableMetaMap
,
pTableName
,
nameL
en
,
&
tvi
,
sizeof
(
STableMetaVgroupInfo
));
taosHashPut
(
pCmd
->
pTableMetaMap
,
name
,
l
en
,
&
tvi
,
sizeof
(
STableMetaVgroupInfo
));
}
}
else
{
// Add to the retrieve table meta array list.
...
...
@@ -8290,8 +8288,9 @@ static int32_t doLoadAllTableMeta(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNod
strncpy
(
pTableMetaInfo
->
aliasName
,
tNameGetTableName
(
&
pTableMetaInfo
->
name
),
tListLen
(
pTableMetaInfo
->
aliasName
));
}
const
char
*
name
=
tNameGetTableName
(
&
pTableMetaInfo
->
name
);
STableMetaVgroupInfo
*
p
=
taosHashGet
(
pCmd
->
pTableMetaMap
,
name
,
strlen
(
name
));
char
fname
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tNameExtractFullName
(
&
pTableMetaInfo
->
name
,
fname
);
STableMetaVgroupInfo
*
p
=
taosHashGet
(
pCmd
->
pTableMetaMap
,
fname
,
strnlen
(
fname
,
TSDB_TABLE_FNAME_LEN
));
pTableMetaInfo
->
pTableMeta
=
tscTableMetaDup
(
p
->
pTableMeta
);
assert
(
pTableMetaInfo
->
pTableMeta
!=
NULL
);
...
...
src/client/src/tscServer.c
浏览文件 @
cbbb0593
...
...
@@ -391,9 +391,9 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
}
if
((
cmd
==
TSDB_SQL_SELECT
||
cmd
==
TSDB_SQL_UPDATE_TAGS_VAL
)
&&
(
rpcMsg
->
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
rpcMsg
->
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
||
rpcMsg
->
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
(
rpcMsg
->
code
==
TSDB_CODE_TDB_INVALID_TABLE_ID
||
// change the retry procedure
/*(*/
rpcMsg
->
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
||
rpcMsg
->
code
==
TSDB_CODE_RPC_NETWORK_UNAVAIL
||
// change the retry procedure
rpcMsg
->
code
==
TSDB_CODE_APP_NOT_READY
))
{
pSql
->
retry
++
;
...
...
@@ -404,7 +404,7 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcEpSet *pEpSet) {
tscError
(
"0x%"
PRIx64
" max retry %d reached, give up"
,
pSql
->
self
,
pSql
->
maxRetry
);
}
else
{
// wait for a little bit moment and then retry
// todo do not sleep in rpc callback thread, add this process into queue
u
to process
// todo do not sleep in rpc callback thread, add this process into queue to process
if
(
rpcMsg
->
code
==
TSDB_CODE_APP_NOT_READY
||
rpcMsg
->
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
)
{
int32_t
duration
=
getWaitingTimeInterval
(
pSql
->
retry
);
taosMsleep
(
duration
);
...
...
@@ -2214,15 +2214,10 @@ int tscProcessMultiTableMetaRsp(SSqlObj *pSql) {
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
SName
sn
=
{
0
};
tNameFromString
(
&
sn
,
pMetaMsg
->
tableFname
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
if
(
pMultiMeta
->
metaClone
==
1
||
pTableMeta
->
tableType
==
TSDB_SUPER_TABLE
)
{
STableMetaVgroupInfo
p
=
{.
pTableMeta
=
pTableMeta
,};
const
char
*
tableName
=
tNameGetTableName
(
&
sn
);
size_t
keyLen
=
strlen
(
tableName
);
taosHashPut
(
pParentCmd
->
pTableMetaMap
,
tableName
,
keyLen
,
&
p
,
sizeof
(
STableMetaVgroupInfo
));
size_t
keyLen
=
strnlen
(
pMetaMsg
->
tableFname
,
TSDB_TABLE_FNAME_LEN
);
taosHashPut
(
pParentCmd
->
pTableMetaMap
,
pMetaMsg
->
tableFname
,
keyLen
,
&
p
,
sizeof
(
STableMetaVgroupInfo
));
}
else
{
freeMeta
=
true
;
}
...
...
@@ -2251,10 +2246,13 @@ int tscProcessMultiTableMetaRsp(SSqlObj *pSql) {
}
for
(
int32_t
i
=
0
;
i
<
pMultiMeta
->
numOfVgroup
;
++
i
)
{
char
*
name
=
pMsg
;
pMsg
+=
TSDB_TABLE_NAME_LEN
;
char
fname
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tstrncpy
(
fname
,
pMsg
,
TSDB_TABLE_FNAME_LEN
);
size_t
len
=
strnlen
(
fname
,
TSDB_TABLE_FNAME_LEN
);
STableMetaVgroupInfo
*
p
=
taosHashGet
(
pParentCmd
->
pTableMetaMap
,
name
,
strnlen
(
name
,
TSDB_TABLE_NAME_LEN
));
pMsg
+=
TSDB_TABLE_FNAME_LEN
;
STableMetaVgroupInfo
*
p
=
taosHashGet
(
pParentCmd
->
pTableMetaMap
,
fname
,
len
);
assert
(
p
!=
NULL
);
int32_t
size
=
0
;
...
...
@@ -2262,9 +2260,7 @@ int tscProcessMultiTableMetaRsp(SSqlObj *pSql) {
taosArrayDestroy
(
p
->
vgroupIdList
);
}
char
tableName
[
TSDB_TABLE_FNAME_LEN
]
=
{
0
};
tstrncpy
(
tableName
,
name
,
TSDB_TABLE_NAME_LEN
);
p
->
vgroupIdList
=
createVgroupIdListFromMsg
(
pMsg
,
pSet
,
tableName
,
&
size
,
pSql
->
self
);
p
->
vgroupIdList
=
createVgroupIdListFromMsg
(
pMsg
,
pSet
,
fname
,
&
size
,
pSql
->
self
);
int32_t
numOfVgId
=
(
int32_t
)
taosArrayGetSize
(
p
->
vgroupIdList
);
int32_t
s
=
sizeof
(
tFilePage
)
+
numOfVgId
*
sizeof
(
int32_t
);
...
...
@@ -2273,11 +2269,10 @@ int tscProcessMultiTableMetaRsp(SSqlObj *pSql) {
idList
->
num
=
numOfVgId
;
memcpy
(
idList
->
data
,
TARRAY_GET_START
(
p
->
vgroupIdList
),
numOfVgId
*
sizeof
(
int32_t
));
void
*
idListInst
=
taosCachePut
(
tscVgroupListBuf
,
tableName
,
strlen
(
tableName
)
,
idList
,
s
,
5000
);
void
*
idListInst
=
taosCachePut
(
tscVgroupListBuf
,
fname
,
len
,
idList
,
s
,
5000
);
taosCacheRelease
(
tscVgroupListBuf
,
(
void
*
)
&
idListInst
,
false
);
tfree
(
idList
);
pMsg
+=
size
;
}
...
...
@@ -2918,7 +2913,7 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
STableMeta
*
pTableMeta
=
pTableMetaInfo
->
pTableMeta
;
if
(
pTableMeta
)
{
tscDebug
(
"0x%"
PRIx64
" update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%"
PRI
d
64
,
pSql
->
self
,
name
,
tscDebug
(
"0x%"
PRIx64
" update table meta:%s, old meta numOfTags:%d, numOfCols:%d, uid:%"
PRI
u
64
,
pSql
->
self
,
name
,
tscGetNumOfTags
(
pTableMeta
),
tscGetNumOfColumns
(
pTableMeta
),
pTableMeta
->
id
.
uid
);
}
...
...
src/common/inc/tcmdtype.h
浏览文件 @
cbbb0593
...
...
@@ -88,10 +88,7 @@ enum {
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_SHOW_CREATE_STABLE
,
"show-create-stable"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_SHOW_CREATE_DATABASE
,
"show-create-database"
)
/*
* build empty result instead of accessing dnode to fetch result
* reset the client cache
*/
// build empty result instead of accessing dnode to fetch result reset the client cache
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_RETRIEVE_EMPTY_RESULT
,
"retrieve-empty-result"
)
TSDB_DEFINE_SQL_TYPE
(
TSDB_SQL_RESET_CACHE
,
"reset-cache"
)
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
cbbb0593
...
...
@@ -1812,12 +1812,8 @@ static int32_t getVgroupInfoLength(SSTableVgroupMsg* pInfo, int32_t numOfTable)
}
static
char
*
serializeVgroupInfo
(
SSTableObj
*
pTable
,
char
*
name
,
char
*
msg
,
SMnodeMsg
*
pMsgBody
,
void
*
handle
)
{
SName
sn
=
{
0
};
tNameFromString
(
&
sn
,
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
const
char
*
tableName
=
tNameGetTableName
(
&
sn
);
strncpy
(
msg
,
tableName
,
TSDB_TABLE_NAME_LEN
);
msg
+=
TSDB_TABLE_NAME_LEN
;
strncpy
(
msg
,
name
,
TSDB_TABLE_FNAME_LEN
);
msg
+=
TSDB_TABLE_FNAME_LEN
;
if
(
pTable
->
vgHash
==
NULL
)
{
mDebug
(
"msg:%p, app:%p stable:%s, no vgroup exist while get stable vgroup info"
,
pMsgBody
,
handle
,
name
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录