Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
32f9383a
T
TDengine
项目概览
taosdata
/
TDengine
接近 2 年 前同步成功
通知
1191
Star
22018
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看板
提交
32f9383a
编写于
1月 12, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of
https://github.com/taosdata/TDengine
into feature/vnode
上级
a5df21be
0384fb14
变更
114
展开全部
隐藏空白更改
内联
并排
Showing
114 changed file
with
4603 addition
and
3322 deletion
+4603
-3322
include/common/common.h
include/common/common.h
+6
-0
include/common/tmsg.h
include/common/tmsg.h
+115
-213
include/dnode/vnode/tsdb/tsdb.h
include/dnode/vnode/tsdb/tsdb.h
+134
-0
include/dnode/vnode/vnode.h
include/dnode/vnode/vnode.h
+16
-4
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+19
-17
include/libs/executor/executor.h
include/libs/executor/executor.h
+20
-14
include/libs/planner/planner.h
include/libs/planner/planner.h
+1
-1
include/libs/qcom/query.h
include/libs/qcom/query.h
+1
-0
include/libs/scheduler/scheduler.h
include/libs/scheduler/scheduler.h
+7
-5
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+5
-5
include/libs/wal/wal.h
include/libs/wal/wal.h
+2
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+4
-2
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+56
-13
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+1
-1
source/client/test/clientTests.cpp
source/client/test/clientTests.cpp
+448
-438
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-1
source/dnode/mgmt/impl/inc/dndInt.h
source/dnode/mgmt/impl/inc/dndInt.h
+3
-2
source/dnode/mgmt/impl/inc/dndVnodes.h
source/dnode/mgmt/impl/inc/dndVnodes.h
+2
-0
source/dnode/mgmt/impl/src/dndMgmt.c
source/dnode/mgmt/impl/src/dndMgmt.c
+14
-3
source/dnode/mgmt/impl/src/dndVnodes.c
source/dnode/mgmt/impl/src/dndVnodes.c
+24
-8
source/dnode/mgmt/impl/src/dnode.c
source/dnode/mgmt/impl/src/dnode.c
+13
-5
source/dnode/mgmt/impl/test/sut/inc/sut.h
source/dnode/mgmt/impl/test/sut/inc/sut.h
+2
-2
source/dnode/mgmt/impl/test/sut/src/sut.cpp
source/dnode/mgmt/impl/test/sut/src/sut.cpp
+1
-1
source/dnode/mnode/impl/inc/mndInt.h
source/dnode/mnode/impl/inc/mndInt.h
+1
-1
source/dnode/mnode/impl/src/mndBnode.c
source/dnode/mnode/impl/src/mndBnode.c
+2
-2
source/dnode/mnode/impl/src/mndCluster.c
source/dnode/mnode/impl/src/mndCluster.c
+2
-2
source/dnode/mnode/impl/src/mndConsumer.c
source/dnode/mnode/impl/src/mndConsumer.c
+5
-5
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+18
-14
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+4
-4
source/dnode/mnode/impl/src/mndFunc.c
source/dnode/mnode/impl/src/mndFunc.c
+7
-7
source/dnode/mnode/impl/src/mndMnode.c
source/dnode/mnode/impl/src/mndMnode.c
+2
-2
source/dnode/mnode/impl/src/mndProfile.c
source/dnode/mnode/impl/src/mndProfile.c
+4
-4
source/dnode/mnode/impl/src/mndQnode.c
source/dnode/mnode/impl/src/mndQnode.c
+2
-2
source/dnode/mnode/impl/src/mndSnode.c
source/dnode/mnode/impl/src/mndSnode.c
+2
-2
source/dnode/mnode/impl/src/mndStb.c
source/dnode/mnode/impl/src/mndStb.c
+30
-28
source/dnode/mnode/impl/src/mndTopic.c
source/dnode/mnode/impl/src/mndTopic.c
+9
-9
source/dnode/mnode/impl/src/mndTrans.c
source/dnode/mnode/impl/src/mndTrans.c
+1
-1
source/dnode/mnode/impl/src/mndUser.c
source/dnode/mnode/impl/src/mndUser.c
+2
-2
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+48
-42
source/dnode/mnode/impl/src/mnode.c
source/dnode/mnode/impl/src/mnode.c
+2
-2
source/dnode/mnode/impl/test/db/db.cpp
source/dnode/mnode/impl/test/db/db.cpp
+18
-29
source/dnode/mnode/impl/test/profile/profile.cpp
source/dnode/mnode/impl/test/profile/profile.cpp
+5
-5
source/dnode/mnode/impl/test/show/show.cpp
source/dnode/mnode/impl/test/show/show.cpp
+1
-1
source/dnode/mnode/impl/test/stb/stb.cpp
source/dnode/mnode/impl/test/stb/stb.cpp
+9
-9
source/dnode/vnode/impl/inc/vnodeDef.h
source/dnode/vnode/impl/inc/vnodeDef.h
+5
-0
source/dnode/vnode/impl/inc/vnodeRequest.h
source/dnode/vnode/impl/inc/vnodeRequest.h
+3
-3
source/dnode/vnode/impl/src/vnodeMain.c
source/dnode/vnode/impl/src/vnodeMain.c
+12
-9
source/dnode/vnode/impl/src/vnodeMgr.c
source/dnode/vnode/impl/src/vnodeMgr.c
+14
-5
source/dnode/vnode/impl/src/vnodeQuery.c
source/dnode/vnode/impl/src/vnodeQuery.c
+6
-6
source/dnode/vnode/impl/src/vnodeRequest.c
source/dnode/vnode/impl/src/vnodeRequest.c
+2
-2
source/dnode/vnode/meta/src/metaIdx.c
source/dnode/vnode/meta/src/metaIdx.c
+3
-7
source/dnode/vnode/tsdb/CMakeLists.txt
source/dnode/vnode/tsdb/CMakeLists.txt
+1
-0
source/dnode/vnode/tsdb/inc/tsdbMemTable.h
source/dnode/vnode/tsdb/inc/tsdbMemTable.h
+1
-1
source/dnode/vnode/tsdb/src/tsdbCommit.c
source/dnode/vnode/tsdb/src/tsdbCommit.c
+1
-1
source/dnode/vnode/tsdb/src/tsdbMemTable.c
source/dnode/vnode/tsdb/src/tsdbMemTable.c
+1
-1
source/dnode/vnode/tsdb/src/tsdbRead.c
source/dnode/vnode/tsdb/src/tsdbRead.c
+1066
-1086
source/libs/catalog/test/catalogTests.cpp
source/libs/catalog/test/catalogTests.cpp
+17
-16
source/libs/executor/CMakeLists.txt
source/libs/executor/CMakeLists.txt
+23
-8
source/libs/executor/inc/dataSinkInt.h
source/libs/executor/inc/dataSinkInt.h
+4
-4
source/libs/executor/inc/executil.h
source/libs/executor/inc/executil.h
+2
-2
source/libs/executor/inc/executorInt.h
source/libs/executor/inc/executorInt.h
+1
-0
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+33
-32
source/libs/executor/src/dataDispatcher.c
source/libs/executor/src/dataDispatcher.c
+32
-13
source/libs/executor/src/dataSinkMgt.c
source/libs/executor/src/dataSinkMgt.c
+9
-8
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+4
-4
source/libs/executor/src/executorMain.c
source/libs/executor/src/executorMain.c
+76
-190
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+150
-186
source/libs/executor/test/CMakeLists.txt
source/libs/executor/test/CMakeLists.txt
+18
-0
source/libs/executor/test/executorTests.cpp
source/libs/executor/test/executorTests.cpp
+221
-0
source/libs/index/src/index.c
source/libs/index/src/index.c
+41
-37
source/libs/index/src/index_cache.c
source/libs/index/src/index_cache.c
+18
-4
source/libs/index/src/index_fst.c
source/libs/index/src/index_fst.c
+1
-0
source/libs/index/src/index_fst_counting_writer.c
source/libs/index/src/index_fst_counting_writer.c
+10
-4
source/libs/index/src/index_tfile.c
source/libs/index/src/index_tfile.c
+13
-3
source/libs/parser/inc/astToMsg.h
source/libs/parser/inc/astToMsg.h
+3
-3
source/libs/parser/src/astToMsg.c
source/libs/parser/src/astToMsg.c
+11
-11
source/libs/parser/src/dCDAstProcess.c
source/libs/parser/src/dCDAstProcess.c
+7
-7
source/libs/parser/src/parser.c
source/libs/parser/src/parser.c
+3
-0
source/libs/planner/inc/plannerInt.h
source/libs/planner/inc/plannerInt.h
+1
-1
source/libs/planner/src/physicalPlan.c
source/libs/planner/src/physicalPlan.c
+8
-7
source/libs/planner/src/physicalPlanJson.c
source/libs/planner/src/physicalPlanJson.c
+47
-9
source/libs/planner/src/planner.c
source/libs/planner/src/planner.c
+12
-13
source/libs/planner/test/phyPlanTests.cpp
source/libs/planner/test/phyPlanTests.cpp
+3
-0
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+7
-7
source/libs/qworker/CMakeLists.txt
source/libs/qworker/CMakeLists.txt
+21
-5
source/libs/qworker/inc/qworkerInt.h
source/libs/qworker/inc/qworkerInt.h
+8
-6
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+200
-124
source/libs/qworker/test/qworkerTests.cpp
source/libs/qworker/test/qworkerTests.cpp
+28
-28
source/libs/scheduler/inc/schedulerInt.h
source/libs/scheduler/inc/schedulerInt.h
+14
-9
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+603
-307
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+75
-42
source/libs/wal/inc/walInt.h
source/libs/wal/inc/walInt.h
+18
-5
source/libs/wal/src/walMeta.c
source/libs/wal/src/walMeta.c
+177
-25
source/libs/wal/src/walMgmt.c
source/libs/wal/src/walMgmt.c
+5
-1
source/libs/wal/src/walSeek.c
source/libs/wal/src/walSeek.c
+44
-32
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+12
-13
source/libs/wal/test/walMetaTest.cpp
source/libs/wal/test/walMetaTest.cpp
+120
-0
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+1
-1
source/util/src/tarray.c
source/util/src/tarray.c
+1
-1
source/util/test/arrayTest.cpp
source/util/test/arrayTest.cpp
+32
-0
src/inc/tsdb.h
src/inc/tsdb.h
+8
-8
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+2
-2
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+33
-33
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+6
-4
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+1
-1
tests/script/sh/exec.sh
tests/script/sh/exec.sh
+2
-2
tests/script/sim/db/basic1.sim
tests/script/sim/db/basic1.sim
+19
-1
tests/script/sim/db/basic6.sim
tests/script/sim/db/basic6.sim
+25
-35
tests/script/sim/db/error1.sim
tests/script/sim/db/error1.sim
+99
-0
tests/script/sim/dnode/basic1.sim
tests/script/sim/dnode/basic1.sim
+0
-0
tests/script/sim/table/basic1.sim
tests/script/sim/table/basic1.sim
+0
-0
tests/script/sim/user/basic1.sim
tests/script/sim/user/basic1.sim
+0
-0
tests/test/c/create_table.c
tests/test/c/create_table.c
+85
-34
tools/shell/src/backup/tnettest.c
tools/shell/src/backup/tnettest.c
+5
-5
未找到文件。
include/common/common.h
浏览文件 @
32f9383a
...
@@ -62,6 +62,12 @@ typedef struct SConstantItem {
...
@@ -62,6 +62,12 @@ typedef struct SConstantItem {
SVariant
value
;
SVariant
value
;
}
SConstantItem
;
}
SConstantItem
;
typedef
struct
{
uint32_t
numOfTables
;
SArray
*
pGroupList
;
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
}
STableGroupInfo
;
typedef
struct
SSDataBlock
{
typedef
struct
SSDataBlock
{
SColumnDataAgg
*
pBlockAgg
;
SColumnDataAgg
*
pBlockAgg
;
SArray
*
pDataBlock
;
// SArray<SColumnInfoData>
SArray
*
pDataBlock
;
// SArray<SColumnInfoData>
...
...
include/common/tmsg.h
浏览文件 @
32f9383a
...
@@ -133,36 +133,36 @@ typedef enum _mgmt_table {
...
@@ -133,36 +133,36 @@ typedef enum _mgmt_table {
#define TSDB_COL_IS_UD_COL(f) ((f & (~(TSDB_COL_NULL))) == TSDB_COL_UDC)
#define TSDB_COL_IS_UD_COL(f) ((f & (~(TSDB_COL_NULL))) == TSDB_COL_UDC)
#define TSDB_COL_REQ_NULL(f) (((f)&TSDB_COL_NULL) != 0)
#define TSDB_COL_REQ_NULL(f) (((f)&TSDB_COL_NULL) != 0)
typedef
struct
SKv
{
typedef
struct
{
int32_t
keyLen
;
int32_t
keyLen
;
int32_t
valueLen
;
int32_t
valueLen
;
void
*
key
;
void
*
key
;
void
*
value
;
void
*
value
;
}
SKv
;
}
SKv
;
typedef
struct
SClientHbKey
{
typedef
struct
{
int32_t
connId
;
int32_t
connId
;
int32_t
hbType
;
int32_t
hbType
;
}
SClientHbKey
;
}
SClientHbKey
;
typedef
struct
SClientHbReq
{
typedef
struct
{
SClientHbKey
connKey
;
SClientHbKey
connKey
;
SHashObj
*
info
;
// hash<Slv.key, Sklv>
SHashObj
*
info
;
// hash<Slv.key, Sklv>
}
SClientHbReq
;
}
SClientHbReq
;
typedef
struct
SClientHbBatchReq
{
typedef
struct
{
int64_t
reqId
;
int64_t
reqId
;
SArray
*
reqs
;
// SArray<SClientHbReq>
SArray
*
reqs
;
// SArray<SClientHbReq>
}
SClientHbBatchReq
;
}
SClientHbBatchReq
;
typedef
struct
SClientHbRsp
{
typedef
struct
{
SClientHbKey
connKey
;
SClientHbKey
connKey
;
int32_t
status
;
int32_t
status
;
int32_t
bodyLen
;
int32_t
bodyLen
;
void
*
body
;
void
*
body
;
}
SClientHbRsp
;
}
SClientHbRsp
;
typedef
struct
SClientHbBatchRsp
{
typedef
struct
{
int64_t
reqId
;
int64_t
reqId
;
int64_t
rspId
;
int64_t
rspId
;
SArray
*
rsps
;
// SArray<SClientHbRsp>
SArray
*
rsps
;
// SArray<SClientHbRsp>
...
@@ -220,13 +220,13 @@ static FORCE_INLINE void* taosDecodeSClientHbKey(void* buf, SClientHbKey* pKey)
...
@@ -220,13 +220,13 @@ static FORCE_INLINE void* taosDecodeSClientHbKey(void* buf, SClientHbKey* pKey)
return
buf
;
return
buf
;
}
}
typedef
struct
SBuildTableMetaInput
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
char
*
dbName
;
char
*
dbName
;
char
*
tableFullName
;
char
*
tableFullName
;
}
SBuildTableMetaInput
;
}
SBuildTableMetaInput
;
typedef
struct
SBuildUseDBInput
{
typedef
struct
{
char
db
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_TABLE_FNAME_LEN
];
int32_t
vgVersion
;
int32_t
vgVersion
;
}
SBuildUseDBInput
;
}
SBuildUseDBInput
;
...
@@ -234,17 +234,12 @@ typedef struct SBuildUseDBInput {
...
@@ -234,17 +234,12 @@ typedef struct SBuildUseDBInput {
#pragma pack(push, 1)
#pragma pack(push, 1)
// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta
// null-terminated string instead of char array to avoid too many memory consumption in case of more than 1M tableMeta
typedef
struct
{
char
fqdn
[
TSDB_FQDN_LEN
];
uint16_t
port
;
}
SEpAddrMsg
;
typedef
struct
{
typedef
struct
{
char
fqdn
[
TSDB_FQDN_LEN
];
char
fqdn
[
TSDB_FQDN_LEN
];
uint16_t
port
;
uint16_t
port
;
}
SEpAddr
;
}
SEpAddr
;
typedef
struct
SMsgHead
{
typedef
struct
{
int32_t
contLen
;
int32_t
contLen
;
int32_t
vgId
;
int32_t
vgId
;
}
SMsgHead
;
}
SMsgHead
;
...
@@ -262,7 +257,7 @@ typedef struct SSubmitBlk {
...
@@ -262,7 +257,7 @@ typedef struct SSubmitBlk {
}
SSubmitBlk
;
}
SSubmitBlk
;
// Submit message for this TSDB
// Submit message for this TSDB
typedef
struct
SSubmitMsg
{
typedef
struct
{
SMsgHead
header
;
SMsgHead
header
;
int64_t
version
;
int64_t
version
;
int32_t
length
;
int32_t
length
;
...
@@ -301,7 +296,7 @@ typedef struct {
...
@@ -301,7 +296,7 @@ typedef struct {
int32_t
failedRows
;
// number of failed records (exclude duplicate records)
int32_t
failedRows
;
// number of failed records (exclude duplicate records)
int32_t
numOfFailedBlocks
;
int32_t
numOfFailedBlocks
;
SShellSubmitRspBlock
failedBlocks
[];
SShellSubmitRspBlock
failedBlocks
[];
}
SShellSubmitRsp
Msg
;
}
SShellSubmitRsp
;
typedef
struct
SSchema
{
typedef
struct
SSchema
{
int8_t
type
;
int8_t
type
;
...
@@ -310,98 +305,24 @@ typedef struct SSchema {
...
@@ -310,98 +305,24 @@ typedef struct SSchema {
char
name
[
TSDB_COL_NAME_LEN
];
char
name
[
TSDB_COL_NAME_LEN
];
}
SSchema
;
}
SSchema
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
int8_t
tableType
;
int16_t
numOfColumns
;
int16_t
numOfTags
;
int32_t
tid
;
int32_t
sversion
;
int32_t
tversion
;
int32_t
tagDataLen
;
int32_t
sqlDataLen
;
uint64_t
uid
;
uint64_t
superTableUid
;
uint64_t
createdTime
;
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
char
stbFname
[
TSDB_TABLE_FNAME_LEN
];
char
data
[];
}
SMDCreateTableMsg
;
// typedef struct {
// int32_t len; // one create table message
// char tableName[TSDB_TABLE_FNAME_LEN];
// int16_t numOfColumns;
// int16_t sqlLen; // the length of SQL, it starts after schema , sql is a null-terminated string
// int8_t igExists;
// int8_t rspMeta;
// int8_t reserved[16];
// char schema[];
//} SCreateTableMsg;
typedef
struct
{
char
tableName
[
TSDB_TABLE_FNAME_LEN
];
int16_t
numOfColumns
;
int16_t
numOfTags
;
int8_t
igExists
;
int8_t
rspMeta
;
char
schema
[];
}
SCreateCTableMsg
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
igExists
;
int8_t
igExists
;
int32_t
numOfTags
;
int32_t
numOfTags
;
int32_t
numOfColumns
;
int32_t
numOfColumns
;
SSchema
pSchema
[];
SSchema
pSchema
[];
}
S
CreateStbMsg
,
SCreateTableMsg
;
}
S
MCreateStbReq
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
igNotExists
;
int8_t
igNotExists
;
}
S
DropStbMsg
;
}
S
MDropStbReq
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
alterType
;
int8_t
alterType
;
SSchema
schema
;
SSchema
schema
;
}
SAlterStbMsg
;
}
SMAlterStbReq
;
typedef
struct
{
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
uint64_t
suid
;
}
SVDropStbReq
;
typedef
struct
{
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
type
;
/* operation type */
int32_t
numOfCols
;
/* number of schema */
int32_t
numOfTags
;
char
data
[];
}
SAlterTableMsg
;
typedef
struct
{
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
ignoreNotExists
;
}
SDropTableMsg
;
typedef
struct
{
SMsgHead
head
;
int64_t
uid
;
int32_t
tid
;
int16_t
tversion
;
int16_t
colId
;
int8_t
type
;
int16_t
bytes
;
int32_t
tagValLen
;
int16_t
numOfTags
;
int32_t
schemaLen
;
char
data
[];
}
SUpdateTableTagValMsg
;
typedef
struct
{
typedef
struct
{
int32_t
pid
;
int32_t
pid
;
...
@@ -470,28 +391,13 @@ typedef struct {
...
@@ -470,28 +391,13 @@ typedef struct {
}
SCreateUserReq
,
SAlterUserReq
;
}
SCreateUserReq
,
SAlterUserReq
;
typedef
struct
{
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
int32_t
tid
;
uint64_t
uid
;
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
}
SMDDropTableMsg
;
typedef
struct
{
int32_t
contLen
;
int32_t
vgId
;
uint64_t
uid
;
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
}
SDropSTableMsg
;
typedef
struct
SColIndex
{
int16_t
colId
;
// column id
int16_t
colId
;
// column id
int16_t
colIndex
;
// column index in colList if it is a normal column or index in tagColList if a tag
int16_t
colIndex
;
// column index in colList if it is a normal column or index in tagColList if a tag
int16_t
flag
;
// denote if it is a tag or a normal column
int16_t
flag
;
// denote if it is a tag or a normal column
char
name
[
TSDB_DB_FNAME_LEN
];
char
name
[
TSDB_DB_FNAME_LEN
];
}
SColIndex
;
}
SColIndex
;
typedef
struct
SColumnFilterInfo
{
typedef
struct
{
int16_t
lowerRelOptr
;
int16_t
lowerRelOptr
;
int16_t
upperRelOptr
;
int16_t
upperRelOptr
;
int16_t
filterstr
;
// denote if current column is char(binary/nchar)
int16_t
filterstr
;
// denote if current column is char(binary/nchar)
...
@@ -512,7 +418,7 @@ typedef struct SColumnFilterInfo {
...
@@ -512,7 +418,7 @@ typedef struct SColumnFilterInfo {
};
};
}
SColumnFilterInfo
;
}
SColumnFilterInfo
;
typedef
struct
SColumnFilterList
{
typedef
struct
{
int16_t
numOfFilters
;
int16_t
numOfFilters
;
union
{
union
{
int64_t
placeholder
;
int64_t
placeholder
;
...
@@ -523,14 +429,14 @@ typedef struct SColumnFilterList {
...
@@ -523,14 +429,14 @@ typedef struct SColumnFilterList {
* for client side struct, we only need the column id, type, bytes are not necessary
* for client side struct, we only need the column id, type, bytes are not necessary
* But for data in vnode side, we need all the following information.
* But for data in vnode side, we need all the following information.
*/
*/
typedef
struct
SColumnInfo
{
typedef
struct
{
int16_t
colId
;
int16_t
colId
;
int16_t
type
;
int16_t
type
;
int16_t
bytes
;
int16_t
bytes
;
SColumnFilterList
flist
;
SColumnFilterList
flist
;
}
SColumnInfo
;
}
SColumnInfo
;
typedef
struct
STableIdInfo
{
typedef
struct
{
uint64_t
uid
;
uint64_t
uid
;
TSKEY
key
;
// last accessed ts, for subscription
TSKEY
key
;
// last accessed ts, for subscription
}
STableIdInfo
;
}
STableIdInfo
;
...
@@ -547,7 +453,7 @@ typedef struct {
...
@@ -547,7 +453,7 @@ typedef struct {
int32_t
tsOrder
;
// ts comp block order
int32_t
tsOrder
;
// ts comp block order
}
STsBufInfo
;
}
STsBufInfo
;
typedef
struct
SInterval
{
typedef
struct
{
int32_t
tz
;
// query client timezone
int32_t
tz
;
// query client timezone
char
intervalUnit
;
char
intervalUnit
;
char
slidingUnit
;
char
slidingUnit
;
...
@@ -606,7 +512,7 @@ typedef struct {
...
@@ -606,7 +512,7 @@ typedef struct {
int32_t
udfContentOffset
;
int32_t
udfContentOffset
;
int32_t
udfContentLen
;
int32_t
udfContentLen
;
SColumnInfo
tableCols
[];
SColumnInfo
tableCols
[];
}
SQueryTable
Msg
;
}
SQueryTable
Req
;
typedef
struct
{
typedef
struct
{
int32_t
code
;
int32_t
code
;
...
@@ -623,7 +529,7 @@ typedef struct {
...
@@ -623,7 +529,7 @@ typedef struct {
int8_t
free
;
int8_t
free
;
}
SRetrieveTableReq
;
}
SRetrieveTableReq
;
typedef
struct
SRetrieveTableRsp
{
typedef
struct
{
int64_t
useconds
;
int64_t
useconds
;
int8_t
completed
;
// all results are returned to client
int8_t
completed
;
// all results are returned to client
int8_t
precision
;
int8_t
precision
;
...
@@ -655,7 +561,7 @@ typedef struct {
...
@@ -655,7 +561,7 @@ typedef struct {
int8_t
update
;
int8_t
update
;
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
int8_t
ignoreExist
;
int8_t
ignoreExist
;
}
SCreateDb
Msg
;
}
SCreateDb
Req
;
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
...
@@ -667,25 +573,25 @@ typedef struct {
...
@@ -667,25 +573,25 @@ typedef struct {
int8_t
walLevel
;
int8_t
walLevel
;
int8_t
quorum
;
int8_t
quorum
;
int8_t
cacheLastRow
;
int8_t
cacheLastRow
;
}
SAlterDb
Msg
;
}
SAlterDb
Req
;
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_TABLE_FNAME_LEN
];
int8_t
ignoreNotExists
;
int8_t
ignoreNotExists
;
}
SDropDb
Msg
;
}
SDropDb
Req
;
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_TABLE_FNAME_LEN
];
int32_t
vgVersion
;
int32_t
vgVersion
;
}
SUseDb
Msg
;
}
SUseDb
Req
;
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_TABLE_FNAME_LEN
];
}
SSyncDb
Msg
;
}
SSyncDb
Req
;
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_TABLE_FNAME_LEN
];
char
db
[
TSDB_TABLE_FNAME_LEN
];
}
SCompactDb
Msg
;
}
SCompactDb
Req
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_FUNC_NAME_LEN
];
char
name
[
TSDB_FUNC_NAME_LEN
];
...
@@ -699,16 +605,16 @@ typedef struct {
...
@@ -699,16 +605,16 @@ typedef struct {
int32_t
commentSize
;
int32_t
commentSize
;
int32_t
codeSize
;
int32_t
codeSize
;
char
pCont
[];
char
pCont
[];
}
SCreateFunc
Msg
;
}
SCreateFunc
Req
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_FUNC_NAME_LEN
];
char
name
[
TSDB_FUNC_NAME_LEN
];
}
SDropFunc
Msg
;
}
SDropFunc
Req
;
typedef
struct
{
typedef
struct
{
int32_t
numOfFuncs
;
int32_t
numOfFuncs
;
char
pFuncNames
[];
char
pFuncNames
[];
}
SRetrieveFunc
Msg
;
}
SRetrieveFunc
Req
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_FUNC_NAME_LEN
];
char
name
[
TSDB_FUNC_NAME_LEN
];
...
@@ -768,7 +674,7 @@ typedef struct {
...
@@ -768,7 +674,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int32_t
reserved
;
int32_t
reserved
;
}
STrans
Msg
;
}
STrans
Req
;
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
...
@@ -843,7 +749,7 @@ typedef struct {
...
@@ -843,7 +749,7 @@ typedef struct {
SMsgHead
header
;
SMsgHead
header
;
char
dbFname
[
TSDB_DB_FNAME_LEN
];
char
dbFname
[
TSDB_DB_FNAME_LEN
];
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
char
tableFname
[
TSDB_TABLE_FNAME_LEN
];
}
STableInfo
Msg
;
}
STableInfo
Req
;
typedef
struct
{
typedef
struct
{
int8_t
metaClone
;
// create local clone of the cached table meta
int8_t
metaClone
;
// create local clone of the cached table meta
...
@@ -851,7 +757,7 @@ typedef struct {
...
@@ -851,7 +757,7 @@ typedef struct {
int32_t
numOfTables
;
int32_t
numOfTables
;
int32_t
numOfUdfs
;
int32_t
numOfUdfs
;
char
tableNames
[];
char
tableNames
[];
}
SMultiTableInfo
Msg
;
}
SMultiTableInfo
Req
;
typedef
struct
SVgroupInfo
{
typedef
struct
SVgroupInfo
{
int32_t
vgId
;
int32_t
vgId
;
...
@@ -859,19 +765,19 @@ typedef struct SVgroupInfo {
...
@@ -859,19 +765,19 @@ typedef struct SVgroupInfo {
uint32_t
hashEnd
;
uint32_t
hashEnd
;
int8_t
inUse
;
int8_t
inUse
;
int8_t
numOfEps
;
int8_t
numOfEps
;
SEpAddr
Msg
epAddr
[
TSDB_MAX_REPLICA
];
SEpAddr
epAddr
[
TSDB_MAX_REPLICA
];
}
SVgroupInfo
;
}
SVgroupInfo
;
typedef
struct
{
typedef
struct
{
int32_t
vgId
;
int32_t
vgId
;
int8_t
numOfEps
;
int8_t
numOfEps
;
SEpAddr
Msg
epAddr
[
TSDB_MAX_REPLICA
];
SEpAddr
epAddr
[
TSDB_MAX_REPLICA
];
}
SVgroupMsg
;
}
SVgroupMsg
;
typedef
struct
{
typedef
struct
{
int32_t
numOfVgroups
;
int32_t
numOfVgroups
;
SVgroupMsg
vgroups
[];
SVgroupMsg
vgroups
[];
}
SVgroups
Msg
,
SVgroups
Info
;
}
SVgroupsInfo
;
typedef
struct
{
typedef
struct
{
char
tbFname
[
TSDB_TABLE_FNAME_LEN
];
// table full name
char
tbFname
[
TSDB_TABLE_FNAME_LEN
];
// table full name
...
@@ -888,9 +794,9 @@ typedef struct {
...
@@ -888,9 +794,9 @@ typedef struct {
uint64_t
tuid
;
uint64_t
tuid
;
int32_t
vgId
;
int32_t
vgId
;
SSchema
pSchema
[];
SSchema
pSchema
[];
}
STableMeta
Msg
;
}
STableMeta
Rsp
;
typedef
struct
SMultiTableMeta
{
typedef
struct
{
int32_t
numOfTables
;
int32_t
numOfTables
;
int32_t
numOfVgroup
;
int32_t
numOfVgroup
;
int32_t
numOfUdf
;
int32_t
numOfUdf
;
...
@@ -932,11 +838,11 @@ typedef struct {
...
@@ -932,11 +838,11 @@ typedef struct {
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
int32_t
numOfVgroup
;
int32_t
numOfVgroup
;
int32_t
vgid
[];
int32_t
vgid
[];
}
SCompact
Msg
;
}
SCompact
Req
;
typedef
struct
SShowRsp
{
typedef
struct
{
int64_t
showId
;
int64_t
showId
;
STableMeta
Msg
tableMeta
;
STableMeta
Rsp
tableMeta
;
}
SShowRsp
;
}
SShowRsp
;
typedef
struct
{
typedef
struct
{
...
@@ -975,17 +881,6 @@ typedef struct {
...
@@ -975,17 +881,6 @@ typedef struct {
int32_t
dnodeId
;
int32_t
dnodeId
;
}
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
}
SMCreateBnodeReq
,
SMDropBnodeReq
,
SDCreateBnodeReq
,
SDDropBnodeReq
;
typedef
struct
{
int32_t
dnodeId
;
int32_t
vgId
;
int32_t
tid
;
}
SConfigTableMsg
;
typedef
struct
{
int32_t
dnodeId
;
int32_t
vgId
;
}
SConfigVnodeMsg
;
typedef
struct
{
typedef
struct
{
char
sql
[
TSDB_SHOW_SQL_LEN
];
char
sql
[
TSDB_SHOW_SQL_LEN
];
int32_t
queryId
;
int32_t
queryId
;
...
@@ -1042,7 +937,7 @@ typedef struct {
...
@@ -1042,7 +937,7 @@ typedef struct {
int8_t
align
[
7
];
int8_t
align
[
7
];
char
name
[
TSDB_STEP_NAME_LEN
];
char
name
[
TSDB_STEP_NAME_LEN
];
char
desc
[
TSDB_STEP_DESC_LEN
];
char
desc
[
TSDB_STEP_DESC_LEN
];
}
SStartup
Msg
;
}
SStartup
Req
;
// mq related
// mq related
typedef
struct
{
typedef
struct
{
...
@@ -1083,46 +978,6 @@ typedef struct {
...
@@ -1083,46 +978,6 @@ typedef struct {
}
SSubmitReqReader
;
}
SSubmitReqReader
;
typedef
struct
{
typedef
struct
{
/* data */
}
SCreateTableReq
;
typedef
struct
{
/* data */
}
SCreateTableRsp
;
typedef
struct
{
/* data */
}
SDropTableReq
;
typedef
struct
{
/* data */
}
SDropTableRsp
;
typedef
struct
{
/* data */
}
SAlterTableReq
;
typedef
struct
{
/* data */
}
SAlterTableRsp
;
typedef
struct
{
/* data */
}
SDropStableReq
;
typedef
struct
{
/* data */
}
SDropStableRsp
;
typedef
struct
{
/* data */
}
SUpdateTagValReq
;
typedef
struct
{
/* data */
}
SUpdateTagValRsp
;
typedef
struct
SSubQueryMsg
{
SMsgHead
header
;
SMsgHead
header
;
uint64_t
sId
;
uint64_t
sId
;
uint64_t
queryId
;
uint64_t
queryId
;
...
@@ -1131,59 +986,67 @@ typedef struct SSubQueryMsg {
...
@@ -1131,59 +986,67 @@ typedef struct SSubQueryMsg {
char
msg
[];
char
msg
[];
}
SSubQueryMsg
;
}
SSubQueryMsg
;
typedef
struct
SResReadyMsg
{
typedef
struct
{
SMsgHead
header
;
SMsgHead
header
;
uint64_t
sId
;
uint64_t
sId
;
uint64_t
queryId
;
uint64_t
queryId
;
uint64_t
taskId
;
uint64_t
taskId
;
}
SResReadyMsg
;
}
SSinkDataReq
;
typedef
struct
SResReadyRsp
{
typedef
struct
{
SMsgHead
header
;
uint64_t
sId
;
uint64_t
queryId
;
uint64_t
taskId
;
}
SResReadyReq
;
typedef
struct
{
int32_t
code
;
int32_t
code
;
}
SResReadyRsp
;
}
SResReadyRsp
;
typedef
struct
SResFetchMsg
{
typedef
struct
{
SMsgHead
header
;
SMsgHead
header
;
uint64_t
sId
;
uint64_t
sId
;
uint64_t
queryId
;
uint64_t
queryId
;
uint64_t
taskId
;
uint64_t
taskId
;
}
SResFetch
Msg
;
}
SResFetch
Req
;
typedef
struct
SSchTasksStatusMsg
{
typedef
struct
{
SMsgHead
header
;
SMsgHead
header
;
uint64_t
sId
;
uint64_t
sId
;
}
SSchTasksStatus
Msg
;
}
SSchTasksStatus
Req
;
typedef
struct
STaskStatus
{
typedef
struct
{
uint64_t
queryId
;
uint64_t
queryId
;
uint64_t
taskId
;
uint64_t
taskId
;
int8_t
status
;
int8_t
status
;
}
STaskStatus
;
}
STaskStatus
;
typedef
struct
SSchedulerStatusRsp
{
typedef
struct
{
uint32_t
num
;
uint32_t
num
;
STaskStatus
status
[];
STaskStatus
status
[];
}
SSchedulerStatusRsp
;
}
SSchedulerStatusRsp
;
typedef
struct
STaskCancelMsg
{
typedef
struct
{
SMsgHead
header
;
SMsgHead
header
;
uint64_t
sId
;
uint64_t
sId
;
uint64_t
queryId
;
uint64_t
queryId
;
uint64_t
taskId
;
uint64_t
taskId
;
}
STaskCancel
Msg
;
}
STaskCancel
Req
;
typedef
struct
STaskCancelRsp
{
typedef
struct
{
int32_t
code
;
int32_t
code
;
}
STaskCancelRsp
;
}
STaskCancelRsp
;
typedef
struct
STaskDropMsg
{
typedef
struct
{
SMsgHead
header
;
SMsgHead
header
;
uint64_t
sId
;
uint64_t
sId
;
uint64_t
queryId
;
uint64_t
queryId
;
uint64_t
taskId
;
uint64_t
taskId
;
}
STaskDrop
Msg
;
}
STaskDrop
Req
;
typedef
struct
STaskDropRsp
{
typedef
struct
{
int32_t
code
;
int32_t
code
;
}
STaskDropRsp
;
}
STaskDropRsp
;
...
@@ -1334,18 +1197,18 @@ typedef struct {
...
@@ -1334,18 +1197,18 @@ typedef struct {
void
*
executor
;
void
*
executor
;
int32_t
sqlLen
;
int32_t
sqlLen
;
char
*
sql
;
char
*
sql
;
}
SCreateTopic
Msg
;
}
SCreateTopic
Req
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
igNotExists
;
int8_t
igNotExists
;
}
SDropTopic
Msg
;
}
SDropTopic
Req
;
typedef
struct
{
typedef
struct
{
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
alterType
;
int8_t
alterType
;
SSchema
schema
;
SSchema
schema
;
}
SAlterTopic
Msg
;
}
SAlterTopic
Req
;
typedef
struct
{
typedef
struct
{
SMsgHead
head
;
SMsgHead
head
;
...
@@ -1356,13 +1219,13 @@ typedef struct {
...
@@ -1356,13 +1219,13 @@ typedef struct {
char
*
executor
;
char
*
executor
;
int32_t
sqlLen
;
int32_t
sqlLen
;
char
*
sql
;
char
*
sql
;
}
SDCreateTopic
Msg
;
}
SDCreateTopic
Req
;
typedef
struct
{
typedef
struct
{
SMsgHead
head
;
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
char
name
[
TSDB_TABLE_FNAME_LEN
];
uint64_t
tuid
;
uint64_t
tuid
;
}
SDDropTopic
Msg
;
}
SDDropTopic
Req
;
typedef
struct
SVCreateTbReq
{
typedef
struct
SVCreateTbReq
{
uint64_t
ver
;
// use a general definition
uint64_t
ver
;
// use a general definition
...
@@ -1402,24 +1265,63 @@ void* tDeserializeSVCreateTbReq(void* buf, SVCreateTbReq* pReq);
...
@@ -1402,24 +1265,63 @@ void* tDeserializeSVCreateTbReq(void* buf, SVCreateTbReq* pReq);
int
tSVCreateTbBatchReqSerialize
(
void
**
buf
,
SVCreateTbBatchReq
*
pReq
);
int
tSVCreateTbBatchReqSerialize
(
void
**
buf
,
SVCreateTbBatchReq
*
pReq
);
void
*
tSVCreateTbBatchReqDeserialize
(
void
*
buf
,
SVCreateTbBatchReq
*
pReq
);
void
*
tSVCreateTbBatchReqDeserialize
(
void
*
buf
,
SVCreateTbBatchReq
*
pReq
);
typedef
struct
SVCreateTbRsp
{
typedef
struct
{
SMsgHead
head
;
}
SVCreateTbRsp
;
}
SVCreateTbRsp
;
typedef
struct
SVShowTablesReq
{
typedef
struct
{
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
ignoreNotExists
;
}
SVAlterTbReq
;
typedef
struct
{
SMsgHead
head
;
}
SVAlterTbRsp
;
typedef
struct
{
SMsgHead
head
;
char
name
[
TSDB_TABLE_FNAME_LEN
];
int8_t
ignoreNotExists
;
}
SVDropTbReq
;
typedef
struct
{
SMsgHead
head
;
}
SVDropTbRsp
;
typedef
struct
{
SMsgHead
head
;
int64_t
uid
;
int32_t
tid
;
int16_t
tversion
;
int16_t
colId
;
int8_t
type
;
int16_t
bytes
;
int32_t
tagValLen
;
int16_t
numOfTags
;
int32_t
schemaLen
;
char
data
[];
}
SUpdateTagValReq
;
typedef
struct
{
SMsgHead
head
;
}
SUpdateTagValRsp
;
typedef
struct
{
SMsgHead
head
;
SMsgHead
head
;
}
SVShowTablesReq
;
}
SVShowTablesReq
;
typedef
struct
SVShowTablesRsp
{
typedef
struct
{
int64_t
id
;
int64_t
id
;
STableMeta
Msg
metaInfo
;
STableMeta
Rsp
metaInfo
;
}
SVShowTablesRsp
;
}
SVShowTablesRsp
;
typedef
struct
SVShowTablesFetchReq
{
typedef
struct
{
SMsgHead
head
;
SMsgHead
head
;
int32_t
id
;
int32_t
id
;
}
SVShowTablesFetchReq
;
}
SVShowTablesFetchReq
;
typedef
struct
SVShowTablesFetchRsp
{
typedef
struct
{
int64_t
useconds
;
int64_t
useconds
;
int8_t
completed
;
// all results are returned to client
int8_t
completed
;
// all results are returned to client
int8_t
precision
;
int8_t
precision
;
...
...
include/dnode/vnode/tsdb/tsdb.h
浏览文件 @
32f9383a
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "mallocator.h"
#include "mallocator.h"
#include "meta.h"
#include "meta.h"
#include "common.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -39,6 +40,10 @@ typedef struct STable {
...
@@ -39,6 +40,10 @@ typedef struct STable {
STSchema
*
pSchema
;
STSchema
*
pSchema
;
}
STable
;
}
STable
;
#define BLOCK_LOAD_OFFSET_SEQ_ORDER 1
#define BLOCK_LOAD_TABLE_SEQ_ORDER 2
#define BLOCK_LOAD_TABLE_RR_ORDER 3
#define TABLE_TID(t) (t)->tid
#define TABLE_TID(t) (t)->tid
#define TABLE_UID(t) (t)->uid
#define TABLE_UID(t) (t)->uid
...
@@ -58,6 +63,22 @@ typedef struct STsdbCfg {
...
@@ -58,6 +63,22 @@ typedef struct STsdbCfg {
int8_t
compression
;
int8_t
compression
;
}
STsdbCfg
;
}
STsdbCfg
;
// query condition to build multi-table data block iterator
typedef
struct
STsdbQueryCond
{
STimeWindow
twindow
;
int32_t
order
;
// desc|asc order to iterate the data block
int32_t
numOfCols
;
SColumnInfo
*
colList
;
bool
loadExternalRows
;
// load external rows or not
int32_t
type
;
// data block load type:
}
STsdbQueryCond
;
typedef
struct
{
void
*
pTable
;
TSKEY
lastKey
;
uint64_t
uid
;
}
STableKeyInfo
;
// STsdb
// STsdb
STsdb
*
tsdbOpen
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
,
SMeta
*
pMeta
);
STsdb
*
tsdbOpen
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
,
SMeta
*
pMeta
);
void
tsdbClose
(
STsdb
*
);
void
tsdbClose
(
STsdb
*
);
...
@@ -70,6 +91,119 @@ int tsdbCommit(STsdb *pTsdb);
...
@@ -70,6 +91,119 @@ int tsdbCommit(STsdb *pTsdb);
int
tsdbOptionsInit
(
STsdbCfg
*
);
int
tsdbOptionsInit
(
STsdbCfg
*
);
void
tsdbOptionsClear
(
STsdbCfg
*
);
void
tsdbOptionsClear
(
STsdbCfg
*
);
typedef
void
*
tsdbReadHandleT
;
/**
* Get the data block iterator, starting from position according to the query condition
*
* @param tsdb tsdb handle
* @param pCond query condition, including time window, result set order, and basic required columns for each block
* @param tableInfoGroup table object list in the form of set, grouped into different sets according to the
* group by condition
* @param qinfo query info handle from query processor
* @return
*/
tsdbReadHandleT
*
tsdbQueryTables
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
tableInfoGroup
,
uint64_t
qId
,
void
*
pRef
);
/**
* Get the last row of the given query time window for all the tables in STableGroupInfo object.
* Note that only one data block with only row will be returned while invoking retrieve data block function for
* all tables in this group.
*
* @param tsdb tsdb handle
* @param pCond query condition, including time window, result set order, and basic required columns for each block
* @param tableInfo table list.
* @return
*/
//tsdbReadHandleT tsdbQueryLastRow(STsdbRepo *tsdb, STsdbQueryCond *pCond, STableGroupInfo *tableInfo, uint64_t qId,
// SMemRef *pRef);
tsdbReadHandleT
tsdbQueryCacheLast
(
STsdb
*
tsdb
,
STsdbQueryCond
*
pCond
,
STableGroupInfo
*
groupList
,
uint64_t
qId
,
void
*
pMemRef
);
bool
isTsdbCacheLastRow
(
tsdbReadHandleT
*
pTsdbReadHandle
);
/**
* get num of rows in mem table
*
* @param pHandle
* @return row size
*/
int64_t
tsdbGetNumOfRowsInMemTable
(
tsdbReadHandleT
*
pHandle
);
/**
* move to next block if exists
*
* @param pTsdbReadHandle
* @return
*/
bool
tsdbNextDataBlock
(
tsdbReadHandleT
pTsdbReadHandle
);
/**
* Get current data block information
*
* @param pTsdbReadHandle
* @param pBlockInfo
* @return
*/
void
tsdbRetrieveDataBlockInfo
(
tsdbReadHandleT
*
pTsdbReadHandle
,
SDataBlockInfo
*
pBlockInfo
);
/**
*
* Get the pre-calculated information w.r.t. current data block.
*
* In case of data block in cache, the pBlockStatis will always be NULL.
* If a block is not completed loaded from disk, the pBlockStatis will be NULL.
* @pBlockStatis the pre-calculated value for current data blocks. if the block is a cache block, always return 0
* @return
*/
int32_t
tsdbRetrieveDataBlockStatisInfo
(
tsdbReadHandleT
*
pTsdbReadHandle
,
SDataStatis
**
pBlockStatis
);
/**
*
* The query condition with primary timestamp is passed to iterator during its constructor function,
* the returned data block must be satisfied with the time window condition in any cases,
* which means the SData data block is not actually the completed disk data blocks.
*
* @param pTsdbReadHandle query handle
* @param pColumnIdList required data columns id list
* @return
*/
SArray
*
tsdbRetrieveDataBlock
(
tsdbReadHandleT
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
/**
* destroy the created table group list, which is generated by tag query
* @param pGroupList
*/
void
tsdbDestroyTableGroup
(
STableGroupInfo
*
pGroupList
);
/**
* create the table group result including only one table, used to handle the normal table query
*
* @param tsdb tsdbHandle
* @param uid table uid
* @param pGroupInfo the generated result
* @return
*/
int32_t
tsdbGetOneTableGroup
(
STsdb
*
tsdb
,
uint64_t
uid
,
TSKEY
startKey
,
STableGroupInfo
*
pGroupInfo
);
/**
*
* @param tsdb
* @param pTableIdList
* @param pGroupInfo
* @return
*/
int32_t
tsdbGetTableGroupFromIdList
(
STsdb
*
tsdb
,
SArray
*
pTableIdList
,
STableGroupInfo
*
pGroupInfo
);
/**
* clean up the query handle
* @param queryHandle
*/
void
tsdbCleanupQueryHandle
(
tsdbReadHandleT
queryHandle
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/dnode/vnode/vnode.h
浏览文件 @
32f9383a
...
@@ -31,8 +31,12 @@ extern "C" {
...
@@ -31,8 +31,12 @@ extern "C" {
/* ------------------------ TYPES EXPOSED ------------------------ */
/* ------------------------ TYPES EXPOSED ------------------------ */
typedef
struct
SVnode
SVnode
;
typedef
struct
SVnode
SVnode
;
typedef
struct
SDnode
SDnode
;
typedef
int32_t
(
*
PutReqToVQueryQFp
)(
SDnode
*
pDnode
,
struct
SRpcMsg
*
pReq
);
typedef
struct
SVnodeCfg
{
typedef
struct
SVnodeCfg
{
int32_t
vgId
;
int32_t
vgId
;
SDnode
*
pDnode
;
/** vnode buffer pool options */
/** vnode buffer pool options */
struct
{
struct
{
...
@@ -66,15 +70,23 @@ typedef struct SVnodeCfg {
...
@@ -66,15 +70,23 @@ typedef struct SVnodeCfg {
SWalCfg
walCfg
;
SWalCfg
walCfg
;
}
SVnodeCfg
;
}
SVnodeCfg
;
typedef
struct
{
int32_t
sver
;
char
*
timezone
;
char
*
locale
;
char
*
charset
;
uint16_t
nthreads
;
// number of commit threads. 0 for no threads and a schedule queue should be given (TODO)
PutReqToVQueryQFp
putReqToVQueryQFp
;
}
SVnodeOpt
;
/* ------------------------ SVnode ------------------------ */
/* ------------------------ SVnode ------------------------ */
/**
/**
* @brief Initialize the vnode module
* @brief Initialize the vnode module
*
*
* @param nthreads number of commit threads. 0 for no threads and
* @param pOption Option of the vnode mnodule
* a schedule queue should be given (TODO)
* @return int 0 for success and -1 for failure
* @return int 0 for success and -1 for failure
*/
*/
int
vnodeInit
(
uint16_t
nthreads
);
int
vnodeInit
(
const
SVnodeOpt
*
pOption
);
/**
/**
* @brief clear a vnode
* @brief clear a vnode
...
@@ -89,7 +101,7 @@ void vnodeClear();
...
@@ -89,7 +101,7 @@ void vnodeClear();
* @param pVnodeCfg options of the vnode
* @param pVnodeCfg options of the vnode
* @return SVnode* The vnode object
* @return SVnode* The vnode object
*/
*/
SVnode
*
vnodeOpen
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
,
int32_t
vid
);
SVnode
*
vnodeOpen
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
);
/**
/**
* @brief Close a VNODE
* @brief Close a VNODE
...
...
source/libs/executor/inc
/dataSinkMgt.h
→
include/libs/executor
/dataSinkMgt.h
浏览文件 @
32f9383a
...
@@ -21,36 +21,38 @@ extern "C" {
...
@@ -21,36 +21,38 @@ extern "C" {
#endif
#endif
#include "os.h"
#include "os.h"
#include "executorimpl.h"
#include "thash.h"
#include "executor.h"
#define DS_CAPACITY_ENOUGH 1
#define DS_BUF_LOW 1
#define DS_CAPACITY_FULL 2
#define DS_BUF_FULL 2
#define DS_NEED_SCHEDULE 3
#define DS_BUF_EMPTY 3
#define DS_END 4
#define DS_IN_PROCESS 5
struct
SDataSink
;
struct
SDataSink
;
struct
SSDataBlock
;
struct
SSDataBlock
;
typedef
struct
SDataSinkMgtCfg
{
typedef
struct
SDataSinkMgtCfg
{
uint32_t
maxDataBlockNum
;
uint32_t
maxDataBlockNum
;
// todo: this should be numOfRows?
uint32_t
maxDataBlockNumPerQuery
;
uint32_t
maxDataBlockNumPerQuery
;
}
SDataSinkMgtCfg
;
}
SDataSinkMgtCfg
;
int32_t
dsDataSinkMgtInit
(
SDataSinkMgtCfg
*
cfg
);
int32_t
dsDataSinkMgtInit
(
SDataSinkMgtCfg
*
cfg
);
typedef
void
*
DataSinkHandle
;
typedef
struct
SInputData
{
typedef
struct
SInputData
{
const
SSDataBlock
*
pData
;
const
struct
SSDataBlock
*
pData
;
SHashObj
*
pTableRetrieveTsMap
;
SHashObj
*
pTableRetrieveTsMap
;
}
SInputData
;
}
SInputData
;
typedef
struct
SOut
P
utData
{
typedef
struct
SOut
p
utData
{
int32_t
numOfRows
;
int32_t
numOfRows
;
int8_t
compressed
;
int8_t
compressed
;
char
*
pData
;
char
*
pData
;
}
SOutPutData
;
bool
queryEnd
;
bool
needSchedule
;
int32_t
bufStatus
;
int64_t
useconds
;
int8_t
precision
;
}
SOutputData
;
/**
/**
* Create a subplan's datasinker handle for all later operations.
* Create a subplan's datasinker handle for all later operations.
...
@@ -66,16 +68,16 @@ int32_t dsCreateDataSinker(const struct SDataSink *pDataSink, DataSinkHandle* pH
...
@@ -66,16 +68,16 @@ int32_t dsCreateDataSinker(const struct SDataSink *pDataSink, DataSinkHandle* pH
* @param pRes
* @param pRes
* @return error code
* @return error code
*/
*/
int32_t
dsPutDataBlock
(
DataSinkHandle
handle
,
const
SInputData
*
pInput
,
int32_t
*
pStatus
);
int32_t
dsPutDataBlock
(
DataSinkHandle
handle
,
const
SInputData
*
pInput
,
bool
*
pContinue
);
void
dsEndPut
(
DataSinkHandle
handle
);
void
dsEndPut
(
DataSinkHandle
handle
,
int64_t
useconds
);
/**
/**
* Get the length of the data returned by the next call to dsGetDataBlock.
* Get the length of the data returned by the next call to dsGetDataBlock.
* @param handle
* @param handle
* @
retur
n data length
* @
param pLe
n data length
*/
*/
int32_t
dsGetDataLength
(
DataSinkHandle
handle
,
int32_t
*
pStatus
);
void
dsGetDataLength
(
DataSinkHandle
handle
,
int32_t
*
pLen
,
bool
*
pQueryEnd
);
/**
/**
* Get data, the caller needs to allocate data memory.
* Get data, the caller needs to allocate data memory.
...
@@ -84,7 +86,7 @@ int32_t dsGetDataLength(DataSinkHandle handle, int32_t* pStatus);
...
@@ -84,7 +86,7 @@ int32_t dsGetDataLength(DataSinkHandle handle, int32_t* pStatus);
* @param pStatus output
* @param pStatus output
* @return error code
* @return error code
*/
*/
int32_t
dsGetDataBlock
(
DataSinkHandle
handle
,
SOut
PutData
*
pOutput
,
int32_t
*
pStatus
);
int32_t
dsGetDataBlock
(
DataSinkHandle
handle
,
SOut
putData
*
pOutput
);
/**
/**
* After dsGetStatus returns DS_NEED_SCHEDULE, the caller need to put this into the work queue.
* After dsGetStatus returns DS_NEED_SCHEDULE, the caller need to put this into the work queue.
...
...
include/libs/executor/executor.h
浏览文件 @
32f9383a
...
@@ -21,24 +21,30 @@ extern "C" {
...
@@ -21,24 +21,30 @@ extern "C" {
#endif
#endif
typedef
void
*
qTaskInfo_t
;
typedef
void
*
qTaskInfo_t
;
typedef
void
*
DataSinkHandle
;
struct
SSubplan
;
/**
* create the qinfo object according to QueryTableMsg
/**
* @param tsdb
* Create the exec task object according to task json
* @param pQueryTableMsg
* @param tsdb
* @param pTaskInfo
* @param vgId
* @return
* @param pTaskInfoMsg
*/
* @param pTaskInfo
int32_t
qCreateTask
(
void
*
tsdb
,
int32_t
vgId
,
void
*
pQueryTableMsg
,
qTaskInfo_t
*
pTaskInfo
,
uint64_t
qId
);
* @param qId
* @return
*/
int32_t
qCreateExecTask
(
void
*
tsdb
,
int32_t
vgId
,
struct
SSubplan
*
pPlan
,
qTaskInfo_t
*
pTaskInfo
);
/**
/**
*
the main query
execution function, including query on both table and multiple tables,
*
The main task
execution function, including query on both table and multiple tables,
* which are decided according to the tag or table name query conditions
* which are decided according to the tag or table name query conditions
*
*
* @param qinfo
* @param tinfo
* @param handle
* @return
* @return
*/
*/
bool
qExecTask
(
qTaskInfo_t
qinfo
,
uint64_t
*
qId
);
int32_t
qExecTask
(
qTaskInfo_t
tinfo
,
DataSinkHandle
*
handle
);
/**
/**
* Retrieve the produced results information, if current query is not paused or completed,
* Retrieve the produced results information, if current query is not paused or completed,
...
@@ -60,7 +66,7 @@ int32_t qRetrieveQueryResultInfo(qTaskInfo_t qinfo, bool* buildRes, void* pRspCo
...
@@ -60,7 +66,7 @@ int32_t qRetrieveQueryResultInfo(qTaskInfo_t qinfo, bool* buildRes, void* pRspCo
* @param contLen payload length
* @param contLen payload length
* @return
* @return
*/
*/
int32_t
qDumpRetrieveResult
(
qTaskInfo_t
qinfo
,
SRetrieveTableRsp
**
pRsp
,
int32_t
*
contLen
,
bool
*
continueExec
);
//
int32_t qDumpRetrieveResult(qTaskInfo_t qinfo, SRetrieveTableRsp** pRsp, int32_t* contLen, bool* continueExec);
/**
/**
* return the transporter context (RPC)
* return the transporter context (RPC)
...
@@ -81,7 +87,7 @@ int32_t qKillTask(qTaskInfo_t qinfo);
...
@@ -81,7 +87,7 @@ int32_t qKillTask(qTaskInfo_t qinfo);
* @param qinfo
* @param qinfo
* @return
* @return
*/
*/
int32_t
qIs
Query
Completed
(
qTaskInfo_t
qinfo
);
int32_t
qIs
Task
Completed
(
qTaskInfo_t
qinfo
);
/**
/**
* destroy query info structure
* destroy query info structure
...
@@ -113,7 +119,7 @@ int32_t qGetQualifiedTableIdList(void* pTableList, const char* tagCond, int32_t
...
@@ -113,7 +119,7 @@ int32_t qGetQualifiedTableIdList(void* pTableList, const char* tagCond, int32_t
* @param numOfIndex
* @param numOfIndex
* @return
* @return
*/
*/
int32_t
qCreateTableGroupByGroupExpr
(
SArray
*
pTableIdList
,
TSKEY
skey
,
STableGroupInfo
groupInfo
,
SColIndex
*
groupByIndex
,
int32_t
numOfIndex
);
//
int32_t qCreateTableGroupByGroupExpr(SArray* pTableIdList, TSKEY skey, STableGroupInfo groupInfo, SColIndex* groupByIndex, int32_t numOfIndex);
/**
/**
* Update the table id list of a given query.
* Update the table id list of a given query.
...
...
include/libs/planner/planner.h
浏览文件 @
32f9383a
...
@@ -114,7 +114,7 @@ typedef struct SProjectPhyNode {
...
@@ -114,7 +114,7 @@ typedef struct SProjectPhyNode {
typedef
struct
SExchangePhyNode
{
typedef
struct
SExchangePhyNode
{
SPhyNode
node
;
SPhyNode
node
;
uint64_t
srcTemplateId
;
// template id of datasource suplans
uint64_t
srcTemplateId
;
// template id of datasource suplans
SArray
*
pSrcEndPoints
;
// SEpAddr
Msg
, scheduler fill by calling qSetSuplanExecutionNode
SArray
*
pSrcEndPoints
;
// SEpAddr, scheduler fill by calling qSetSuplanExecutionNode
}
SExchangePhyNode
;
}
SExchangePhyNode
;
typedef
struct
SSubplanId
{
typedef
struct
SSubplanId
{
...
...
include/libs/qcom/query.h
浏览文件 @
32f9383a
...
@@ -35,6 +35,7 @@ enum {
...
@@ -35,6 +35,7 @@ enum {
JOB_TASK_STATUS_CANCELLING
,
JOB_TASK_STATUS_CANCELLING
,
JOB_TASK_STATUS_CANCELLED
,
JOB_TASK_STATUS_CANCELLED
,
JOB_TASK_STATUS_DROPPING
,
JOB_TASK_STATUS_DROPPING
,
JOB_TASK_STATUS_FREEING
,
};
};
typedef
struct
STableComInfo
{
typedef
struct
STableComInfo
{
...
...
include/libs/scheduler/scheduler.h
浏览文件 @
32f9383a
...
@@ -20,8 +20,10 @@
...
@@ -20,8 +20,10 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#include "planner.h"
#include "catalog.h"
#include "catalog.h"
#include "planner.h"
struct
SSchJob
;
typedef
struct
SSchedulerCfg
{
typedef
struct
SSchedulerCfg
{
uint32_t
maxJobNum
;
uint32_t
maxJobNum
;
...
@@ -65,7 +67,7 @@ int32_t schedulerInit(SSchedulerCfg *cfg);
...
@@ -65,7 +67,7 @@ int32_t schedulerInit(SSchedulerCfg *cfg);
* @param nodeList Qnode/Vnode address list, element is SQueryNodeAddr
* @param nodeList Qnode/Vnode address list, element is SQueryNodeAddr
* @return
* @return
*/
*/
int32_t
scheduleExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
void
**
pJob
,
SQueryResult
*
pRes
);
int32_t
scheduleExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
struct
SSchJob
**
pJob
,
SQueryResult
*
pRes
);
/**
/**
* Process the query job, generated according to the query physical plan.
* Process the query job, generated according to the query physical plan.
...
@@ -73,7 +75,7 @@ int32_t scheduleExecJob(void *transport, SArray *nodeList, SQueryDag* pDag, void
...
@@ -73,7 +75,7 @@ int32_t scheduleExecJob(void *transport, SArray *nodeList, SQueryDag* pDag, void
* @param nodeList Qnode/Vnode address list, element is SQueryNodeAddr
* @param nodeList Qnode/Vnode address list, element is SQueryNodeAddr
* @return
* @return
*/
*/
int32_t
scheduleAsyncExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
void
**
pJob
);
int32_t
scheduleAsyncExecJob
(
void
*
transport
,
SArray
*
nodeList
,
SQueryDag
*
pDag
,
struct
SSchJob
**
pJob
);
/**
/**
* Fetch query result from the remote query executor
* Fetch query result from the remote query executor
...
@@ -81,7 +83,7 @@ int32_t scheduleAsyncExecJob(void *transport, SArray *nodeList, SQueryDag* pDag,
...
@@ -81,7 +83,7 @@ int32_t scheduleAsyncExecJob(void *transport, SArray *nodeList, SQueryDag* pDag,
* @param data
* @param data
* @return
* @return
*/
*/
int32_t
scheduleFetchRows
(
void
*
pJob
,
void
**
data
);
int32_t
scheduleFetchRows
(
struct
SSchJob
*
pJob
,
void
**
data
);
/**
/**
...
@@ -89,7 +91,7 @@ int32_t scheduleFetchRows(void *pJob, void **data);
...
@@ -89,7 +91,7 @@ int32_t scheduleFetchRows(void *pJob, void **data);
* @param pJob
* @param pJob
* @return
* @return
*/
*/
int32_t
scheduleCancelJob
(
void
*
pJob
);
//
int32_t scheduleCancelJob(void *pJob);
/**
/**
* Free the query job
* Free the query job
...
...
include/libs/transport/trpc.h
浏览文件 @
32f9383a
...
@@ -101,11 +101,11 @@ typedef struct SMsgSendInfo {
...
@@ -101,11 +101,11 @@ typedef struct SMsgSendInfo {
SDataBuf
msgInfo
;
SDataBuf
msgInfo
;
}
SMsgSendInfo
;
}
SMsgSendInfo
;
typedef
struct
SQueryNodeAddr
{
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
//
vgId or qnodeId
int32_t
nodeId
;
//
vgId or qnodeId
int8_t
inUse
;
int8_t
inUse
;
int8_t
numOfEps
;
int8_t
numOfEps
;
SEpAddr
Msg
epAddr
[
TSDB_MAX_REPLICA
];
SEpAddr
epAddr
[
TSDB_MAX_REPLICA
];
}
SQueryNodeAddr
;
}
SQueryNodeAddr
;
bool
tIsValidSchema
(
struct
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
numOfTags
);
bool
tIsValidSchema
(
struct
SSchema
*
pSchema
,
int32_t
numOfCols
,
int32_t
numOfTags
);
...
...
include/libs/wal/wal.h
浏览文件 @
32f9383a
...
@@ -71,6 +71,7 @@ extern int32_t wDebugFlag;
...
@@ -71,6 +71,7 @@ extern int32_t wDebugFlag;
#define WAL_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead))
#define WAL_MAX_SIZE (TSDB_MAX_WAL_SIZE + sizeof(SWalHead))
#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12)
#define WAL_PATH_LEN (TSDB_FILENAME_LEN + 12)
#define WAL_FILE_LEN (WAL_PATH_LEN + 32)
#define WAL_FILE_LEN (WAL_PATH_LEN + 32)
#define WAL_MAGIC 0xFAFBFCFDULL
#define WAL_CUR_FAILED 1
#define WAL_CUR_FAILED 1
...
@@ -98,6 +99,7 @@ typedef struct {
...
@@ -98,6 +99,7 @@ typedef struct {
}
SWalCfg
;
}
SWalCfg
;
typedef
struct
{
typedef
struct
{
uint64_t
magic
;
uint32_t
cksumHead
;
uint32_t
cksumHead
;
uint32_t
cksumBody
;
uint32_t
cksumBody
;
SWalReadHead
head
;
SWalReadHead
head
;
...
...
source/client/inc/clientInt.h
浏览文件 @
32f9383a
...
@@ -113,6 +113,7 @@ typedef struct SRequestSendRecvBody {
...
@@ -113,6 +113,7 @@ typedef struct SRequestSendRecvBody {
tsem_t
rspSem
;
// not used now
tsem_t
rspSem
;
// not used now
void
*
fp
;
void
*
fp
;
SShowReqInfo
showInfo
;
// todo this attribute will be removed after the query framework being completed.
SShowReqInfo
showInfo
;
// todo this attribute will be removed after the query framework being completed.
struct
SSchJob
*
pQueryJob
;
// query job, created according to sql query DAG.
SDataBuf
requestMsg
;
SDataBuf
requestMsg
;
SReqResultInfo
resInfo
;
SReqResultInfo
resInfo
;
}
SRequestSendRecvBody
;
}
SRequestSendRecvBody
;
...
@@ -129,7 +130,7 @@ typedef struct SRequestObj {
...
@@ -129,7 +130,7 @@ typedef struct SRequestObj {
char
*
msgBuf
;
char
*
msgBuf
;
void
*
pInfo
;
// sql parse info, generated by parser module
void
*
pInfo
;
// sql parse info, generated by parser module
int32_t
code
;
int32_t
code
;
uint64_t
affectedRows
;
uint64_t
affectedRows
;
// todo remove it
SQueryExecMetric
metric
;
SQueryExecMetric
metric
;
SRequestSendRecvBody
body
;
SRequestSendRecvBody
body
;
}
SRequestObj
;
}
SRequestObj
;
...
@@ -161,12 +162,13 @@ int taos_options_imp(TSDB_OPTION option, const char *str);
...
@@ -161,12 +162,13 @@ int taos_options_imp(TSDB_OPTION option, const char *str);
void
*
openTransporter
(
const
char
*
user
,
const
char
*
auth
,
int32_t
numOfThreads
);
void
*
openTransporter
(
const
char
*
user
,
const
char
*
auth
,
int32_t
numOfThreads
);
void
processMsgFromServer
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
processMsgFromServer
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
);
void
initMsgHandleFp
();
void
initMsgHandleFp
();
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
TAOS_RES
*
taos_query_l
(
TAOS
*
taos
,
const
char
*
sql
,
int
sqlLen
);
void
*
doFetchRow
(
SRequestObj
*
pRequest
);
void
*
doFetchRow
(
SRequestObj
*
pRequest
);
void
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
);
void
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
);
#ifdef __cplusplus
#ifdef __cplusplus
...
...
source/client/src/clientImpl.c
浏览文件 @
32f9383a
#include "../../libs/scheduler/inc/schedulerInt.h"
#include "clientInt.h"
#include "clientInt.h"
#include "clientLog.h"
#include "clientLog.h"
#include "parser.h"
#include "planner.h"
#include "scheduler.h"
#include "tdef.h"
#include "tdef.h"
#include "tep.h"
#include "tep.h"
#include "tglobal.h"
#include "tglobal.h"
...
@@ -8,9 +12,6 @@
...
@@ -8,9 +12,6 @@
#include "tnote.h"
#include "tnote.h"
#include "tpagedfile.h"
#include "tpagedfile.h"
#include "tref.h"
#include "tref.h"
#include "parser.h"
#include "planner.h"
#include "scheduler.h"
#define CHECK_CODE_GOTO(expr, lable) \
#define CHECK_CODE_GOTO(expr, lable) \
do { \
do { \
...
@@ -57,6 +58,7 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i
...
@@ -57,6 +58,7 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i
}
}
static
STscObj
*
taosConnectImpl
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
,
__taos_async_fn_t
fp
,
void
*
param
,
SAppInstInfo
*
pAppInfo
);
static
STscObj
*
taosConnectImpl
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
,
__taos_async_fn_t
fp
,
void
*
param
,
SAppInstInfo
*
pAppInfo
);
static
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SDataBlockSchema
*
pDataBlockSchema
);
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
)
{
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
)
{
if
(
taos_init
()
!=
TSDB_CODE_SUCCESS
)
{
if
(
taos_init
()
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -197,19 +199,49 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) {
...
@@ -197,19 +199,49 @@ int32_t execDdlQuery(SRequestObj* pRequest, SQueryNode* pQuery) {
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQueryNode
*
pQueryNode
,
SQueryDag
**
pDag
)
{
int32_t
getPlan
(
SRequestObj
*
pRequest
,
SQueryNode
*
pQueryNode
,
SQueryDag
**
pDag
)
{
pRequest
->
type
=
pQueryNode
->
type
;
pRequest
->
type
=
pQueryNode
->
type
;
return
qCreateQueryDag
(
pQueryNode
,
pDag
,
pRequest
->
requestId
);
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
int32_t
code
=
qCreateQueryDag
(
pQueryNode
,
pDag
,
pRequest
->
requestId
);
if
(
code
!=
0
)
{
return
code
;
}
if
(
pQueryNode
->
type
==
TSDB_SQL_SELECT
)
{
SArray
*
pa
=
taosArrayGetP
((
*
pDag
)
->
pSubplans
,
0
);
SSubplan
*
pPlan
=
taosArrayGetP
(
pa
,
0
);
SDataBlockSchema
*
pDataBlockSchema
=
&
(
pPlan
->
pDataSink
->
schema
);
setResSchemaInfo
(
pResInfo
,
pDataBlockSchema
);
pRequest
->
type
=
TDMT_VND_QUERY
;
}
return
code
;
}
void
setResSchemaInfo
(
SReqResultInfo
*
pResInfo
,
const
SDataBlockSchema
*
pDataBlockSchema
)
{
assert
(
pDataBlockSchema
!=
NULL
&&
pDataBlockSchema
->
numOfCols
>
0
);
pResInfo
->
numOfCols
=
pDataBlockSchema
->
numOfCols
;
pResInfo
->
fields
=
calloc
(
pDataBlockSchema
->
numOfCols
,
sizeof
(
pDataBlockSchema
->
pSchema
[
0
]));
for
(
int32_t
i
=
0
;
i
<
pResInfo
->
numOfCols
;
++
i
)
{
SSchema
*
pSchema
=
&
pDataBlockSchema
->
pSchema
[
i
];
pResInfo
->
fields
[
i
].
bytes
=
pSchema
->
bytes
;
pResInfo
->
fields
[
i
].
type
=
pSchema
->
type
;
tstrncpy
(
pResInfo
->
fields
[
i
].
name
,
pSchema
[
i
].
name
,
tListLen
(
pResInfo
->
fields
[
i
].
name
));
}
}
}
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryDag
*
pDag
,
void
**
pJob
)
{
int32_t
scheduleQuery
(
SRequestObj
*
pRequest
,
SQueryDag
*
pDag
)
{
if
(
TSDB_SQL_INSERT
==
pRequest
->
type
||
TSDB_SQL_CREATE_TABLE
==
pRequest
->
type
)
{
if
(
TSDB_SQL_INSERT
==
pRequest
->
type
||
TSDB_SQL_CREATE_TABLE
==
pRequest
->
type
)
{
SQueryResult
res
=
{.
code
=
0
,
.
numOfRows
=
0
,
.
msgSize
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
msg
=
pRequest
->
msgBuf
};
SQueryResult
res
=
{.
code
=
0
,
.
numOfRows
=
0
,
.
msgSize
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
msg
=
pRequest
->
msgBuf
};
int32_t
code
=
scheduleExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
,
pDag
,
p
Job
,
&
res
);
int32_t
code
=
scheduleExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQuery
Job
,
&
res
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
// handle error and retry
// handle error and retry
}
else
{
}
else
{
if
(
*
p
Job
!=
NULL
)
{
if
(
pRequest
->
body
.
pQuery
Job
!=
NULL
)
{
scheduleFreeJob
(
*
p
Job
);
scheduleFreeJob
(
pRequest
->
body
.
pQuery
Job
);
}
}
}
}
...
@@ -217,7 +249,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, void** pJob) {
...
@@ -217,7 +249,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryDag* pDag, void** pJob) {
return
res
.
code
;
return
res
.
code
;
}
}
return
scheduleAsyncExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
/*todo appInfo.xxx*/
,
pDag
,
p
Job
);
return
scheduleAsyncExecJob
(
pRequest
->
pTscObj
->
pTransporter
,
NULL
,
pDag
,
&
pRequest
->
body
.
pQuery
Job
);
}
}
TAOS_RES
*
tmq_create_topic
(
TAOS
*
taos
,
const
char
*
name
,
const
char
*
sql
,
int
sqlLen
)
{
TAOS_RES
*
tmq_create_topic
(
TAOS
*
taos
,
const
char
*
name
,
const
char
*
sql
,
int
sqlLen
)
{
...
@@ -294,7 +326,6 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
...
@@ -294,7 +326,6 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
SRequestObj
*
pRequest
=
NULL
;
SRequestObj
*
pRequest
=
NULL
;
SQueryNode
*
pQuery
=
NULL
;
SQueryNode
*
pQuery
=
NULL
;
SQueryDag
*
pDag
=
NULL
;
SQueryDag
*
pDag
=
NULL
;
void
*
pJob
=
NULL
;
terrno
=
TSDB_CODE_SUCCESS
;
terrno
=
TSDB_CODE_SUCCESS
;
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
CHECK_CODE_GOTO
(
buildRequest
(
pTscObj
,
sql
,
sqlLen
,
&
pRequest
),
_return
);
...
@@ -304,9 +335,8 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
...
@@ -304,9 +335,8 @@ TAOS_RES *taos_query_l(TAOS *taos, const char *sql, int sqlLen) {
CHECK_CODE_GOTO
(
execDdlQuery
(
pRequest
,
pQuery
),
_return
);
CHECK_CODE_GOTO
(
execDdlQuery
(
pRequest
,
pQuery
),
_return
);
}
else
{
}
else
{
CHECK_CODE_GOTO
(
getPlan
(
pRequest
,
pQuery
,
&
pDag
),
_return
);
CHECK_CODE_GOTO
(
getPlan
(
pRequest
,
pQuery
,
&
pDag
),
_return
);
CHECK_CODE_GOTO
(
scheduleQuery
(
pRequest
,
pDag
,
&
pJob
),
_return
);
CHECK_CODE_GOTO
(
scheduleQuery
(
pRequest
,
pDag
),
_return
);
pRequest
->
code
=
terrno
;
pRequest
->
code
=
terrno
;
return
pRequest
;
}
}
_return:
_return:
...
@@ -315,6 +345,7 @@ _return:
...
@@ -315,6 +345,7 @@ _return:
if
(
NULL
!=
pRequest
&&
TSDB_CODE_SUCCESS
!=
terrno
)
{
if
(
NULL
!=
pRequest
&&
TSDB_CODE_SUCCESS
!=
terrno
)
{
pRequest
->
code
=
terrno
;
pRequest
->
code
=
terrno
;
}
}
return
pRequest
;
return
pRequest
;
}
}
...
@@ -513,7 +544,17 @@ void* doFetchRow(SRequestObj* pRequest) {
...
@@ -513,7 +544,17 @@ void* doFetchRow(SRequestObj* pRequest) {
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
if
(
pResultInfo
->
pData
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
numOfRows
)
{
if
(
pResultInfo
->
pData
==
NULL
||
pResultInfo
->
current
>=
pResultInfo
->
numOfRows
)
{
if
(
pRequest
->
type
==
TDMT_MND_SHOW
)
{
if
(
pRequest
->
type
==
TDMT_VND_QUERY
)
{
pRequest
->
type
=
TDMT_VND_FETCH
;
scheduleFetchRows
(
pRequest
->
body
.
pQueryJob
,
(
void
**
)
&
pRequest
->
body
.
resInfo
.
pData
);
pResultInfo
->
current
=
0
;
if
(
pResultInfo
->
numOfRows
<=
pResultInfo
->
current
)
{
return
NULL
;
}
goto
_return
;
}
else
if
(
pRequest
->
type
==
TDMT_MND_SHOW
)
{
pRequest
->
type
=
TDMT_MND_SHOW_RETRIEVE
;
pRequest
->
type
=
TDMT_MND_SHOW_RETRIEVE
;
}
else
if
(
pRequest
->
type
==
TDMT_VND_SHOW_TABLES
)
{
}
else
if
(
pRequest
->
type
==
TDMT_VND_SHOW_TABLES
)
{
pRequest
->
type
=
TDMT_VND_SHOW_TABLES_FETCH
;
pRequest
->
type
=
TDMT_VND_SHOW_TABLES_FETCH
;
...
@@ -556,6 +597,8 @@ void* doFetchRow(SRequestObj* pRequest) {
...
@@ -556,6 +597,8 @@ void* doFetchRow(SRequestObj* pRequest) {
}
}
}
}
_return:
for
(
int32_t
i
=
0
;
i
<
pResultInfo
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pResultInfo
->
numOfCols
;
++
i
)
{
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
]
+
pResultInfo
->
fields
[
i
].
bytes
*
pResultInfo
->
current
;
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
]
+
pResultInfo
->
fields
[
i
].
bytes
*
pResultInfo
->
current
;
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pResultInfo
->
fields
[
i
].
type
))
{
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
32f9383a
...
@@ -130,7 +130,7 @@ int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -130,7 +130,7 @@ int32_t processShowRsp(void* param, const SDataBuf* pMsg, int32_t code) {
SShowRsp
*
pShow
=
(
SShowRsp
*
)
pMsg
->
pData
;
SShowRsp
*
pShow
=
(
SShowRsp
*
)
pMsg
->
pData
;
pShow
->
showId
=
htobe64
(
pShow
->
showId
);
pShow
->
showId
=
htobe64
(
pShow
->
showId
);
STableMeta
Msg
*
pMetaMsg
=
&
(
pShow
->
tableMeta
);
STableMeta
Rsp
*
pMetaMsg
=
&
(
pShow
->
tableMeta
);
pMetaMsg
->
numOfColumns
=
htonl
(
pMetaMsg
->
numOfColumns
);
pMetaMsg
->
numOfColumns
=
htonl
(
pMetaMsg
->
numOfColumns
);
SSchema
*
pSchema
=
pMetaMsg
->
pSchema
;
SSchema
*
pSchema
=
pMetaMsg
->
pSchema
;
...
...
source/client/test/clientTests.cpp
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/common/src/tglobal.c
浏览文件 @
32f9383a
...
@@ -37,7 +37,7 @@ uint16_t tsServerPort = 6030;
...
@@ -37,7 +37,7 @@ uint16_t tsServerPort = 6030;
int32_t
tsStatusInterval
=
1
;
// second
int32_t
tsStatusInterval
=
1
;
// second
int8_t
tsEnableTelemetryReporting
=
0
;
int8_t
tsEnableTelemetryReporting
=
0
;
char
tsEmail
[
TSDB_FQDN_LEN
]
=
{
0
};
char
tsEmail
[
TSDB_FQDN_LEN
]
=
{
0
};
int32_t
tsNumOfSupportVnodes
=
1
6
;
int32_t
tsNumOfSupportVnodes
=
1
28
;
// common
// common
int32_t
tsRpcTimer
=
300
;
int32_t
tsRpcTimer
=
300
;
...
...
source/dnode/mgmt/impl/inc/dndInt.h
浏览文件 @
32f9383a
...
@@ -94,6 +94,7 @@ typedef struct {
...
@@ -94,6 +94,7 @@ typedef struct {
pthread_t
*
threadId
;
pthread_t
*
threadId
;
SRWLatch
latch
;
SRWLatch
latch
;
SDnodeWorker
mgmtWorker
;
SDnodeWorker
mgmtWorker
;
SDnodeWorker
statusWorker
;
}
SDnodeMgmt
;
}
SDnodeMgmt
;
typedef
struct
{
typedef
struct
{
...
@@ -167,7 +168,7 @@ typedef struct SDnode {
...
@@ -167,7 +168,7 @@ typedef struct SDnode {
SBnodeMgmt
bmgmt
;
SBnodeMgmt
bmgmt
;
SVnodesMgmt
vmgmt
;
SVnodesMgmt
vmgmt
;
STransMgmt
tmgmt
;
STransMgmt
tmgmt
;
SStartup
Msg
startup
;
SStartup
Req
startup
;
}
SDnode
;
}
SDnode
;
EStat
dndGetStat
(
SDnode
*
pDnode
);
EStat
dndGetStat
(
SDnode
*
pDnode
);
...
@@ -175,7 +176,7 @@ void dndSetStat(SDnode *pDnode, EStat stat);
...
@@ -175,7 +176,7 @@ void dndSetStat(SDnode *pDnode, EStat stat);
char
*
dndStatStr
(
EStat
stat
);
char
*
dndStatStr
(
EStat
stat
);
void
dndReportStartup
(
SDnode
*
pDnode
,
char
*
pName
,
char
*
pDesc
);
void
dndReportStartup
(
SDnode
*
pDnode
,
char
*
pName
,
char
*
pDesc
);
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartup
Msg
*
pStartup
);
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartup
Req
*
pStartup
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/mgmt/impl/inc/dndVnodes.h
浏览文件 @
32f9383a
...
@@ -36,6 +36,8 @@ int32_t dndProcessAuthVnodeReq(SDnode *pDnode, SRpcMsg *pReq);
...
@@ -36,6 +36,8 @@ int32_t dndProcessAuthVnodeReq(SDnode *pDnode, SRpcMsg *pReq);
int32_t
dndProcessSyncVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
dndProcessSyncVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
dndProcessCompactVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
dndProcessCompactVnodeReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
int32_t
dndPutReqToVQueryQ
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/mgmt/impl/src/dndMgmt.c
浏览文件 @
32f9383a
...
@@ -473,12 +473,12 @@ static int32_t dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
...
@@ -473,12 +473,12 @@ static int32_t dndProcessConfigDnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
void
dndProcessStartupReq
(
SDnode
*
pDnode
,
SRpcMsg
*
pReq
)
{
dDebug
(
"startup req is received"
);
dDebug
(
"startup req is received"
);
SStartup
Msg
*
pStartup
=
rpcMallocCont
(
sizeof
(
SStartupMsg
));
SStartup
Req
*
pStartup
=
rpcMallocCont
(
sizeof
(
SStartupReq
));
dndGetStartup
(
pDnode
,
pStartup
);
dndGetStartup
(
pDnode
,
pStartup
);
dDebug
(
"startup req is sent, step:%s desc:%s finished:%d"
,
pStartup
->
name
,
pStartup
->
desc
,
pStartup
->
finished
);
dDebug
(
"startup req is sent, step:%s desc:%s finished:%d"
,
pStartup
->
name
,
pStartup
->
desc
,
pStartup
->
finished
);
SRpcMsg
rpcRsp
=
{.
handle
=
pReq
->
handle
,
.
pCont
=
pStartup
,
.
contLen
=
sizeof
(
SStartup
Msg
)};
SRpcMsg
rpcRsp
=
{.
handle
=
pReq
->
handle
,
.
pCont
=
pStartup
,
.
contLen
=
sizeof
(
SStartup
Req
)};
rpcSendResponse
(
&
rpcRsp
);
rpcSendResponse
(
&
rpcRsp
);
}
}
...
@@ -536,6 +536,11 @@ int32_t dndInitMgmt(SDnode *pDnode) {
...
@@ -536,6 +536,11 @@ int32_t dndInitMgmt(SDnode *pDnode) {
return
-
1
;
return
-
1
;
}
}
if
(
dndInitWorker
(
pDnode
,
&
pMgmt
->
statusWorker
,
DND_WORKER_SINGLE
,
"dnode-status"
,
1
,
1
,
dndProcessMgmtQueue
)
!=
0
)
{
dError
(
"failed to start dnode mgmt worker since %s"
,
terrstr
());
return
-
1
;
}
pMgmt
->
threadId
=
taosCreateThread
(
dnodeThreadRoutine
,
pDnode
);
pMgmt
->
threadId
=
taosCreateThread
(
dnodeThreadRoutine
,
pDnode
);
if
(
pMgmt
->
threadId
==
NULL
)
{
if
(
pMgmt
->
threadId
==
NULL
)
{
dError
(
"failed to init dnode thread"
);
dError
(
"failed to init dnode thread"
);
...
@@ -550,6 +555,7 @@ int32_t dndInitMgmt(SDnode *pDnode) {
...
@@ -550,6 +555,7 @@ int32_t dndInitMgmt(SDnode *pDnode) {
void
dndStopMgmt
(
SDnode
*
pDnode
)
{
void
dndStopMgmt
(
SDnode
*
pDnode
)
{
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
SDnodeMgmt
*
pMgmt
=
&
pDnode
->
dmgmt
;
dndCleanupWorker
(
&
pMgmt
->
mgmtWorker
);
dndCleanupWorker
(
&
pMgmt
->
mgmtWorker
);
dndCleanupWorker
(
&
pMgmt
->
statusWorker
);
if
(
pMgmt
->
threadId
!=
NULL
)
{
if
(
pMgmt
->
threadId
!=
NULL
)
{
taosDestoryThread
(
pMgmt
->
threadId
);
taosDestoryThread
(
pMgmt
->
threadId
);
...
@@ -587,7 +593,12 @@ void dndProcessMgmtMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
...
@@ -587,7 +593,12 @@ void dndProcessMgmtMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
dndUpdateMnodeEpSet
(
pDnode
,
pEpSet
);
dndUpdateMnodeEpSet
(
pDnode
,
pEpSet
);
}
}
if
(
dndWriteMsgToWorker
(
&
pMgmt
->
mgmtWorker
,
pMsg
,
sizeof
(
SRpcMsg
))
!=
0
)
{
SDnodeWorker
*
pWorker
=
&
pMgmt
->
mgmtWorker
;
if
(
pMsg
->
msgType
==
TDMT_MND_STATUS_RSP
)
{
pWorker
=
&
pMgmt
->
statusWorker
;
}
if
(
dndWriteMsgToWorker
(
pWorker
,
pMsg
,
sizeof
(
SRpcMsg
))
!=
0
)
{
if
(
pMsg
->
msgType
&
1u
)
{
if
(
pMsg
->
msgType
&
1u
)
{
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
handle
,
.
code
=
TSDB_CODE_OUT_OF_MEMORY
};
SRpcMsg
rsp
=
{.
handle
=
pMsg
->
handle
,
.
code
=
TSDB_CODE_OUT_OF_MEMORY
};
rpcSendResponse
(
&
rsp
);
rpcSendResponse
(
&
rsp
);
...
...
source/dnode/mgmt/impl/src/dndVnodes.c
浏览文件 @
32f9383a
...
@@ -381,7 +381,8 @@ static void *dnodeOpenVnodeFunc(void *param) {
...
@@ -381,7 +381,8 @@ static void *dnodeOpenVnodeFunc(void *param) {
pMgmt
->
openVnodes
,
pMgmt
->
totalVnodes
);
pMgmt
->
openVnodes
,
pMgmt
->
totalVnodes
);
dndReportStartup
(
pDnode
,
"open-vnodes"
,
stepDesc
);
dndReportStartup
(
pDnode
,
"open-vnodes"
,
stepDesc
);
SVnode
*
pImpl
=
vnodeOpen
(
pCfg
->
path
,
NULL
,
pCfg
->
vgId
);
SVnodeCfg
cfg
=
{.
pDnode
=
pDnode
,
.
vgId
=
pCfg
->
vgId
};
SVnode
*
pImpl
=
vnodeOpen
(
pCfg
->
path
,
&
cfg
);
if
(
pImpl
==
NULL
)
{
if
(
pImpl
==
NULL
)
{
dError
(
"vgId:%d, failed to open vnode by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
dError
(
"vgId:%d, failed to open vnode by thread:%d"
,
pCfg
->
vgId
,
pThread
->
threadIndex
);
pThread
->
failed
++
;
pThread
->
failed
++
;
...
@@ -581,7 +582,8 @@ int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
...
@@ -581,7 +582,8 @@ int32_t dndProcessCreateVnodeReq(SDnode *pDnode, SRpcMsg *pReq) {
return
-
1
;
return
-
1
;
}
}
SVnode
*
pImpl
=
vnodeOpen
(
wrapperCfg
.
path
,
NULL
/*pCfg*/
,
pCreate
->
vgId
);
vnodeCfg
.
pDnode
=
pDnode
;
SVnode
*
pImpl
=
vnodeOpen
(
wrapperCfg
.
path
,
&
vnodeCfg
);
if
(
pImpl
==
NULL
)
{
if
(
pImpl
==
NULL
)
{
dError
(
"vgId:%d, failed to create vnode since %s"
,
pCreate
->
vgId
,
terrstr
());
dError
(
"vgId:%d, failed to create vnode since %s"
,
pCreate
->
vgId
,
terrstr
());
return
-
1
;
return
-
1
;
...
@@ -800,7 +802,7 @@ static void dndProcessVnodeSyncQueue(SVnodeObj *pVnode, STaosQall *qall, int32_t
...
@@ -800,7 +802,7 @@ static void dndProcessVnodeSyncQueue(SVnodeObj *pVnode, STaosQall *qall, int32_t
}
}
}
}
static
int32_t
dndWriteRpcMsgToVnodeQueue
(
STaosQueue
*
pQueue
,
SRpcMsg
*
pRpcMsg
)
{
static
int32_t
dndWriteRpcMsgToVnodeQueue
(
STaosQueue
*
pQueue
,
SRpcMsg
*
pRpcMsg
,
bool
sendRsp
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
pQueue
==
NULL
)
{
if
(
pQueue
==
NULL
)
{
...
@@ -817,13 +819,15 @@ static int32_t dndWriteRpcMsgToVnodeQueue(STaosQueue *pQueue, SRpcMsg *pRpcMsg)
...
@@ -817,13 +819,15 @@ static int32_t dndWriteRpcMsgToVnodeQueue(STaosQueue *pQueue, SRpcMsg *pRpcMsg)
}
}
}
}
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
&&
sendRsp
)
{
if
(
pRpcMsg
->
msgType
&
1u
)
{
if
(
pRpcMsg
->
msgType
&
1u
)
{
SRpcMsg
rsp
=
{.
handle
=
pRpcMsg
->
handle
,
.
code
=
code
};
SRpcMsg
rsp
=
{.
handle
=
pRpcMsg
->
handle
,
.
code
=
code
};
rpcSendResponse
(
&
rsp
);
rpcSendResponse
(
&
rsp
);
}
}
rpcFreeCont
(
pRpcMsg
->
pCont
);
rpcFreeCont
(
pRpcMsg
->
pCont
);
}
}
return
code
;
}
}
static
SVnodeObj
*
dndAcquireVnodeFromMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
static
SVnodeObj
*
dndAcquireVnodeFromMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
...
@@ -846,7 +850,7 @@ static SVnodeObj *dndAcquireVnodeFromMsg(SDnode *pDnode, SRpcMsg *pMsg) {
...
@@ -846,7 +850,7 @@ static SVnodeObj *dndAcquireVnodeFromMsg(SDnode *pDnode, SRpcMsg *pMsg) {
void
dndProcessVnodeWriteMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
void
dndProcessVnodeWriteMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
if
(
pVnode
!=
NULL
)
{
if
(
pVnode
!=
NULL
)
{
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pWriteQ
,
pMsg
);
(
void
)
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pWriteQ
,
pMsg
,
true
);
dndReleaseVnode
(
pDnode
,
pVnode
);
dndReleaseVnode
(
pDnode
,
pVnode
);
}
}
}
}
...
@@ -854,7 +858,7 @@ void dndProcessVnodeWriteMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
...
@@ -854,7 +858,7 @@ void dndProcessVnodeWriteMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
void
dndProcessVnodeSyncMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
void
dndProcessVnodeSyncMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
if
(
pVnode
!=
NULL
)
{
if
(
pVnode
!=
NULL
)
{
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pSyncQ
,
pMsg
);
(
void
)
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pSyncQ
,
pMsg
,
true
);
dndReleaseVnode
(
pDnode
,
pVnode
);
dndReleaseVnode
(
pDnode
,
pVnode
);
}
}
}
}
...
@@ -862,7 +866,7 @@ void dndProcessVnodeSyncMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
...
@@ -862,7 +866,7 @@ void dndProcessVnodeSyncMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
void
dndProcessVnodeQueryMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
void
dndProcessVnodeQueryMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
if
(
pVnode
!=
NULL
)
{
if
(
pVnode
!=
NULL
)
{
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pQueryQ
,
pMsg
);
(
void
)
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pQueryQ
,
pMsg
,
true
);
dndReleaseVnode
(
pDnode
,
pVnode
);
dndReleaseVnode
(
pDnode
,
pVnode
);
}
}
}
}
...
@@ -870,11 +874,23 @@ void dndProcessVnodeQueryMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
...
@@ -870,11 +874,23 @@ void dndProcessVnodeQueryMsg(SDnode *pDnode, SRpcMsg *pMsg, SEpSet *pEpSet) {
void
dndProcessVnodeFetchMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
void
dndProcessVnodeFetchMsg
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
SVnodeObj
*
pVnode
=
dndAcquireVnodeFromMsg
(
pDnode
,
pMsg
);
if
(
pVnode
!=
NULL
)
{
if
(
pVnode
!=
NULL
)
{
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pFetchQ
,
pMsg
);
(
void
)
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pFetchQ
,
pMsg
,
true
);
dndReleaseVnode
(
pDnode
,
pVnode
);
dndReleaseVnode
(
pDnode
,
pVnode
);
}
}
}
}
int32_t
dndPutReqToVQueryQ
(
SDnode
*
pDnode
,
SRpcMsg
*
pMsg
)
{
SMsgHead
*
pHead
=
pMsg
->
pCont
;
// pHead->vgId = htonl(pHead->vgId);
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
pHead
->
vgId
);
if
(
pVnode
==
NULL
)
return
-
1
;
int32_t
code
=
dndWriteRpcMsgToVnodeQueue
(
pVnode
->
pFetchQ
,
pMsg
,
false
);
dndReleaseVnode
(
pDnode
,
pVnode
);
return
code
;
}
static
int32_t
dndPutMsgIntoVnodeApplyQueue
(
SDnode
*
pDnode
,
int32_t
vgId
,
SRpcMsg
*
pMsg
)
{
static
int32_t
dndPutMsgIntoVnodeApplyQueue
(
SDnode
*
pDnode
,
int32_t
vgId
,
SRpcMsg
*
pMsg
)
{
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
vgId
);
SVnodeObj
*
pVnode
=
dndAcquireVnode
(
pDnode
,
vgId
);
if
(
pVnode
==
NULL
)
return
-
1
;
if
(
pVnode
==
NULL
)
return
-
1
;
...
...
source/dnode/mgmt/impl/src/dnode.c
浏览文件 @
32f9383a
...
@@ -22,8 +22,8 @@
...
@@ -22,8 +22,8 @@
#include "dndTransport.h"
#include "dndTransport.h"
#include "dndVnodes.h"
#include "dndVnodes.h"
#include "sync.h"
#include "sync.h"
#include "wal.h"
#include "tfs.h"
#include "tfs.h"
#include "wal.h"
EStat
dndGetStat
(
SDnode
*
pDnode
)
{
return
pDnode
->
stat
;
}
EStat
dndGetStat
(
SDnode
*
pDnode
)
{
return
pDnode
->
stat
;
}
...
@@ -46,14 +46,14 @@ char *dndStatStr(EStat stat) {
...
@@ -46,14 +46,14 @@ char *dndStatStr(EStat stat) {
}
}
void
dndReportStartup
(
SDnode
*
pDnode
,
char
*
pName
,
char
*
pDesc
)
{
void
dndReportStartup
(
SDnode
*
pDnode
,
char
*
pName
,
char
*
pDesc
)
{
SStartup
Msg
*
pStartup
=
&
pDnode
->
startup
;
SStartup
Req
*
pStartup
=
&
pDnode
->
startup
;
tstrncpy
(
pStartup
->
name
,
pName
,
TSDB_STEP_NAME_LEN
);
tstrncpy
(
pStartup
->
name
,
pName
,
TSDB_STEP_NAME_LEN
);
tstrncpy
(
pStartup
->
desc
,
pDesc
,
TSDB_STEP_DESC_LEN
);
tstrncpy
(
pStartup
->
desc
,
pDesc
,
TSDB_STEP_DESC_LEN
);
pStartup
->
finished
=
0
;
pStartup
->
finished
=
0
;
}
}
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartup
Msg
*
pStartup
)
{
void
dndGetStartup
(
SDnode
*
pDnode
,
SStartup
Req
*
pStartup
)
{
memcpy
(
pStartup
,
&
pDnode
->
startup
,
sizeof
(
SStartup
Msg
));
memcpy
(
pStartup
,
&
pDnode
->
startup
,
sizeof
(
SStartup
Req
));
pStartup
->
finished
=
(
dndGetStat
(
pDnode
)
==
DND_STAT_RUNNING
);
pStartup
->
finished
=
(
dndGetStat
(
pDnode
)
==
DND_STAT_RUNNING
);
}
}
...
@@ -196,7 +196,15 @@ SDnode *dndInit(SDnodeOpt *pOption) {
...
@@ -196,7 +196,15 @@ SDnode *dndInit(SDnodeOpt *pOption) {
return
NULL
;
return
NULL
;
}
}
if
(
vnodeInit
(
pDnode
->
opt
.
numOfCommitThreads
)
!=
0
)
{
SVnodeOpt
vnodeOpt
=
{
.
sver
=
pDnode
->
opt
.
sver
,
.
timezone
=
pDnode
->
opt
.
timezone
,
.
locale
=
pDnode
->
opt
.
locale
,
.
charset
=
pDnode
->
opt
.
charset
,
.
nthreads
=
pDnode
->
opt
.
numOfCommitThreads
,
.
putReqToVQueryQFp
=
dndPutReqToVQueryQ
,
};
if
(
vnodeInit
(
&
vnodeOpt
)
!=
0
)
{
dError
(
"failed to init vnode env"
);
dError
(
"failed to init vnode env"
);
dndCleanup
(
pDnode
);
dndCleanup
(
pDnode
);
return
NULL
;
return
NULL
;
...
...
source/dnode/mgmt/impl/test/sut/inc/sut.h
浏览文件 @
32f9383a
...
@@ -53,7 +53,7 @@ class Testbase {
...
@@ -53,7 +53,7 @@ class Testbase {
void
SendShowMetaReq
(
int8_t
showType
,
const
char
*
db
);
void
SendShowMetaReq
(
int8_t
showType
,
const
char
*
db
);
void
SendShowRetrieveReq
();
void
SendShowRetrieveReq
();
STableMeta
Msg
*
GetShowMeta
();
STableMeta
Rsp
*
GetShowMeta
();
SRetrieveTableRsp
*
GetRetrieveRsp
();
SRetrieveTableRsp
*
GetRetrieveRsp
();
int32_t
GetMetaNum
();
int32_t
GetMetaNum
();
...
@@ -74,7 +74,7 @@ class Testbase {
...
@@ -74,7 +74,7 @@ class Testbase {
private:
private:
int64_t
showId
;
int64_t
showId
;
STableMeta
Msg
*
pMeta
;
STableMeta
Rsp
*
pMeta
;
SRetrieveTableRsp
*
pRetrieveRsp
;
SRetrieveTableRsp
*
pRetrieveRsp
;
char
*
pData
;
char
*
pData
;
int32_t
pos
;
int32_t
pos
;
...
...
source/dnode/mgmt/impl/test/sut/src/sut.cpp
浏览文件 @
32f9383a
...
@@ -179,6 +179,6 @@ const char* Testbase::GetShowBinary(int32_t len) {
...
@@ -179,6 +179,6 @@ const char* Testbase::GetShowBinary(int32_t len) {
int32_t
Testbase
::
GetShowRows
()
{
return
pRetrieveRsp
->
numOfRows
;
}
int32_t
Testbase
::
GetShowRows
()
{
return
pRetrieveRsp
->
numOfRows
;
}
STableMeta
Msg
*
Testbase
::
GetShowMeta
()
{
return
pMeta
;
}
STableMeta
Rsp
*
Testbase
::
GetShowMeta
()
{
return
pMeta
;
}
SRetrieveTableRsp
*
Testbase
::
GetRetrieveRsp
()
{
return
pRetrieveRsp
;
}
SRetrieveTableRsp
*
Testbase
::
GetRetrieveRsp
()
{
return
pRetrieveRsp
;
}
\ No newline at end of file
source/dnode/mnode/impl/inc/mndInt.h
浏览文件 @
32f9383a
...
@@ -32,7 +32,7 @@ extern "C" {
...
@@ -32,7 +32,7 @@ extern "C" {
typedef
int32_t
(
*
MndMsgFp
)(
SMnodeMsg
*
pMsg
);
typedef
int32_t
(
*
MndMsgFp
)(
SMnodeMsg
*
pMsg
);
typedef
int32_t
(
*
MndInitFp
)(
SMnode
*
pMnode
);
typedef
int32_t
(
*
MndInitFp
)(
SMnode
*
pMnode
);
typedef
void
(
*
MndCleanupFp
)(
SMnode
*
pMnode
);
typedef
void
(
*
MndCleanupFp
)(
SMnode
*
pMnode
);
typedef
int32_t
(
*
ShowMetaFp
)(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
typedef
int32_t
(
*
ShowMetaFp
)(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
typedef
int32_t
(
*
ShowRetrieveFp
)(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
typedef
int32_t
(
*
ShowRetrieveFp
)(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
typedef
void
(
*
ShowFreeIterFp
)(
SMnode
*
pMnode
,
void
*
pIter
);
typedef
void
(
*
ShowFreeIterFp
)(
SMnode
*
pMnode
,
void
*
pIter
);
...
...
source/dnode/mnode/impl/src/mndBnode.c
浏览文件 @
32f9383a
...
@@ -31,7 +31,7 @@ static int32_t mndProcessCreateBnodeReq(SMnodeMsg *pReq);
...
@@ -31,7 +31,7 @@ static int32_t mndProcessCreateBnodeReq(SMnodeMsg *pReq);
static
int32_t
mndProcessDropBnodeReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessDropBnodeReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessCreateBnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessCreateBnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessDropBnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessDropBnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndGetBnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetBnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveBnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveBnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextBnode
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextBnode
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -391,7 +391,7 @@ static int32_t mndProcessDropBnodeRsp(SMnodeMsg *pRsp) {
...
@@ -391,7 +391,7 @@ static int32_t mndProcessDropBnodeRsp(SMnodeMsg *pRsp) {
return
0
;
return
0
;
}
}
static
int32_t
mndGetBnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetBnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndCluster.c
浏览文件 @
32f9383a
...
@@ -26,7 +26,7 @@ static int32_t mndClusterActionInsert(SSdb *pSdb, SClusterObj *pCluster);
...
@@ -26,7 +26,7 @@ static int32_t mndClusterActionInsert(SSdb *pSdb, SClusterObj *pCluster);
static
int32_t
mndClusterActionDelete
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
);
static
int32_t
mndClusterActionDelete
(
SSdb
*
pSdb
,
SClusterObj
*
pCluster
);
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
pOldCluster
,
SClusterObj
*
pNewCluster
);
static
int32_t
mndClusterActionUpdate
(
SSdb
*
pSdb
,
SClusterObj
*
pOldCluster
,
SClusterObj
*
pNewCluster
);
static
int32_t
mndCreateDefaultCluster
(
SMnode
*
pMnode
);
static
int32_t
mndCreateDefaultCluster
(
SMnode
*
pMnode
);
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveClusters
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveClusters
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextCluster
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextCluster
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -163,7 +163,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
...
@@ -163,7 +163,7 @@ static int32_t mndCreateDefaultCluster(SMnode *pMnode) {
return
sdbWrite
(
pMnode
->
pSdb
,
pRaw
);
return
sdbWrite
(
pMnode
->
pSdb
,
pRaw
);
}
}
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetClusterMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
...
...
source/dnode/mnode/impl/src/mndConsumer.c
浏览文件 @
32f9383a
...
@@ -39,7 +39,7 @@ static int32_t mndProcessCreateConsumerMsg(SMnodeMsg *pMsg);
...
@@ -39,7 +39,7 @@ static int32_t mndProcessCreateConsumerMsg(SMnodeMsg *pMsg);
static
int32_t
mndProcessDropConsumerMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropConsumerMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropConsumerInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropConsumerInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessConsumerMetaMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessConsumerMetaMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetConsumerMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetConsumerMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveConsumer
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveConsumer
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextConsumer
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextConsumer
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -395,7 +395,7 @@ static int32_t mndProcessSubscribeInternalRsp(SMnodeMsg *pMsg) { return 0; }
...
@@ -395,7 +395,7 @@ static int32_t mndProcessSubscribeInternalRsp(SMnodeMsg *pMsg) { return 0; }
static
int32_t
mndProcessConsumerMetaMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessConsumerMetaMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
STableInfo
Msg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
STableInfo
Req
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"consumer:%s, start to retrieve meta"
,
pInfo
->
tableFname
);
mDebug
(
"consumer:%s, start to retrieve meta"
,
pInfo
->
tableFname
);
...
@@ -417,9 +417,9 @@ static int32_t mndProcessConsumerMetaMsg(SMnodeMsg *pMsg) {
...
@@ -417,9 +417,9 @@ static int32_t mndProcessConsumerMetaMsg(SMnodeMsg *pMsg) {
taosRLockLatch(&pConsumer->lock);
taosRLockLatch(&pConsumer->lock);
int32_t totalCols = pConsumer->numOfColumns + pConsumer->numOfTags;
int32_t totalCols = pConsumer->numOfColumns + pConsumer->numOfTags;
int32_t contLen = sizeof(STableMeta
Msg
) + totalCols * sizeof(SSchema);
int32_t contLen = sizeof(STableMeta
Rsp
) + totalCols * sizeof(SSchema);
STableMeta
Msg
*pMeta = rpcMallocCont(contLen);
STableMeta
Rsp
*pMeta = rpcMallocCont(contLen);
if (pMeta == NULL) {
if (pMeta == NULL) {
taosRUnLockLatch(&pConsumer->lock);
taosRUnLockLatch(&pConsumer->lock);
mndReleaseDb(pMnode, pDb);
mndReleaseDb(pMnode, pDb);
...
@@ -483,7 +483,7 @@ static int32_t mndGetNumOfConsumers(SMnode *pMnode, char *dbName, int32_t *pNumO
...
@@ -483,7 +483,7 @@ static int32_t mndGetNumOfConsumers(SMnode *pMnode, char *dbName, int32_t *pNumO
return
0
;
return
0
;
}
}
static
int32_t
mndGetConsumerMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetConsumerMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
32f9383a
...
@@ -35,7 +35,7 @@ static int32_t mndProcessDropDbReq(SMnodeMsg *pReq);
...
@@ -35,7 +35,7 @@ static int32_t mndProcessDropDbReq(SMnodeMsg *pReq);
static
int32_t
mndProcessUseDbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessUseDbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessSyncDbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessSyncDbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessCompactDbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessCompactDbReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetDbMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetDbMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveDbs
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveDbs
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextDb
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextDb
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -194,7 +194,7 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
...
@@ -194,7 +194,7 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
char
*
db
)
{
SDbObj
*
mndAcquireDb
(
SMnode
*
pMnode
,
char
*
db
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDbObj
*
pDb
=
sdbAcquire
(
pSdb
,
SDB_DB
,
db
);
SDbObj
*
pDb
=
sdbAcquire
(
pSdb
,
SDB_DB
,
db
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_DB_NOT_EXIST
;
}
}
return
pDb
;
return
pDb
;
...
@@ -378,7 +378,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
...
@@ -378,7 +378,7 @@ static int32_t mndSetCreateDbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
return
0
;
}
}
static
int32_t
mndCreateDb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pReq
,
SCreateDb
Msg
*
pCreate
,
SUserObj
*
pUser
)
{
static
int32_t
mndCreateDb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pReq
,
SCreateDb
Req
*
pCreate
,
SUserObj
*
pUser
)
{
SDbObj
dbObj
=
{
0
};
SDbObj
dbObj
=
{
0
};
memcpy
(
dbObj
.
name
,
pCreate
->
db
,
TSDB_DB_FNAME_LEN
);
memcpy
(
dbObj
.
name
,
pCreate
->
db
,
TSDB_DB_FNAME_LEN
);
memcpy
(
dbObj
.
acct
,
pUser
->
acct
,
TSDB_USER_LEN
);
memcpy
(
dbObj
.
acct
,
pUser
->
acct
,
TSDB_USER_LEN
);
...
@@ -449,7 +449,7 @@ CREATE_DB_OVER:
...
@@ -449,7 +449,7 @@ CREATE_DB_OVER:
static
int32_t
mndProcessCreateDbReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessCreateDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SCreateDb
Msg
*
pCreate
=
pReq
->
rpcMsg
.
pCont
;
SCreateDb
Req
*
pCreate
=
pReq
->
rpcMsg
.
pCont
;
pCreate
->
numOfVgroups
=
htonl
(
pCreate
->
numOfVgroups
);
pCreate
->
numOfVgroups
=
htonl
(
pCreate
->
numOfVgroups
);
pCreate
->
cacheBlockSize
=
htonl
(
pCreate
->
cacheBlockSize
);
pCreate
->
cacheBlockSize
=
htonl
(
pCreate
->
cacheBlockSize
);
...
@@ -463,7 +463,7 @@ static int32_t mndProcessCreateDbReq(SMnodeMsg *pReq) {
...
@@ -463,7 +463,7 @@ static int32_t mndProcessCreateDbReq(SMnodeMsg *pReq) {
pCreate
->
commitTime
=
htonl
(
pCreate
->
commitTime
);
pCreate
->
commitTime
=
htonl
(
pCreate
->
commitTime
);
pCreate
->
fsyncPeriod
=
htonl
(
pCreate
->
fsyncPeriod
);
pCreate
->
fsyncPeriod
=
htonl
(
pCreate
->
fsyncPeriod
);
mDebug
(
"db:%s, start to create
"
,
pCreate
->
db
);
mDebug
(
"db:%s, start to create
, vgroups:%d"
,
pCreate
->
db
,
pCreate
->
numOfVgroups
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pCreate
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pCreate
->
db
);
if
(
pDb
!=
NULL
)
{
if
(
pDb
!=
NULL
)
{
...
@@ -476,6 +476,9 @@ static int32_t mndProcessCreateDbReq(SMnodeMsg *pReq) {
...
@@ -476,6 +476,9 @@ static int32_t mndProcessCreateDbReq(SMnodeMsg *pReq) {
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
}
else
if
(
terrno
!=
TSDB_CODE_MND_DB_NOT_EXIST
)
{
mError
(
"db:%s, failed to create since %s"
,
pCreate
->
db
,
terrstr
());
return
-
1
;
}
}
SUserObj
*
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
SUserObj
*
pOperUser
=
mndAcquireUser
(
pMnode
,
pReq
->
user
);
...
@@ -495,7 +498,7 @@ static int32_t mndProcessCreateDbReq(SMnodeMsg *pReq) {
...
@@ -495,7 +498,7 @@ static int32_t mndProcessCreateDbReq(SMnodeMsg *pReq) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
static
int32_t
mndSetDbCfgFromAlterDbMsg
(
SDbObj
*
pDb
,
SAlterDb
Msg
*
pAlter
)
{
static
int32_t
mndSetDbCfgFromAlterDbMsg
(
SDbObj
*
pDb
,
SAlterDb
Req
*
pAlter
)
{
terrno
=
TSDB_CODE_MND_DB_OPTION_UNCHANGED
;
terrno
=
TSDB_CODE_MND_DB_OPTION_UNCHANGED
;
if
(
pAlter
->
totalBlocks
>=
0
&&
pAlter
->
totalBlocks
!=
pDb
->
cfg
.
totalBlocks
)
{
if
(
pAlter
->
totalBlocks
>=
0
&&
pAlter
->
totalBlocks
!=
pDb
->
cfg
.
totalBlocks
)
{
...
@@ -646,7 +649,7 @@ UPDATE_DB_OVER:
...
@@ -646,7 +649,7 @@ UPDATE_DB_OVER:
static
int32_t
mndProcessAlterDbReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessAlterDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SAlterDb
Msg
*
pAlter
=
pReq
->
rpcMsg
.
pCont
;
SAlterDb
Req
*
pAlter
=
pReq
->
rpcMsg
.
pCont
;
pAlter
->
totalBlocks
=
htonl
(
pAlter
->
totalBlocks
);
pAlter
->
totalBlocks
=
htonl
(
pAlter
->
totalBlocks
);
pAlter
->
daysToKeep0
=
htonl
(
pAlter
->
daysToKeep0
);
pAlter
->
daysToKeep0
=
htonl
(
pAlter
->
daysToKeep0
);
pAlter
->
daysToKeep1
=
htonl
(
pAlter
->
daysToKeep1
);
pAlter
->
daysToKeep1
=
htonl
(
pAlter
->
daysToKeep1
);
...
@@ -737,7 +740,7 @@ static int32_t mndBuildDropVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *
...
@@ -737,7 +740,7 @@ static int32_t mndBuildDropVgroupAction(SMnode *pMnode, STrans *pTrans, SDbObj *
if
(
pReq
==
NULL
)
return
-
1
;
if
(
pReq
==
NULL
)
return
-
1
;
action
.
pCont
=
pReq
;
action
.
pCont
=
pReq
;
action
.
contLen
=
sizeof
(
S
Create
VnodeReq
);
action
.
contLen
=
sizeof
(
S
Drop
VnodeReq
);
action
.
msgType
=
TDMT_DND_DROP_VNODE
;
action
.
msgType
=
TDMT_DND_DROP_VNODE
;
action
.
acceptableCode
=
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
;
action
.
acceptableCode
=
TSDB_CODE_DND_VNODE_NOT_DEPLOYED
;
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
if
(
mndTransAppendRedoAction
(
pTrans
,
&
action
)
!=
0
)
{
...
@@ -793,7 +796,7 @@ DROP_DB_OVER:
...
@@ -793,7 +796,7 @@ DROP_DB_OVER:
static
int32_t
mndProcessDropDbReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessDropDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SDropDb
Msg
*
pDrop
=
pReq
->
rpcMsg
.
pCont
;
SDropDb
Req
*
pDrop
=
pReq
->
rpcMsg
.
pCont
;
mDebug
(
"db:%s, start to drop"
,
pDrop
->
db
);
mDebug
(
"db:%s, start to drop"
,
pDrop
->
db
);
...
@@ -823,7 +826,7 @@ static int32_t mndProcessDropDbReq(SMnodeMsg *pReq) {
...
@@ -823,7 +826,7 @@ static int32_t mndProcessDropDbReq(SMnodeMsg *pReq) {
static
int32_t
mndProcessUseDbReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessUseDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SUseDb
Msg
*
pUse
=
pReq
->
rpcMsg
.
pCont
;
SUseDb
Req
*
pUse
=
pReq
->
rpcMsg
.
pCont
;
pUse
->
vgVersion
=
htonl
(
pUse
->
vgVersion
);
pUse
->
vgVersion
=
htonl
(
pUse
->
vgVersion
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pUse
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pUse
->
db
);
...
@@ -836,6 +839,7 @@ static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) {
...
@@ -836,6 +839,7 @@ static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) {
int32_t
contLen
=
sizeof
(
SUseDbRsp
)
+
pDb
->
cfg
.
numOfVgroups
*
sizeof
(
SVgroupInfo
);
int32_t
contLen
=
sizeof
(
SUseDbRsp
)
+
pDb
->
cfg
.
numOfVgroups
*
sizeof
(
SVgroupInfo
);
SUseDbRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
SUseDbRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
return
-
1
;
}
}
...
@@ -857,7 +861,7 @@ static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) {
...
@@ -857,7 +861,7 @@ static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) {
pInfo
->
numOfEps
=
pVgroup
->
replica
;
pInfo
->
numOfEps
=
pVgroup
->
replica
;
for
(
int32_t
gid
=
0
;
gid
<
pVgroup
->
replica
;
++
gid
)
{
for
(
int32_t
gid
=
0
;
gid
<
pVgroup
->
replica
;
++
gid
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
gid
];
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
gid
];
SEpAddr
Msg
*
pEpArrr
=
&
pInfo
->
epAddr
[
gid
];
SEpAddr
*
pEpArrr
=
&
pInfo
->
epAddr
[
gid
];
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
pVgid
->
dnodeId
);
if
(
pDnode
!=
NULL
)
{
if
(
pDnode
!=
NULL
)
{
memcpy
(
pEpArrr
->
fqdn
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
memcpy
(
pEpArrr
->
fqdn
,
pDnode
->
fqdn
,
TSDB_FQDN_LEN
);
...
@@ -890,7 +894,7 @@ static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) {
...
@@ -890,7 +894,7 @@ static int32_t mndProcessUseDbReq(SMnodeMsg *pReq) {
static
int32_t
mndProcessSyncDbReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessSyncDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSyncDb
Msg
*
pSync
=
pReq
->
rpcMsg
.
pCont
;
SSyncDb
Req
*
pSync
=
pReq
->
rpcMsg
.
pCont
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pSync
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pSync
->
db
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
mError
(
"db:%s, failed to process sync db req since %s"
,
pSync
->
db
,
terrstr
());
mError
(
"db:%s, failed to process sync db req since %s"
,
pSync
->
db
,
terrstr
());
...
@@ -903,7 +907,7 @@ static int32_t mndProcessSyncDbReq(SMnodeMsg *pReq) {
...
@@ -903,7 +907,7 @@ static int32_t mndProcessSyncDbReq(SMnodeMsg *pReq) {
static
int32_t
mndProcessCompactDbReq
(
SMnodeMsg
*
pReq
)
{
static
int32_t
mndProcessCompactDbReq
(
SMnodeMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SCompactDb
Msg
*
pCompact
=
pReq
->
rpcMsg
.
pCont
;
SCompactDb
Req
*
pCompact
=
pReq
->
rpcMsg
.
pCont
;
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pCompact
->
db
);
SDbObj
*
pDb
=
mndAcquireDb
(
pMnode
,
pCompact
->
db
);
if
(
pDb
==
NULL
)
{
if
(
pDb
==
NULL
)
{
mError
(
"db:%s, failed to process compact db req since %s"
,
pCompact
->
db
,
terrstr
());
mError
(
"db:%s, failed to process compact db req since %s"
,
pCompact
->
db
,
terrstr
());
...
@@ -914,7 +918,7 @@ static int32_t mndProcessCompactDbReq(SMnodeMsg *pReq) {
...
@@ -914,7 +918,7 @@ static int32_t mndProcessCompactDbReq(SMnodeMsg *pReq) {
return
0
;
return
0
;
}
}
static
int32_t
mndGetDbMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetDbMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
32f9383a
...
@@ -53,10 +53,10 @@ static int32_t mndProcessConfigDnodeReq(SMnodeMsg *pReq);
...
@@ -53,10 +53,10 @@ static int32_t mndProcessConfigDnodeReq(SMnodeMsg *pReq);
static
int32_t
mndProcessConfigDnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessConfigDnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessStatusReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessStatusReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetConfigMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetConfigMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveConfigs
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveConfigs
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextConfig
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextConfig
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndGetDnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetDnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveDnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveDnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextDnode
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextDnode
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -582,7 +582,7 @@ static int32_t mndProcessConfigDnodeRsp(SMnodeMsg *pRsp) {
...
@@ -582,7 +582,7 @@ static int32_t mndProcessConfigDnodeRsp(SMnodeMsg *pRsp) {
mInfo
(
"app:%p config rsp from dnode"
,
pRsp
->
rpcMsg
.
ahandle
);
mInfo
(
"app:%p config rsp from dnode"
,
pRsp
->
rpcMsg
.
ahandle
);
}
}
static
int32_t
mndGetConfigMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetConfigMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
int32_t
cols
=
0
;
int32_t
cols
=
0
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
SSchema
*
pSchema
=
pMeta
->
pSchema
;
...
@@ -656,7 +656,7 @@ static int32_t mndRetrieveConfigs(SMnodeMsg *pReq, SShowObj *pShow, char *data,
...
@@ -656,7 +656,7 @@ static int32_t mndRetrieveConfigs(SMnodeMsg *pReq, SShowObj *pShow, char *data,
static
void
mndCancelGetNextConfig
(
SMnode
*
pMnode
,
void
*
pIter
)
{}
static
void
mndCancelGetNextConfig
(
SMnode
*
pMnode
,
void
*
pIter
)
{}
static
int32_t
mndGetDnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetDnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndFunc.c
浏览文件 @
32f9383a
...
@@ -26,12 +26,12 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw);
...
@@ -26,12 +26,12 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw);
static
int32_t
mndFuncActionInsert
(
SSdb
*
pSdb
,
SFuncObj
*
pFunc
);
static
int32_t
mndFuncActionInsert
(
SSdb
*
pSdb
,
SFuncObj
*
pFunc
);
static
int32_t
mndFuncActionDelete
(
SSdb
*
pSdb
,
SFuncObj
*
pFunc
);
static
int32_t
mndFuncActionDelete
(
SSdb
*
pSdb
,
SFuncObj
*
pFunc
);
static
int32_t
mndFuncActionUpdate
(
SSdb
*
pSdb
,
SFuncObj
*
pOldFunc
,
SFuncObj
*
pNewFunc
);
static
int32_t
mndFuncActionUpdate
(
SSdb
*
pSdb
,
SFuncObj
*
pOldFunc
,
SFuncObj
*
pNewFunc
);
static
int32_t
mndCreateFunc
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCreateFunc
Msg
*
pCreate
);
static
int32_t
mndCreateFunc
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCreateFunc
Req
*
pCreate
);
static
int32_t
mndDropFunc
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SFuncObj
*
pFunc
);
static
int32_t
mndDropFunc
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SFuncObj
*
pFunc
);
static
int32_t
mndProcessCreateFuncMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCreateFuncMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropFuncMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropFuncMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessRetrieveFuncMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessRetrieveFuncMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetFuncMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetFuncMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveFuncs
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveFuncs
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextFunc
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextFunc
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -156,7 +156,7 @@ static int32_t mndFuncActionUpdate(SSdb *pSdb, SFuncObj *pOldFunc, SFuncObj *pNe
...
@@ -156,7 +156,7 @@ static int32_t mndFuncActionUpdate(SSdb *pSdb, SFuncObj *pOldFunc, SFuncObj *pNe
return
0
;
return
0
;
}
}
static
int32_t
mndCreateFunc
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCreateFunc
Msg
*
pCreate
)
{
static
int32_t
mndCreateFunc
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SCreateFunc
Req
*
pCreate
)
{
SFuncObj
*
pFunc
=
calloc
(
1
,
sizeof
(
SFuncObj
)
+
pCreate
->
commentSize
+
pCreate
->
codeSize
);
SFuncObj
*
pFunc
=
calloc
(
1
,
sizeof
(
SFuncObj
)
+
pCreate
->
commentSize
+
pCreate
->
codeSize
);
pFunc
->
createdTime
=
taosGetTimestampMs
();
pFunc
->
createdTime
=
taosGetTimestampMs
();
pFunc
->
funcType
=
pCreate
->
funcType
;
pFunc
->
funcType
=
pCreate
->
funcType
;
...
@@ -264,7 +264,7 @@ static int32_t mndDropFunc(SMnode *pMnode, SMnodeMsg *pMsg, SFuncObj *pFunc) {
...
@@ -264,7 +264,7 @@ static int32_t mndDropFunc(SMnode *pMnode, SMnodeMsg *pMsg, SFuncObj *pFunc) {
static
int32_t
mndProcessCreateFuncMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessCreateFuncMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SCreateFunc
Msg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
SCreateFunc
Req
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
pCreate
->
outputLen
=
htonl
(
pCreate
->
outputLen
);
pCreate
->
outputLen
=
htonl
(
pCreate
->
outputLen
);
pCreate
->
bufSize
=
htonl
(
pCreate
->
bufSize
);
pCreate
->
bufSize
=
htonl
(
pCreate
->
bufSize
);
pCreate
->
sigature
=
htobe64
(
pCreate
->
sigature
);
pCreate
->
sigature
=
htobe64
(
pCreate
->
sigature
);
...
@@ -323,7 +323,7 @@ static int32_t mndProcessCreateFuncMsg(SMnodeMsg *pMsg) {
...
@@ -323,7 +323,7 @@ static int32_t mndProcessCreateFuncMsg(SMnodeMsg *pMsg) {
static
int32_t
mndProcessDropFuncMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessDropFuncMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SDropFunc
Msg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SDropFunc
Req
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"func:%s, start to drop"
,
pDrop
->
name
);
mDebug
(
"func:%s, start to drop"
,
pDrop
->
name
);
...
@@ -353,7 +353,7 @@ static int32_t mndProcessDropFuncMsg(SMnodeMsg *pMsg) {
...
@@ -353,7 +353,7 @@ static int32_t mndProcessDropFuncMsg(SMnodeMsg *pMsg) {
static
int32_t
mndProcessRetrieveFuncMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessRetrieveFuncMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SRetrieveFunc
Msg
*
pRetrieve
=
pMsg
->
rpcMsg
.
pCont
;
SRetrieveFunc
Req
*
pRetrieve
=
pMsg
->
rpcMsg
.
pCont
;
pRetrieve
->
numOfFuncs
=
htonl
(
pRetrieve
->
numOfFuncs
);
pRetrieve
->
numOfFuncs
=
htonl
(
pRetrieve
->
numOfFuncs
);
int32_t
size
=
sizeof
(
SRetrieveFuncRsp
)
+
(
sizeof
(
SFuncInfo
)
+
TSDB_FUNC_CODE_LEN
)
*
pRetrieve
->
numOfFuncs
+
16384
;
int32_t
size
=
sizeof
(
SRetrieveFuncRsp
)
+
(
sizeof
(
SFuncInfo
)
+
TSDB_FUNC_CODE_LEN
)
*
pRetrieve
->
numOfFuncs
+
16384
;
...
@@ -395,7 +395,7 @@ static int32_t mndProcessRetrieveFuncMsg(SMnodeMsg *pMsg) {
...
@@ -395,7 +395,7 @@ static int32_t mndProcessRetrieveFuncMsg(SMnodeMsg *pMsg) {
return
0
;
return
0
;
}
}
static
int32_t
mndGetFuncMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetFuncMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndMnode.c
浏览文件 @
32f9383a
...
@@ -33,7 +33,7 @@ static int32_t mndProcessDropMnodeReq(SMnodeMsg *pReq);
...
@@ -33,7 +33,7 @@ static int32_t mndProcessDropMnodeReq(SMnodeMsg *pReq);
static
int32_t
mndProcessCreateMnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessCreateMnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessAlterMnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessAlterMnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessDropMnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessDropMnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndGetMnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetMnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveMnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveMnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextMnode
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextMnode
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -579,7 +579,7 @@ static int32_t mndProcessDropMnodeRsp(SMnodeMsg *pRsp) {
...
@@ -579,7 +579,7 @@ static int32_t mndProcessDropMnodeRsp(SMnodeMsg *pRsp) {
return
0
;
return
0
;
}
}
static
int32_t
mndGetMnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetMnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndProfile.c
浏览文件 @
32f9383a
...
@@ -51,9 +51,9 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq);
...
@@ -51,9 +51,9 @@ static int32_t mndProcessHeartBeatReq(SMnodeMsg *pReq);
static
int32_t
mndProcessConnectReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessConnectReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessKillQueryReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessKillQueryReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessKillConnReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessKillConnReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveConns
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveConns
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveQueries
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveQueries
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextQuery
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextQuery
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -389,7 +389,7 @@ static int32_t mndProcessKillConnReq(SMnodeMsg *pReq) {
...
@@ -389,7 +389,7 @@ static int32_t mndProcessKillConnReq(SMnodeMsg *pReq) {
}
}
}
}
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetConnsMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
...
@@ -518,7 +518,7 @@ static int32_t mndRetrieveConns(SMnodeMsg *pReq, SShowObj *pShow, char *data, in
...
@@ -518,7 +518,7 @@ static int32_t mndRetrieveConns(SMnodeMsg *pReq, SShowObj *pShow, char *data, in
return
numOfRows
;
return
numOfRows
;
}
}
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetQueryMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
SProfileMgmt
*
pMgmt
=
&
pMnode
->
profileMgmt
;
...
...
source/dnode/mnode/impl/src/mndQnode.c
浏览文件 @
32f9383a
...
@@ -31,7 +31,7 @@ static int32_t mndProcessCreateQnodeReq(SMnodeMsg *pReq);
...
@@ -31,7 +31,7 @@ static int32_t mndProcessCreateQnodeReq(SMnodeMsg *pReq);
static
int32_t
mndProcessDropQnodeReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessDropQnodeReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessCreateQnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessCreateQnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessDropQnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessDropQnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndGetQnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetQnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveQnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveQnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextQnode
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextQnode
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -391,7 +391,7 @@ static int32_t mndProcessDropQnodeRsp(SMnodeMsg *pRsp) {
...
@@ -391,7 +391,7 @@ static int32_t mndProcessDropQnodeRsp(SMnodeMsg *pRsp) {
return
0
;
return
0
;
}
}
static
int32_t
mndGetQnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetQnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndSnode.c
浏览文件 @
32f9383a
...
@@ -31,7 +31,7 @@ static int32_t mndProcessCreateSnodeReq(SMnodeMsg *pReq);
...
@@ -31,7 +31,7 @@ static int32_t mndProcessCreateSnodeReq(SMnodeMsg *pReq);
static
int32_t
mndProcessDropSnodeReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessDropSnodeReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessCreateSnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessCreateSnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessDropSnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndProcessDropSnodeRsp
(
SMnodeMsg
*
pRsp
);
static
int32_t
mndGetSnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetSnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveSnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveSnodes
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextSnode
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextSnode
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -393,7 +393,7 @@ static int32_t mndProcessDropSnodeRsp(SMnodeMsg *pRsp) {
...
@@ -393,7 +393,7 @@ static int32_t mndProcessDropSnodeRsp(SMnodeMsg *pRsp) {
return
0
;
return
0
;
}
}
static
int32_t
mndGetSnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetSnodeMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndStb.c
浏览文件 @
32f9383a
...
@@ -32,14 +32,14 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw);
...
@@ -32,14 +32,14 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw);
static
int32_t
mndStbActionInsert
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionInsert
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionDelete
(
SSdb
*
pSdb
,
SStbObj
*
pStb
);
static
int32_t
mndStbActionUpdate
(
SSdb
*
pSdb
,
SStbObj
*
pOldStb
,
SStbObj
*
pNewStb
);
static
int32_t
mndStbActionUpdate
(
SSdb
*
pSdb
,
SStbObj
*
pOldStb
,
SStbObj
*
pNewStb
);
static
int32_t
mndProces
sCreateStbMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProces
SMCreateStbReq
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProces
sAlterStbMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProces
SMAlterStbReq
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProces
sDropStbMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProces
SMDropStbReq
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCreateStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessCreateStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessAlterStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropStbInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessStbMetaMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessStbMetaMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetStbMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetStbMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveStb
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveStb
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextStb
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextStb
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -52,9 +52,9 @@ int32_t mndInitStb(SMnode *pMnode) {
...
@@ -52,9 +52,9 @@ int32_t mndInitStb(SMnode *pMnode) {
.
updateFp
=
(
SdbUpdateFp
)
mndStbActionUpdate
,
.
updateFp
=
(
SdbUpdateFp
)
mndStbActionUpdate
,
.
deleteFp
=
(
SdbDeleteFp
)
mndStbActionDelete
};
.
deleteFp
=
(
SdbDeleteFp
)
mndStbActionDelete
};
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_STB
,
mndProces
sCreateStbMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CREATE_STB
,
mndProces
SMCreateStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_STB
,
mndProces
sAlterStbMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_ALTER_STB
,
mndProces
SMAlterStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_STB
,
mndProces
sDropStbMsg
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DROP_STB
,
mndProces
SMDropStbReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_CREATE_STB_RSP
,
mndProcessCreateStbInRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_CREATE_STB_RSP
,
mndProcessCreateStbInRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_ALTER_STB_RSP
,
mndProcessAlterStbInRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_ALTER_STB_RSP
,
mndProcessAlterStbInRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_DROP_STB_RSP
,
mndProcessDropStbInRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_VND_DROP_STB_RSP
,
mndProcessDropStbInRsp
);
...
@@ -204,7 +204,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOldStb, SStbObj *pNewStb
...
@@ -204,7 +204,7 @@ static int32_t mndStbActionUpdate(SSdb *pSdb, SStbObj *pOldStb, SStbObj *pNewStb
SStbObj
*
mndAcquireStb
(
SMnode
*
pMnode
,
char
*
stbName
)
{
SStbObj
*
mndAcquireStb
(
SMnode
*
pMnode
,
char
*
stbName
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SStbObj
*
pStb
=
sdbAcquire
(
pSdb
,
SDB_STB
,
stbName
);
SStbObj
*
pStb
=
sdbAcquire
(
pSdb
,
SDB_STB
,
stbName
);
if
(
pStb
==
NULL
)
{
if
(
pStb
==
NULL
&&
terrno
==
TSDB_CODE_SDB_OBJ_NOT_THERE
)
{
terrno
=
TSDB_CODE_MND_STB_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_STB_NOT_EXIST
;
}
}
return
pStb
;
return
pStb
;
...
@@ -264,10 +264,10 @@ static void *mndBuildCreateStbMsg(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb
...
@@ -264,10 +264,10 @@ static void *mndBuildCreateStbMsg(SMnode *pMnode, SVgObj *pVgroup, SStbObj *pStb
return
buf
;
return
buf
;
}
}
static
SVDrop
St
bReq
*
mndBuildDropStbMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
)
{
static
SVDrop
T
bReq
*
mndBuildDropStbMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SStbObj
*
pStb
)
{
int32_t
contLen
=
sizeof
(
SVDrop
St
bReq
);
int32_t
contLen
=
sizeof
(
SVDrop
T
bReq
);
SVDrop
St
bReq
*
pDrop
=
calloc
(
1
,
contLen
);
SVDrop
T
bReq
*
pDrop
=
calloc
(
1
,
contLen
);
if
(
pDrop
==
NULL
)
{
if
(
pDrop
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
return
NULL
;
...
@@ -276,12 +276,12 @@ static SVDropStbReq *mndBuildDropStbMsg(SMnode *pMnode, SVgObj *pVgroup, SStbObj
...
@@ -276,12 +276,12 @@ static SVDropStbReq *mndBuildDropStbMsg(SMnode *pMnode, SVgObj *pVgroup, SStbObj
pDrop
->
head
.
contLen
=
htonl
(
contLen
);
pDrop
->
head
.
contLen
=
htonl
(
contLen
);
pDrop
->
head
.
vgId
=
htonl
(
pVgroup
->
vgId
);
pDrop
->
head
.
vgId
=
htonl
(
pVgroup
->
vgId
);
memcpy
(
pDrop
->
name
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
);
memcpy
(
pDrop
->
name
,
pStb
->
name
,
TSDB_TABLE_FNAME_LEN
);
pDrop
->
suid
=
htobe64
(
pStb
->
uid
);
//
pDrop->suid = htobe64(pStb->uid);
return
pDrop
;
return
pDrop
;
}
}
static
int32_t
mndCheckCreateStbMsg
(
S
CreateStbMsg
*
pCreate
)
{
static
int32_t
mndCheckCreateStbMsg
(
S
MCreateStbReq
*
pCreate
)
{
pCreate
->
numOfColumns
=
htonl
(
pCreate
->
numOfColumns
);
pCreate
->
numOfColumns
=
htonl
(
pCreate
->
numOfColumns
);
pCreate
->
numOfTags
=
htonl
(
pCreate
->
numOfTags
);
pCreate
->
numOfTags
=
htonl
(
pCreate
->
numOfTags
);
int32_t
totalCols
=
pCreate
->
numOfColumns
+
pCreate
->
numOfTags
;
int32_t
totalCols
=
pCreate
->
numOfColumns
+
pCreate
->
numOfTags
;
...
@@ -398,7 +398,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
...
@@ -398,7 +398,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
if
(
pVgroup
->
dbUid
!=
pDb
->
uid
)
continue
;
if
(
pVgroup
->
dbUid
!=
pDb
->
uid
)
continue
;
SVDrop
St
bReq
*
pMsg
=
mndBuildDropStbMsg
(
pMnode
,
pVgroup
,
pStb
);
SVDrop
T
bReq
*
pMsg
=
mndBuildDropStbMsg
(
pMnode
,
pVgroup
,
pStb
);
if
(
pMsg
==
NULL
)
{
if
(
pMsg
==
NULL
)
{
sdbCancelFetch
(
pSdb
,
pIter
);
sdbCancelFetch
(
pSdb
,
pIter
);
sdbRelease
(
pSdb
,
pVgroup
);
sdbRelease
(
pSdb
,
pVgroup
);
...
@@ -409,7 +409,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
...
@@ -409,7 +409,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
STransAction
action
=
{
0
};
STransAction
action
=
{
0
};
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
action
.
epSet
=
mndGetVgroupEpset
(
pMnode
,
pVgroup
);
action
.
pCont
=
pMsg
;
action
.
pCont
=
pMsg
;
action
.
contLen
=
sizeof
(
SVDrop
St
bReq
);
action
.
contLen
=
sizeof
(
SVDrop
T
bReq
);
action
.
msgType
=
TDMT_VND_DROP_STB
;
action
.
msgType
=
TDMT_VND_DROP_STB
;
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
if
(
mndTransAppendUndoAction
(
pTrans
,
&
action
)
!=
0
)
{
free
(
pMsg
);
free
(
pMsg
);
...
@@ -423,7 +423,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
...
@@ -423,7 +423,7 @@ static int32_t mndSetCreateStbUndoActions(SMnode *pMnode, STrans *pTrans, SDbObj
return
0
;
return
0
;
}
}
static
int32_t
mndCreateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
S
CreateStbMsg
*
pCreate
,
SDbObj
*
pDb
)
{
static
int32_t
mndCreateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
S
MCreateStbReq
*
pCreate
,
SDbObj
*
pDb
)
{
SStbObj
stbObj
=
{
0
};
SStbObj
stbObj
=
{
0
};
tstrncpy
(
stbObj
.
name
,
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
tstrncpy
(
stbObj
.
name
,
pCreate
->
name
,
TSDB_TABLE_FNAME_LEN
);
tstrncpy
(
stbObj
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
tstrncpy
(
stbObj
.
db
,
pDb
->
name
,
TSDB_DB_FNAME_LEN
);
...
@@ -494,9 +494,9 @@ CREATE_STB_OVER:
...
@@ -494,9 +494,9 @@ CREATE_STB_OVER:
return
code
;
return
code
;
}
}
static
int32_t
mndProces
sCreateStbMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProces
SMCreateStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
S
CreateStbMsg
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
S
MCreateStbReq
*
pCreate
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"stb:%s, start to create"
,
pCreate
->
name
);
mDebug
(
"stb:%s, start to create"
,
pCreate
->
name
);
...
@@ -513,9 +513,11 @@ static int32_t mndProcessCreateStbMsg(SMnodeMsg *pMsg) {
...
@@ -513,9 +513,11 @@ static int32_t mndProcessCreateStbMsg(SMnodeMsg *pMsg) {
return
0
;
return
0
;
}
else
{
}
else
{
terrno
=
TSDB_CODE_MND_STB_ALREADY_EXIST
;
terrno
=
TSDB_CODE_MND_STB_ALREADY_EXIST
;
mError
(
"
d
b:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
mError
(
"
st
b:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
}
else
if
(
terrno
!=
TSDB_CODE_MND_STB_NOT_EXIST
)
{
mError
(
"stb:%s, failed to create since %s"
,
pCreate
->
name
,
terrstr
());
}
}
// topic should have different name with stb
// topic should have different name with stb
...
@@ -551,7 +553,7 @@ static int32_t mndProcessCreateStbInRsp(SMnodeMsg *pMsg) {
...
@@ -551,7 +553,7 @@ static int32_t mndProcessCreateStbInRsp(SMnodeMsg *pMsg) {
return
0
;
return
0
;
}
}
static
int32_t
mndCheckAlterStbMsg
(
S
AlterStbMsg
*
pAlter
)
{
static
int32_t
mndCheckAlterStbMsg
(
S
MAlterStbReq
*
pAlter
)
{
SSchema
*
pSchema
=
&
pAlter
->
schema
;
SSchema
*
pSchema
=
&
pAlter
->
schema
;
pSchema
->
colId
=
htonl
(
pSchema
->
colId
);
pSchema
->
colId
=
htonl
(
pSchema
->
colId
);
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
pSchema
->
bytes
=
htonl
(
pSchema
->
bytes
);
...
@@ -578,9 +580,9 @@ static int32_t mndCheckAlterStbMsg(SAlterStbMsg *pAlter) {
...
@@ -578,9 +580,9 @@ static int32_t mndCheckAlterStbMsg(SAlterStbMsg *pAlter) {
static
int32_t
mndUpdateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SStbObj
*
pOldStb
,
SStbObj
*
pNewStb
)
{
return
0
;
}
static
int32_t
mndUpdateStb
(
SMnode
*
pMnode
,
SMnodeMsg
*
pMsg
,
SStbObj
*
pOldStb
,
SStbObj
*
pNewStb
)
{
return
0
;
}
static
int32_t
mndProces
sAlterStbMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProces
SMAlterStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
S
AlterStbMsg
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
S
MAlterStbReq
*
pAlter
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"stb:%s, start to alter"
,
pAlter
->
name
);
mDebug
(
"stb:%s, start to alter"
,
pAlter
->
name
);
...
@@ -692,9 +694,9 @@ DROP_STB_OVER:
...
@@ -692,9 +694,9 @@ DROP_STB_OVER:
return
0
;
return
0
;
}
}
static
int32_t
mndProces
sDropStbMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProces
SMDropStbReq
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
S
DropStbMsg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
S
MDropStbReq
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"stb:%s, start to drop"
,
pDrop
->
name
);
mDebug
(
"stb:%s, start to drop"
,
pDrop
->
name
);
...
@@ -729,7 +731,7 @@ static int32_t mndProcessDropStbInRsp(SMnodeMsg *pMsg) {
...
@@ -729,7 +731,7 @@ static int32_t mndProcessDropStbInRsp(SMnodeMsg *pMsg) {
static
int32_t
mndProcessStbMetaMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessStbMetaMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
STableInfo
Msg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
STableInfo
Req
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"stb:%s, start to retrieve meta"
,
pInfo
->
tableFname
);
mDebug
(
"stb:%s, start to retrieve meta"
,
pInfo
->
tableFname
);
...
@@ -750,9 +752,9 @@ static int32_t mndProcessStbMetaMsg(SMnodeMsg *pMsg) {
...
@@ -750,9 +752,9 @@ static int32_t mndProcessStbMetaMsg(SMnodeMsg *pMsg) {
taosRLockLatch
(
&
pStb
->
lock
);
taosRLockLatch
(
&
pStb
->
lock
);
int32_t
totalCols
=
pStb
->
numOfColumns
+
pStb
->
numOfTags
;
int32_t
totalCols
=
pStb
->
numOfColumns
+
pStb
->
numOfTags
;
int32_t
contLen
=
sizeof
(
STableMeta
Msg
)
+
totalCols
*
sizeof
(
SSchema
);
int32_t
contLen
=
sizeof
(
STableMeta
Rsp
)
+
totalCols
*
sizeof
(
SSchema
);
STableMeta
Msg
*
pMeta
=
rpcMallocCont
(
contLen
);
STableMeta
Rsp
*
pMeta
=
rpcMallocCont
(
contLen
);
if
(
pMeta
==
NULL
)
{
if
(
pMeta
==
NULL
)
{
taosRUnLockLatch
(
&
pStb
->
lock
);
taosRUnLockLatch
(
&
pStb
->
lock
);
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
...
@@ -818,7 +820,7 @@ static int32_t mndGetNumOfStbs(SMnode *pMnode, char *dbName, int32_t *pNumOfStbs
...
@@ -818,7 +820,7 @@ static int32_t mndGetNumOfStbs(SMnode *pMnode, char *dbName, int32_t *pNumOfStbs
return
0
;
return
0
;
}
}
static
int32_t
mndGetStbMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetStbMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndTopic.c
浏览文件 @
32f9383a
...
@@ -35,7 +35,7 @@ static int32_t mndProcessCreateTopicMsg(SMnodeMsg *pMsg);
...
@@ -35,7 +35,7 @@ static int32_t mndProcessCreateTopicMsg(SMnodeMsg *pMsg);
static
int32_t
mndProcessDropTopicMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropTopicMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropTopicInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessDropTopicInRsp
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessTopicMetaMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndProcessTopicMetaMsg
(
SMnodeMsg
*
pMsg
);
static
int32_t
mndGetTopicMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetTopicMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveTopic
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveTopic
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextTopic
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextTopic
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -186,10 +186,10 @@ static SDbObj *mndAcquireDbByTopic(SMnode *pMnode, char *topicName) {
...
@@ -186,10 +186,10 @@ static SDbObj *mndAcquireDbByTopic(SMnode *pMnode, char *topicName) {
return
mndAcquireDb
(
pMnode
,
db
);
return
mndAcquireDb
(
pMnode
,
db
);
}
}
static
SDDropTopic
Msg
*
mndBuildDropTopicMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SMqTopicObj
*
pTopic
)
{
static
SDDropTopic
Req
*
mndBuildDropTopicMsg
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SMqTopicObj
*
pTopic
)
{
int32_t
contLen
=
sizeof
(
SDDropTopic
Msg
);
int32_t
contLen
=
sizeof
(
SDDropTopic
Req
);
SDDropTopic
Msg
*
pDrop
=
calloc
(
1
,
contLen
);
SDDropTopic
Req
*
pDrop
=
calloc
(
1
,
contLen
);
if
(
pDrop
==
NULL
)
{
if
(
pDrop
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
NULL
;
return
NULL
;
...
@@ -274,7 +274,7 @@ static int32_t mndDropTopic(SMnode *pMnode, SMnodeMsg *pMsg, SMqTopicObj *pTopic
...
@@ -274,7 +274,7 @@ static int32_t mndDropTopic(SMnode *pMnode, SMnodeMsg *pMsg, SMqTopicObj *pTopic
static
int32_t
mndProcessDropTopicMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessDropTopicMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SDropTopic
Msg
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
SDropTopic
Req
*
pDrop
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"topic:%s, start to drop"
,
pDrop
->
name
);
mDebug
(
"topic:%s, start to drop"
,
pDrop
->
name
);
...
@@ -309,7 +309,7 @@ static int32_t mndProcessDropTopicInRsp(SMnodeMsg *pMsg) {
...
@@ -309,7 +309,7 @@ static int32_t mndProcessDropTopicInRsp(SMnodeMsg *pMsg) {
static
int32_t
mndProcessTopicMetaMsg
(
SMnodeMsg
*
pMsg
)
{
static
int32_t
mndProcessTopicMetaMsg
(
SMnodeMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
STableInfo
Msg
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
STableInfo
Req
*
pInfo
=
pMsg
->
rpcMsg
.
pCont
;
mDebug
(
"topic:%s, start to retrieve meta"
,
pInfo
->
tableFname
);
mDebug
(
"topic:%s, start to retrieve meta"
,
pInfo
->
tableFname
);
...
@@ -331,9 +331,9 @@ static int32_t mndProcessTopicMetaMsg(SMnodeMsg *pMsg) {
...
@@ -331,9 +331,9 @@ static int32_t mndProcessTopicMetaMsg(SMnodeMsg *pMsg) {
taosRLockLatch(&pTopic->lock);
taosRLockLatch(&pTopic->lock);
int32_t totalCols = pTopic->numOfColumns + pTopic->numOfTags;
int32_t totalCols = pTopic->numOfColumns + pTopic->numOfTags;
int32_t contLen = sizeof(STableMeta
Msg
) + totalCols * sizeof(SSchema);
int32_t contLen = sizeof(STableMeta
Rsp
) + totalCols * sizeof(SSchema);
STableMeta
Msg
*pMeta = rpcMallocCont(contLen);
STableMeta
Rsp
*pMeta = rpcMallocCont(contLen);
if (pMeta == NULL) {
if (pMeta == NULL) {
taosRUnLockLatch(&pTopic->lock);
taosRUnLockLatch(&pTopic->lock);
mndReleaseDb(pMnode, pDb);
mndReleaseDb(pMnode, pDb);
...
@@ -397,7 +397,7 @@ static int32_t mndGetNumOfTopics(SMnode *pMnode, char *dbName, int32_t *pNumOfTo
...
@@ -397,7 +397,7 @@ static int32_t mndGetNumOfTopics(SMnode *pMnode, char *dbName, int32_t *pNumOfTo
return
0
;
return
0
;
}
}
static
int32_t
mndGetTopicMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetTopicMeta
(
SMnodeMsg
*
pMsg
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SMnode
*
pMnode
=
pMsg
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndTrans.c
浏览文件 @
32f9383a
...
@@ -809,7 +809,7 @@ static bool mndTransPerformUndoLogStage(SMnode *pMnode, STrans *pTrans) {
...
@@ -809,7 +809,7 @@ static bool mndTransPerformUndoLogStage(SMnode *pMnode, STrans *pTrans) {
mDebug
(
"trans:%d, stage from undoLog to rollback"
,
pTrans
->
id
);
mDebug
(
"trans:%d, stage from undoLog to rollback"
,
pTrans
->
id
);
continueExec
=
true
;
continueExec
=
true
;
}
else
{
}
else
{
m
Debug
(
"trans:%d, stage keep on undoLog since %s"
,
pTrans
->
id
,
terrstr
());
m
Error
(
"trans:%d, stage keep on undoLog since %s"
,
pTrans
->
id
,
terrstr
());
continueExec
=
false
;
continueExec
=
false
;
}
}
...
...
source/dnode/mnode/impl/src/mndUser.c
浏览文件 @
32f9383a
...
@@ -32,7 +32,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, char *user, char *pass
...
@@ -32,7 +32,7 @@ static int32_t mndCreateUser(SMnode *pMnode, char *acct, char *user, char *pass
static
int32_t
mndProcessCreateUserReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessCreateUserReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessAlterUserReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessAlterUserReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessDropUserReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndProcessDropUserReq
(
SMnodeMsg
*
pReq
);
static
int32_t
mndGetUserMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
);
static
int32_t
mndGetUserMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
);
static
int32_t
mndRetrieveUsers
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveUsers
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextUser
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextUser
(
SMnode
*
pMnode
,
void
*
pIter
);
...
@@ -432,7 +432,7 @@ static int32_t mndProcessDropUserReq(SMnodeMsg *pReq) {
...
@@ -432,7 +432,7 @@ static int32_t mndProcessDropUserReq(SMnodeMsg *pReq) {
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
}
static
int32_t
mndGetUserMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Msg
*
pMeta
)
{
static
int32_t
mndGetUserMeta
(
SMnodeMsg
*
pReq
,
SShowObj
*
pShow
,
STableMeta
Rsp
*
pMeta
)
{
SMnode
*
pMnode
=
pReq
->
pMnode
;
SMnode
*
pMnode
=
pReq
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
32f9383a
...
@@ -27,19 +27,19 @@
...
@@ -27,19 +27,19 @@
static
SSdbRow
*
mndVgroupActionDecode
(
SSdbRaw
*
pRaw
);
static
SSdbRow
*
mndVgroupActionDecode
(
SSdbRaw
*
pRaw
);
static
int32_t
mndVgroupActionInsert
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionInsert
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionDelete
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionDelete
(
SSdb
*
pSdb
,
SVgObj
*
pVgroup
);
static
int32_t
mndVgroupActionUpdate
(
SSdb
*
pSdb
,
SVgObj
*
pOld
Vgroup
,
SVgObj
*
pNewVgroup
);
static
int32_t
mndVgroupActionUpdate
(
SSdb
*
pSdb
,
SVgObj
*
pOld
,
SVgObj
*
pNew
);
static
int32_t
mndProcessCreateVnodeRsp
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessCreateVnodeRsp
(
SMnodeMsg
*
p
Rsp
);
static
int32_t
mndProcessAlterVnodeRsp
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessAlterVnodeRsp
(
SMnodeMsg
*
p
Rsp
);
static
int32_t
mndProcessDropVnodeRsp
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessDropVnodeRsp
(
SMnodeMsg
*
p
Rsp
);
static
int32_t
mndProcessSyncVnodeRsp
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessSyncVnodeRsp
(
SMnodeMsg
*
p
Rsp
);
static
int32_t
mndProcessCompactVnodeRsp
(
SMnodeMsg
*
p
Msg
);
static
int32_t
mndProcessCompactVnodeRsp
(
SMnodeMsg
*
p
Rsp
);
static
int32_t
mndGetVgroupMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndGetVgroupMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveVgroups
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveVgroups
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextVgroup
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextVgroup
(
SMnode
*
pMnode
,
void
*
pIter
);
static
int32_t
mndGetVnodeMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
);
static
int32_t
mndGetVnodeMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
);
static
int32_t
mndRetrieveVnodes
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
int32_t
mndRetrieveVnodes
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
);
static
void
mndCancelGetNextVnode
(
SMnode
*
pMnode
,
void
*
pIter
);
static
void
mndCancelGetNextVnode
(
SMnode
*
pMnode
,
void
*
pIter
);
int32_t
mndInitVgroup
(
SMnode
*
pMnode
)
{
int32_t
mndInitVgroup
(
SMnode
*
pMnode
)
{
...
@@ -164,14 +164,14 @@ static int32_t mndVgroupActionDelete(SSdb *pSdb, SVgObj *pVgroup) {
...
@@ -164,14 +164,14 @@ static int32_t mndVgroupActionDelete(SSdb *pSdb, SVgObj *pVgroup) {
return
0
;
return
0
;
}
}
static
int32_t
mndVgroupActionUpdate
(
SSdb
*
pSdb
,
SVgObj
*
pOld
Vgroup
,
SVgObj
*
pNewVgroup
)
{
static
int32_t
mndVgroupActionUpdate
(
SSdb
*
pSdb
,
SVgObj
*
pOld
,
SVgObj
*
pNew
)
{
mTrace
(
"vgId:%d, perform update action, old row:%p new row:%p"
,
pOld
Vgroup
->
vgId
,
pOldVgroup
,
pNewVgroup
);
mTrace
(
"vgId:%d, perform update action, old row:%p new row:%p"
,
pOld
->
vgId
,
pOld
,
pNew
);
pOld
Vgroup
->
updateTime
=
pNewVgroup
->
updateTime
;
pOld
->
updateTime
=
pNew
->
updateTime
;
pOld
Vgroup
->
version
=
pNewVgroup
->
version
;
pOld
->
version
=
pNew
->
version
;
pOld
Vgroup
->
hashBegin
=
pNewVgroup
->
hashBegin
;
pOld
->
hashBegin
=
pNew
->
hashBegin
;
pOld
Vgroup
->
hashEnd
=
pNewVgroup
->
hashEnd
;
pOld
->
hashEnd
=
pNew
->
hashEnd
;
pOld
Vgroup
->
replica
=
pNewVgroup
->
replica
;
pOld
->
replica
=
pNew
->
replica
;
memcpy
(
pOld
Vgroup
->
vnodeGid
,
pNewVgroup
->
vnodeGid
,
TSDB_MAX_REPLICA
*
sizeof
(
SVnodeGid
));
memcpy
(
pOld
->
vnodeGid
,
pNew
->
vnodeGid
,
TSDB_MAX_REPLICA
*
sizeof
(
SVnodeGid
));
return
0
;
return
0
;
}
}
...
@@ -273,15 +273,10 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
...
@@ -273,15 +273,10 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
SDnodeObj
*
pDnode
=
pObj
;
SDnodeObj
*
pDnode
=
pObj
;
SArray
*
pArray
=
p1
;
SArray
*
pArray
=
p1
;
pDnode
->
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
int64_t
curMs
=
taosGetTimestampMs
();
int64_t
curMs
=
taosGetTimestampMs
();
bool
online
=
mndIsDnodeOnline
(
pMnode
,
pDnode
,
curMs
);
bool
online
=
mndIsDnodeOnline
(
pMnode
,
pDnode
,
curMs
);
if
(
online
&&
pDnode
->
numOfSupportVnodes
>
0
)
{
bool
isMnode
=
mndIsMnode
(
pMnode
,
pDnode
->
id
);
taosArrayPush
(
pArray
,
pDnode
);
pDnode
->
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
}
bool
isMnode
=
mndIsMnode
(
pMnode
,
pDnode
->
id
);
mDebug
(
"dnode:%d, vnodes:%d supportVnodes:%d isMnode:%d online:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
,
mDebug
(
"dnode:%d, vnodes:%d supportVnodes:%d isMnode:%d online:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
,
pDnode
->
numOfSupportVnodes
,
isMnode
,
online
);
pDnode
->
numOfSupportVnodes
,
isMnode
,
online
);
...
@@ -290,6 +285,9 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
...
@@ -290,6 +285,9 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
pDnode
->
numOfVnodes
++
;
pDnode
->
numOfVnodes
++
;
}
}
if
(
online
&&
pDnode
->
numOfSupportVnodes
>
0
)
{
taosArrayPush
(
pArray
,
pDnode
);
}
return
true
;
return
true
;
}
}
...
@@ -311,7 +309,7 @@ static SArray *mndBuildDnodesArray(SMnode *pMnode) {
...
@@ -311,7 +309,7 @@ static SArray *mndBuildDnodesArray(SMnode *pMnode) {
static
int32_t
mndCompareDnodeVnodes
(
SDnodeObj
*
pDnode1
,
SDnodeObj
*
pDnode2
)
{
static
int32_t
mndCompareDnodeVnodes
(
SDnodeObj
*
pDnode1
,
SDnodeObj
*
pDnode2
)
{
float
d1Score
=
(
float
)
pDnode1
->
numOfVnodes
/
pDnode1
->
numOfSupportVnodes
;
float
d1Score
=
(
float
)
pDnode1
->
numOfVnodes
/
pDnode1
->
numOfSupportVnodes
;
float
d2Score
=
(
float
)
pDnode2
->
numOfVnodes
/
pDnode2
->
numOfSupportVnodes
;
float
d2Score
=
(
float
)
pDnode2
->
numOfVnodes
/
pDnode2
->
numOfSupportVnodes
;
return
d1Score
>
d2Score
?
1
:
0
;
return
d1Score
>
=
d2Score
?
1
:
0
;
}
}
static
int32_t
mndGetAvailableDnode
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SArray
*
pArray
)
{
static
int32_t
mndGetAvailableDnode
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SArray
*
pArray
)
{
...
@@ -321,6 +319,14 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pAr
...
@@ -321,6 +319,14 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pAr
taosArraySort
(
pArray
,
(
__compar_fn_t
)
mndCompareDnodeVnodes
);
taosArraySort
(
pArray
,
(
__compar_fn_t
)
mndCompareDnodeVnodes
);
int32_t
size
=
taosArrayGetSize
(
pArray
);
if
(
size
<
pVgroup
->
replica
)
{
mError
(
"db:%s, vgId:%d, no enough online dnodes:%d to alloc %d replica"
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
size
,
pVgroup
->
replica
);
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
return
-
1
;
}
for
(
int32_t
v
=
0
;
v
<
pVgroup
->
replica
;
++
v
)
{
for
(
int32_t
v
=
0
;
v
<
pVgroup
->
replica
;
++
v
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
v
];
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
v
];
SDnodeObj
*
pDnode
=
taosArrayGet
(
pArray
,
v
);
SDnodeObj
*
pDnode
=
taosArrayGet
(
pArray
,
v
);
...
@@ -427,24 +433,24 @@ SEpSet mndGetVgroupEpset(SMnode *pMnode, SVgObj *pVgroup) {
...
@@ -427,24 +433,24 @@ SEpSet mndGetVgroupEpset(SMnode *pMnode, SVgObj *pVgroup) {
return
epset
;
return
epset
;
}
}
static
int32_t
mndProcessCreateVnodeRsp
(
SMnodeMsg
*
p
Msg
)
{
static
int32_t
mndProcessCreateVnodeRsp
(
SMnodeMsg
*
p
Rsp
)
{
mndTransProcessRsp
(
p
Msg
);
mndTransProcessRsp
(
p
Rsp
);
return
0
;
return
0
;
}
}
static
int32_t
mndProcessAlterVnodeRsp
(
SMnodeMsg
*
p
Msg
)
{
static
int32_t
mndProcessAlterVnodeRsp
(
SMnodeMsg
*
p
Rsp
)
{
mndTransProcessRsp
(
p
Msg
);
mndTransProcessRsp
(
p
Rsp
);
return
0
;
return
0
;
}
}
static
int32_t
mndProcessDropVnodeRsp
(
SMnodeMsg
*
p
Msg
)
{
static
int32_t
mndProcessDropVnodeRsp
(
SMnodeMsg
*
p
Rsp
)
{
mndTransProcessRsp
(
p
Msg
);
mndTransProcessRsp
(
p
Rsp
);
return
0
;
return
0
;
}
}
static
int32_t
mndProcessSyncVnodeRsp
(
SMnodeMsg
*
p
Msg
)
{
return
0
;
}
static
int32_t
mndProcessSyncVnodeRsp
(
SMnodeMsg
*
p
Rsp
)
{
return
0
;
}
static
int32_t
mndProcessCompactVnodeRsp
(
SMnodeMsg
*
p
Msg
)
{
return
0
;
}
static
int32_t
mndProcessCompactVnodeRsp
(
SMnodeMsg
*
p
Rsp
)
{
return
0
;
}
static
bool
mndGetVgroupMaxReplicaFp
(
SMnode
*
pMnode
,
void
*
pObj
,
void
*
p1
,
void
*
p2
,
void
*
p3
)
{
static
bool
mndGetVgroupMaxReplicaFp
(
SMnode
*
pMnode
,
void
*
pObj
,
void
*
p1
,
void
*
p2
,
void
*
p3
)
{
SVgObj
*
pVgroup
=
pObj
;
SVgObj
*
pVgroup
=
pObj
;
...
@@ -475,8 +481,8 @@ static int32_t mndGetVgroupMaxReplica(SMnode *pMnode, char *dbName, int8_t *pRep
...
@@ -475,8 +481,8 @@ static int32_t mndGetVgroupMaxReplica(SMnode *pMnode, char *dbName, int8_t *pRep
return
0
;
return
0
;
}
}
static
int32_t
mndGetVgroupMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
static
int32_t
mndGetVgroupMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
if
(
mndGetVgroupMaxReplica
(
pMnode
,
pShow
->
db
,
&
pShow
->
replica
,
&
pShow
->
numOfRows
)
!=
0
)
{
if
(
mndGetVgroupMaxReplica
(
pMnode
,
pShow
->
db
,
&
pShow
->
replica
,
&
pShow
->
numOfRows
)
!=
0
)
{
...
@@ -526,8 +532,8 @@ static int32_t mndGetVgroupMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
...
@@ -526,8 +532,8 @@ static int32_t mndGetVgroupMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg
return
0
;
return
0
;
}
}
static
int32_t
mndRetrieveVgroups
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
static
int32_t
mndRetrieveVgroups
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
SVgObj
*
pVgroup
=
NULL
;
SVgObj
*
pVgroup
=
NULL
;
...
@@ -593,8 +599,8 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) {
...
@@ -593,8 +599,8 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) {
return
numOfVnodes
;
return
numOfVnodes
;
}
}
static
int32_t
mndGetVnodeMeta
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
STableMetaMsg
*
pMeta
)
{
static
int32_t
mndGetVnodeMeta
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
STableMetaRsp
*
pMeta
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
...
@@ -633,8 +639,8 @@ static int32_t mndGetVnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
...
@@ -633,8 +639,8 @@ static int32_t mndGetVnodeMeta(SMnodeMsg *pMsg, SShowObj *pShow, STableMetaMsg *
return
0
;
return
0
;
}
}
static
int32_t
mndRetrieveVnodes
(
SMnodeMsg
*
p
Msg
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
static
int32_t
mndRetrieveVnodes
(
SMnodeMsg
*
p
Req
,
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
)
{
SMnode
*
pMnode
=
p
Msg
->
pMnode
;
SMnode
*
pMnode
=
p
Req
->
pMnode
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
SVgObj
*
pVgroup
=
NULL
;
SVgObj
*
pVgroup
=
NULL
;
...
...
source/dnode/mnode/impl/src/mnode.c
浏览文件 @
32f9383a
...
@@ -61,8 +61,8 @@ void mndSendRedirectRsp(SMnode *pMnode, SRpcMsg *pMsg) {
...
@@ -61,8 +61,8 @@ void mndSendRedirectRsp(SMnode *pMnode, SRpcMsg *pMsg) {
static
void
mndTransReExecute
(
void
*
param
,
void
*
tmrId
)
{
static
void
mndTransReExecute
(
void
*
param
,
void
*
tmrId
)
{
SMnode
*
pMnode
=
param
;
SMnode
*
pMnode
=
param
;
if
(
mndIsMaster
(
pMnode
))
{
if
(
mndIsMaster
(
pMnode
))
{
STrans
Msg
*
pMsg
=
rpcMallocCont
(
sizeof
(
STransMsg
));
STrans
Req
*
pMsg
=
rpcMallocCont
(
sizeof
(
STransReq
));
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TRANS
,
.
pCont
=
pMsg
,
.
contLen
=
sizeof
(
STrans
Msg
)};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TRANS
,
.
pCont
=
pMsg
,
.
contLen
=
sizeof
(
STrans
Req
)};
pMnode
->
putReqToMWriteQFp
(
pMnode
->
pDnode
,
&
rpcMsg
);
pMnode
->
putReqToMWriteQFp
(
pMnode
->
pDnode
,
&
rpcMsg
);
}
}
...
...
source/dnode/mnode/impl/test/db/db.cpp
浏览文件 @
32f9383a
...
@@ -13,28 +13,17 @@
...
@@ -13,28 +13,17 @@
class
MndTestDb
:
public
::
testing
::
Test
{
class
MndTestDb
:
public
::
testing
::
Test
{
protected:
protected:
static
void
SetUpTestSuite
()
{
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/mnode_test_db"
,
9030
);
}
test
.
Init
(
"/tmp/mnode_test_db"
,
9030
);
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
const
char
*
fqdn
=
"localhost"
;
const
char
*
firstEp
=
"localhost:9030"
;
server2
.
Start
(
"/tmp/mnode_test_db2"
,
fqdn
,
9031
,
firstEp
);
static
Testbase
test
;
}
static
void
TearDownTestSuite
()
{
server2
.
Stop
();
test
.
Cleanup
();
}
static
Testbase
test
;
static
TestServer
server2
;
public:
public:
void
SetUp
()
override
{}
void
SetUp
()
override
{}
void
TearDown
()
override
{}
void
TearDown
()
override
{}
};
};
Testbase
MndTestDb
::
test
;
Testbase
MndTestDb
::
test
;
TestServer
MndTestDb
::
server2
;
TEST_F
(
MndTestDb
,
01
_ShowDb
)
{
TEST_F
(
MndTestDb
,
01
_ShowDb
)
{
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_DB
,
""
);
...
@@ -64,9 +53,9 @@ TEST_F(MndTestDb, 01_ShowDb) {
...
@@ -64,9 +53,9 @@ TEST_F(MndTestDb, 01_ShowDb) {
TEST_F
(
MndTestDb
,
02
_Create_Alter_Drop_Db
)
{
TEST_F
(
MndTestDb
,
02
_Create_Alter_Drop_Db
)
{
{
{
int32_t
contLen
=
sizeof
(
SCreateDb
Msg
);
int32_t
contLen
=
sizeof
(
SCreateDb
Req
);
SCreateDb
Msg
*
pReq
=
(
SCreateDbMsg
*
)
rpcMallocCont
(
contLen
);
SCreateDb
Req
*
pReq
=
(
SCreateDbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
db
,
"1.d1"
);
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
...
@@ -136,9 +125,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
...
@@ -136,9 +125,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
CheckBinary
(
"master"
,
9
);
CheckBinary
(
"master"
,
9
);
{
{
int32_t
contLen
=
sizeof
(
SAlterDb
Msg
);
int32_t
contLen
=
sizeof
(
SAlterDb
Req
);
SAlterDb
Msg
*
pReq
=
(
SAlterDbMsg
*
)
rpcMallocCont
(
contLen
);
SAlterDb
Req
*
pReq
=
(
SAlterDbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
db
,
"1.d1"
);
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
totalBlocks
=
htonl
(
12
);
pReq
->
totalBlocks
=
htonl
(
12
);
pReq
->
daysToKeep0
=
htonl
(
300
);
pReq
->
daysToKeep0
=
htonl
(
300
);
...
@@ -205,9 +194,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
...
@@ -205,9 +194,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
CheckInt8
(
0
);
// update
CheckInt8
(
0
);
// update
{
{
int32_t
contLen
=
sizeof
(
SDropDb
Msg
);
int32_t
contLen
=
sizeof
(
SDropDb
Req
);
SDropDb
Msg
*
pReq
=
(
SDropDbMsg
*
)
rpcMallocCont
(
contLen
);
SDropDb
Req
*
pReq
=
(
SDropDbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
db
,
"1.d1"
);
strcpy
(
pReq
->
db
,
"1.d1"
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_DB
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_DB
,
pReq
,
contLen
);
...
@@ -224,9 +213,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
...
@@ -224,9 +213,9 @@ TEST_F(MndTestDb, 02_Create_Alter_Drop_Db) {
TEST_F
(
MndTestDb
,
03
_Create_Use_Restart_Use_Db
)
{
TEST_F
(
MndTestDb
,
03
_Create_Use_Restart_Use_Db
)
{
{
{
int32_t
contLen
=
sizeof
(
SCreateDb
Msg
);
int32_t
contLen
=
sizeof
(
SCreateDb
Req
);
SCreateDb
Msg
*
pReq
=
(
SCreateDbMsg
*
)
rpcMallocCont
(
contLen
);
SCreateDb
Req
*
pReq
=
(
SCreateDbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
db
,
"1.d2"
);
strcpy
(
pReq
->
db
,
"1.d2"
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
...
@@ -261,9 +250,9 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
...
@@ -261,9 +250,9 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
CheckBinary
(
"d2"
,
TSDB_DB_NAME_LEN
-
1
);
CheckBinary
(
"d2"
,
TSDB_DB_NAME_LEN
-
1
);
{
{
int32_t
contLen
=
sizeof
(
SUseDb
Msg
);
int32_t
contLen
=
sizeof
(
SUseDb
Req
);
SUseDb
Msg
*
pReq
=
(
SUseDbMsg
*
)
rpcMallocCont
(
contLen
);
SUseDb
Req
*
pReq
=
(
SUseDbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
db
,
"1.d2"
);
strcpy
(
pReq
->
db
,
"1.d2"
);
pReq
->
vgVersion
=
htonl
(
-
1
);
pReq
->
vgVersion
=
htonl
(
-
1
);
...
@@ -290,7 +279,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
...
@@ -290,7 +279,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
EXPECT_EQ
(
pInfo
->
hashEnd
,
UINT32_MAX
/
2
-
1
);
EXPECT_EQ
(
pInfo
->
hashEnd
,
UINT32_MAX
/
2
-
1
);
EXPECT_EQ
(
pInfo
->
inUse
,
0
);
EXPECT_EQ
(
pInfo
->
inUse
,
0
);
EXPECT_EQ
(
pInfo
->
numOfEps
,
1
);
EXPECT_EQ
(
pInfo
->
numOfEps
,
1
);
SEpAddr
Msg
*
pAddr
=
&
pInfo
->
epAddr
[
0
];
SEpAddr
*
pAddr
=
&
pInfo
->
epAddr
[
0
];
pAddr
->
port
=
htons
(
pAddr
->
port
);
pAddr
->
port
=
htons
(
pAddr
->
port
);
EXPECT_EQ
(
pAddr
->
port
,
9030
);
EXPECT_EQ
(
pAddr
->
port
,
9030
);
EXPECT_STREQ
(
pAddr
->
fqdn
,
"localhost"
);
EXPECT_STREQ
(
pAddr
->
fqdn
,
"localhost"
);
...
@@ -306,7 +295,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
...
@@ -306,7 +295,7 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
EXPECT_EQ
(
pInfo
->
hashEnd
,
UINT32_MAX
);
EXPECT_EQ
(
pInfo
->
hashEnd
,
UINT32_MAX
);
EXPECT_EQ
(
pInfo
->
inUse
,
0
);
EXPECT_EQ
(
pInfo
->
inUse
,
0
);
EXPECT_EQ
(
pInfo
->
numOfEps
,
1
);
EXPECT_EQ
(
pInfo
->
numOfEps
,
1
);
SEpAddr
Msg
*
pAddr
=
&
pInfo
->
epAddr
[
0
];
SEpAddr
*
pAddr
=
&
pInfo
->
epAddr
[
0
];
pAddr
->
port
=
htons
(
pAddr
->
port
);
pAddr
->
port
=
htons
(
pAddr
->
port
);
EXPECT_EQ
(
pAddr
->
port
,
9030
);
EXPECT_EQ
(
pAddr
->
port
,
9030
);
EXPECT_STREQ
(
pAddr
->
fqdn
,
"localhost"
);
EXPECT_STREQ
(
pAddr
->
fqdn
,
"localhost"
);
...
@@ -314,9 +303,9 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
...
@@ -314,9 +303,9 @@ TEST_F(MndTestDb, 03_Create_Use_Restart_Use_Db) {
}
}
{
{
int32_t
contLen
=
sizeof
(
SDropDb
Msg
);
int32_t
contLen
=
sizeof
(
SDropDb
Req
);
SDropDb
Msg
*
pReq
=
(
SDropDbMsg
*
)
rpcMallocCont
(
contLen
);
SDropDb
Req
*
pReq
=
(
SDropDbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
db
,
"1.d2"
);
strcpy
(
pReq
->
db
,
"1.d2"
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_DB
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_DB
,
pReq
,
contLen
);
...
...
source/dnode/mnode/impl/test/profile/profile.cpp
浏览文件 @
32f9383a
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
class
MndTestProfile
:
public
::
testing
::
Test
{
class
MndTestProfile
:
public
::
testing
::
Test
{
protected:
protected:
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/mnode_test_profile"
,
90
22
);
}
static
void
SetUpTestSuite
()
{
test
.
Init
(
"/tmp/mnode_test_profile"
,
90
31
);
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
void
TearDownTestSuite
()
{
test
.
Cleanup
();
}
static
Testbase
test
;
static
Testbase
test
;
...
@@ -53,7 +53,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) {
...
@@ -53,7 +53,7 @@ TEST_F(MndTestProfile, 01_ConnectMsg) {
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
22
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
31
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
connId
=
pRsp
->
connId
;
connId
=
pRsp
->
connId
;
...
@@ -127,7 +127,7 @@ TEST_F(MndTestProfile, 04_HeartBeatMsg) {
...
@@ -127,7 +127,7 @@ TEST_F(MndTestProfile, 04_HeartBeatMsg) {
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
22
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
31
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
}
}
...
@@ -185,7 +185,7 @@ TEST_F(MndTestProfile, 05_KillConnMsg) {
...
@@ -185,7 +185,7 @@ TEST_F(MndTestProfile, 05_KillConnMsg) {
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
22
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
31
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
connId
=
pRsp
->
connId
;
connId
=
pRsp
->
connId
;
...
@@ -249,7 +249,7 @@ TEST_F(MndTestProfile, 07_KillQueryMsg) {
...
@@ -249,7 +249,7 @@ TEST_F(MndTestProfile, 07_KillQueryMsg) {
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
inUse
,
0
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
numOfEps
,
1
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
22
);
EXPECT_EQ
(
pRsp
->
epSet
.
port
[
0
],
90
31
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
EXPECT_STREQ
(
pRsp
->
epSet
.
fqdn
[
0
],
"localhost"
);
}
}
}
}
...
...
source/dnode/mnode/impl/test/show/show.cpp
浏览文件 @
32f9383a
...
@@ -63,7 +63,7 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) {
...
@@ -63,7 +63,7 @@ TEST_F(MndTestShow, 03_ShowMsg_Conn) {
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_CONNS
,
""
);
test
.
SendShowMetaReq
(
TSDB_MGMT_TABLE_CONNS
,
""
);
STableMeta
Msg
*
pMeta
=
test
.
GetShowMeta
();
STableMeta
Rsp
*
pMeta
=
test
.
GetShowMeta
();
EXPECT_STREQ
(
pMeta
->
tbFname
,
"show connections"
);
EXPECT_STREQ
(
pMeta
->
tbFname
,
"show connections"
);
EXPECT_EQ
(
pMeta
->
numOfTags
,
0
);
EXPECT_EQ
(
pMeta
->
numOfTags
,
0
);
EXPECT_EQ
(
pMeta
->
numOfColumns
,
7
);
EXPECT_EQ
(
pMeta
->
numOfColumns
,
7
);
...
...
source/dnode/mnode/impl/test/stb/stb.cpp
浏览文件 @
32f9383a
...
@@ -27,9 +27,9 @@ Testbase MndTestStb::test;
...
@@ -27,9 +27,9 @@ Testbase MndTestStb::test;
TEST_F
(
MndTestStb
,
01
_Create_Show_Meta_Drop_Restart_Stb
)
{
TEST_F
(
MndTestStb
,
01
_Create_Show_Meta_Drop_Restart_Stb
)
{
{
{
int32_t
contLen
=
sizeof
(
SCreateDb
Msg
);
int32_t
contLen
=
sizeof
(
SCreateDb
Req
);
SCreateDb
Msg
*
pReq
=
(
SCreateDbMsg
*
)
rpcMallocCont
(
contLen
);
SCreateDb
Req
*
pReq
=
(
SCreateDbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
db
,
"1.d1"
);
strcpy
(
pReq
->
db
,
"1.d1"
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
numOfVgroups
=
htonl
(
2
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
pReq
->
cacheBlockSize
=
htonl
(
16
);
...
@@ -59,9 +59,9 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
...
@@ -59,9 +59,9 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
{
{
int32_t
cols
=
2
;
int32_t
cols
=
2
;
int32_t
tags
=
3
;
int32_t
tags
=
3
;
int32_t
contLen
=
(
tags
+
cols
)
*
sizeof
(
SSchema
)
+
sizeof
(
S
CreateStbMsg
);
int32_t
contLen
=
(
tags
+
cols
)
*
sizeof
(
SSchema
)
+
sizeof
(
S
MCreateStbReq
);
S
CreateStbMsg
*
pReq
=
(
SCreateStbMsg
*
)
rpcMallocCont
(
contLen
);
S
MCreateStbReq
*
pReq
=
(
SMCreateStbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
name
,
"1.d1.stb"
);
strcpy
(
pReq
->
name
,
"1.d1.stb"
);
pReq
->
numOfTags
=
htonl
(
tags
);
pReq
->
numOfTags
=
htonl
(
tags
);
pReq
->
numOfColumns
=
htonl
(
cols
);
pReq
->
numOfColumns
=
htonl
(
cols
);
...
@@ -123,16 +123,16 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
...
@@ -123,16 +123,16 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
// ----- meta ------
// ----- meta ------
{
{
int32_t
contLen
=
sizeof
(
STableInfo
Msg
);
int32_t
contLen
=
sizeof
(
STableInfo
Req
);
STableInfo
Msg
*
pReq
=
(
STableInfoMsg
*
)
rpcMallocCont
(
contLen
);
STableInfo
Req
*
pReq
=
(
STableInfoReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
tableFname
,
"1.d1.stb"
);
strcpy
(
pReq
->
tableFname
,
"1.d1.stb"
);
SRpcMsg
*
pMsg
=
test
.
SendReq
(
TDMT_MND_STB_META
,
pReq
,
contLen
);
SRpcMsg
*
pMsg
=
test
.
SendReq
(
TDMT_MND_STB_META
,
pReq
,
contLen
);
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_NE
(
pMsg
,
nullptr
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
ASSERT_EQ
(
pMsg
->
code
,
0
);
STableMeta
Msg
*
pRsp
=
(
STableMetaMsg
*
)
pMsg
->
pCont
;
STableMeta
Rsp
*
pRsp
=
(
STableMetaRsp
*
)
pMsg
->
pCont
;
pRsp
->
numOfTags
=
htonl
(
pRsp
->
numOfTags
);
pRsp
->
numOfTags
=
htonl
(
pRsp
->
numOfTags
);
pRsp
->
numOfColumns
=
htonl
(
pRsp
->
numOfColumns
);
pRsp
->
numOfColumns
=
htonl
(
pRsp
->
numOfColumns
);
pRsp
->
sversion
=
htonl
(
pRsp
->
sversion
);
pRsp
->
sversion
=
htonl
(
pRsp
->
sversion
);
...
@@ -214,9 +214,9 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
...
@@ -214,9 +214,9 @@ TEST_F(MndTestStb, 01_Create_Show_Meta_Drop_Restart_Stb) {
CheckInt32
(
3
);
CheckInt32
(
3
);
{
{
int32_t
contLen
=
sizeof
(
S
DropStbMsg
);
int32_t
contLen
=
sizeof
(
S
MDropStbReq
);
S
DropStbMsg
*
pReq
=
(
SDropStbMsg
*
)
rpcMallocCont
(
contLen
);
S
MDropStbReq
*
pReq
=
(
SMDropStbReq
*
)
rpcMallocCont
(
contLen
);
strcpy
(
pReq
->
name
,
"1.d1.stb"
);
strcpy
(
pReq
->
name
,
"1.d1.stb"
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_STB
,
pReq
,
contLen
);
SRpcMsg
*
pRsp
=
test
.
SendReq
(
TDMT_MND_DROP_STB
,
pReq
,
contLen
);
...
...
source/dnode/vnode/impl/inc/vnodeDef.h
浏览文件 @
32f9383a
...
@@ -57,6 +57,8 @@ typedef struct SVnodeMgr {
...
@@ -57,6 +57,8 @@ typedef struct SVnodeMgr {
pthread_cond_t
hasTask
;
pthread_cond_t
hasTask
;
TD_DLIST
(
SVnodeTask
)
queue
;
TD_DLIST
(
SVnodeTask
)
queue
;
// For vnode Mgmt
// For vnode Mgmt
SDnode
*
pDnode
;
PutReqToVQueryQFp
putReqToVQueryQFp
;
}
SVnodeMgr
;
}
SVnodeMgr
;
extern
SVnodeMgr
vnodeMgr
;
extern
SVnodeMgr
vnodeMgr
;
...
@@ -75,10 +77,13 @@ struct SVnode {
...
@@ -75,10 +77,13 @@ struct SVnode {
SVnodeFS
*
pFs
;
SVnodeFS
*
pFs
;
tsem_t
canCommit
;
tsem_t
canCommit
;
SQHandle
*
pQuery
;
SQHandle
*
pQuery
;
SDnode
*
pDnode
;
};
};
int
vnodeScheduleTask
(
SVnodeTask
*
task
);
int
vnodeScheduleTask
(
SVnodeTask
*
task
);
int32_t
vnodePutReqToVQueryQ
(
SVnode
*
pVnode
,
struct
SRpcMsg
*
pReq
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/vnode/impl/inc/vnodeRequest.h
浏览文件 @
32f9383a
...
@@ -22,9 +22,9 @@
...
@@ -22,9 +22,9 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
// SVDropT
able
Req
// SVDropT
b
Req
// int vnodeBuildDropTableReq(void **buf, const SVDropT
able
Req *pReq);
// int vnodeBuildDropTableReq(void **buf, const SVDropT
b
Req *pReq);
// void *vnodeParseDropTableReq(void *buf, SVDropT
able
Req *pReq);
// void *vnodeParseDropTableReq(void *buf, SVDropT
b
Req *pReq);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
source/dnode/vnode/impl/src/vnodeMain.c
浏览文件 @
32f9383a
...
@@ -15,27 +15,29 @@
...
@@ -15,27 +15,29 @@
#include "vnodeDef.h"
#include "vnodeDef.h"
static
SVnode
*
vnodeNew
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
,
int32_t
vid
);
static
SVnode
*
vnodeNew
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
);
static
void
vnodeFree
(
SVnode
*
pVnode
);
static
void
vnodeFree
(
SVnode
*
pVnode
);
static
int
vnodeOpenImpl
(
SVnode
*
pVnode
);
static
int
vnodeOpenImpl
(
SVnode
*
pVnode
);
static
void
vnodeCloseImpl
(
SVnode
*
pVnode
);
static
void
vnodeCloseImpl
(
SVnode
*
pVnode
);
SVnode
*
vnodeOpen
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
,
int32_t
vid
)
{
SVnode
*
vnodeOpen
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
)
{
SVnode
*
pVnode
=
NULL
;
SVnode
*
pVnode
=
NULL
;
// Set default options
// Set default options
//if (pVnodeCfg == NULL) {
SVnodeCfg
cfg
=
defaultVnodeOptions
;
pVnodeCfg
=
&
defaultVnodeOptions
;
if
(
pVnodeCfg
!=
NULL
)
{
//}
cfg
.
vgId
=
pVnodeCfg
->
vgId
;
cfg
.
pDnode
=
pVnodeCfg
->
pDnode
;
}
// Validate options
// Validate options
if
(
vnodeValidateOptions
(
pVnodeC
fg
)
<
0
)
{
if
(
vnodeValidateOptions
(
&
c
fg
)
<
0
)
{
// TODO
// TODO
return
NULL
;
return
NULL
;
}
}
// Create the handle
// Create the handle
pVnode
=
vnodeNew
(
path
,
pVnodeCfg
,
vid
);
pVnode
=
vnodeNew
(
path
,
&
cfg
);
if
(
pVnode
==
NULL
)
{
if
(
pVnode
==
NULL
)
{
// TODO: handle error
// TODO: handle error
return
NULL
;
return
NULL
;
...
@@ -62,7 +64,7 @@ void vnodeClose(SVnode *pVnode) {
...
@@ -62,7 +64,7 @@ void vnodeClose(SVnode *pVnode) {
void
vnodeDestroy
(
const
char
*
path
)
{
taosRemoveDir
(
path
);
}
void
vnodeDestroy
(
const
char
*
path
)
{
taosRemoveDir
(
path
);
}
/* ------------------------ STATIC METHODS ------------------------ */
/* ------------------------ STATIC METHODS ------------------------ */
static
SVnode
*
vnodeNew
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
,
int32_t
vid
)
{
static
SVnode
*
vnodeNew
(
const
char
*
path
,
const
SVnodeCfg
*
pVnodeCfg
)
{
SVnode
*
pVnode
=
NULL
;
SVnode
*
pVnode
=
NULL
;
pVnode
=
(
SVnode
*
)
calloc
(
1
,
sizeof
(
*
pVnode
));
pVnode
=
(
SVnode
*
)
calloc
(
1
,
sizeof
(
*
pVnode
));
...
@@ -71,7 +73,8 @@ static SVnode *vnodeNew(const char *path, const SVnodeCfg *pVnodeCfg, int32_t vi
...
@@ -71,7 +73,8 @@ static SVnode *vnodeNew(const char *path, const SVnodeCfg *pVnodeCfg, int32_t vi
return
NULL
;
return
NULL
;
}
}
pVnode
->
vgId
=
vid
;
pVnode
->
vgId
=
pVnodeCfg
->
vgId
;
pVnode
->
pDnode
=
pVnodeCfg
->
pDnode
;
pVnode
->
path
=
strdup
(
path
);
pVnode
->
path
=
strdup
(
path
);
vnodeOptionsCopy
(
&
(
pVnode
->
config
),
pVnodeCfg
);
vnodeOptionsCopy
(
&
(
pVnode
->
config
),
pVnodeCfg
);
...
...
source/dnode/vnode/impl/src/vnodeMgr.c
浏览文件 @
32f9383a
...
@@ -19,17 +19,18 @@ SVnodeMgr vnodeMgr = {.vnodeInitFlag = TD_MOD_UNINITIALIZED};
...
@@ -19,17 +19,18 @@ SVnodeMgr vnodeMgr = {.vnodeInitFlag = TD_MOD_UNINITIALIZED};
static
void
*
loop
(
void
*
arg
);
static
void
*
loop
(
void
*
arg
);
int
vnodeInit
(
uint16_t
nthreads
)
{
int
vnodeInit
(
const
SVnodeOpt
*
pOption
)
{
if
(
TD_CHECK_AND_SET_MODE_INIT
(
&
(
vnodeMgr
.
vnodeInitFlag
))
==
TD_MOD_INITIALIZED
)
{
if
(
TD_CHECK_AND_SET_MODE_INIT
(
&
(
vnodeMgr
.
vnodeInitFlag
))
==
TD_MOD_INITIALIZED
)
{
return
0
;
return
0
;
}
}
vnodeMgr
.
stop
=
false
;
vnodeMgr
.
stop
=
false
;
vnodeMgr
.
putReqToVQueryQFp
=
pOption
->
putReqToVQueryQFp
;
// Start commit handers
// Start commit handers
if
(
nthreads
>
0
)
{
if
(
pOption
->
nthreads
>
0
)
{
vnodeMgr
.
nthreads
=
nthreads
;
vnodeMgr
.
nthreads
=
pOption
->
nthreads
;
vnodeMgr
.
threads
=
(
pthread_t
*
)
calloc
(
nthreads
,
sizeof
(
pthread_t
));
vnodeMgr
.
threads
=
(
pthread_t
*
)
calloc
(
pOption
->
nthreads
,
sizeof
(
pthread_t
));
if
(
vnodeMgr
.
threads
==
NULL
)
{
if
(
vnodeMgr
.
threads
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
...
@@ -38,7 +39,7 @@ int vnodeInit(uint16_t nthreads) {
...
@@ -38,7 +39,7 @@ int vnodeInit(uint16_t nthreads) {
pthread_cond_init
(
&
(
vnodeMgr
.
hasTask
),
NULL
);
pthread_cond_init
(
&
(
vnodeMgr
.
hasTask
),
NULL
);
TD_DLIST_INIT
(
&
(
vnodeMgr
.
queue
));
TD_DLIST_INIT
(
&
(
vnodeMgr
.
queue
));
for
(
uint16_t
i
=
0
;
i
<
nthreads
;
i
++
)
{
for
(
uint16_t
i
=
0
;
i
<
pOption
->
nthreads
;
i
++
)
{
pthread_create
(
&
(
vnodeMgr
.
threads
[
i
]),
NULL
,
loop
,
NULL
);
pthread_create
(
&
(
vnodeMgr
.
threads
[
i
]),
NULL
,
loop
,
NULL
);
pthread_setname_np
(
vnodeMgr
.
threads
[
i
],
"VND Commit Thread"
);
pthread_setname_np
(
vnodeMgr
.
threads
[
i
],
"VND Commit Thread"
);
}
}
...
@@ -89,6 +90,14 @@ int vnodeScheduleTask(SVnodeTask* pTask) {
...
@@ -89,6 +90,14 @@ int vnodeScheduleTask(SVnodeTask* pTask) {
return
0
;
return
0
;
}
}
int32_t
vnodePutReqToVQueryQ
(
SVnode
*
pVnode
,
struct
SRpcMsg
*
pReq
)
{
if
(
pVnode
==
NULL
||
pVnode
->
pDnode
==
NULL
||
vnodeMgr
.
putReqToVQueryQFp
==
NULL
)
{
terrno
=
TSDB_CODE_VND_APP_ERROR
;
return
-
1
;
}
return
(
*
vnodeMgr
.
putReqToVQueryQFp
)(
pVnode
->
pDnode
,
pReq
);
}
/* ------------------------ STATIC METHODS ------------------------ */
/* ------------------------ STATIC METHODS ------------------------ */
static
void
*
loop
(
void
*
arg
)
{
static
void
*
loop
(
void
*
arg
)
{
SVnodeTask
*
pTask
;
SVnodeTask
*
pTask
;
...
...
source/dnode/vnode/impl/src/vnodeQuery.c
浏览文件 @
32f9383a
...
@@ -23,7 +23,7 @@ int vnodeQueryOpen(SVnode *pVnode) { return qWorkerInit(NULL, &pVnode->pQuery);
...
@@ -23,7 +23,7 @@ int vnodeQueryOpen(SVnode *pVnode) { return qWorkerInit(NULL, &pVnode->pQuery);
int
vnodeProcessQueryReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
int
vnodeProcessQueryReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
vTrace
(
"query message is processed"
);
vTrace
(
"query message is processed"
);
return
qWorkerProcessQueryMsg
(
pVnode
,
pVnode
->
pQuery
,
pMsg
);
return
qWorkerProcessQueryMsg
(
pVnode
->
pTsdb
,
pVnode
->
pQuery
,
pMsg
);
}
}
int
vnodeProcessFetchReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
int
vnodeProcessFetchReq
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
...
@@ -53,14 +53,14 @@ int vnodeProcessFetchReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
...
@@ -53,14 +53,14 @@ int vnodeProcessFetchReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
}
}
static
int
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
static
int
vnodeGetTableMeta
(
SVnode
*
pVnode
,
SRpcMsg
*
pMsg
,
SRpcMsg
**
pRsp
)
{
STableInfo
Msg
*
pReq
=
(
STableInfoMsg
*
)(
pMsg
->
pCont
);
STableInfo
Req
*
pReq
=
(
STableInfoReq
*
)(
pMsg
->
pCont
);
STbCfg
*
pTbCfg
=
NULL
;
STbCfg
*
pTbCfg
=
NULL
;
STbCfg
*
pStbCfg
=
NULL
;
STbCfg
*
pStbCfg
=
NULL
;
tb_uid_t
uid
;
tb_uid_t
uid
;
int32_t
nCols
;
int32_t
nCols
;
int32_t
nTagCols
;
int32_t
nTagCols
;
SSchemaWrapper
*
pSW
;
SSchemaWrapper
*
pSW
;
STableMeta
Msg
*
pTbMetaMsg
=
NULL
;
STableMeta
Rsp
*
pTbMetaMsg
=
NULL
;
SSchema
*
pTagSchema
;
SSchema
*
pTagSchema
;
SRpcMsg
rpcMsg
;
SRpcMsg
rpcMsg
;
int
msgLen
=
0
;
int
msgLen
=
0
;
...
@@ -94,8 +94,8 @@ static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
...
@@ -94,8 +94,8 @@ static int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
pTagSchema
=
NULL
;
pTagSchema
=
NULL
;
}
}
msgLen
=
sizeof
(
STableMeta
Msg
)
+
sizeof
(
SSchema
)
*
(
nCols
+
nTagCols
);
msgLen
=
sizeof
(
STableMeta
Rsp
)
+
sizeof
(
SSchema
)
*
(
nCols
+
nTagCols
);
pTbMetaMsg
=
(
STableMeta
Msg
*
)
rpcMallocCont
(
msgLen
);
pTbMetaMsg
=
(
STableMeta
Rsp
*
)
rpcMallocCont
(
msgLen
);
if
(
pTbMetaMsg
==
NULL
)
{
if
(
pTbMetaMsg
==
NULL
)
{
goto
_exit
;
goto
_exit
;
}
}
...
@@ -167,7 +167,7 @@ static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg) {
...
@@ -167,7 +167,7 @@ static int32_t vnodeGetTableList(SVnode *pVnode, SRpcMsg *pMsg) {
// SVShowTablesFetchReq *pFetchReq = pMsg->pCont;
// SVShowTablesFetchReq *pFetchReq = pMsg->pCont;
SVShowTablesFetchRsp
*
pFetchRsp
=
(
SVShowTablesFetchRsp
*
)
rpcMallocCont
(
sizeof
(
SVShowTablesFetchRsp
)
+
payloadLen
);
SVShowTablesFetchRsp
*
pFetchRsp
=
(
SVShowTablesFetchRsp
*
)
rpcMallocCont
(
sizeof
(
SVShowTablesFetchRsp
)
+
payloadLen
);
memset
(
pFetchRsp
,
0
,
sizeof
(
struct
SVShowTablesFetchRsp
)
+
payloadLen
);
memset
(
pFetchRsp
,
0
,
sizeof
(
SVShowTablesFetchRsp
)
+
payloadLen
);
char
*
p
=
pFetchRsp
->
data
;
char
*
p
=
pFetchRsp
->
data
;
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfTables
;
++
i
)
{
...
...
source/dnode/vnode/impl/src/vnodeRequest.c
浏览文件 @
32f9383a
...
@@ -108,12 +108,12 @@ static void *vnodeParseCreateTableReq(void *buf, SVCreateTableReq *pReq) {
...
@@ -108,12 +108,12 @@ static void *vnodeParseCreateTableReq(void *buf, SVCreateTableReq *pReq) {
return buf;
return buf;
}
}
int vnodeBuildDropTableReq(void **buf, const SVDropT
able
Req *pReq) {
int vnodeBuildDropTableReq(void **buf, const SVDropT
b
Req *pReq) {
// TODO
// TODO
return 0;
return 0;
}
}
void *vnodeParseDropTableReq(void *buf, SVDropT
able
Req *pReq) {
void *vnodeParseDropTableReq(void *buf, SVDropT
b
Req *pReq) {
// TODO
// TODO
}
}
#endif
#endif
\ No newline at end of file
source/dnode/vnode/meta/src/metaIdx.c
浏览文件 @
32f9383a
...
@@ -49,9 +49,7 @@ int metaOpenIdx(SMeta *pMeta) {
...
@@ -49,9 +49,7 @@ int metaOpenIdx(SMeta *pMeta) {
#ifdef USE_INVERTED_INDEX
#ifdef USE_INVERTED_INDEX
SIndexOpts
opts
;
SIndexOpts
opts
;
if
(
indexOpen
(
&
opts
,
pMeta
->
path
,
&
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
if
(
indexOpen
(
&
opts
,
pMeta
->
path
,
&
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
return
-
1
;
}
return
-
1
;
}
#endif
#endif
return
0
;
return
0
;
...
@@ -67,16 +65,14 @@ void metaCloseIdx(SMeta *pMeta) { /* TODO */
...
@@ -67,16 +65,14 @@ void metaCloseIdx(SMeta *pMeta) { /* TODO */
#ifdef USE_INVERTED_INDEX
#ifdef USE_INVERTED_INDEX
SIndexOpts
opts
;
SIndexOpts
opts
;
if
(
indexClose
(
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
if
(
indexClose
(
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
return
-
1
;
}
return
-
1
;
}
#endif
#endif
}
}
int
metaSaveTableToIdx
(
SMeta
*
pMeta
,
const
STbCfg
*
pTbCfg
)
{
int
metaSaveTableToIdx
(
SMeta
*
pMeta
,
const
STbCfg
*
pTbCfg
)
{
#ifdef USE_INVERTED_INDEX
#ifdef USE_INVERTED_INDEX
if
(
pTbCfgs
-
type
==
META_CHILD_TABLE
)
{
if
(
pTbCfgs
->
type
==
META_CHILD_TABLE
)
{
char
buf
[
8
]
=
{
0
};
char
buf
[
8
]
=
{
0
};
int16_t
colId
=
(
kvRowColIdx
(
pTbCfg
->
ctbCfg
.
pTag
))[
0
].
colId
;
int16_t
colId
=
(
kvRowColIdx
(
pTbCfg
->
ctbCfg
.
pTag
))[
0
].
colId
;
sprintf
(
buf
,
"%d"
,
colId
);
// colname
sprintf
(
buf
,
"%d"
,
colId
);
// colname
...
...
source/dnode/vnode/tsdb/CMakeLists.txt
浏览文件 @
32f9383a
...
@@ -13,6 +13,7 @@ else(0)
...
@@ -13,6 +13,7 @@ else(0)
"src/tsdbReadImpl.c"
"src/tsdbReadImpl.c"
"src/tsdbFile.c"
"src/tsdbFile.c"
"src/tsdbFS.c"
"src/tsdbFS.c"
"src/tsdbRead.c"
)
)
endif
(
0
)
endif
(
0
)
...
...
source/dnode/vnode/tsdb/inc/tsdbMemTable.h
浏览文件 @
32f9383a
...
@@ -54,7 +54,7 @@ typedef struct STsdbMemTable {
...
@@ -54,7 +54,7 @@ typedef struct STsdbMemTable {
STsdbMemTable
*
tsdbNewMemTable
(
STsdb
*
pTsdb
);
STsdbMemTable
*
tsdbNewMemTable
(
STsdb
*
pTsdb
);
void
tsdbFreeMemTable
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
);
void
tsdbFreeMemTable
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
);
int
tsdbMemTableInsert
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
,
SSubmitMsg
*
pMsg
,
SShellSubmitRsp
Msg
*
pRsp
);
int
tsdbMemTableInsert
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
,
SSubmitMsg
*
pMsg
,
SShellSubmitRsp
*
pRsp
);
int
tsdbLoadDataFromCache
(
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
int
tsdbLoadDataFromCache
(
STable
*
pTable
,
SSkipListIterator
*
pIter
,
TSKEY
maxKey
,
int
maxRowsToRead
,
SDataCols
*
pCols
,
TKEY
*
filterKeys
,
int
nFilterKeys
,
bool
keepDup
,
SMergeInfo
*
pMergeInfo
);
TKEY
*
filterKeys
,
int
nFilterKeys
,
bool
keepDup
,
SMergeInfo
*
pMergeInfo
);
...
...
source/dnode/vnode/tsdb/src/tsdbCommit.c
浏览文件 @
32f9383a
...
@@ -1253,7 +1253,7 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDataCols *
...
@@ -1253,7 +1253,7 @@ int tsdbWriteBlockImpl(STsdb *pRepo, STable *pTable, SDFile *pDFile, SDataCols *
pBlock
->
keyFirst
=
dataColsKeyFirst
(
pDataCols
);
pBlock
->
keyFirst
=
dataColsKeyFirst
(
pDataCols
);
pBlock
->
keyLast
=
dataColsKeyLast
(
pDataCols
);
pBlock
->
keyLast
=
dataColsKeyLast
(
pDataCols
);
tsdbDebug
(
"vgId:%d
tid:%d
a block of data is written to file %s, offset %"
PRId64
tsdbDebug
(
"vgId:%d
uid:%"
PRId64
"
a block of data is written to file %s, offset %"
PRId64
" numOfRows %d len %d numOfCols %"
PRId16
" keyFirst %"
PRId64
" keyLast %"
PRId64
,
" numOfRows %d len %d numOfCols %"
PRId16
" keyFirst %"
PRId64
" keyLast %"
PRId64
,
REPO_ID
(
pRepo
),
TABLE_TID
(
pTable
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
rowsToWrite
,
pBlock
->
len
,
REPO_ID
(
pRepo
),
TABLE_TID
(
pTable
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
rowsToWrite
,
pBlock
->
len
,
pBlock
->
numOfCols
,
pBlock
->
keyFirst
,
pBlock
->
keyLast
);
pBlock
->
numOfCols
,
pBlock
->
keyFirst
,
pBlock
->
keyLast
);
...
...
source/dnode/vnode/tsdb/src/tsdbMemTable.c
浏览文件 @
32f9383a
...
@@ -73,7 +73,7 @@ void tsdbFreeMemTable(STsdb *pTsdb, STsdbMemTable *pMemTable) {
...
@@ -73,7 +73,7 @@ void tsdbFreeMemTable(STsdb *pTsdb, STsdbMemTable *pMemTable) {
}
}
}
}
int
tsdbMemTableInsert
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
,
SSubmitMsg
*
pMsg
,
SShellSubmitRsp
Msg
*
pRsp
)
{
int
tsdbMemTableInsert
(
STsdb
*
pTsdb
,
STsdbMemTable
*
pMemTable
,
SSubmitMsg
*
pMsg
,
SShellSubmitRsp
*
pRsp
)
{
SSubmitBlk
*
pBlock
=
NULL
;
SSubmitBlk
*
pBlock
=
NULL
;
SSubmitMsgIter
msgIter
=
{
0
};
SSubmitMsgIter
msgIter
=
{
0
};
int32_t
affectedrows
=
0
,
numOfRows
=
0
;
int32_t
affectedrows
=
0
,
numOfRows
=
0
;
...
...
source/dnode/vnode/tsdb/src/tsdbRead.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/catalog/test/catalogTests.cpp
浏览文件 @
32f9383a
无法预览此类型文件
source/libs/executor/CMakeLists.txt
浏览文件 @
32f9383a
aux_source_directory
(
src EXECUTOR_SRC
)
aux_source_directory
(
src EXECUTOR_SRC
)
add_library
(
executor
${
EXECUTOR_SRC
}
)
#add_library(executor ${EXECUTOR_SRC})
#target_link_libraries(
# executor
# PRIVATE os util common function parser planner qcom tsdb
#)
add_library
(
executor STATIC
${
EXECUTOR_SRC
}
)
#set_target_properties(executor PROPERTIES
# IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/libexecutor.a"
# INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/include/libs/executor"
# )
target_link_libraries
(
executor
PRIVATE os util common function parser planner qcom tsdb
)
target_include_directories
(
target_include_directories
(
executor
executor
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/executor"
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/executor"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
)
target_link_libraries
(
#if(${BUILD_TEST})
executor
ADD_SUBDIRECTORY
(
test
)
PRIVATE os util common function parser planner qcom
#endif(${BUILD_TEST})
)
\ No newline at end of file
\ No newline at end of file
source/libs/executor/inc/dataSinkInt.h
浏览文件 @
32f9383a
...
@@ -31,10 +31,10 @@ typedef struct SDataSinkManager {
...
@@ -31,10 +31,10 @@ typedef struct SDataSinkManager {
pthread_mutex_t
mutex
;
pthread_mutex_t
mutex
;
}
SDataSinkManager
;
}
SDataSinkManager
;
typedef
int32_t
(
*
FPutDataBlock
)(
struct
SDataSinkHandle
*
pHandle
,
const
SInputData
*
pInput
,
int32_t
*
pStatus
);
typedef
int32_t
(
*
FPutDataBlock
)(
struct
SDataSinkHandle
*
pHandle
,
const
SInputData
*
pInput
,
bool
*
pContinue
);
typedef
void
(
*
FEndPut
)(
struct
SDataSinkHandle
*
pHandle
);
typedef
void
(
*
FEndPut
)(
struct
SDataSinkHandle
*
pHandle
,
int64_t
useconds
);
typedef
int32_t
(
*
FGetDataLength
)(
struct
SDataSinkHandle
*
pHandle
,
int32_t
*
pStatus
);
typedef
void
(
*
FGetDataLength
)(
struct
SDataSinkHandle
*
pHandle
,
int32_t
*
pLen
,
bool
*
pQueryEnd
);
typedef
int32_t
(
*
FGetDataBlock
)(
struct
SDataSinkHandle
*
pHandle
,
SOut
PutData
*
pOutput
,
int32_t
*
pStatus
);
typedef
int32_t
(
*
FGetDataBlock
)(
struct
SDataSinkHandle
*
pHandle
,
SOut
putData
*
pOutput
);
typedef
int32_t
(
*
FDestroyDataSinker
)(
struct
SDataSinkHandle
*
pHandle
);
typedef
int32_t
(
*
FDestroyDataSinker
)(
struct
SDataSinkHandle
*
pHandle
);
typedef
struct
SDataSinkHandle
{
typedef
struct
SDataSinkHandle
{
...
...
source/libs/executor/inc/executil.h
浏览文件 @
32f9383a
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
#define GET_RES_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t))
#define GET_RES_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t))
#define GET_RES_EXT_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t) + POINTER_BYTES)
#define GET_RES_EXT_WINDOW_KEY_LEN(_l) ((_l) + sizeof(uint64_t) + POINTER_BYTES)
#define GET_
QID(_r) (((SQInfo*)((_r)->qinfo))->q
Id)
#define GET_
TASKID(_t) (((SExecTaskInfo*)(_t))->id.query
Id)
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
#define curTimeWindowIndex(_winres) ((_winres)->curIndex)
...
@@ -157,6 +157,6 @@ int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo);
...
@@ -157,6 +157,6 @@ int32_t getNumOfTotalRes(SGroupResInfo* pGroupResInfo);
int32_t
mergeIntoGroupResult
(
SGroupResInfo
*
pGroupResInfo
,
struct
STaskRuntimeEnv
*
pRuntimeEnv
,
int32_t
*
offset
);
int32_t
mergeIntoGroupResult
(
SGroupResInfo
*
pGroupResInfo
,
struct
STaskRuntimeEnv
*
pRuntimeEnv
,
int32_t
*
offset
);
int32_t
initUdfInfo
(
struct
SUdfInfo
*
pUdfInfo
);
//
int32_t initUdfInfo(struct SUdfInfo* pUdfInfo);
#endif // TDENGINE_QUERYUTIL_H
#endif // TDENGINE_QUERYUTIL_H
source/libs/executor/inc/executorInt.h
浏览文件 @
32f9383a
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
extern
"C"
{
extern
"C"
{
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
32f9383a
...
@@ -20,24 +20,19 @@
...
@@ -20,24 +20,19 @@
#include "ttszip.h"
#include "ttszip.h"
#include "tvariant.h"
#include "tvariant.h"
#include "
thash
.h"
#include "
dataSinkMgt
.h"
#include "executil.h"
#include "executil.h"
#include "planner.h"
#include "taosdef.h"
#include "taosdef.h"
#include "tarray.h"
#include "tarray.h"
#include "tfilter.h"
#include "tfilter.h"
#include "thash.h"
#include "tlockfree.h"
#include "tlockfree.h"
#include "tpagedfile.h"
#include "tpagedfile.h"
#include "planner.h"
#include "executor.h"
struct
SColumnFilterElem
;
struct
SColumnFilterElem
;
typedef
struct
{
uint32_t
numOfTables
;
SArray
*
pGroupList
;
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
}
STableGroupInfo
;
typedef
int32_t
(
*
__block_search_fn_t
)(
char
*
data
,
int32_t
num
,
int64_t
key
,
int32_t
order
);
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)
#define IS_QUERY_KILLED(_q) ((_q)->code == TSDB_CODE_TSC_QUERY_CANCELLED)
...
@@ -51,19 +46,19 @@ typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int
...
@@ -51,19 +46,19 @@ typedef int32_t (*__block_search_fn_t)(char* data, int32_t num, int64_t key, int
#define NEEDTO_COMPRESS_QUERY(size) ((size) > tsCompressColData? 1 : 0)
#define NEEDTO_COMPRESS_QUERY(size) ((size) > tsCompressColData? 1 : 0)
enum
{
enum
{
// when
query
starts to execute, this status will set
// when
this task
starts to execute, this status will set
QUERY
_NOT_COMPLETED
=
0x1u
,
TASK
_NOT_COMPLETED
=
0x1u
,
/*
query
is over
/*
Task
is over
* 1. this status is used in one row result query process, e.g., count/sum/first/last/ avg...etc.
* 1. this status is used in one row result query process, e.g., count/sum/first/last/ avg...etc.
* 2. when all data within queried time window, it is also denoted as query_completed
* 2. when all data within queried time window, it is also denoted as query_completed
*/
*/
QUERY
_COMPLETED
=
0x2u
,
TASK
_COMPLETED
=
0x2u
,
/* when the result is not completed return to client, this status will be
/* when the result is not completed return to client, this status will be
* usually used in case of interval query with interpolation option
* usually used in case of interval query with interpolation option
*/
*/
QUERY
_OVER
=
0x4u
,
TASK
_OVER
=
0x4u
,
};
};
typedef
struct
SResultRowCell
{
typedef
struct
SResultRowCell
{
...
@@ -129,6 +124,7 @@ typedef struct {
...
@@ -129,6 +124,7 @@ typedef struct {
}
SOperatorProfResult
;
}
SOperatorProfResult
;
typedef
struct
STaskCostInfo
{
typedef
struct
STaskCostInfo
{
int64_t
created
;
int64_t
start
;
int64_t
start
;
int64_t
end
;
int64_t
end
;
...
@@ -246,13 +242,14 @@ typedef struct STaskIdInfo {
...
@@ -246,13 +242,14 @@ typedef struct STaskIdInfo {
uint64_t
taskId
;
// this is a subplan id
uint64_t
taskId
;
// this is a subplan id
}
STaskIdInfo
;
}
STaskIdInfo
;
typedef
struct
STaskInfo
{
typedef
struct
S
Exec
TaskInfo
{
STaskIdInfo
id
;
STaskIdInfo
id
;
char
*
content
;
char
*
content
;
uint32_t
status
;
uint32_t
status
;
STimeWindow
window
;
STimeWindow
window
;
STaskCostInfo
cost
;
STaskCostInfo
cost
;
int64_t
owner
;
// if it is in execution
int64_t
owner
;
// if it is in execution
int32_t
code
;
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
STableGroupInfo
tableqinfoGroupInfo
;
// this is a group array list, including SArray<STableQueryInfo*> structure
pthread_mutex_t
lock
;
// used to synchronize the rsp/query threads
pthread_mutex_t
lock
;
// used to synchronize the rsp/query threads
...
@@ -260,8 +257,10 @@ typedef struct STaskInfo {
...
@@ -260,8 +257,10 @@ typedef struct STaskInfo {
// int32_t dataReady; // denote if query result is ready or not
// int32_t dataReady; // denote if query result is ready or not
// void* rspContext; // response context
// void* rspContext; // response context
char
*
sql
;
// query sql string
char
*
sql
;
// query sql string
jmp_buf
env
;
jmp_buf
env
;
//
}
STaskInfo
;
DataSinkHandle
dsHandle
;
struct
SOperatorInfo
*
pRoot
;
}
SExecTaskInfo
;
typedef
struct
STaskRuntimeEnv
{
typedef
struct
STaskRuntimeEnv
{
jmp_buf
env
;
jmp_buf
env
;
...
@@ -269,7 +268,7 @@ typedef struct STaskRuntimeEnv {
...
@@ -269,7 +268,7 @@ typedef struct STaskRuntimeEnv {
uint32_t
status
;
// query status
uint32_t
status
;
// query status
void
*
qinfo
;
void
*
qinfo
;
uint8_t
scanFlag
;
// denotes reversed scan of data or not
uint8_t
scanFlag
;
// denotes reversed scan of data or not
void
*
p
Query
Handle
;
void
*
p
TsdbRead
Handle
;
int32_t
prevGroupId
;
// previous executed group id
int32_t
prevGroupId
;
// previous executed group id
bool
enableGroupData
;
bool
enableGroupData
;
...
@@ -314,8 +313,8 @@ typedef struct SOperatorInfo {
...
@@ -314,8 +313,8 @@ typedef struct SOperatorInfo {
char
*
name
;
// name, used to show the query execution plan
char
*
name
;
// name, used to show the query execution plan
void
*
info
;
// extension attribution
void
*
info
;
// extension attribution
SExprInfo
*
pExpr
;
SExprInfo
*
pExpr
;
STaskRuntimeEnv
*
pRuntimeEnv
;
STaskRuntimeEnv
*
pRuntimeEnv
;
// todo remove it
S
TaskInfo
*
pTaskInfo
;
S
ExecTaskInfo
*
pTaskInfo
;
struct
SOperatorInfo
**
pDownstream
;
// downstram pointer list
struct
SOperatorInfo
**
pDownstream
;
// downstram pointer list
int32_t
numOfDownstream
;
// number of downstream. The value is always ONE expect for join operator
int32_t
numOfDownstream
;
// number of downstream. The value is always ONE expect for join operator
...
@@ -376,7 +375,7 @@ typedef struct STaskParam {
...
@@ -376,7 +375,7 @@ typedef struct STaskParam {
}
STaskParam
;
}
STaskParam
;
typedef
struct
STableScanInfo
{
typedef
struct
STableScanInfo
{
void
*
p
Query
Handle
;
void
*
p
TsdbRead
Handle
;
int32_t
numOfBlocks
;
int32_t
numOfBlocks
;
int32_t
numOfSkipped
;
int32_t
numOfSkipped
;
int32_t
numOfBlockStatis
;
int32_t
numOfBlockStatis
;
...
@@ -544,7 +543,7 @@ typedef struct SOrderOperatorInfo {
...
@@ -544,7 +543,7 @@ typedef struct SOrderOperatorInfo {
void
appendUpstream
(
SOperatorInfo
*
p
,
SOperatorInfo
*
pUpstream
);
void
appendUpstream
(
SOperatorInfo
*
p
,
SOperatorInfo
*
pUpstream
);
SOperatorInfo
*
createDataBlocksOptScanInfo
(
void
*
pTsdbQueryHandle
,
STaskRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
,
int32_t
reverseTime
);
SOperatorInfo
*
createDataBlocksOptScanInfo
(
void
*
pTsdbQueryHandle
,
STaskRuntimeEnv
*
pRuntimeEnv
,
int32_t
repeatTime
,
int32_t
reverseTime
);
SOperatorInfo
*
createTableScanOperator
(
void
*
pTsdbQueryHandle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
);
SOperatorInfo
*
createTableScanOperator
(
void
*
pTsdbQueryHandle
,
int32_t
order
,
int32_t
numOfOutput
,
int32_t
repeatTime
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createTableSeqScanOperator
(
void
*
pTsdbQueryHandle
,
STaskRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createTableSeqScanOperator
(
void
*
pTsdbQueryHandle
,
STaskRuntimeEnv
*
pRuntimeEnv
);
SOperatorInfo
*
createAggregateOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
SOperatorInfo
*
createAggregateOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
);
...
@@ -572,11 +571,11 @@ SOperatorInfo* createFilterOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorI
...
@@ -572,11 +571,11 @@ SOperatorInfo* createFilterOperatorInfo(STaskRuntimeEnv* pRuntimeEnv, SOperatorI
SOperatorInfo
*
createJoinOperatorInfo
(
SOperatorInfo
**
pUpstream
,
int32_t
numOfUpstream
,
SSchema
*
pSchema
,
int32_t
numOfOutput
);
SOperatorInfo
*
createJoinOperatorInfo
(
SOperatorInfo
**
pUpstream
,
int32_t
numOfUpstream
,
SSchema
*
pSchema
,
int32_t
numOfOutput
);
SOperatorInfo
*
createOrderOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
SOrder
*
pOrderVal
);
SOperatorInfo
*
createOrderOperatorInfo
(
STaskRuntimeEnv
*
pRuntimeEnv
,
SOperatorInfo
*
upstream
,
SExprInfo
*
pExpr
,
int32_t
numOfOutput
,
SOrder
*
pOrderVal
);
SSDataBlock
*
doGlobalAggregate
(
void
*
param
,
bool
*
newgroup
);
//
SSDataBlock* doGlobalAggregate(void* param, bool* newgroup);
SSDataBlock
*
doMultiwayMergeSort
(
void
*
param
,
bool
*
newgroup
);
//
SSDataBlock* doMultiwayMergeSort(void* param, bool* newgroup);
SSDataBlock
*
doSLimit
(
void
*
param
,
bool
*
newgroup
);
//
SSDataBlock* doSLimit(void* param, bool* newgroup);
int32_t
doCreateFilterInfo
(
SColumnInfo
*
pCols
,
int32_t
numOfCols
,
int32_t
numOfFilterCols
,
SSingleColumnFilterInfo
**
pFilterInfo
,
uint64_t
qId
);
//
int32_t doCreateFilterInfo(SColumnInfo* pCols, int32_t numOfCols, int32_t numOfFilterCols, SSingleColumnFilterInfo** pFilterInfo, uint64_t qId);
void
doSetFilterColumnInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
,
SSDataBlock
*
pBlock
);
void
doSetFilterColumnInfo
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
,
SSDataBlock
*
pBlock
);
bool
doFilterDataBlock
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
,
int32_t
numOfRows
,
int8_t
*
p
);
bool
doFilterDataBlock
(
SSingleColumnFilterInfo
*
pFilterInfo
,
int32_t
numOfFilterCols
,
int32_t
numOfRows
,
int8_t
*
p
);
void
doCompactSDataBlock
(
SSDataBlock
*
pBlock
,
int32_t
numOfRows
,
int8_t
*
p
);
void
doCompactSDataBlock
(
SSDataBlock
*
pBlock
,
int32_t
numOfRows
,
int8_t
*
p
);
...
@@ -593,17 +592,17 @@ void clearOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity);
...
@@ -593,17 +592,17 @@ void clearOutputBuf(SOptrBasicInfo* pBInfo, int32_t *bufCapacity);
void
copyTsColoum
(
SSDataBlock
*
pRes
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
copyTsColoum
(
SSDataBlock
*
pRes
,
SQLFunctionCtx
*
pCtx
,
int32_t
numOfOutput
);
void
freeParam
(
STaskParam
*
param
);
void
freeParam
(
STaskParam
*
param
);
int32_t
convertQueryMsg
(
SQueryTable
Msg
*
pQueryMsg
,
STaskParam
*
param
);
int32_t
convertQueryMsg
(
SQueryTable
Req
*
pQueryMsg
,
STaskParam
*
param
);
int32_t
createQueryFunc
(
SQueriedTableInfo
*
pTableInfo
,
int32_t
numOfOutput
,
SExprInfo
**
pExprInfo
,
int32_t
createQueryFunc
(
SQueriedTableInfo
*
pTableInfo
,
int32_t
numOfOutput
,
SExprInfo
**
pExprInfo
,
SSqlExpr
**
pExprMsg
,
SColumnInfo
*
pTagCols
,
int32_t
queryType
,
void
*
pMsg
,
struct
SUdfInfo
*
pUdfInfo
);
SSqlExpr
**
pExprMsg
,
SColumnInfo
*
pTagCols
,
int32_t
queryType
,
void
*
pMsg
,
struct
SUdfInfo
*
pUdfInfo
);
int32_t
createIndirectQueryFuncExprFromMsg
(
SQueryTable
Msg
*
pQueryMsg
,
int32_t
numOfOutput
,
SExprInfo
**
pExprInfo
,
int32_t
createIndirectQueryFuncExprFromMsg
(
SQueryTable
Req
*
pQueryMsg
,
int32_t
numOfOutput
,
SExprInfo
**
pExprInfo
,
SSqlExpr
**
pExpr
,
SExprInfo
*
prevExpr
,
struct
SUdfInfo
*
pUdfInfo
);
SSqlExpr
**
pExpr
,
SExprInfo
*
prevExpr
,
struct
SUdfInfo
*
pUdfInfo
);
int32_t
createQueryFilter
(
char
*
data
,
uint16_t
len
,
SFilterInfo
**
pFilters
);
int32_t
createQueryFilter
(
char
*
data
,
uint16_t
len
,
SFilterInfo
**
pFilters
);
SGroupbyExpr
*
createGroupbyExprFromMsg
(
SQueryTable
Msg
*
pQueryMsg
,
SColIndex
*
pColIndex
,
int32_t
*
code
);
SGroupbyExpr
*
createGroupbyExprFromMsg
(
SQueryTable
Req
*
pQueryMsg
,
SColIndex
*
pColIndex
,
int32_t
*
code
);
SQInfo
*
createQInfoImpl
(
SQueryTable
Msg
*
pQueryMsg
,
SGroupbyExpr
*
pGroupbyExpr
,
SExprInfo
*
pExprs
,
SQInfo
*
createQInfoImpl
(
SQueryTable
Req
*
pQueryMsg
,
SGroupbyExpr
*
pGroupbyExpr
,
SExprInfo
*
pExprs
,
SExprInfo
*
pSecExprs
,
STableGroupInfo
*
pTableGroupInfo
,
SColumnInfo
*
pTagCols
,
SFilterInfo
*
pFilters
,
int32_t
vgId
,
char
*
sql
,
uint64_t
qId
,
struct
SUdfInfo
*
pUdfInfo
);
SExprInfo
*
pSecExprs
,
STableGroupInfo
*
pTableGroupInfo
,
SColumnInfo
*
pTagCols
,
SFilterInfo
*
pFilters
,
int32_t
vgId
,
char
*
sql
,
uint64_t
qId
,
struct
SUdfInfo
*
pUdfInfo
);
int32_t
initQInfo
(
STsBufInfo
*
pTsBufInfo
,
void
*
tsdb
,
void
*
sourceOptr
,
SQInfo
*
pQInfo
,
STaskParam
*
param
,
char
*
start
,
int32_t
initQInfo
(
STsBufInfo
*
pTsBufInfo
,
void
*
tsdb
,
void
*
sourceOptr
,
SQInfo
*
pQInfo
,
STaskParam
*
param
,
char
*
start
,
...
@@ -617,14 +616,14 @@ STableQueryInfo* createTmpTableQueryInfo(STimeWindow win);
...
@@ -617,14 +616,14 @@ STableQueryInfo* createTmpTableQueryInfo(STimeWindow win);
int32_t
buildArithmeticExprFromMsg
(
SExprInfo
*
pArithExprInfo
,
void
*
pQueryMsg
);
int32_t
buildArithmeticExprFromMsg
(
SExprInfo
*
pArithExprInfo
,
void
*
pQueryMsg
);
bool
is
QueryKilled
(
SQInfo
*
pQ
Info
);
bool
is
TaskKilled
(
SExecTaskInfo
*
pTask
Info
);
int32_t
checkForQueryBuf
(
size_t
numOfTables
);
int32_t
checkForQueryBuf
(
size_t
numOfTables
);
bool
checkNeedToCompressQueryCol
(
SQInfo
*
pQInfo
);
bool
checkNeedToCompressQueryCol
(
SQInfo
*
pQInfo
);
bool
doBuildResCheck
(
SQInfo
*
pQInfo
);
bool
doBuildResCheck
(
SQInfo
*
pQInfo
);
void
setQueryStatus
(
STaskRuntimeEnv
*
pRuntimeEnv
,
int8_t
status
);
void
setQueryStatus
(
STaskRuntimeEnv
*
pRuntimeEnv
,
int8_t
status
);
bool
onlyQueryTags
(
STaskAttr
*
pQueryAttr
);
bool
onlyQueryTags
(
STaskAttr
*
pQueryAttr
);
void
destroyUdfInfo
(
struct
SUdfInfo
*
pUdfInfo
);
//
void destroyUdfInfo(struct SUdfInfo* pUdfInfo);
bool
isValidQInfo
(
void
*
param
);
bool
isValidQInfo
(
void
*
param
);
...
@@ -644,5 +643,7 @@ void freeQueryAttr(STaskAttr *pQuery);
...
@@ -644,5 +643,7 @@ void freeQueryAttr(STaskAttr *pQuery);
int32_t
getMaximumIdleDurationSec
();
int32_t
getMaximumIdleDurationSec
();
void
doInvokeUdf
(
struct
SUdfInfo
*
pUdfInfo
,
SQLFunctionCtx
*
pCtx
,
int32_t
idx
,
int32_t
type
);
void
doInvokeUdf
(
struct
SUdfInfo
*
pUdfInfo
,
SQLFunctionCtx
*
pCtx
,
int32_t
idx
,
int32_t
type
);
void
setTaskStatus
(
SExecTaskInfo
*
pTaskInfo
,
int8_t
status
);
int32_t
doCreateExecTaskInfo
(
SSubplan
*
pPlan
,
SExecTaskInfo
**
pTaskInfo
,
void
*
readerHandle
);
#endif // TDENGINE_EXECUTORIMPL_H
#endif // TDENGINE_EXECUTORIMPL_H
source/libs/executor/src/dataDispatcher.c
浏览文件 @
32f9383a
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "tcompression.h"
#include "tcompression.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tqueue.h"
#include "tqueue.h"
#include "executorimpl.h"
#define DATA_META_LENGTH(tables) (sizeof(int32_t) + sizeof(STableIdInfo) * taosHashGetSize(tables) + sizeof(SRetrieveTableRsp))
#define DATA_META_LENGTH(tables) (sizeof(int32_t) + sizeof(STableIdInfo) * taosHashGetSize(tables) + sizeof(SRetrieveTableRsp))
...
@@ -42,6 +43,8 @@ typedef struct SDataDispatchHandle {
...
@@ -42,6 +43,8 @@ typedef struct SDataDispatchHandle {
STaosQueue
*
pDataBlocks
;
STaosQueue
*
pDataBlocks
;
SDataDispatchBuf
nextOutput
;
SDataDispatchBuf
nextOutput
;
int32_t
status
;
int32_t
status
;
bool
queryEnd
;
int64_t
useconds
;
pthread_mutex_t
mutex
;
pthread_mutex_t
mutex
;
}
SDataDispatchHandle
;
}
SDataDispatchHandle
;
...
@@ -106,10 +109,14 @@ static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputDat
...
@@ -106,10 +109,14 @@ static void toDataCacheEntry(const SDataDispatchHandle* pHandle, const SInputDat
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
pEntry
->
compressed
=
(
int8_t
)
needCompress
(
pInput
->
pData
,
&
(
pHandle
->
schema
));
pEntry
->
compressed
=
(
int8_t
)
needCompress
(
pInput
->
pData
,
&
(
pHandle
->
schema
));
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
dataLen
=
0
;
pBuf
->
useSize
=
DATA_META_LENGTH
(
pInput
->
pTableRetrieveTsMap
);
pBuf
->
useSize
=
DATA_META_LENGTH
(
pInput
->
pTableRetrieveTsMap
);
copyData
(
pInput
,
&
pHandle
->
schema
,
pEntry
->
data
,
pEntry
->
compressed
,
&
pEntry
->
dataLen
);
copyData
(
pInput
,
&
pHandle
->
schema
,
pEntry
->
data
,
pEntry
->
compressed
,
&
pEntry
->
dataLen
);
pBuf
->
useSize
+=
(
pEntry
->
compressed
?
pEntry
->
dataLen
:
pHandle
->
schema
.
resultRowSize
*
pInput
->
pData
->
info
.
rows
);
if
(
0
==
pEntry
->
compressed
)
{
pEntry
->
dataLen
=
pHandle
->
schema
.
resultRowSize
*
pInput
->
pData
->
info
.
rows
;
}
pBuf
->
useSize
+=
pEntry
->
dataLen
;
// todo completed
// todo completed
}
}
...
@@ -124,7 +131,9 @@ static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput,
...
@@ -124,7 +131,9 @@ static bool allocBuf(SDataDispatchHandle* pDispatcher, const SInputData* pInput,
static
int32_t
updateStatus
(
SDataDispatchHandle
*
pDispatcher
)
{
static
int32_t
updateStatus
(
SDataDispatchHandle
*
pDispatcher
)
{
pthread_mutex_lock
(
&
pDispatcher
->
mutex
);
pthread_mutex_lock
(
&
pDispatcher
->
mutex
);
int32_t
status
=
taosQueueSize
(
pDispatcher
->
pDataBlocks
)
<
pDispatcher
->
pManager
->
cfg
.
maxDataBlockNumPerQuery
?
DS_CAPACITY_ENOUGH
:
DS_CAPACITY_FULL
;
int32_t
blockNums
=
taosQueueSize
(
pDispatcher
->
pDataBlocks
);
int32_t
status
=
(
0
==
blockNums
?
DS_BUF_EMPTY
:
(
blockNums
<
pDispatcher
->
pManager
->
cfg
.
maxDataBlockNumPerQuery
?
DS_BUF_LOW
:
DS_BUF_FULL
));
pDispatcher
->
status
=
status
;
pDispatcher
->
status
=
status
;
pthread_mutex_unlock
(
&
pDispatcher
->
mutex
);
pthread_mutex_unlock
(
&
pDispatcher
->
mutex
);
return
status
;
return
status
;
...
@@ -137,7 +146,7 @@ static int32_t getStatus(SDataDispatchHandle* pDispatcher) {
...
@@ -137,7 +146,7 @@ static int32_t getStatus(SDataDispatchHandle* pDispatcher) {
return
status
;
return
status
;
}
}
static
int32_t
putDataBlock
(
SDataSinkHandle
*
pHandle
,
const
SInputData
*
pInput
,
int32_t
*
pStatus
)
{
static
int32_t
putDataBlock
(
SDataSinkHandle
*
pHandle
,
const
SInputData
*
pInput
,
bool
*
pContinue
)
{
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
SDataDispatchBuf
*
pBuf
=
taosAllocateQitem
(
sizeof
(
SDataDispatchBuf
));
SDataDispatchBuf
*
pBuf
=
taosAllocateQitem
(
sizeof
(
SDataDispatchBuf
));
if
(
NULL
==
pBuf
||
!
allocBuf
(
pDispatcher
,
pInput
,
pBuf
))
{
if
(
NULL
==
pBuf
||
!
allocBuf
(
pDispatcher
,
pInput
,
pBuf
))
{
...
@@ -145,38 +154,46 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput,
...
@@ -145,38 +154,46 @@ static int32_t putDataBlock(SDataSinkHandle* pHandle, const SInputData* pInput,
}
}
toDataCacheEntry
(
pDispatcher
,
pInput
,
pBuf
);
toDataCacheEntry
(
pDispatcher
,
pInput
,
pBuf
);
taosWriteQitem
(
pDispatcher
->
pDataBlocks
,
pBuf
);
taosWriteQitem
(
pDispatcher
->
pDataBlocks
,
pBuf
);
*
p
Status
=
updateStatus
(
pDispatcher
);
*
p
Continue
=
(
DS_BUF_LOW
==
updateStatus
(
pDispatcher
)
?
true
:
false
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
void
endPut
(
struct
SDataSinkHandle
*
pHandle
)
{
static
void
endPut
(
struct
SDataSinkHandle
*
pHandle
,
int64_t
useconds
)
{
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
pthread_mutex_lock
(
&
pDispatcher
->
mutex
);
pthread_mutex_lock
(
&
pDispatcher
->
mutex
);
pDispatcher
->
status
=
DS_END
;
pDispatcher
->
queryEnd
=
true
;
pDispatcher
->
useconds
=
useconds
;
pthread_mutex_unlock
(
&
pDispatcher
->
mutex
);
pthread_mutex_unlock
(
&
pDispatcher
->
mutex
);
}
}
static
int32_t
getDataLength
(
SDataSinkHandle
*
pHandle
,
int32_t
*
pStatus
)
{
static
void
getDataLength
(
SDataSinkHandle
*
pHandle
,
int32_t
*
pLen
,
bool
*
pQueryEnd
)
{
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
if
(
taosQueueEmpty
(
pDispatcher
->
pDataBlocks
))
{
if
(
taosQueueEmpty
(
pDispatcher
->
pDataBlocks
))
{
*
pStatus
=
getStatus
(
pDispatcher
)
?
DS_END
:
DS_IN_PROCESS
;
*
pQueryEnd
=
pDispatcher
->
queryEnd
;
return
0
;
*
pLen
=
0
;
return
;
}
}
SDataDispatchBuf
*
pBuf
=
NULL
;
SDataDispatchBuf
*
pBuf
=
NULL
;
taosReadQitem
(
pDispatcher
->
pDataBlocks
,
(
void
**
)
&
pBuf
);
taosReadQitem
(
pDispatcher
->
pDataBlocks
,
(
void
**
)
&
pBuf
);
memcpy
(
&
pDispatcher
->
nextOutput
,
pBuf
,
sizeof
(
SDataDispatchBuf
));
memcpy
(
&
pDispatcher
->
nextOutput
,
pBuf
,
sizeof
(
SDataDispatchBuf
));
taosFreeQitem
(
pBuf
);
taosFreeQitem
(
pBuf
);
return
((
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
))
->
dataLen
;
*
pLen
=
((
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
))
->
dataLen
;
}
}
static
int32_t
getDataBlock
(
SDataSinkHandle
*
pHandle
,
SOut
PutData
*
pOutput
,
int32_t
*
pStatus
)
{
static
int32_t
getDataBlock
(
SDataSinkHandle
*
pHandle
,
SOut
putData
*
pOutput
)
{
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
SDataDispatchHandle
*
pDispatcher
=
(
SDataDispatchHandle
*
)
pHandle
;
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
);
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)(
pDispatcher
->
nextOutput
.
pData
);
memcpy
(
pOutput
->
pData
,
pEntry
->
data
,
pEntry
->
dataLen
);
memcpy
(
pOutput
->
pData
,
pEntry
->
data
,
pEntry
->
dataLen
);
pOutput
->
numOfRows
=
pEntry
->
numOfRows
;
pOutput
->
numOfRows
=
pEntry
->
numOfRows
;
pOutput
->
compressed
=
pEntry
->
compressed
;
pOutput
->
compressed
=
pEntry
->
compressed
;
tfree
(
pDispatcher
->
nextOutput
.
pData
);
// todo persistent
tfree
(
pDispatcher
->
nextOutput
.
pData
);
// todo persistent
*
pStatus
=
updateStatus
(
pDispatcher
);
pOutput
->
bufStatus
=
updateStatus
(
pDispatcher
);
pthread_mutex_lock
(
&
pDispatcher
->
mutex
);
pOutput
->
queryEnd
=
pDispatcher
->
queryEnd
;
pOutput
->
needSchedule
=
false
;
pOutput
->
useconds
=
pDispatcher
->
useconds
;
pOutput
->
precision
=
pDispatcher
->
schema
.
precision
;
pthread_mutex_unlock
(
&
pDispatcher
->
mutex
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -200,12 +217,14 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSink* pDataS
...
@@ -200,12 +217,14 @@ int32_t createDataDispatcher(SDataSinkManager* pManager, const SDataSink* pDataS
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
}
dispatcher
->
sink
.
fPut
=
putDataBlock
;
dispatcher
->
sink
.
fPut
=
putDataBlock
;
dispatcher
->
sink
.
fEndPut
=
endPut
;
dispatcher
->
sink
.
fGetLen
=
getDataLength
;
dispatcher
->
sink
.
fGetLen
=
getDataLength
;
dispatcher
->
sink
.
fGetData
=
getDataBlock
;
dispatcher
->
sink
.
fGetData
=
getDataBlock
;
dispatcher
->
sink
.
fDestroy
=
destroyDataSinker
;
dispatcher
->
sink
.
fDestroy
=
destroyDataSinker
;
dispatcher
->
pManager
=
pManager
;
dispatcher
->
pManager
=
pManager
;
dispatcher
->
schema
=
pDataSink
->
schema
;
dispatcher
->
schema
=
pDataSink
->
schema
;
dispatcher
->
status
=
DS_CAPACITY_ENOUGH
;
dispatcher
->
status
=
DS_BUF_EMPTY
;
dispatcher
->
queryEnd
=
false
;
dispatcher
->
pDataBlocks
=
taosOpenQueue
();
dispatcher
->
pDataBlocks
=
taosOpenQueue
();
pthread_mutex_init
(
&
dispatcher
->
mutex
,
NULL
);
pthread_mutex_init
(
&
dispatcher
->
mutex
,
NULL
);
if
(
NULL
==
dispatcher
->
pDataBlocks
)
{
if
(
NULL
==
dispatcher
->
pDataBlocks
)
{
...
...
source/libs/executor/src/dataSinkMgt.c
浏览文件 @
32f9383a
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include "tarray.h"
#include "dataSinkMgt.h"
#include "dataSinkMgt.h"
#include "dataSinkInt.h"
#include "dataSinkInt.h"
#include "planner.h"
#include "planner.h"
...
@@ -31,24 +32,24 @@ int32_t dsCreateDataSinker(const struct SDataSink *pDataSink, DataSinkHandle* pH
...
@@ -31,24 +32,24 @@ int32_t dsCreateDataSinker(const struct SDataSink *pDataSink, DataSinkHandle* pH
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
int32_t
dsPutDataBlock
(
DataSinkHandle
handle
,
const
SInputData
*
pInput
,
int32_t
*
pStatus
)
{
int32_t
dsPutDataBlock
(
DataSinkHandle
handle
,
const
SInputData
*
pInput
,
bool
*
pContinue
)
{
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
return
pHandleImpl
->
fPut
(
pHandleImpl
,
pInput
,
p
Status
);
return
pHandleImpl
->
fPut
(
pHandleImpl
,
pInput
,
p
Continue
);
}
}
void
dsEndPut
(
DataSinkHandle
handle
)
{
void
dsEndPut
(
DataSinkHandle
handle
,
int64_t
useconds
)
{
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
return
pHandleImpl
->
fEndPut
(
pHandleImpl
);
return
pHandleImpl
->
fEndPut
(
pHandleImpl
,
useconds
);
}
}
int32_t
dsGetDataLength
(
DataSinkHandle
handle
,
int32_t
*
pStatus
)
{
void
dsGetDataLength
(
DataSinkHandle
handle
,
int32_t
*
pLen
,
bool
*
pQueryEnd
)
{
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
return
pHandleImpl
->
fGetLen
(
pHandleImpl
,
pStatus
);
pHandleImpl
->
fGetLen
(
pHandleImpl
,
pLen
,
pQueryEnd
);
}
}
int32_t
dsGetDataBlock
(
DataSinkHandle
handle
,
SOut
PutData
*
pOutput
,
int32_t
*
pStatus
)
{
int32_t
dsGetDataBlock
(
DataSinkHandle
handle
,
SOut
putData
*
pOutput
)
{
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
SDataSinkHandle
*
pHandleImpl
=
(
SDataSinkHandle
*
)
handle
;
return
pHandleImpl
->
fGetData
(
pHandleImpl
,
pOutput
,
pStatus
);
return
pHandleImpl
->
fGetData
(
pHandleImpl
,
pOutput
);
}
}
void
dsScheduleProcess
(
void
*
ahandle
,
void
*
pItem
)
{
void
dsScheduleProcess
(
void
*
ahandle
,
void
*
pItem
)
{
...
...
source/libs/executor/src/executil.c
浏览文件 @
32f9383a
...
@@ -547,7 +547,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
...
@@ -547,7 +547,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
pTableQueryInfoList
=
malloc
(
POINTER_BYTES
*
size
);
pTableQueryInfoList
=
malloc
(
POINTER_BYTES
*
size
);
if
(
pTableQueryInfoList
==
NULL
||
posList
==
NULL
||
pGroupResInfo
->
pRows
==
NULL
||
pGroupResInfo
->
pRows
==
NULL
)
{
if
(
pTableQueryInfoList
==
NULL
||
posList
==
NULL
||
pGroupResInfo
->
pRows
==
NULL
||
pGroupResInfo
->
pRows
==
NULL
)
{
// qError("QInfo:%"PRIu64" failed alloc memory", GET_
Q
ID(pRuntimeEnv));
// qError("QInfo:%"PRIu64" failed alloc memory", GET_
TASK
ID(pRuntimeEnv));
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_end
;
goto
_end
;
}
}
...
@@ -619,7 +619,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
...
@@ -619,7 +619,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
int64_t
endt
=
taosGetTimestampMs
();
int64_t
endt
=
taosGetTimestampMs
();
// qDebug("QInfo:%"PRIx64" result merge completed for group:%d, elapsed time:%" PRId64 " ms", GET_
Q
ID(pRuntimeEnv),
// qDebug("QInfo:%"PRIx64" result merge completed for group:%d, elapsed time:%" PRId64 " ms", GET_
TASK
ID(pRuntimeEnv),
// pGroupResInfo->currentGroup, endt - startt);
// pGroupResInfo->currentGroup, endt - startt);
_end:
_end:
...
@@ -641,13 +641,13 @@ int32_t mergeIntoGroupResult(SGroupResInfo* pGroupResInfo, STaskRuntimeEnv* pRun
...
@@ -641,13 +641,13 @@ int32_t mergeIntoGroupResult(SGroupResInfo* pGroupResInfo, STaskRuntimeEnv* pRun
break
;
break
;
}
}
// qDebug("QInfo:%"PRIu64" no result in group %d, continue", GET_
Q
ID(pRuntimeEnv), pGroupResInfo->currentGroup);
// qDebug("QInfo:%"PRIu64" no result in group %d, continue", GET_
TASK
ID(pRuntimeEnv), pGroupResInfo->currentGroup);
cleanupGroupResInfo
(
pGroupResInfo
);
cleanupGroupResInfo
(
pGroupResInfo
);
incNextGroup
(
pGroupResInfo
);
incNextGroup
(
pGroupResInfo
);
}
}
// int64_t elapsedTime = taosGetTimestampUs() - st;
// int64_t elapsedTime = taosGetTimestampUs() - st;
// qDebug("QInfo:%"PRIu64" merge res data into group, index:%d, total group:%d, elapsed time:%" PRId64 "us", GET_
Q
ID(pRuntimeEnv),
// qDebug("QInfo:%"PRIu64" merge res data into group, index:%d, total group:%d, elapsed time:%" PRId64 "us", GET_
TASK
ID(pRuntimeEnv),
// pGroupResInfo->currentGroup, pGroupResInfo->totalGroup, elapsedTime);
// pGroupResInfo->currentGroup, pGroupResInfo->totalGroup, elapsedTime);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/libs/executor/src/executorMain.c
浏览文件 @
32f9383a
...
@@ -14,10 +14,12 @@
...
@@ -14,10 +14,12 @@
*/
*/
#include "os.h"
#include "os.h"
#include "tarray.h"
#include "dataSinkMgt.h"
#include "exception.h"
#include "tcache.h"
#include "tcache.h"
#include "tglobal.h"
#include "tglobal.h"
#include "tmsg.h"
#include "tmsg.h"
#include "exception.h"
#include "thash.h"
#include "thash.h"
#include "executorimpl.h"
#include "executorimpl.h"
...
@@ -66,152 +68,24 @@ void freeParam(STaskParam *param) {
...
@@ -66,152 +68,24 @@ void freeParam(STaskParam *param) {
tfree
(
param
->
prevResult
);
tfree
(
param
->
prevResult
);
}
}
// todo parse json to get the operator tree.
int32_t
qCreateExecTask
(
void
*
tsdb
,
int32_t
vgId
,
SSubplan
*
pSubplan
,
qTaskInfo_t
*
pTaskInfo
)
{
assert
(
tsdb
!=
NULL
&&
pSubplan
!=
NULL
);
int32_t
qCreateTask
(
void
*
tsdb
,
int32_t
vgId
,
void
*
pQueryMsg
,
qTaskInfo_t
*
pTaskInfo
,
uint64_t
taskId
)
{
SExecTaskInfo
**
pTask
=
(
SExecTaskInfo
**
)
pTaskInfo
;
assert
(
pQueryMsg
!=
NULL
&&
tsdb
!=
NULL
);
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
doCreateExecTaskInfo
(
pSubplan
,
pTask
,
tsdb
);
#if 0
STaskParam param = {0};
code = convertQueryMsg(pQueryMsg, ¶m);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto _over;
goto
_error
;
}
if (pQueryMsg->numOfTables <= 0) {
qError("Invalid number of tables to query, numOfTables:%d", pQueryMsg->numOfTables);
code = TSDB_CODE_QRY_INVALID_MSG;
goto _over;
}
if (param.pTableIdList == NULL || taosArrayGetSize(param.pTableIdList) == 0) {
qError("qmsg:%p, SQueryTableMsg wrong format", pQueryMsg);
code = TSDB_CODE_QRY_INVALID_MSG;
goto _over;
}
SQueriedTableInfo info = { .numOfTags = pQueryMsg->numOfTags, .numOfCols = pQueryMsg->numOfCols, .colList = pQueryMsg->tableCols};
if ((code = createQueryFunc(&info, pQueryMsg->numOfOutput, ¶m.pExprs, param.pExpr, param.pTagColumnInfo,
pQueryMsg->queryType, pQueryMsg, param.pUdfInfo)) != TSDB_CODE_SUCCESS) {
goto _over;
}
if (param.pSecExpr != NULL) {
if ((code = createIndirectQueryFuncExprFromMsg(pQueryMsg, pQueryMsg->secondStageOutput, ¶m.pSecExprs, param.pSecExpr, param.pExprs, param.pUdfInfo)) != TSDB_CODE_SUCCESS) {
goto _over;
}
}
if (param.colCond != NULL) {
if ((code = createQueryFilter(param.colCond, pQueryMsg->colCondLen, ¶m.pFilters)) != TSDB_CODE_SUCCESS) {
goto _over;
}
}
param.pGroupbyExpr = createGroupbyExprFromMsg(pQueryMsg, param.pGroupColIndex, &code);
if ((param.pGroupbyExpr == NULL && pQueryMsg->numOfGroupCols != 0) || code != TSDB_CODE_SUCCESS) {
goto _over;
}
bool isSTableQuery = false;
STableGroupInfo tableGroupInfo = {0};
int64_t st = taosGetTimestampUs();
if (TSDB_QUERY_HAS_TYPE(pQueryMsg->queryType, TSDB_QUERY_TYPE_TABLE_QUERY)) {
STableIdInfo *id = taosArrayGet(param.pTableIdList, 0);
qDebug("qmsg:%p query normal table, uid:%"PRId64", tid:%d", pQueryMsg, id->uid, id->tid);
if ((code = tsdbGetOneTableGroup(tsdb, id->uid, pQueryMsg->window.skey, &tableGroupInfo)) != TSDB_CODE_SUCCESS) {
goto _over;
}
} else if (TSDB_QUERY_HAS_TYPE(pQueryMsg->queryType, TSDB_QUERY_TYPE_MULTITABLE_QUERY|TSDB_QUERY_TYPE_STABLE_QUERY)) {
isSTableQuery = true;
// also note there's possibility that only one table in the super table
if (!TSDB_QUERY_HAS_TYPE(pQueryMsg->queryType, TSDB_QUERY_TYPE_MULTITABLE_QUERY)) {
STableIdInfo *id = taosArrayGet(param.pTableIdList, 0);
// group by normal column, do not pass the group by condition to tsdb to group table into different group
int32_t numOfGroupByCols = pQueryMsg->numOfGroupCols;
if (pQueryMsg->numOfGroupCols == 1 && !TSDB_COL_IS_TAG(param.pGroupColIndex->flag)) {
numOfGroupByCols = 0;
}
qDebug("qmsg:%p query stable, uid:%"PRIu64", tid:%d", pQueryMsg, id->uid, id->tid);
code = tsdbQuerySTableByTagCond(tsdb, id->uid, pQueryMsg->window.skey, param.tagCond, pQueryMsg->tagCondLen,
pQueryMsg->tagNameRelType, param.tbnameCond, &tableGroupInfo, param.pGroupColIndex, numOfGroupByCols);
if (code != TSDB_CODE_SUCCESS) {
qError("qmsg:%p failed to query stable, reason: %s", pQueryMsg, tstrerror(code));
goto _over;
}
} else {
code = tsdbGetTableGroupFromIdList(tsdb, param.pTableIdList, &tableGroupInfo);
if (code != TSDB_CODE_SUCCESS) {
goto _over;
}
qDebug("qmsg:%p query on %u tables in one group from client", pQueryMsg, tableGroupInfo.numOfTables);
}
int64_t el = taosGetTimestampUs() - st;
qDebug("qmsg:%p tag filter completed, numOfTables:%u, elapsed time:%"PRId64"us", pQueryMsg, tableGroupInfo.numOfTables, el);
} else {
assert(0);
}
}
code = checkForQueryBuf(tableGroupInfo.numOfTables);
SDataSinkMgtCfg
cfg
=
{.
maxDataBlockNum
=
1000
,
.
maxDataBlockNumPerQuery
=
100
};
if (code != TSDB_CODE_SUCCESS) { // not enough query buffer, abort
code
=
dsDataSinkMgtInit
(
&
cfg
);
goto _over;
}
assert(pQueryMsg->stableQuery == isSTableQuery);
(*pTaskInfo) = createQInfoImpl(pQueryMsg, param.pGroupbyExpr, param.pExprs, param.pSecExprs, &tableGroupInfo,
param.pTagColumnInfo, param.pFilters, vgId, param.sql, qId, param.pUdfInfo);
param.sql = NULL;
param.pExprs = NULL;
param.pSecExprs = NULL;
param.pGroupbyExpr = NULL;
param.pTagColumnInfo = NULL;
param.pFilters = NULL;
if ((*pTaskInfo) == NULL) {
code = TSDB_CODE_QRY_OUT_OF_MEMORY;
goto _over;
}
param.pUdfInfo = NULL;
code = initQInfo(&pQueryMsg->tsBuf, tsdb, NULL, *pTaskInfo, ¶m, (char*)pQueryMsg, pQueryMsg->prevResultLen, NULL);
_over:
if (param.pGroupbyExpr != NULL) {
taosArrayDestroy(param.pGroupbyExpr->columnInfo);
}
tfree(param.colCond);
destroyUdfInfo(param.pUdfInfo);
taosArrayDestroy(param.pTableIdList);
param.pTableIdList = NULL;
freeParam(¶m);
for (int32_t i = 0; i < pQueryMsg->numOfCols; i++) {
SColumnInfo* column = pQueryMsg->tableCols + i;
freeColumnFilterInfo(column->flist.filterInfo, column->flist.numOfFilters);
}
filterFreeInfo(param.pFilters);
//pTaskInfo already freed in initQInfo, but *pTaskInfo may not pointer to null;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
*pTaskInfo = NULL
;
goto
_error
;
}
}
#endif
code
=
dsCreateDataSinker
(
pSubplan
->
pDataSink
,
&
(
*
pTask
)
->
dsHandle
);
_error:
// if failed to add ref for all tables in this query, abort current query
// if failed to add ref for all tables in this query, abort current query
return
code
;
return
code
;
}
}
...
@@ -250,7 +124,7 @@ int waitMoment(SQInfo* pQInfo){
...
@@ -250,7 +124,7 @@ int waitMoment(SQInfo* pQInfo){
while
(
used_ms
<
ms
)
{
while
(
used_ms
<
ms
)
{
taosMsleep
(
1000
);
taosMsleep
(
1000
);
used_ms
+=
1000
;
used_ms
+=
1000
;
if
(
is
Query
Killed
(
pQInfo
)){
if
(
is
Task
Killed
(
pQInfo
)){
printf
(
"test check query is canceled, sleep break.%s
\n
"
,
pQInfo
->
sql
);
printf
(
"test check query is canceled, sleep break.%s
\n
"
,
pQInfo
->
sql
);
break
;
break
;
}
}
...
@@ -261,68 +135,80 @@ int waitMoment(SQInfo* pQInfo){
...
@@ -261,68 +135,80 @@ int waitMoment(SQInfo* pQInfo){
}
}
#endif
#endif
bool
qExecTask
(
qTaskInfo_t
qinfo
,
uint64_t
*
qId
)
{
int32_t
qExecTask
(
qTaskInfo_t
tinfo
,
DataSinkHandle
*
handle
)
{
SQInfo
*
pQInfo
=
(
SQInfo
*
)
qinfo
;
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
assert
(
pQInfo
&&
pQInfo
->
signature
==
pQInfo
);
int64_t
threadId
=
taosGetSelfPthreadId
();
int64_t
threadId
=
taosGetSelfPthreadId
();
int64_t
curOwner
=
0
;
int64_t
curOwner
=
0
;
if
((
curOwner
=
atomic_val_compare_exchange_64
(
&
pQInfo
->
owner
,
0
,
threadId
))
!=
0
)
{
if
((
curOwner
=
atomic_val_compare_exchange_64
(
&
pTaskInfo
->
owner
,
0
,
threadId
))
!=
0
)
{
qError
(
"QInfo:0x%"
PRIx64
"-%p qhandle is now executed by thread:%p"
,
pQInfo
->
qId
,
pQInfo
,
(
void
*
)
curOwner
);
qError
(
"QInfo:0x%"
PRIx64
"-%p qhandle is now executed by thread:%p"
,
GET_TASKID
(
pTaskInfo
),
pTaskInfo
,
pQInfo
->
code
=
TSDB_CODE_QRY_IN_EXEC
;
(
void
*
)
curOwner
);
return
false
;
pTaskInfo
->
code
=
TSDB_CODE_QRY_IN_EXEC
;
return
pTaskInfo
->
code
;
}
}
*
qId
=
pQInfo
->
qId
;
if
(
pTaskInfo
->
cost
.
start
==
0
)
{
if
(
pQInfo
->
startExecTs
==
0
)
pTaskInfo
->
cost
.
start
=
taosGetTimestampMs
();
pQInfo
->
startExecTs
=
taosGetTimestampMs
();
if
(
isQueryKilled
(
pQInfo
))
{
qDebug
(
"QInfo:0x%"
PRIx64
" it is already killed, abort"
,
pQInfo
->
qId
);
return
doBuildResCheck
(
pQInfo
);
}
}
STaskRuntimeEnv
*
pRuntimeEnv
=
&
pQInfo
->
runtimeEnv
;
if
(
isTaskKilled
(
pTaskInfo
))
{
if
(
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
==
0
)
{
qDebug
(
"QInfo:0x%"
PRIx64
" it is already killed, abort"
,
GET_TASKID
(
pTaskInfo
));
qDebug
(
"QInfo:0x%"
PRIx64
" no table exists for query, abort"
,
pQInfo
->
qId
);
return
pTaskInfo
->
code
;
// setTaskStatus(pRuntimeEnv, QUERY_COMPLETED);
return
doBuildResCheck
(
pQInfo
);
}
}
// STaskRuntimeEnv* pRuntimeEnv = &pTaskInfo->runtimeEnv;
// if (pTaskInfo->tableqinfoGroupInfo.numOfTables == 0) {
// qDebug("QInfo:0x%"PRIx64" no table exists for query, abort", GET_TASKID(pTaskInfo));
// setTaskStatus(pTaskInfo, TASK_COMPLETED);
// return doBuildResCheck(pTaskInfo);
// }
// error occurs, record the error code and return to client
// error occurs, record the error code and return to client
int32_t
ret
=
setjmp
(
p
QInfo
->
runtimeEnv
.
env
);
int32_t
ret
=
setjmp
(
p
TaskInfo
->
env
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
publishQueryAbortEvent
(
p
Q
Info
,
ret
);
publishQueryAbortEvent
(
p
Task
Info
,
ret
);
p
Q
Info
->
code
=
ret
;
p
Task
Info
->
code
=
ret
;
qDebug
(
"QInfo:0x%"
PRIx64
" query abort due to error/cancel occurs, code:%s"
,
pQInfo
->
qId
,
tstrerror
(
pQ
Info
->
code
));
qDebug
(
"QInfo:0x%"
PRIx64
" query abort due to error/cancel occurs, code:%s"
,
GET_TASKID
(
pTaskInfo
),
tstrerror
(
pTask
Info
->
code
));
return
doBuildResCheck
(
pQInfo
)
;
return
pTaskInfo
->
code
;
}
}
qDebug
(
"QInfo:0x%"
PRIx64
" query task is launched"
,
pQInfo
->
qId
);
qDebug
(
"QInfo:0x%"
PRIx64
" query task is launched"
,
GET_TASKID
(
pTaskInfo
)
);
bool
newgroup
=
false
;
bool
newgroup
=
false
;
publishOperatorProfEvent
(
pRuntimeEnv
->
proot
,
QUERY_PROF_BEFORE_OPERATOR_EXEC
);
publishOperatorProfEvent
(
pTaskInfo
->
pRoot
,
QUERY_PROF_BEFORE_OPERATOR_EXEC
);
int64_t
st
=
0
;
int64_t
st
=
taosGetTimestampUs
();
*
handle
=
pTaskInfo
->
dsHandle
;
pRuntimeEnv
->
outputBuf
=
pRuntimeEnv
->
proot
->
exec
(
pRuntimeEnv
->
proot
,
&
newgroup
);
pQInfo
->
summary
.
elapsedTime
+=
(
taosGetTimestampUs
()
-
st
);
while
(
1
)
{
#ifdef TEST_IMPL
st
=
taosGetTimestampUs
();
waitMoment
(
pQInfo
);
SSDataBlock
*
pRes
=
pTaskInfo
->
pRoot
->
exec
(
pTaskInfo
->
pRoot
,
&
newgroup
);
#endif
publishOperatorProfEvent
(
pRuntimeEnv
->
proot
,
QUERY_PROF_AFTER_OPERATOR_EXEC
);
pRuntimeEnv
->
resultInfo
.
total
+=
GET_NUM_OF_RESULTS
(
pRuntimeEnv
);
if
(
isQueryKilled
(
pQInfo
))
{
qDebug
(
"QInfo:0x%"
PRIx64
" query is killed"
,
pQInfo
->
qId
);
}
else
if
(
GET_NUM_OF_RESULTS
(
pRuntimeEnv
)
==
0
)
{
qDebug
(
"QInfo:0x%"
PRIx64
" over, %u tables queried, total %"
PRId64
" rows returned"
,
pQInfo
->
qId
,
pRuntimeEnv
->
tableqinfoGroupInfo
.
numOfTables
,
pRuntimeEnv
->
resultInfo
.
total
);
}
else
{
qDebug
(
"QInfo:0x%"
PRIx64
" query paused, %d rows returned, total:%"
PRId64
" rows"
,
pQInfo
->
qId
,
GET_NUM_OF_RESULTS
(
pRuntimeEnv
),
pRuntimeEnv
->
resultInfo
.
total
);
}
return
doBuildResCheck
(
pQInfo
);
pTaskInfo
->
cost
.
elapsedTime
+=
(
taosGetTimestampUs
()
-
st
);
publishOperatorProfEvent
(
pTaskInfo
->
pRoot
,
QUERY_PROF_AFTER_OPERATOR_EXEC
);
if
(
pRes
==
NULL
)
{
// no results generated yet, abort
dsEndPut
(
pTaskInfo
->
dsHandle
,
pTaskInfo
->
cost
.
elapsedTime
);
return
pTaskInfo
->
code
;
}
bool
qcontinue
=
false
;
SInputData
inputData
=
{.
pData
=
pRes
,
.
pTableRetrieveTsMap
=
NULL
};
pTaskInfo
->
code
=
dsPutDataBlock
(
pTaskInfo
->
dsHandle
,
&
inputData
,
&
qcontinue
);
if
(
isTaskKilled
(
pTaskInfo
))
{
qDebug
(
"QInfo:0x%"
PRIx64
" task is killed"
,
GET_TASKID
(
pTaskInfo
));
// } else if (GET_NUM_OF_RESULTS(pRuntimeEnv) == 0) {
// qDebug("QInfo:0x%"PRIx64" over, %u tables queried, total %"PRId64" rows returned", pTaskInfo->qId, pRuntimeEnv->tableqinfoGroupInfo.numOfTables,
// pRuntimeEnv->resultInfo.total);
}
if
(
!
qcontinue
)
{
qDebug
(
"QInfo:0x%"
PRIx64
" query paused, %d rows returned, total:%"
PRId64
" rows, in sinkNode:%d"
,
GET_TASKID
(
pTaskInfo
),
0
,
0L
,
0
);
return
pTaskInfo
->
code
;
}
}
}
}
int32_t
qRetrieveQueryResultInfo
(
qTaskInfo_t
qinfo
,
bool
*
buildRes
,
void
*
pRspContext
)
{
int32_t
qRetrieveQueryResultInfo
(
qTaskInfo_t
qinfo
,
bool
*
buildRes
,
void
*
pRspContext
)
{
...
@@ -398,13 +284,13 @@ int32_t qKillTask(qTaskInfo_t qinfo) {
...
@@ -398,13 +284,13 @@ int32_t qKillTask(qTaskInfo_t qinfo) {
}
}
int32_t
qIsTaskCompleted
(
qTaskInfo_t
qinfo
)
{
int32_t
qIsTaskCompleted
(
qTaskInfo_t
qinfo
)
{
S
QInfo
*
pQInfo
=
(
SQ
Info
*
)
qinfo
;
S
ExecTaskInfo
*
pTaskInfo
=
(
SExecTask
Info
*
)
qinfo
;
if
(
p
QInfo
==
NULL
||
!
isValidQInfo
(
pQInfo
)
)
{
if
(
p
TaskInfo
==
NULL
/*|| !isValidQInfo(pTaskInfo)*/
)
{
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
return
TSDB_CODE_QRY_INVALID_QHANDLE
;
}
}
return
is
QueryKilled
(
pQInfo
)
||
Q_STATUS_EQUAL
(
pQInfo
->
runtimeEnv
.
status
,
QUERY
_OVER
);
return
is
TaskKilled
(
pTaskInfo
)
||
Q_STATUS_EQUAL
(
pTaskInfo
->
status
,
TASK
_OVER
);
}
}
void
qDestroyTask
(
qTaskInfo_t
qHandle
)
{
void
qDestroyTask
(
qTaskInfo_t
qHandle
)
{
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/executor/test/CMakeLists.txt
0 → 100644
浏览文件 @
32f9383a
MESSAGE
(
STATUS
"build parser unit test"
)
# GoogleTest requires at least C++11
SET
(
CMAKE_CXX_STANDARD 11
)
AUX_SOURCE_DIRECTORY
(
${
CMAKE_CURRENT_SOURCE_DIR
}
SOURCE_LIST
)
ADD_EXECUTABLE
(
executorTest
${
SOURCE_LIST
}
)
TARGET_LINK_LIBRARIES
(
executorTest
PUBLIC os util common transport gtest taos qcom executor function planner
)
TARGET_INCLUDE_DIRECTORIES
(
executorTest
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/executor/"
PRIVATE
"
${
CMAKE_SOURCE_DIR
}
/source/libs/executor/inc"
)
source/libs/executor/test/executorTests.cpp
浏览文件 @
32f9383a
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* 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/>.
*/
#include <executorimpl.h>
#include <gtest/gtest.h>
#include <tglobal.h>
#include <iostream>
#pragma GCC diagnostic ignored "-Wwrite-strings"
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wsign-compare"
#include "os.h"
#include "taos.h"
#include "tdef.h"
#include "tvariant.h"
#include "tep.h"
#include "trpc.h"
#include "stub.h"
#include "executor.h"
/**
{
"Id": {
"QueryId": 1.3108161807422521e+19,
"TemplateId": 0,
"SubplanId": 0
},
"Node": {
"Name": "TableScan",
"Targets": [{
"Base": {
"Schema": {
"Type": 9,
"ColId": 5000,
"Bytes": 8
},
"Columns": [{
"TableId": 1,
"Flag": 0,
"Info": {
"ColId": 1,
"Type": 9,
"Bytes": 8
}
}],
"InterBytes": 0
},
"Expr": {
"Type": 4,
"Column": {
"Type": 9,
"ColId": 1,
"Bytes": 8
}
}
}, {
"Base": {
"Schema": {
"Type": 4,
"ColId": 5001,
"Bytes": 4
},
"Columns": [{
"TableId": 1,
"Flag": 0,
"Info": {
"ColId": 2,
"Type": 4,
"Bytes": 4
}
}],
"InterBytes": 0
},
"Expr": {
"Type": 4,
"Column": {
"Type": 4,
"ColId": 2,
"Bytes": 4
}
}
}],
"InputSchema": [{
"Type": 9,
"ColId": 5000,
"Bytes": 8
}, {
"Type": 4,
"ColId": 5001,
"Bytes": 4
}],
"TableScan": {
"TableId": 1,
"TableType": 2,
"Flag": 0,
"Window": {
"StartKey": -9.2233720368547758e+18,
"EndKey": 9.2233720368547758e+18
}
}
},
"DataSink": {
"Name": "Dispatch",
"Dispatch": {
}
}
}
*/
int
main
(
int
argc
,
char
**
argv
)
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
TEST
(
testCase
,
build_executor_tree_Test
)
{
const
char
*
msg
=
"{
\n
"
"
\t\"
Id
\"
:
\t
{
\n
"
"
\t\t\"
QueryId
\"
:
\t
1.3108161807422521e+19,
\n
"
"
\t\t\"
TemplateId
\"
:
\t
0,
\n
"
"
\t\t\"
SubplanId
\"
:
\t
0
\n
"
"
\t
},
\n
"
"
\t\"
Node
\"
:
\t
{
\n
"
"
\t\t\"
Name
\"
:
\t\"
TableScan
\"
,
\n
"
"
\t\t\"
Targets
\"
:
\t
[{
\n
"
"
\t\t\t\t\"
Base
\"
:
\t
{
\n
"
"
\t\t\t\t\t\"
Schema
\"
:
\t
{
\n
"
"
\t\t\t\t\t\t\"
Type
\"
:
\t
9,
\n
"
"
\t\t\t\t\t\t\"
ColId
\"
:
\t
5000,
\n
"
"
\t\t\t\t\t\t\"
Bytes
\"
:
\t
8
\n
"
"
\t\t\t\t\t
},
\n
"
"
\t\t\t\t\t\"
Columns
\"
:
\t
[{
\n
"
"
\t\t\t\t\t\t\t\"
TableId
\"
:
\t
1,
\n
"
"
\t\t\t\t\t\t\t\"
Flag
\"
:
\t
0,
\n
"
"
\t\t\t\t\t\t\t\"
Info
\"
:
\t
{
\n
"
"
\t\t\t\t\t\t\t\t\"
ColId
\"
:
\t
1,
\n
"
"
\t\t\t\t\t\t\t\t\"
Type
\"
:
\t
9,
\n
"
"
\t\t\t\t\t\t\t\t\"
Bytes
\"
:
\t
8
\n
"
"
\t\t\t\t\t\t\t
}
\n
"
"
\t\t\t\t\t\t
}],
\n
"
"
\t\t\t\t\t\"
InterBytes
\"
:
\t
0
\n
"
"
\t\t\t\t
},
\n
"
"
\t\t\t\t\"
Expr
\"
:
\t
{
\n
"
"
\t\t\t\t\t\"
Type
\"
:
\t
4,
\n
"
"
\t\t\t\t\t\"
Column
\"
:
\t
{
\n
"
"
\t\t\t\t\t\t\"
Type
\"
:
\t
9,
\n
"
"
\t\t\t\t\t\t\"
ColId
\"
:
\t
1,
\n
"
"
\t\t\t\t\t\t\"
Bytes
\"
:
\t
8
\n
"
"
\t\t\t\t\t
}
\n
"
"
\t\t\t\t
}
\n
"
"
\t\t\t
}, {
\n
"
"
\t\t\t\t\"
Base
\"
:
\t
{
\n
"
"
\t\t\t\t\t\"
Schema
\"
:
\t
{
\n
"
"
\t\t\t\t\t\t\"
Type
\"
:
\t
4,
\n
"
"
\t\t\t\t\t\t\"
ColId
\"
:
\t
5001,
\n
"
"
\t\t\t\t\t\t\"
Bytes
\"
:
\t
4
\n
"
"
\t\t\t\t\t
},
\n
"
"
\t\t\t\t\t\"
Columns
\"
:
\t
[{
\n
"
"
\t\t\t\t\t\t\t\"
TableId
\"
:
\t
1,
\n
"
"
\t\t\t\t\t\t\t\"
Flag
\"
:
\t
0,
\n
"
"
\t\t\t\t\t\t\t\"
Info
\"
:
\t
{
\n
"
"
\t\t\t\t\t\t\t\t\"
ColId
\"
:
\t
2,
\n
"
"
\t\t\t\t\t\t\t\t\"
Type
\"
:
\t
4,
\n
"
"
\t\t\t\t\t\t\t\t\"
Bytes
\"
:
\t
4
\n
"
"
\t\t\t\t\t\t\t
}
\n
"
"
\t\t\t\t\t\t
}],
\n
"
"
\t\t\t\t\t\"
InterBytes
\"
:
\t
0
\n
"
"
\t\t\t\t
},
\n
"
"
\t\t\t\t\"
Expr
\"
:
\t
{
\n
"
"
\t\t\t\t\t\"
Type
\"
:
\t
4,
\n
"
"
\t\t\t\t\t\"
Column
\"
:
\t
{
\n
"
"
\t\t\t\t\t\t\"
Type
\"
:
\t
4,
\n
"
"
\t\t\t\t\t\t\"
ColId
\"
:
\t
2,
\n
"
"
\t\t\t\t\t\t\"
Bytes
\"
:
\t
4
\n
"
"
\t\t\t\t\t
}
\n
"
"
\t\t\t\t
}
\n
"
"
\t\t\t
}],
\n
"
"
\t\t\"
InputSchema
\"
:
\t
[{
\n
"
"
\t\t\t\t\"
Type
\"
:
\t
9,
\n
"
"
\t\t\t\t\"
ColId
\"
:
\t
5000,
\n
"
"
\t\t\t\t\"
Bytes
\"
:
\t
8
\n
"
"
\t\t\t
}, {
\n
"
"
\t\t\t\t\"
Type
\"
:
\t
4,
\n
"
"
\t\t\t\t\"
ColId
\"
:
\t
5001,
\n
"
"
\t\t\t\t\"
Bytes
\"
:
\t
4
\n
"
"
\t\t\t
}],
\n
"
"
\t\t\"
TableScan
\"
:
\t
{
\n
"
"
\t\t\t\"
TableId
\"
:
\t
1,
\n
"
"
\t\t\t\"
TableType
\"
:
\t
2,
\n
"
"
\t\t\t\"
Flag
\"
:
\t
0,
\n
"
"
\t\t\t\"
Window
\"
:
\t
{
\n
"
"
\t\t\t\t\"
StartKey
\"
:
\t
-9.2233720368547758e+18,
\n
"
"
\t\t\t\t\"
EndKey
\"
:
\t
9.2233720368547758e+18
\n
"
"
\t\t\t
}
\n
"
"
\t\t
}
\n
"
"
\t
},
\n
"
"
\t\"
DataSink
\"
:
\t
{
\n
"
"
\t\t\"
Name
\"
:
\t\"
Dispatch
\"
,
\n
"
"
\t\t\"
Dispatch
\"
:
\t
{
\n
"
"
\t\t
}
\n
"
"
\t
}
\n
"
"}"
;
SExecTaskInfo
*
pTaskInfo
=
nullptr
;
int32_t
code
=
qCreateExecTask
((
void
*
)
1
,
2
,
NULL
,
(
void
**
)
&
pTaskInfo
);
}
\ No newline at end of file
source/libs/index/src/index.c
浏览文件 @
32f9383a
...
@@ -59,6 +59,10 @@ static int indexMergeFinalResults(SArray* interResults, EIndexOperatorType oTyp
...
@@ -59,6 +59,10 @@ static int indexMergeFinalResults(SArray* interResults, EIndexOperatorType oTyp
static
int
indexGenTFile
(
SIndex
*
index
,
IndexCache
*
cache
,
SArray
*
batch
);
static
int
indexGenTFile
(
SIndex
*
index
,
IndexCache
*
cache
,
SArray
*
batch
);
// merge cache and tfile by opera type
static
void
indexMergeCacheAndTFile
(
SArray
*
result
,
IterateValue
*
icache
,
IterateValue
*
iTfv
);
static
void
indexMergeSameKey
(
SArray
*
result
,
TFileValue
*
tv
);
int
indexOpen
(
SIndexOpts
*
opts
,
const
char
*
path
,
SIndex
**
index
)
{
int
indexOpen
(
SIndexOpts
*
opts
,
const
char
*
path
,
SIndex
**
index
)
{
pthread_once
(
&
isInit
,
indexInit
);
pthread_once
(
&
isInit
,
indexInit
);
SIndex
*
sIdx
=
calloc
(
1
,
sizeof
(
SIndex
));
SIndex
*
sIdx
=
calloc
(
1
,
sizeof
(
SIndex
));
...
@@ -385,6 +389,27 @@ static void indexMergeSameKey(SArray* result, TFileValue* tv) {
...
@@ -385,6 +389,27 @@ static void indexMergeSameKey(SArray* result, TFileValue* tv) {
taosArrayPush
(
result
,
&
tv
);
taosArrayPush
(
result
,
&
tv
);
}
}
}
}
static
void
indexMergeCacheAndTFile
(
SArray
*
result
,
IterateValue
*
cv
,
IterateValue
*
tv
)
{
// opt
char
*
colVal
=
(
cv
!=
NULL
)
?
cv
->
colVal
:
tv
->
colVal
;
// design merge-algorithm later, too complicated to handle all kind of situation
TFileValue
*
tfv
=
tfileValueCreate
(
colVal
);
if
(
cv
!=
NULL
)
{
if
(
cv
->
type
==
ADD_VALUE
)
{
taosArrayAddAll
(
tfv
->
tableId
,
cv
->
val
);
}
else
if
(
cv
->
type
==
DEL_VALUE
)
{
}
else
if
(
cv
->
type
==
UPDATE_VALUE
)
{
}
else
{
// do nothing
}
}
if
(
tv
!=
NULL
)
{
// opt later
taosArrayAddAll
(
tfv
->
tableId
,
tv
->
val
);
}
indexMergeSameKey
(
result
,
tfv
);
}
static
void
indexDestroyTempResult
(
SArray
*
result
)
{
static
void
indexDestroyTempResult
(
SArray
*
result
)
{
int32_t
sz
=
result
?
taosArrayGetSize
(
result
)
:
0
;
int32_t
sz
=
result
?
taosArrayGetSize
(
result
)
:
0
;
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
...
@@ -411,51 +436,30 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
...
@@ -411,51 +436,30 @@ int indexFlushCacheToTFile(SIndex* sIdx, void* cache) {
bool
cn
=
cacheIter
?
cacheIter
->
next
(
cacheIter
)
:
false
;
bool
cn
=
cacheIter
?
cacheIter
->
next
(
cacheIter
)
:
false
;
bool
tn
=
tfileIter
?
tfileIter
->
next
(
tfileIter
)
:
false
;
bool
tn
=
tfileIter
?
tfileIter
->
next
(
tfileIter
)
:
false
;
while
(
cn
==
true
&&
tn
==
true
)
{
while
(
cn
==
true
||
tn
==
true
)
{
IterateValue
*
cv
=
cacheIter
->
getValue
(
cacheIter
);
IterateValue
*
cv
=
(
cn
==
true
)
?
cacheIter
->
getValue
(
cacheIter
)
:
NULL
;
IterateValue
*
tv
=
tfileIter
->
getValue
(
tfileIter
);
IterateValue
*
tv
=
(
tn
==
true
)
?
tfileIter
->
getValue
(
tfileIter
)
:
NULL
;
// dump value
int
comp
=
0
;
int
comp
=
strcmp
(
cv
->
colVal
,
tv
->
colVal
);
if
(
cn
==
true
&&
tn
==
true
)
{
comp
=
strcmp
(
cv
->
colVal
,
tv
->
colVal
);
}
else
if
(
cn
==
true
)
{
comp
=
-
1
;
}
else
{
comp
=
1
;
}
if
(
comp
==
0
)
{
if
(
comp
==
0
)
{
TFileValue
*
tfv
=
tfileValueCreate
(
cv
->
colVal
);
indexMergeCacheAndTFile
(
result
,
cv
,
tv
);
taosArrayAddAll
(
tfv
->
tableId
,
cv
->
val
);
taosArrayAddAll
(
tfv
->
tableId
,
tv
->
val
);
indexMergeSameKey
(
result
,
tfv
);
cn
=
cacheIter
->
next
(
cacheIter
);
cn
=
cacheIter
->
next
(
cacheIter
);
tn
=
tfileIter
->
next
(
tfileIter
);
tn
=
tfileIter
->
next
(
tfileIter
);
continue
;
}
else
if
(
comp
<
0
)
{
}
else
if
(
comp
<
0
)
{
TFileValue
*
tfv
=
tfileValueCreate
(
cv
->
colVal
);
indexMergeCacheAndTFile
(
result
,
cv
,
NULL
);
taosArrayAddAll
(
tfv
->
tableId
,
cv
->
val
);
indexMergeSameKey
(
result
,
tfv
);
// copy to final Result;
cn
=
cacheIter
->
next
(
cacheIter
);
cn
=
cacheIter
->
next
(
cacheIter
);
}
else
{
}
else
{
TFileValue
*
tfv
=
tfileValueCreate
(
tv
->
colVal
);
indexMergeCacheAndTFile
(
result
,
NULL
,
tv
);
taosArrayAddAll
(
tfv
->
tableId
,
tv
->
val
);
indexMergeSameKey
(
result
,
tfv
);
// copy to final result
tn
=
tfileIter
->
next
(
tfileIter
);
tn
=
tfileIter
->
next
(
tfileIter
);
}
}
}
}
while
(
cn
==
true
)
{
IterateValue
*
cv
=
cacheIter
->
getValue
(
cacheIter
);
TFileValue
*
tfv
=
tfileValueCreate
(
cv
->
colVal
);
taosArrayAddAll
(
tfv
->
tableId
,
cv
->
val
);
indexMergeSameKey
(
result
,
tfv
);
cn
=
cacheIter
->
next
(
cacheIter
);
}
while
(
tn
==
true
)
{
IterateValue
*
tv
=
tfileIter
->
getValue
(
tfileIter
);
TFileValue
*
tfv
=
tfileValueCreate
(
tv
->
colVal
);
taosArrayAddAll
(
tfv
->
tableId
,
tv
->
val
);
indexMergeSameKey
(
result
,
tfv
);
tn
=
tfileIter
->
next
(
tfileIter
);
}
int
ret
=
indexGenTFile
(
sIdx
,
pCache
,
result
);
int
ret
=
indexGenTFile
(
sIdx
,
pCache
,
result
);
indexDestroyTempResult
(
result
);
indexDestroyTempResult
(
result
);
...
@@ -503,7 +507,7 @@ static int indexGenTFile(SIndex* sIdx, IndexCache* cache, SArray* batch) {
...
@@ -503,7 +507,7 @@ static int indexGenTFile(SIndex* sIdx, IndexCache* cache, SArray* batch) {
tfileWriterClose
(
tw
);
tfileWriterClose
(
tw
);
TFileReader
*
reader
=
tfileReaderOpen
(
sIdx
->
path
,
cache
->
suid
,
version
,
cache
->
colName
);
TFileReader
*
reader
=
tfileReaderOpen
(
sIdx
->
path
,
cache
->
suid
,
version
,
cache
->
colName
);
if
(
reader
==
NULL
)
{
goto
END
;
}
if
(
reader
==
NULL
)
{
return
-
1
;
}
TFileHeader
*
header
=
&
reader
->
header
;
TFileHeader
*
header
=
&
reader
->
header
;
ICacheKey
key
=
{.
suid
=
cache
->
suid
,
.
colName
=
header
->
colName
,
.
nColName
=
strlen
(
header
->
colName
)};
ICacheKey
key
=
{.
suid
=
cache
->
suid
,
.
colName
=
header
->
colName
,
.
nColName
=
strlen
(
header
->
colName
)};
...
...
source/libs/index/src/index_cache.c
浏览文件 @
32f9383a
...
@@ -217,9 +217,9 @@ int indexCachePut(void* cache, SIndexTerm* term, uint64_t uid) {
...
@@ -217,9 +217,9 @@ int indexCachePut(void* cache, SIndexTerm* term, uint64_t uid) {
// set value
// set value
ct
->
uid
=
uid
;
ct
->
uid
=
uid
;
ct
->
operaType
=
term
->
operType
;
ct
->
operaType
=
term
->
operType
;
// ugly code, refactor later
// ugly code, refactor later
int64_t
estimate
=
sizeof
(
ct
)
+
strlen
(
ct
->
colVal
);
int64_t
estimate
=
sizeof
(
ct
)
+
strlen
(
ct
->
colVal
);
pthread_mutex_lock
(
&
pCache
->
mtx
);
pthread_mutex_lock
(
&
pCache
->
mtx
);
pCache
->
occupiedMem
+=
estimate
;
pCache
->
occupiedMem
+=
estimate
;
indexCacheMakeRoomForWrite
(
pCache
);
indexCacheMakeRoomForWrite
(
pCache
);
...
@@ -331,7 +331,6 @@ static char* indexCacheTermGet(const void* pData) {
...
@@ -331,7 +331,6 @@ static char* indexCacheTermGet(const void* pData) {
static
int32_t
indexCacheTermCompare
(
const
void
*
l
,
const
void
*
r
)
{
static
int32_t
indexCacheTermCompare
(
const
void
*
l
,
const
void
*
r
)
{
CacheTerm
*
lt
=
(
CacheTerm
*
)
l
;
CacheTerm
*
lt
=
(
CacheTerm
*
)
l
;
CacheTerm
*
rt
=
(
CacheTerm
*
)
r
;
CacheTerm
*
rt
=
(
CacheTerm
*
)
r
;
// compare colVal
// compare colVal
int32_t
cmp
=
strcmp
(
lt
->
colVal
,
rt
->
colVal
);
int32_t
cmp
=
strcmp
(
lt
->
colVal
,
rt
->
colVal
);
if
(
cmp
==
0
)
{
return
rt
->
version
-
lt
->
version
;
}
if
(
cmp
==
0
)
{
return
rt
->
version
-
lt
->
version
;
}
...
@@ -359,17 +358,32 @@ static bool indexCacheIteratorNext(Iterate* itera) {
...
@@ -359,17 +358,32 @@ static bool indexCacheIteratorNext(Iterate* itera) {
IterateValue
*
iv
=
&
itera
->
val
;
IterateValue
*
iv
=
&
itera
->
val
;
iterateValueDestroy
(
iv
,
false
);
iterateValueDestroy
(
iv
,
false
);
// IterateValue* iv = &itera->val;
// IterateValue tIterVal = {.colVal = NULL, .val = taosArrayInit(1, sizeof(uint64_t))};
bool
next
=
tSkipListIterNext
(
iter
);
bool
next
=
tSkipListIterNext
(
iter
);
if
(
next
)
{
if
(
next
)
{
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
SSkipListNode
*
node
=
tSkipListIterGet
(
iter
);
CacheTerm
*
ct
=
(
CacheTerm
*
)
SL_GET_NODE_DATA
(
node
);
CacheTerm
*
ct
=
(
CacheTerm
*
)
SL_GET_NODE_DATA
(
node
);
// equal func
// if (iv->colVal != NULL && ct->colVal != NULL) {
// if (0 == strcmp(iv->colVal, ct->colVal)) { if (iv->type == ADD_VALUE) }
//} else {
// tIterVal.colVal = calloc(1, strlen(ct->colVal) + 1);
// tIterval.colVal = tstrdup(ct->colVal);
//}
iv
->
type
=
ct
->
operaType
;
iv
->
type
=
ct
->
operaType
;
iv
->
colVal
=
calloc
(
1
,
strlen
(
ct
->
colVal
)
+
1
);
iv
->
colVal
=
tstrdup
(
ct
->
colVal
);
memcpy
(
iv
->
colVal
,
ct
->
colVal
,
strlen
(
ct
->
colVal
));
// iv->colVal = calloc(1, strlen(ct->colVal) + 1);
// memcpy(iv->colVal, ct->colVal, strlen(ct->colVal));
taosArrayPush
(
iv
->
val
,
&
ct
->
uid
);
taosArrayPush
(
iv
->
val
,
&
ct
->
uid
);
}
}
// IterateValue* iv = &itera->val;
// iterateValueDestroy(iv, true);
//*iv = tIterVal;
return
next
;
return
next
;
}
}
...
...
source/libs/index/src/index_fst.c
浏览文件 @
32f9383a
...
@@ -936,6 +936,7 @@ Fst* fstCreate(FstSlice* slice) {
...
@@ -936,6 +936,7 @@ Fst* fstCreate(FstSlice* slice) {
len
-=
sizeof
(
checkSum
);
len
-=
sizeof
(
checkSum
);
taosDecodeFixedU32
(
buf
+
len
,
&
checkSum
);
taosDecodeFixedU32
(
buf
+
len
,
&
checkSum
);
if
(
taosCheckChecksum
(
buf
,
len
,
checkSum
))
{
if
(
taosCheckChecksum
(
buf
,
len
,
checkSum
))
{
indexError
(
"index file is corrupted"
);
// verify fst
// verify fst
return
NULL
;
return
NULL
;
}
}
...
...
source/libs/index/src/index_fst_counting_writer.c
浏览文件 @
32f9383a
...
@@ -60,9 +60,10 @@ static int writeCtxDoReadFrom(WriterCtx* ctx, uint8_t* buf, int len, int32_t off
...
@@ -60,9 +60,10 @@ static int writeCtxDoReadFrom(WriterCtx* ctx, uint8_t* buf, int len, int32_t off
return
nRead
;
return
nRead
;
}
}
static
int
writeCtxGetSize
(
WriterCtx
*
ctx
)
{
static
int
writeCtxGetSize
(
WriterCtx
*
ctx
)
{
if
(
ctx
->
type
==
TFile
&&
ctx
->
file
.
readOnly
)
{
if
(
ctx
->
type
==
TFile
)
{
// refactor later
struct
stat
fstat
;
return
ctx
->
file
.
size
;
stat
(
ctx
->
file
.
buf
,
&
fstat
);
return
fstat
.
st_size
;
}
}
return
0
;
return
0
;
}
}
...
@@ -88,7 +89,7 @@ WriterCtx* writerCtxCreate(WriterType type, const char* path, bool readOnly, int
...
@@ -88,7 +89,7 @@ WriterCtx* writerCtxCreate(WriterType type, const char* path, bool readOnly, int
if
(
readOnly
==
false
)
{
if
(
readOnly
==
false
)
{
// ctx->file.fd = open(path, O_WRONLY | O_CREAT | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO);
// ctx->file.fd = open(path, O_WRONLY | O_CREAT | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO);
ctx
->
file
.
fd
=
tfOpenCreateWriteAppend
(
path
);
ctx
->
file
.
fd
=
tfOpenCreateWriteAppend
(
path
);
tfFtruncate
(
ctx
->
file
.
fd
,
0
);
struct
stat
fstat
;
struct
stat
fstat
;
stat
(
path
,
&
fstat
);
stat
(
path
,
&
fstat
);
ctx
->
file
.
size
=
fstat
.
st_size
;
ctx
->
file
.
size
=
fstat
.
st_size
;
...
@@ -138,6 +139,11 @@ void writerCtxDestroy(WriterCtx* ctx, bool remove) {
...
@@ -138,6 +139,11 @@ void writerCtxDestroy(WriterCtx* ctx, bool remove) {
munmap
(
ctx
->
file
.
ptr
,
ctx
->
file
.
size
);
munmap
(
ctx
->
file
.
ptr
,
ctx
->
file
.
size
);
#endif
#endif
}
}
if
(
ctx
->
file
.
readOnly
==
false
)
{
struct
stat
fstat
;
stat
(
ctx
->
file
.
buf
,
&
fstat
);
// indexError("write file size: %d", (int)(fstat.st_size));
}
if
(
remove
)
{
unlink
(
ctx
->
file
.
buf
);
}
if
(
remove
)
{
unlink
(
ctx
->
file
.
buf
);
}
}
}
free
(
ctx
);
free
(
ctx
);
...
...
source/libs/index/src/index_tfile.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/parser/inc/astToMsg.h
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/parser/src/astToMsg.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/parser/src/dCDAstProcess.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/parser/src/parser.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/planner/inc/plannerInt.h
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/planner/src/physicalPlan.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/planner/src/physicalPlanJson.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/planner/src/planner.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/planner/test/phyPlanTests.cpp
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/qcom/src/querymsg.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/qworker/CMakeLists.txt
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/qworker/inc/qworkerInt.h
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/qworker/src/qworker.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/qworker/test/qworkerTests.cpp
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/scheduler/inc/schedulerInt.h
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/scheduler/src/scheduler.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/wal/inc/walInt.h
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/wal/src/walMeta.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/wal/src/walMgmt.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/wal/src/walSeek.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/wal/src/walWrite.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/libs/wal/test/walMetaTest.cpp
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/os/src/osSysinfo.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/util/src/tarray.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
source/util/test/arrayTest.cpp
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
src/inc/tsdb.h
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
src/query/inc/qExecutor.h
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
src/query/src/qExecutor.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
tests/script/jenkins/basic.txt
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
tests/script/sh/deploy.sh
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
tests/script/sh/exec.sh
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
tests/script/
general
/db/basic1.sim
→
tests/script/
sim
/db/basic1.sim
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
tests/script/
general/db/basic
.sim
→
tests/script/
sim/db/basic6
.sim
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
tests/script/sim/db/error1.sim
0 → 100644
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
tests/script/
unique
/dnode/basic1.sim
→
tests/script/
sim
/dnode/basic1.sim
浏览文件 @
32f9383a
文件已移动
tests/script/
general
/table/basic1.sim
→
tests/script/
sim
/table/basic1.sim
浏览文件 @
32f9383a
文件已移动
tests/script/
general
/user/basic1.sim
→
tests/script/
sim
/user/basic1.sim
浏览文件 @
32f9383a
文件已移动
tests/test/c/create_table.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
tools/shell/src/backup/tnettest.c
浏览文件 @
32f9383a
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录