Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8af5230b
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8af5230b
编写于
1月 11, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:add logic for ins_columns
上级
672378f0
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
36 addition
and
15 deletion
+36
-15
include/common/tmsg.h
include/common/tmsg.h
+1
-0
source/common/src/tmsg.c
source/common/src/tmsg.c
+2
-0
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+1
-0
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+1
-0
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+17
-5
source/libs/executor/src/sysscanoperator.c
source/libs/executor/src/sysscanoperator.c
+11
-7
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+1
-1
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+2
-2
未找到文件。
include/common/tmsg.h
浏览文件 @
8af5230b
...
...
@@ -1400,6 +1400,7 @@ typedef struct {
char
db
[
TSDB_DB_FNAME_LEN
];
char
tb
[
TSDB_TABLE_NAME_LEN
];
char
user
[
TSDB_USER_LEN
];
char
filterTb
[
TSDB_TABLE_NAME_LEN
];
int64_t
showId
;
}
SRetrieveTableReq
;
...
...
source/common/src/tmsg.c
浏览文件 @
8af5230b
...
...
@@ -3191,6 +3191,7 @@ int32_t tSerializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableReq
if
(
tEncodeI64
(
&
encoder
,
pReq
->
showId
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
tb
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
filterTb
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
user
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
...
...
@@ -3207,6 +3208,7 @@ int32_t tDeserializeSRetrieveTableReq(void *buf, int32_t bufLen, SRetrieveTableR
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
showId
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
db
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
tb
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
filterTb
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
user
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
8af5230b
...
...
@@ -444,6 +444,7 @@ typedef struct {
STableMetaRsp
*
pMeta
;
bool
sysDbRsp
;
char
db
[
TSDB_DB_FNAME_LEN
];
char
filterTb
[
TSDB_TABLE_NAME_LEN
];
}
SShowObj
;
typedef
struct
{
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
8af5230b
...
...
@@ -134,6 +134,7 @@ static SShowObj *mndCreateShowObj(SMnode *pMnode, SRetrieveTableReq *pReq) {
showObj
.
pMnode
=
pMnode
;
showObj
.
type
=
convertToRetrieveType
(
pReq
->
tb
,
tListLen
(
pReq
->
tb
));
memcpy
(
showObj
.
db
,
pReq
->
db
,
TSDB_DB_FNAME_LEN
);
strncpy
(
showObj
.
filterTb
,
pReq
->
filterTb
,
TSDB_TABLE_NAME_LEN
);
int32_t
keepTime
=
tsShellActivityTimer
*
6
*
1000
;
SShowObj
*
pShow
=
taosCachePut
(
pMgmt
->
cache
,
&
showId
,
sizeof
(
int64_t
),
&
showObj
,
size
,
keepTime
);
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
8af5230b
...
...
@@ -2882,7 +2882,7 @@ static int32_t mndRetrieveStb(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pBloc
}
static
int32_t
buildDbColsInfoBlock
(
const
SSDataBlock
*
p
,
const
SSysTableMeta
*
pSysDbTableMeta
,
size_t
size
,
const
char
*
dbName
)
{
const
char
*
dbName
,
const
char
*
tbName
)
{
char
tName
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
dName
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
typeName
[
TSDB_TABLE_FNAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
...
...
@@ -2896,6 +2896,10 @@ static int32_t buildDbColsInfoBlock(const SSDataBlock* p, const SSysTableMeta* p
// if (pm->sysInfo) {
// continue;
// }
if
(
tbName
[
0
]
&&
strncmp
(
tbName
,
pm
->
name
,
TSDB_TABLE_NAME_LEN
)
!=
0
){
continue
;
}
STR_TO_VARSTR
(
tName
,
pm
->
name
);
for
(
int32_t
j
=
0
;
j
<
pm
->
colNum
;
j
++
){
...
...
@@ -2946,15 +2950,19 @@ static int32_t buildDbColsInfoBlock(const SSDataBlock* p, const SSysTableMeta* p
return
numOfRows
;
}
static
int32_t
buildSysDbColsInfo
(
SSDataBlock
*
p
)
{
static
int32_t
buildSysDbColsInfo
(
SSDataBlock
*
p
,
char
*
db
,
char
*
tb
)
{
size_t
size
=
0
;
const
SSysTableMeta
*
pSysDbTableMeta
=
NULL
;
if
(
db
[
0
]
&&
strncmp
(
db
,
TSDB_INFORMATION_SCHEMA_DB
,
TSDB_DB_FNAME_LEN
)
!=
0
&&
strncmp
(
db
,
TSDB_PERFORMANCE_SCHEMA_DB
,
TSDB_DB_FNAME_LEN
)
!=
0
){
return
p
->
info
.
rows
;
}
getInfosDbMeta
(
&
pSysDbTableMeta
,
&
size
);
p
->
info
.
rows
=
buildDbColsInfoBlock
(
p
,
pSysDbTableMeta
,
size
,
TSDB_INFORMATION_SCHEMA_DB
);
p
->
info
.
rows
=
buildDbColsInfoBlock
(
p
,
pSysDbTableMeta
,
size
,
TSDB_INFORMATION_SCHEMA_DB
,
tb
);
getPerfDbMeta
(
&
pSysDbTableMeta
,
&
size
);
p
->
info
.
rows
=
buildDbColsInfoBlock
(
p
,
pSysDbTableMeta
,
size
,
TSDB_PERFORMANCE_SCHEMA_DB
);
p
->
info
.
rows
=
buildDbColsInfoBlock
(
p
,
pSysDbTableMeta
,
size
,
TSDB_PERFORMANCE_SCHEMA_DB
,
tb
);
return
p
->
info
.
rows
;
}
...
...
@@ -2964,7 +2972,7 @@ static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SStbObj
*
pStb
=
NULL
;
int32_t
numOfRows
=
buildSysDbColsInfo
(
pBlock
);
int32_t
numOfRows
=
buildSysDbColsInfo
(
pBlock
,
pShow
->
db
,
pShow
->
filterTb
);
mDebug
(
"mndRetrieveStbCol get system table cols, rows:%d, db:%s"
,
numOfRows
,
pShow
->
db
);
SDbObj
*
pDb
=
NULL
;
if
(
strlen
(
pShow
->
db
)
>
0
)
{
...
...
@@ -2986,6 +2994,10 @@ static int32_t mndRetrieveStbCol(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *pB
SName
name
=
{
0
};
char
stbName
[
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
mndExtractTbNameFromStbFullName
(
pStb
->
name
,
&
stbName
[
VARSTR_HEADER_SIZE
],
TSDB_TABLE_NAME_LEN
);
if
(
pShow
->
filterTb
[
0
]
&&
strncmp
(
pShow
->
filterTb
,
&
stbName
[
VARSTR_HEADER_SIZE
],
TSDB_TABLE_NAME_LEN
)
!=
0
){
sdbRelease
(
pSdb
,
pStb
);
continue
;
}
varDataSetLen
(
stbName
,
strlen
(
&
stbName
[
VARSTR_HEADER_SIZE
]));
mDebug
(
"mndRetrieveStbCol get stable cols, stable name:%s, db:%s"
,
pStb
->
name
,
pStb
->
db
);
...
...
source/libs/executor/src/sysscanoperator.c
浏览文件 @
8af5230b
...
...
@@ -442,15 +442,14 @@ static SSDataBlock* sysTableScanUserCols(SOperatorInfo* pOperator) {
tNameGetDbName
(
&
sn
,
varDataVal
(
dbname
));
varDataSetLen
(
dbname
,
strlen
(
varDataVal
(
dbname
)));
char
condTableName
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
// optimize when sql like where table_name='tablename' and xxx.
if
(
pInfo
->
pCondition
&&
sysTableIsCondOnOneTable
(
pInfo
->
pCondition
,
condTableName
)
)
{
if
(
pInfo
->
req
.
filterTb
[
0
]
)
{
char
tableName
[
TSDB_TABLE_NAME_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_TO_VARSTR
(
tableName
,
condTableName
);
STR_TO_VARSTR
(
tableName
,
pInfo
->
req
.
filterTb
);
SMetaReader
smrTable
=
{
0
};
metaReaderInit
(
&
smrTable
,
pInfo
->
readHandle
.
meta
,
0
);
int32_t
code
=
metaGetTableEntryByName
(
&
smrTable
,
condTableName
);
int32_t
code
=
metaGetTableEntryByName
(
&
smrTable
,
pInfo
->
req
.
filterTb
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// terrno has been set by metaGetTableEntryByName, therefore, return directly
metaReaderClear
(
&
smrTable
);
...
...
@@ -1548,9 +1547,14 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
char
dbName
[
TSDB_DB_NAME_LEN
]
=
{
0
};
const
char
*
name
=
tNameGetTableName
(
&
pInfo
->
name
);
getDBNameFromCondition
(
pInfo
->
pCondition
,
dbName
);
strcpy
(
pInfo
->
req
.
db
,
dbName
);
// sprintf(pInfo->req.db, "%d.%s", pInfo->accountId, dbName);
if
(
pInfo
->
showRewrite
)
{
getDBNameFromCondition
(
pInfo
->
pCondition
,
dbName
);
sprintf
(
pInfo
->
req
.
db
,
"%d.%s"
,
pInfo
->
accountId
,
dbName
);
}
else
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_COLS
,
TSDB_TABLE_FNAME_LEN
)
==
0
){
getDBNameFromCondition
(
pInfo
->
pCondition
,
dbName
);
if
(
dbName
[
0
])
sprintf
(
pInfo
->
req
.
db
,
"%d.%s"
,
pInfo
->
accountId
,
dbName
);
sysTableIsCondOnOneTable
(
pInfo
->
pCondition
,
pInfo
->
req
.
filterTb
);
}
SSDataBlock
*
pBlock
=
NULL
;
if
(
strncasecmp
(
name
,
TSDB_INS_TABLE_TABLES
,
TSDB_TABLE_FNAME_LEN
)
==
0
)
{
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
8af5230b
...
...
@@ -166,7 +166,7 @@ static int32_t collectMetaKeyFromRealTableImpl(SCollectMetaKeyCxt* pCxt, const c
code
=
reserveDnodeRequiredInCache
(
pCxt
->
pMetaCache
);
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TAGS
)
||
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLES
))
&&
(
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TAGS
)
||
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_TABLES
)
||
0
==
strcmp
(
pTable
,
TSDB_INS_TABLE_COLS
)
)
&&
QUERY_NODE_SELECT_STMT
==
nodeType
(
pCxt
->
pStmt
))
{
code
=
collectMetaKeyFromInsTags
(
pCxt
);
}
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
8af5230b
...
...
@@ -2278,8 +2278,8 @@ static int32_t setVnodeSysTableVgroupList(STranslateContext* pCxt, SName* pName,
((
SSelectStmt
*
)
pCxt
->
pCurrStmt
)
->
isEmptyResult
=
true
;
}
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_TABLES
)
||
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_COLS
))
&&
!
hasUserDbCond
)
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
(
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_TABLES
)
&&
!
hasUserDbCond
)
||
0
==
strcmp
(
pRealTable
->
table
.
tableName
,
TSDB_INS_TABLE_COLS
))
{
code
=
addMnodeToVgroupList
(
&
pCxt
->
pParseCxt
->
mgmtEpSet
,
&
pVgs
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录