Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d62ddcf2
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看板
提交
d62ddcf2
编写于
4月 27, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh(query): add more information for the result of show tables.
上级
02cee2ba
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
98 addition
and
24 deletion
+98
-24
include/libs/executor/executor.h
include/libs/executor/executor.h
+1
-0
source/dnode/mnode/impl/src/mndInfoSchema.c
source/dnode/mnode/impl/src/mndInfoSchema.c
+1
-0
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-0
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+1
-1
source/dnode/vnode/src/vnd/vnodeQuery.c
source/dnode/vnode/src/vnd/vnodeQuery.c
+10
-0
source/dnode/vnode/src/vnd/vnodeSvr.c
source/dnode/vnode/src/vnd/vnodeSvr.c
+1
-1
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-1
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+1
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+81
-20
未找到文件。
include/libs/executor/executor.h
浏览文件 @
d62ddcf2
...
...
@@ -32,6 +32,7 @@ typedef struct SReadHandle {
void
*
reader
;
void
*
meta
;
void
*
config
;
void
*
vnode
;
}
SReadHandle
;
#define STREAM_DATA_TYPE_SUBMIT_BLOCK 0x1
...
...
source/dnode/mnode/impl/src/mndInfoSchema.c
浏览文件 @
d62ddcf2
...
...
@@ -142,6 +142,7 @@ static const SInfosTableSchema userTblsSchema[] = {
{.
name
=
"vgroup_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"ttl"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"table_comment"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"type"
,
.
bytes
=
20
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SInfosTableSchema
userTblDistSchema
[]
=
{
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
d62ddcf2
...
...
@@ -68,6 +68,7 @@ void vnodeStop(SVnode *pVnode);
int64_t
vnodeGetSyncHandle
(
SVnode
*
pVnode
);
void
vnodeGetSnapshot
(
SVnode
*
pVnode
,
SSnapshot
*
pSnapshot
);
void
vnodeGetInfo
(
SVnode
*
pVnode
,
const
char
**
dbname
,
int32_t
*
vgId
);
// meta
typedef
struct
SMeta
SMeta
;
// todo: remove
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
d62ddcf2
...
...
@@ -88,7 +88,7 @@ int metaCreateTable(SMeta *pMeta, int64_t version, SVCreateTbReq *pReq) {
// preprocess req
pReq
->
uid
=
tGenIdPI64
();
pReq
->
ctime
=
taosGetTimestamp
Sec
();
pReq
->
ctime
=
taosGetTimestamp
Ms
();
// validate req
metaReaderInit
(
&
mr
,
pMeta
->
pVnode
,
0
);
...
...
source/dnode/vnode/src/vnd/vnodeQuery.c
浏览文件 @
d62ddcf2
...
...
@@ -136,3 +136,13 @@ int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) {
pLoad
->
numOfBatchInsertSuccessReqs
=
4
;
return
0
;
}
void
vnodeGetInfo
(
SVnode
*
pVnode
,
const
char
**
dbname
,
int32_t
*
vgId
)
{
if
(
dbname
)
{
*
dbname
=
pVnode
->
config
.
dbname
;
}
if
(
vgId
)
{
*
vgId
=
TD_VID
(
pVnode
);
}
}
\ No newline at end of file
source/dnode/vnode/src/vnd/vnodeSvr.c
浏览文件 @
d62ddcf2
...
...
@@ -144,7 +144,7 @@ _err:
int
vnodeProcessQueryMsg
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
)
{
vTrace
(
"message in vnode query queue is processing"
);
SReadHandle
handle
=
{.
reader
=
pVnode
->
pTsdb
,
.
meta
=
pVnode
->
pMeta
,
.
config
=
&
pVnode
->
config
};
SReadHandle
handle
=
{.
reader
=
pVnode
->
pTsdb
,
.
meta
=
pVnode
->
pMeta
,
.
config
=
&
pVnode
->
config
,
.
vnode
=
pVnode
};
switch
(
pMsg
->
msgType
)
{
case
TDMT_VND_QUERY
:
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
d62ddcf2
...
...
@@ -380,7 +380,7 @@ typedef struct SStreamBlockScanInfo {
typedef
struct
SSysTableScanInfo
{
union
{
void
*
pTransporter
;
void
*
readHandle
;
SReadHandle
readHandle
;
};
SRetrieveMetaTableRsp
*
pRsp
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
d62ddcf2
...
...
@@ -6497,7 +6497,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
SArray
*
colList
=
extractScanColumnId
(
pScanNode
->
pScanCols
);
SOperatorInfo
*
pOperator
=
createSysTableScanOperatorInfo
(
pHandle
->
meta
,
pResBlock
,
&
pScanNode
->
tableName
,
pScanNode
->
node
.
pConditions
,
pSysScanPhyNode
->
mgmtEpSet
,
pHandle
,
pResBlock
,
&
pScanNode
->
tableName
,
pScanNode
->
node
.
pConditions
,
pSysScanPhyNode
->
mgmtEpSet
,
colList
,
pTaskInfo
,
pSysScanPhyNode
->
showRewrite
,
pSysScanPhyNode
->
accountId
);
return
pOperator
;
}
else
{
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
d62ddcf2
...
...
@@ -811,7 +811,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
const
char
*
name
=
tNameGetTableName
(
&
pInfo
->
name
);
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
if
(
pInfo
->
pCur
==
NULL
)
{
pInfo
->
pCur
=
metaOpenTbCursor
(
pInfo
->
readHandle
);
pInfo
->
pCur
=
metaOpenTbCursor
(
pInfo
->
readHandle
.
meta
);
}
blockDataCleanup
(
pInfo
->
pRes
);
...
...
@@ -819,32 +819,93 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
int32_t
tableNameSlotId
=
1
;
SColumnInfoData
*
pTableNameCol
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
tableNameSlotId
);
char
*
tb
=
NULL
;
int32_t
numOfRows
=
0
;
const
char
*
db
=
NULL
;
int32_t
vgId
=
0
;
vnodeGetInfo
(
pInfo
->
readHandle
.
vnode
,
&
db
,
&
vgId
);
SName
sn
=
{
0
};
char
dbname
[
TSDB_DB_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
tNameFromString
(
&
sn
,
db
,
T_NAME_ACCT
|
T_NAME_DB
);
tNameGetDbName
(
&
sn
,
varDataVal
(
dbname
));
varDataSetLen
(
dbname
,
strlen
(
varDataVal
(
dbname
)));
char
n
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
while
(
metaTbCursorNext
(
pInfo
->
pCur
)
==
0
)
{
STR_TO_VARSTR
(
n
,
pInfo
->
pCur
->
mr
.
me
.
name
);
colDataAppend
(
pTableNameCol
,
numOfRows
,
n
,
false
);
numOfRows
+=
1
;
if
(
numOfRows
>=
pInfo
->
capacity
)
{
break
;
int32_t
tableType
=
pInfo
->
pCur
->
mr
.
me
.
type
;
// database name
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
0
);
colDataAppend
(
pColInfoData
,
numOfRows
,
dbname
,
false
);
// vgId
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
6
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
vgId
,
false
);
// table comment
// todo: set the correct comment
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
8
);
colDataAppendNULL
(
pColInfoData
,
numOfRows
);
char
typestr
[
256
]
=
{
0
};
if
(
tableType
==
TSDB_CHILD_TABLE
)
{
SMetaReader
mr
=
{
0
};
metaReaderInit
(
&
mr
,
pInfo
->
readHandle
.
meta
,
0
);
// metaGetTableEntryByUid(&mr, pInfo->pCur->mr.me.ctbEntry.suid);
metaReaderClear
(
&
mr
);
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
3
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
mr
.
me
.
stbEntry
.
schema
.
nCols
,
false
);
// create time
int64_t
ts
=
pInfo
->
pCur
->
mr
.
me
.
ctbEntry
.
ctime
;
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
2
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
ts
,
false
);
// uid
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
5
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
uid
,
false
);
// ttl
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
7
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ctbEntry
.
ttlDays
,
false
);
STR_TO_VARSTR
(
typestr
,
"CHILD_TABLE"
);
}
else
if
(
tableType
==
TSDB_NORMAL_TABLE
)
{
// create time
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
2
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
ctime
,
false
);
// number of columns
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
3
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
schema
.
nCols
,
false
);
// super table name
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
4
);
colDataAppendNULL
(
pColInfoData
,
numOfRows
);
// uid
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
5
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
uid
,
false
);
// ttl
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
7
);
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
pInfo
->
pCur
->
mr
.
me
.
ntbEntry
.
ttlDays
,
false
);
STR_TO_VARSTR
(
typestr
,
"NORMAL_TABLE"
);
}
for
(
int32_t
i
=
0
;
i
<
pInfo
->
pRes
->
info
.
numOfCols
;
++
i
)
{
if
(
i
==
tableNameSlotId
)
{
continue
;
}
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
9
);
colDataAppend
(
pColInfoData
,
numOfRows
,
typestr
,
false
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
i
);
int64_t
tmp
=
0
;
char
t
[
10
]
=
{
0
};
STR_TO_VARSTR
(
t
,
"_"
);
// TODO
if
(
IS_VAR_DATA_TYPE
(
pColInfoData
->
info
.
type
))
{
colDataAppend
(
pColInfoData
,
numOfRows
,
t
,
false
);
}
else
{
colDataAppend
(
pColInfoData
,
numOfRows
,
(
char
*
)
&
tmp
,
false
);
}
if
(
++
numOfRows
>=
pInfo
->
capacity
)
{
break
;
}
}
...
...
@@ -923,7 +984,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
}
}
SOperatorInfo
*
createSysTableScanOperatorInfo
(
void
*
pSysTableR
eadHandle
,
SSDataBlock
*
pResBlock
,
const
SName
*
pName
,
SOperatorInfo
*
createSysTableScanOperatorInfo
(
void
*
r
eadHandle
,
SSDataBlock
*
pResBlock
,
const
SName
*
pName
,
SNode
*
pCondition
,
SEpSet
epset
,
SArray
*
colList
,
SExecTaskInfo
*
pTaskInfo
,
bool
showRewrite
,
int32_t
accountId
)
{
SSysTableScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
SSysTableScanInfo
));
...
...
@@ -945,7 +1006,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* pSysTableReadHandle, SSDataB
tNameAssign
(
&
pInfo
->
name
,
pName
);
const
char
*
name
=
tNameGetTableName
(
&
pInfo
->
name
);
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_USER_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
pInfo
->
readHandle
=
pSysTableR
eadHandle
;
pInfo
->
readHandle
=
*
(
SReadHandle
*
)
r
eadHandle
;
blockDataEnsureCapacity
(
pInfo
->
pRes
,
pInfo
->
capacity
);
}
else
{
tsem_init
(
&
pInfo
->
ready
,
0
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录