Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
588fd848
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
588fd848
编写于
4月 24, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact meta
上级
cc9496e5
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
58 addition
and
57 deletion
+58
-57
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+16
-6
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+18
-27
source/dnode/vnode/src/meta/metaTDBImpl.c
source/dnode/vnode/src/meta/metaTDBImpl.c
+1
-5
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+4
-1
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+18
-17
source/libs/executor/test/CMakeLists.txt
source/libs/executor/test/CMakeLists.txt
+1
-1
未找到文件。
source/dnode/vnode/inc/vnode.h
浏览文件 @
588fd848
...
...
@@ -31,6 +31,8 @@
#include "tmsg.h"
#include "trow.h"
#include "tdbInt.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -65,20 +67,19 @@ typedef struct SMeta SMeta; // todo: remove
typedef
struct
SMetaReader
SMetaReader
;
typedef
struct
SMetaEntry
SMetaEntry
;
void
metaReaderInit
(
SMetaReader
*
pReader
,
SVnode
*
pVnode
,
int32_t
flags
);
void
metaReaderClear
(
SMetaReader
*
pReader
);
int
metaReadNext
(
SMetaReader
*
pReader
);
const
SMetaEntry
*
metaReaderGetEntry
(
SMetaReader
*
pReader
);
void
metaReaderInit
(
SMetaReader
*
pReader
,
SVnode
*
pVnode
,
int32_t
flags
);
void
metaReaderClear
(
SMetaReader
*
pReader
);
int
metaReadNext
(
SMetaReader
*
pReader
);
#if 1 // refact APIs below (TODO)
typedef
SVCreateTbReq
STbCfg
;
typedef
SVCreateTSmaReq
SSmaCfg
;
#if 1
typedef
struct
SMTbCursor
SMTbCursor
;
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
);
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
);
char
*
metaTbCursorNext
(
SMTbCursor
*
pTbCur
);
int
metaTbCursorNext
(
SMTbCursor
*
pTbCur
);
#endif
// tsdb
...
...
@@ -210,6 +211,15 @@ struct SMetaReader {
int
szBuf
;
};
struct
SMTbCursor
{
TDBC
*
pDbc
;
void
*
pKey
;
void
*
pVal
;
int
kLen
;
int
vLen
;
SMetaReader
mr
;
};
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
588fd848
...
...
@@ -75,68 +75,59 @@ int metaGetTableEntryByName(SMetaReader *pReader, const char *name) {
}
int
metaReadNext
(
SMetaReader
*
pReader
)
{
SMeta
*
pMeta
=
pReader
->
pMeta
;
// TODO
return
0
;
}
const
SMetaEntry
*
metaReaderGetEntry
(
SMetaReader
*
pReader
)
{
return
&
pReader
->
me
;
}
#if 1 // ===================================================
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
)
{
SMTbCursor
*
pTbCur
=
NULL
;
#if 0
SMetaDB *pDB = pMeta->pDB;
pTbCur
=
(
SMTbCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pTbCur
));
if
(
pTbCur
==
NULL
)
{
return
NULL
;
}
tdbDbcOpen(pDB->pTbDB, &pTbCur->pDbc);
metaReaderInit
(
&
pTbCur
->
mr
,
pMeta
->
pVnode
,
0
);
tdbDbcOpen
(
pMeta
->
pUidIdx
,
&
pTbCur
->
pDbc
);
#endif
return
pTbCur
;
}
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
)
{
#if 0
if
(
pTbCur
)
{
TDB_FREE
(
pTbCur
->
pKey
);
TDB_FREE
(
pTbCur
->
pVal
);
metaReaderClear
(
&
pTbCur
->
mr
);
if
(
pTbCur
->
pDbc
)
{
tdbDbcClose
(
pTbCur
->
pDbc
);
}
taosMemoryFree
(
pTbCur
);
}
#endif
}
char
*
metaTbCursorNext
(
SMTbCursor
*
pTbCur
)
{
#if 0
void *pKey = NULL;
void *pVal = NULL;
int kLen;
int vLen;
int
metaTbCursorNext
(
SMTbCursor
*
pTbCur
)
{
int
ret
;
void
*
pBuf
;
STbCfg
tbCfg
;
for
(;;)
{
ret = tdbDbNext(pTbCur->pDbc, &pKey, &kLen, &pVal, &vLen);
if (ret < 0) break;
pBuf = pVal;
metaDecodeTbInfo(pBuf, &tbCfg);
if (tbCfg.type == META_SUPER_TABLE) {
taosMemoryFree(tbCfg.name);
taosMemoryFree(tbCfg.stbCfg.pTagSchema);
continue;
} else if (tbCfg.type == META_CHILD_TABLE) {
kvRowFree(tbCfg.ctbCfg.pTag);
ret
=
tdbDbNext
(
pTbCur
->
pDbc
,
&
pTbCur
->
pKey
,
&
pTbCur
->
kLen
,
&
pTbCur
->
pVal
,
&
pTbCur
->
vLen
);
if
(
ret
<
0
)
{
return
-
1
;
}
return tbCfg.name;
metaGetTableEntryByVersion
(
&
pTbCur
->
mr
,
*
(
int64_t
*
)
pTbCur
->
pVal
,
*
(
tb_uid_t
*
)
pTbCur
->
pKey
);
if
(
pTbCur
->
mr
.
me
.
type
==
META_SUPER_TABLE
)
{
continue
;
}
}
#endif
return
NULL
;
return
0
;
}
STbCfg
*
metaGetTbInfoByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
...
...
source/dnode/vnode/src/meta/metaTDBImpl.c
浏览文件 @
588fd848
...
...
@@ -47,7 +47,7 @@ struct SMetaDB {
#endif
};
#pragma pack(push,1)
#pragma pack(push,
1)
typedef
struct
{
tb_uid_t
uid
;
int32_t
sver
;
...
...
@@ -406,10 +406,6 @@ static SSchemaWrapper *metaGetTableSchemaImpl(SMeta *pMeta, tb_uid_t uid, int32_
return
pSchemaWrapper
;
}
struct
SMTbCursor
{
TDBC
*
pDbc
;
};
struct
SMCtbCursor
{
TDBC
*
pCur
;
tb_uid_t
suid
;
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
588fd848
...
...
@@ -12,6 +12,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// clang-format off
#ifndef TDENGINE_EXECUTORIMPL_H
#define TDENGINE_EXECUTORIMPL_H
...
...
@@ -38,6 +39,8 @@ extern "C" {
#include "tmsg.h"
#include "tpagedbuf.h"
#include "vnode.h"
typedef
int32_t
(
*
__block_search_fn_t
)(
char
*
data
,
int32_t
num
,
int64_t
key
,
int32_t
order
);
#define IS_QUERY_KILLED(_q) ((_q)->code == TSDB_CODE_TSC_QUERY_CANCELLED)
...
...
@@ -379,7 +382,7 @@ typedef struct SSysTableScanInfo {
int32_t
accountId
;
bool
showRewrite
;
SNode
*
pCondition
;
// db_name filter condition, to discard data that are not in current database
void
*
pCur
;
// cursor for iterate the local table meta store.
SMTbCursor
*
pCur
;
// cursor for iterate the local table meta store.
SArray
*
scanCols
;
// SArray<int16_t> scan column id list
// int32_t type; // show type, TODO remove it
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
588fd848
...
...
@@ -376,8 +376,9 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator, bool* newgroup) {
}
SOperatorInfo
*
createTableScanOperatorInfo
(
void
*
pDataReader
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
dataLoadFlag
,
int32_t
repeatTime
,
int32_t
reverseTime
,
SArray
*
pColMatchInfo
,
SSDataBlock
*
pResBlock
,
SNode
*
pCondition
,
SInterval
*
pInterval
,
double
sampleRatio
,
SExecTaskInfo
*
pTaskInfo
)
{
int32_t
repeatTime
,
int32_t
reverseTime
,
SArray
*
pColMatchInfo
,
SSDataBlock
*
pResBlock
,
SNode
*
pCondition
,
SInterval
*
pInterval
,
double
sampleRatio
,
SExecTaskInfo
*
pTaskInfo
)
{
assert
(
repeatTime
>
0
);
STableScanInfo
*
pInfo
=
taosMemoryCalloc
(
1
,
sizeof
(
STableScanInfo
));
...
...
@@ -390,19 +391,19 @@ SOperatorInfo* createTableScanOperatorInfo(void* pDataReader, int32_t order, int
return
NULL
;
}
pInfo
->
interval
=
*
pInterval
;
pInfo
->
sampleRatio
=
sampleRatio
;
pInfo
->
dataBlockLoadFlag
=
dataLoadFlag
;
pInfo
->
pResBlock
=
pResBlock
;
pInfo
->
pFilterNode
=
pCondition
;
pInfo
->
dataReader
=
pDataReader
;
pInfo
->
times
=
repeatTime
;
pInfo
->
reverseTimes
=
reverseTime
;
pInfo
->
order
=
order
;
pInfo
->
current
=
0
;
pInfo
->
scanFlag
=
MAIN_SCAN
;
pInfo
->
pColMatchInfo
=
pColMatchInfo
;
pOperator
->
name
=
"TableScanOperator"
;
pInfo
->
interval
=
*
pInterval
;
pInfo
->
sampleRatio
=
sampleRatio
;
pInfo
->
dataBlockLoadFlag
=
dataLoadFlag
;
pInfo
->
pResBlock
=
pResBlock
;
pInfo
->
pFilterNode
=
pCondition
;
pInfo
->
dataReader
=
pDataReader
;
pInfo
->
times
=
repeatTime
;
pInfo
->
reverseTimes
=
reverseTime
;
pInfo
->
order
=
order
;
pInfo
->
current
=
0
;
pInfo
->
scanFlag
=
MAIN_SCAN
;
pInfo
->
pColMatchInfo
=
pColMatchInfo
;
pOperator
->
name
=
"TableScanOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
;
pOperator
->
blockingOptr
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
...
...
@@ -828,8 +829,8 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator, bool* newgroup) {
int32_t
numOfRows
=
0
;
char
n
[
TSDB_TABLE_NAME_LEN
]
=
{
0
};
while
(
(
name
=
metaTbCursorNext
(
pInfo
->
pCur
))
!=
NULL
)
{
STR_TO_VARSTR
(
n
,
name
);
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
)
{
...
...
source/libs/executor/test/CMakeLists.txt
浏览文件 @
588fd848
...
...
@@ -8,7 +8,7 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCE_LIST)
ADD_EXECUTABLE
(
executorTest
${
SOURCE_LIST
}
)
TARGET_LINK_LIBRARIES
(
executorTest
PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes
PRIVATE os util common transport gtest taos_static qcom executor function planner scalar nodes
vnode
)
TARGET_INCLUDE_DIRECTORIES
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录