Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e1967b57
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e1967b57
编写于
6月 07, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ci problem
上级
f6c38f09
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
62 addition
and
64 deletion
+62
-64
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+60
-62
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+2
-2
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
e1967b57
...
...
@@ -31,7 +31,7 @@ void metaReaderClear(SMetaReader *pReader) {
}
int
metaGetTableEntryByVersion
(
SMetaReader
*
pReader
,
int64_t
version
,
tb_uid_t
uid
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
SMeta
*
pMeta
=
pReader
->
pMeta
;
STbDbKey
tbDbKey
=
{.
version
=
version
,
.
uid
=
uid
};
// query table.db
...
...
@@ -54,7 +54,7 @@ _err:
}
int
metaGetTableEntryByUid
(
SMetaReader
*
pReader
,
tb_uid_t
uid
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
SMeta
*
pMeta
=
pReader
->
pMeta
;
int64_t
version
;
// query uid.idx
...
...
@@ -68,7 +68,7 @@ int metaGetTableEntryByUid(SMetaReader *pReader, tb_uid_t uid) {
}
int
metaGetTableEntryByName
(
SMetaReader
*
pReader
,
const
char
*
name
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
SMeta
*
pMeta
=
pReader
->
pMeta
;
tb_uid_t
uid
;
// query name.idx
...
...
@@ -82,7 +82,7 @@ int metaGetTableEntryByName(SMetaReader *pReader, const char *name) {
}
tb_uid_t
metaGetTableEntryUidByName
(
SMeta
*
pMeta
,
const
char
*
name
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
tb_uid_t
uid
=
0
;
...
...
@@ -134,7 +134,7 @@ void metaCloseTbCursor(SMTbCursor *pTbCur) {
int
metaTbCursorNext
(
SMTbCursor
*
pTbCur
)
{
int
ret
;
void
*
pBuf
;
void
*
pBuf
;
STbCfg
tbCfg
;
for
(;;)
{
...
...
@@ -155,7 +155,7 @@ int metaTbCursorNext(SMTbCursor *pTbCur) {
}
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
)
{
void
*
pData
=
NULL
;
void
*
pData
=
NULL
;
int
nData
=
0
;
int64_t
version
;
SSchemaWrapper
schema
=
{
0
};
...
...
@@ -163,7 +163,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
SDecoder
dc
=
{
0
};
metaRLock
(
pMeta
);
if
(
sver
<
0
)
{
_query:
if
(
tdbTbGet
(
pMeta
->
pUidIdx
,
&
uid
,
sizeof
(
uid
),
&
pData
,
&
nData
)
<
0
)
{
goto
_err
;
}
...
...
@@ -171,19 +171,29 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
version
=
*
(
int64_t
*
)
pData
;
tdbTbGet
(
pMeta
->
pTbDb
,
&
(
STbDbKey
){.
uid
=
uid
,
.
version
=
version
},
sizeof
(
STbDbKey
),
&
pData
,
&
nData
);
SMetaEntry
me
=
{
0
};
tDecoderInit
(
&
dc
,
pData
,
nData
);
metaDecodeEntry
(
&
dc
,
&
me
);
if
(
me
.
type
==
TSDB_SUPER_TABLE
)
{
if
(
sver
==
-
1
||
sver
==
me
.
stbEntry
.
schemaRow
.
version
)
{
pSchema
=
tCloneSSchemaWrapper
(
&
me
.
stbEntry
.
schemaRow
);
}
else
if
(
me
.
type
==
TSDB_NORMAL_TABLE
)
{
pSchema
=
tCloneSSchemaWrapper
(
&
me
.
ntbEntry
.
schemaRow
);
}
else
{
ASSERT
(
0
);
tDecoderClear
(
&
dc
);
goto
_exit
;
}
}
else
if
(
me
.
type
==
TSDB_CHILD_TABLE
)
{
uid
=
me
.
ctbEntry
.
suid
;
tDecoderClear
(
&
dc
);
goto
_query
;
}
else
{
if
(
sver
==
-
1
||
sver
==
me
.
ntbEntry
.
schemaRow
.
version
)
{
pSchema
=
tCloneSSchemaWrapper
(
&
me
.
ntbEntry
.
schemaRow
);
tDecoderClear
(
&
dc
);
goto
_exit
;
}
}
tDecoderClear
(
&
dc
);
// query from skm db
if
(
tdbTbGet
(
pMeta
->
pSkmDb
,
&
(
SSkmDbKey
){.
uid
=
uid
,
.
sver
=
sver
},
sizeof
(
SSkmDbKey
),
&
pData
,
&
nData
)
<
0
)
{
goto
_err
;
}
...
...
@@ -192,8 +202,8 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
tDecodeSSchemaWrapper
(
&
dc
,
&
schema
);
pSchema
=
tCloneSSchemaWrapper
(
&
schema
);
tDecoderClear
(
&
dc
);
}
_exit:
metaULock
(
pMeta
);
tdbFree
(
pData
);
return
pSchema
;
...
...
@@ -205,11 +215,11 @@ _err:
}
struct
SMCtbCursor
{
SMeta
*
pMeta
;
TBC
*
pCur
;
SMeta
*
pMeta
;
TBC
*
pCur
;
tb_uid_t
suid
;
void
*
pKey
;
void
*
pVal
;
void
*
pKey
;
void
*
pVal
;
int
kLen
;
int
vLen
;
};
...
...
@@ -279,25 +289,13 @@ tb_uid_t metaCtbCursorNext(SMCtbCursor *pCtbCur) {
}
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
)
{
tb_uid_t
quid
;
SMetaReader
mr
=
{
0
};
STSchema
*
pTSchema
=
NULL
;
// SMetaReader mr = {0};
STSchema
*
pTSchema
=
NULL
;
SSchemaWrapper
*
pSW
=
NULL
;
STSchemaBuilder
sb
=
{
0
};
SSchema
*
pSchema
;
metaReaderInit
(
&
mr
,
pMeta
,
0
);
metaGetTableEntryByUid
(
&
mr
,
uid
);
if
(
mr
.
me
.
type
==
TSDB_CHILD_TABLE
)
{
quid
=
mr
.
me
.
ctbEntry
.
suid
;
}
else
{
quid
=
uid
;
}
metaReaderClear
(
&
mr
);
SSchema
*
pSchema
;
pSW
=
metaGetTableSchema
(
pMeta
,
q
uid
,
sver
,
0
);
pSW
=
metaGetTableSchema
(
pMeta
,
uid
,
sver
,
0
);
if
(
!
pSW
)
return
NULL
;
tdInitTSchemaBuilder
(
&
sb
,
pSW
->
version
);
...
...
@@ -321,11 +319,11 @@ int metaGetTbNum(SMeta *pMeta) {
}
typedef
struct
{
SMeta
*
pMeta
;
TBC
*
pCur
;
SMeta
*
pMeta
;
TBC
*
pCur
;
tb_uid_t
uid
;
void
*
pKey
;
void
*
pVal
;
void
*
pKey
;
void
*
pVal
;
int
kLen
;
int
vLen
;
}
SMSmaCursor
;
...
...
@@ -397,7 +395,7 @@ tb_uid_t metaSmaCursorNext(SMSmaCursor *pSmaCur) {
STSmaWrapper
*
metaGetSmaInfoByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
bool
deepCopy
)
{
STSmaWrapper
*
pSW
=
NULL
;
SArray
*
pSmaIds
=
NULL
;
SArray
*
pSmaIds
=
NULL
;
if
(
!
(
pSmaIds
=
metaGetSmaIdsByTable
(
pMeta
,
uid
)))
{
return
NULL
;
...
...
@@ -421,7 +419,7 @@ STSmaWrapper *metaGetSmaInfoByTable(SMeta *pMeta, tb_uid_t uid, bool deepCopy) {
metaReaderInit
(
&
mr
,
pMeta
,
0
);
int64_t
smaId
;
int
smaIdx
=
0
;
STSma
*
pTSma
=
NULL
;
STSma
*
pTSma
=
NULL
;
for
(
int
i
=
0
;
i
<
pSW
->
number
;
++
i
)
{
smaId
=
*
(
tb_uid_t
*
)
taosArrayGet
(
pSmaIds
,
i
);
if
(
metaGetTableEntryByUid
(
&
mr
,
smaId
)
<
0
)
{
...
...
@@ -469,7 +467,7 @@ _err:
}
STSma
*
metaGetSmaInfoByIndex
(
SMeta
*
pMeta
,
int64_t
indexUid
)
{
STSma
*
pTSma
=
NULL
;
STSma
*
pTSma
=
NULL
;
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pMeta
,
0
);
if
(
metaGetTableEntryByUid
(
&
mr
,
indexUid
)
<
0
)
{
...
...
@@ -491,7 +489,7 @@ STSma *metaGetSmaInfoByIndex(SMeta *pMeta, int64_t indexUid) {
}
SArray
*
metaGetSmaIdsByTable
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
SArray
*
pUids
=
NULL
;
SArray
*
pUids
=
NULL
;
SSmaIdxKey
*
pSmaIdxKey
=
NULL
;
SMSmaCursor
*
pCur
=
metaOpenSmaCursor
(
pMeta
,
uid
);
...
...
@@ -529,7 +527,7 @@ SArray *metaGetSmaIdsByTable(SMeta *pMeta, tb_uid_t uid) {
}
SArray
*
metaGetSmaTbUids
(
SMeta
*
pMeta
)
{
SArray
*
pUids
=
NULL
;
SArray
*
pUids
=
NULL
;
SSmaIdxKey
*
pSmaIdxKey
=
NULL
;
tb_uid_t
lastUid
=
0
;
...
...
@@ -591,13 +589,13 @@ const void *metaGetTableTagVal(SMetaEntry *pEntry, int16_t type, STagVal *val) {
}
typedef
struct
{
SMeta
*
pMeta
;
TBC
*
pCur
;
SMeta
*
pMeta
;
TBC
*
pCur
;
tb_uid_t
suid
;
int16_t
cid
;
int16_t
type
;
void
*
pKey
;
void
*
pVal
;
void
*
pKey
;
void
*
pVal
;
int32_t
kLen
;
int32_t
vLen
;
}
SIdxCursor
;
...
...
@@ -621,7 +619,7 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
int32_t
nKey
=
0
;
int32_t
nTagData
=
0
;
void
*
tagData
=
NULL
;
void
*
tagData
=
NULL
;
if
(
IS_VAR_DATA_TYPE
(
param
->
type
))
{
tagData
=
varDataVal
(
param
->
val
);
...
...
@@ -640,7 +638,7 @@ int32_t metaFilteTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
goto
END
;
}
void
*
entryKey
=
NULL
,
*
entryVal
=
NULL
;
void
*
entryKey
=
NULL
,
*
entryVal
=
NULL
;
int32_t
nEntryKey
,
nEntryVal
;
while
(
1
)
{
valid
=
tdbTbcGet
(
pCursor
->
pCur
,
(
const
void
**
)
&
entryKey
,
&
nEntryKey
,
(
const
void
**
)
&
entryVal
,
&
nEntryVal
);
...
...
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
e1967b57
...
...
@@ -141,10 +141,10 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
}
// this interface use suid instead of uid
pHandle
->
pSchemaWrapper
=
metaGetTableSchema
(
pHandle
->
pVnodeMeta
,
pHandle
->
msgIter
.
s
uid
,
sversion
,
true
);
pHandle
->
pSchemaWrapper
=
metaGetTableSchema
(
pHandle
->
pVnodeMeta
,
pHandle
->
msgIter
.
uid
,
sversion
,
true
);
if
(
pHandle
->
pSchemaWrapper
==
NULL
)
{
tqWarn
(
"cannot found schema wrapper for table: suid: %ld, version %d, possibly dropped table"
,
pHandle
->
msgIter
.
s
uid
,
pHandle
->
cachedSchemaVer
);
pHandle
->
msgIter
.
uid
,
pHandle
->
cachedSchemaVer
);
/*ASSERT(0);*/
terrno
=
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
;
return
-
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录