Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
406d35d4
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
406d35d4
编写于
7月 05, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feat/tsdb_refact' of
https://github.com/taosdata/TDengine
into feat/tsdb_snapshot
上级
4d0f46fb
b8899c82
变更
135
展开全部
隐藏空白更改
内联
并排
Showing
135 changed file
with
5305 addition
and
2072 deletion
+5305
-2072
Jenkinsfile2
Jenkinsfile2
+30
-0
include/common/tmsg.h
include/common/tmsg.h
+7
-1
include/libs/executor/executor.h
include/libs/executor/executor.h
+0
-3
include/libs/nodes/nodes.h
include/libs/nodes/nodes.h
+3
-2
include/libs/nodes/plannodes.h
include/libs/nodes/plannodes.h
+1
-0
include/libs/scalar/scalar.h
include/libs/scalar/scalar.h
+2
-0
include/libs/scheduler/scheduler.h
include/libs/scheduler/scheduler.h
+1
-1
include/libs/sync/sync.h
include/libs/sync/sync.h
+22
-16
include/libs/sync/syncTools.h
include/libs/sync/syncTools.h
+39
-28
include/libs/transport/trpc.h
include/libs/transport/trpc.h
+9
-6
include/util/tRealloc.h
include/util/tRealloc.h
+2
-2
include/util/taoserror.h
include/util/taoserror.h
+8
-5
include/util/tdef.h
include/util/tdef.h
+3
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+17
-12
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+57
-10
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+39
-16
source/client/src/clientMain.c
source/client/src/clientMain.c
+35
-41
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+10
-9
source/common/src/tmsg.c
source/common/src/tmsg.c
+20
-8
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+2
-0
source/dnode/mgmt/node_mgmt/src/dmProc.c
source/dnode/mgmt/node_mgmt/src/dmProc.c
+10
-10
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+1
-1
source/dnode/mgmt/node_util/src/dmEps.c
source/dnode/mgmt/node_util/src/dmEps.c
+1
-1
source/dnode/mgmt/test/sut/src/sut.cpp
source/dnode/mgmt/test/sut/src/sut.cpp
+5
-3
source/dnode/mnode/impl/inc/mndDef.h
source/dnode/mnode/impl/inc/mndDef.h
+6
-2
source/dnode/mnode/impl/inc/mndVgroup.h
source/dnode/mnode/impl/inc/mndVgroup.h
+2
-0
source/dnode/mnode/impl/src/mndDb.c
source/dnode/mnode/impl/src/mndDb.c
+13
-2
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+6
-3
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+10
-10
source/dnode/mnode/impl/src/mndSync.c
source/dnode/mnode/impl/src/mndSync.c
+2
-2
source/dnode/mnode/impl/src/mndVgroup.c
source/dnode/mnode/impl/src/mndVgroup.c
+109
-24
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+1
-1
source/dnode/vnode/src/sma/smaCommit.c
source/dnode/vnode/src/sma/smaCommit.c
+6
-6
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+2
-3
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+219
-135
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
+6
-0
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+8
-8
source/dnode/vnode/src/vnd/vnodeSync.c
source/dnode/vnode/src/vnd/vnodeSync.c
+128
-64
source/libs/command/inc/commandInt.h
source/libs/command/inc/commandInt.h
+6
-0
source/libs/command/src/explain.c
source/libs/command/src/explain.c
+289
-0
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+0
-4
source/libs/executor/src/executorMain.c
source/libs/executor/src/executorMain.c
+2
-23
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+18
-15
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+8
-8
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+199
-1
source/libs/function/src/functionMgt.c
source/libs/function/src/functionMgt.c
+1
-1
source/libs/nodes/src/nodesUtilFuncs.c
source/libs/nodes/src/nodesUtilFuncs.c
+19
-10
source/libs/parser/inc/parAst.h
source/libs/parser/inc/parAst.h
+1
-0
source/libs/parser/inc/parUtil.h
source/libs/parser/inc/parUtil.h
+1
-0
source/libs/parser/inc/sql.y
source/libs/parser/inc/sql.y
+2
-2
source/libs/parser/src/parAstCreater.c
source/libs/parser/src/parAstCreater.c
+5
-0
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+6
-0
source/libs/parser/src/parInsert.c
source/libs/parser/src/parInsert.c
+67
-25
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+432
-267
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+9
-1
source/libs/parser/src/sql.c
source/libs/parser/src/sql.c
+658
-698
source/libs/parser/test/mockCatalog.cpp
source/libs/parser/test/mockCatalog.cpp
+37
-32
source/libs/parser/test/mockCatalogService.cpp
source/libs/parser/test/mockCatalogService.cpp
+28
-0
source/libs/parser/test/mockCatalogService.h
source/libs/parser/test/mockCatalogService.h
+2
-0
source/libs/parser/test/parInitialATest.cpp
source/libs/parser/test/parInitialATest.cpp
+16
-18
source/libs/parser/test/parInitialCTest.cpp
source/libs/parser/test/parInitialCTest.cpp
+41
-22
source/libs/planner/src/planOptimizer.c
source/libs/planner/src/planOptimizer.c
+4
-2
source/libs/planner/src/planPhysiCreater.c
source/libs/planner/src/planPhysiCreater.c
+3
-0
source/libs/planner/src/planSpliter.c
source/libs/planner/src/planSpliter.c
+7
-3
source/libs/planner/test/planOptimizeTest.cpp
source/libs/planner/test/planOptimizeTest.cpp
+2
-0
source/libs/planner/test/planSetOpTest.cpp
source/libs/planner/test/planSetOpTest.cpp
+9
-1
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+0
-5
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+69
-0
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+7
-26
source/libs/scheduler/src/schJob.c
source/libs/scheduler/src/schJob.c
+10
-18
source/libs/scheduler/src/schRemote.c
source/libs/scheduler/src/schRemote.c
+6
-2
source/libs/scheduler/src/scheduler.c
source/libs/scheduler/src/scheduler.c
+15
-8
source/libs/scheduler/test/schedulerTests.cpp
source/libs/scheduler/test/schedulerTests.cpp
+5
-5
source/libs/sync/inc/syncAppendEntriesReply.h
source/libs/sync/inc/syncAppendEntriesReply.h
+0
-5
source/libs/sync/inc/syncInt.h
source/libs/sync/inc/syncInt.h
+3
-2
source/libs/sync/inc/syncRaftEntry.h
source/libs/sync/inc/syncRaftEntry.h
+5
-4
source/libs/sync/inc/syncReplication.h
source/libs/sync/inc/syncReplication.h
+1
-0
source/libs/sync/inc/syncSnapshot.h
source/libs/sync/inc/syncSnapshot.h
+26
-23
source/libs/sync/src/syncAppendEntries.c
source/libs/sync/src/syncAppendEntries.c
+98
-36
source/libs/sync/src/syncAppendEntriesReply.c
source/libs/sync/src/syncAppendEntriesReply.c
+11
-11
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+4
-2
source/libs/sync/src/syncMessage.c
source/libs/sync/src/syncMessage.c
+158
-60
source/libs/sync/src/syncRaftEntry.c
source/libs/sync/src/syncRaftEntry.c
+16
-0
source/libs/sync/src/syncRaftLog.c
source/libs/sync/src/syncRaftLog.c
+9
-0
source/libs/sync/src/syncReplication.c
source/libs/sync/src/syncReplication.c
+15
-7
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+9
-3
source/libs/sync/test/CMakeLists.txt
source/libs/sync/test/CMakeLists.txt
+14
-0
source/libs/sync/test/syncAppendEntriesBatchTest.cpp
source/libs/sync/test/syncAppendEntriesBatchTest.cpp
+25
-25
source/libs/sync/test/syncClientRequestBatchTest.cpp
source/libs/sync/test/syncClientRequestBatchTest.cpp
+125
-0
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
+3
-3
source/libs/sync/test/syncSnapshotReceiverTest.cpp
source/libs/sync/test/syncSnapshotReceiverTest.cpp
+1
-1
source/libs/sync/test/syncSnapshotSenderTest.cpp
source/libs/sync/test/syncSnapshotSenderTest.cpp
+1
-1
source/libs/sync/test/syncTestTool.cpp
source/libs/sync/test/syncTestTool.cpp
+5
-5
source/libs/tfs/src/tfs.c
source/libs/tfs/src/tfs.c
+1
-1
source/libs/transport/inc/transComm.h
source/libs/transport/inc/transComm.h
+20
-17
source/libs/transport/inc/transportInt.h
source/libs/transport/inc/transportInt.h
+1
-1
source/libs/transport/src/trans.c
source/libs/transport/src/trans.c
+12
-6
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+46
-24
source/libs/transport/src/transComm.c
source/libs/transport/src/transComm.c
+21
-19
source/libs/transport/src/transSvr.c
source/libs/transport/src/transSvr.c
+22
-21
source/libs/transport/test/transUT.cpp
source/libs/transport/test/transUT.cpp
+1
-1
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+5
-2
source/util/src/terror.c
source/util/src/terror.c
+2
-0
source/util/src/ttimer.c
source/util/src/ttimer.c
+2
-1
tests/script/api/stopquery.c
tests/script/api/stopquery.c
+257
-26
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-0
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+2
-2
tests/script/sh/stop_dnodes.sh
tests/script/sh/stop_dnodes.sh
+1
-1
tests/script/tmp/prepare.sim
tests/script/tmp/prepare.sim
+26
-32
tests/script/tsim/insert/update0.sim
tests/script/tsim/insert/update0.sim
+2
-2
tests/script/tsim/sma/rsmaPersistenceRecovery.sim
tests/script/tsim/sma/rsmaPersistenceRecovery.sim
+237
-0
tests/script/tsim/tmq/basic1.sim
tests/script/tsim/tmq/basic1.sim
+1
-0
tests/script/tsim/valgrind/basic.sim
tests/script/tsim/valgrind/basic.sim
+27
-2
tests/system-test/1-insert/block_wise.py
tests/system-test/1-insert/block_wise.py
+442
-0
tests/system-test/1-insert/create_retentions.py
tests/system-test/1-insert/create_retentions.py
+34
-58
tests/system-test/1-insert/time_range_wise.py
tests/system-test/1-insert/time_range_wise.py
+13
-14
tests/system-test/2-query/abs.py
tests/system-test/2-query/abs.py
+1
-1
tests/system-test/2-query/distribute_agg_apercentile.py
tests/system-test/2-query/distribute_agg_apercentile.py
+1
-1
tests/system-test/2-query/distribute_agg_avg.py
tests/system-test/2-query/distribute_agg_avg.py
+1
-1
tests/system-test/2-query/distribute_agg_count.py
tests/system-test/2-query/distribute_agg_count.py
+1
-1
tests/system-test/2-query/distribute_agg_max.py
tests/system-test/2-query/distribute_agg_max.py
+1
-1
tests/system-test/2-query/distribute_agg_min.py
tests/system-test/2-query/distribute_agg_min.py
+1
-1
tests/system-test/2-query/distribute_agg_spread.py
tests/system-test/2-query/distribute_agg_spread.py
+1
-1
tests/system-test/2-query/distribute_agg_stddev.py
tests/system-test/2-query/distribute_agg_stddev.py
+1
-1
tests/system-test/2-query/distribute_agg_sum.py
tests/system-test/2-query/distribute_agg_sum.py
+1
-1
tests/system-test/2-query/function_null.py
tests/system-test/2-query/function_null.py
+1
-1
tests/system-test/2-query/irate.py
tests/system-test/2-query/irate.py
+1
-1
tests/system-test/2-query/json_tag.py
tests/system-test/2-query/json_tag.py
+1
-1
tests/system-test/2-query/max.py
tests/system-test/2-query/max.py
+1
-1
tests/system-test/2-query/twa.py
tests/system-test/2-query/twa.py
+1
-1
tests/system-test/7-tmq/tmqConsFromTsdb-1ctb.py
tests/system-test/7-tmq/tmqConsFromTsdb-1ctb.py
+263
-0
tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py
tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py
+241
-0
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py
+241
-0
tests/system-test/7-tmq/tmqConsFromTsdb1.py
tests/system-test/7-tmq/tmqConsFromTsdb1.py
+1
-1
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+14
-7
未找到文件。
Jenkinsfile2
浏览文件 @
406d35d4
...
@@ -127,6 +127,25 @@ def pre_test(){
...
@@ -127,6 +127,25 @@ def pre_test(){
'''
'''
return 1
return 1
}
}
def pre_test_build_mac() {
sh '''
hostname
date
'''
sh '''
cd ${WK}
rm -rf debug
mkdir debug
'''
sh '''
cd ${WK}/debug
cmake ..
make -j8
'''
sh '''
date
'''
}
def pre_test_win(){
def pre_test_win(){
bat '''
bat '''
hostname
hostname
...
@@ -334,6 +353,17 @@ pipeline {
...
@@ -334,6 +353,17 @@ pipeline {
}
}
}
}
}
}
stage('mac test') {
agent{label " Mac_catalina "}
steps {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
timeout(time: 20, unit: 'MINUTES'){
pre_test()
pre_test_build_mac()
}
}
}
}
stage('linux test') {
stage('linux test') {
agent{label " worker03 || slave215 || slave217 || slave219 "}
agent{label " worker03 || slave215 || slave217 || slave219 "}
options { skipDefaultCheckout() }
options { skipDefaultCheckout() }
...
...
include/common/tmsg.h
浏览文件 @
406d35d4
...
@@ -708,6 +708,7 @@ typedef struct {
...
@@ -708,6 +708,7 @@ typedef struct {
int32_t
buffer
;
// MB
int32_t
buffer
;
// MB
int32_t
pageSize
;
int32_t
pageSize
;
int32_t
pages
;
int32_t
pages
;
int32_t
lastRowMem
;
int32_t
daysPerFile
;
int32_t
daysPerFile
;
int32_t
daysToKeep0
;
int32_t
daysToKeep0
;
int32_t
daysToKeep1
;
int32_t
daysToKeep1
;
...
@@ -736,6 +737,7 @@ typedef struct {
...
@@ -736,6 +737,7 @@ typedef struct {
int32_t
buffer
;
int32_t
buffer
;
int32_t
pageSize
;
int32_t
pageSize
;
int32_t
pages
;
int32_t
pages
;
int32_t
lastRowMem
;
int32_t
daysPerFile
;
int32_t
daysPerFile
;
int32_t
daysToKeep0
;
int32_t
daysToKeep0
;
int32_t
daysToKeep1
;
int32_t
daysToKeep1
;
...
@@ -1023,8 +1025,10 @@ typedef struct {
...
@@ -1023,8 +1025,10 @@ typedef struct {
int64_t
clusterId
;
int64_t
clusterId
;
int64_t
rebootTime
;
int64_t
rebootTime
;
int64_t
updateTime
;
int64_t
updateTime
;
int32_t
numOfCores
;
float
numOfCores
;
int32_t
numOfSupportVnodes
;
int32_t
numOfSupportVnodes
;
int64_t
memTotal
;
int64_t
memAvail
;
char
dnodeEp
[
TSDB_EP_LEN
];
char
dnodeEp
[
TSDB_EP_LEN
];
SMnodeLoad
mload
;
SMnodeLoad
mload
;
SQnodeLoad
qload
;
SQnodeLoad
qload
;
...
@@ -1079,6 +1083,7 @@ typedef struct {
...
@@ -1079,6 +1083,7 @@ typedef struct {
int32_t
buffer
;
int32_t
buffer
;
int32_t
pageSize
;
int32_t
pageSize
;
int32_t
pages
;
int32_t
pages
;
int32_t
lastRowMem
;
int32_t
daysPerFile
;
int32_t
daysPerFile
;
int32_t
daysToKeep0
;
int32_t
daysToKeep0
;
int32_t
daysToKeep1
;
int32_t
daysToKeep1
;
...
@@ -1131,6 +1136,7 @@ typedef struct {
...
@@ -1131,6 +1136,7 @@ typedef struct {
int32_t
buffer
;
int32_t
buffer
;
int32_t
pageSize
;
int32_t
pageSize
;
int32_t
pages
;
int32_t
pages
;
int32_t
lastRowMem
;
int32_t
daysPerFile
;
int32_t
daysPerFile
;
int32_t
daysToKeep0
;
int32_t
daysToKeep0
;
int32_t
daysToKeep1
;
int32_t
daysToKeep1
;
...
...
include/libs/executor/executor.h
浏览文件 @
406d35d4
...
@@ -37,9 +37,6 @@ typedef struct SReadHandle {
...
@@ -37,9 +37,6 @@ typedef struct SReadHandle {
void
*
mnd
;
void
*
mnd
;
SMsgCb
*
pMsgCb
;
SMsgCb
*
pMsgCb
;
/* XXXXXXXXXXXXXXXXXXXX */
int32_t
deleteQuery
;
/* XXXXXXXXXXXXXXXXXXXX */
// int8_t initTsdbReader;
// int8_t initTsdbReader;
bool
tqReader
;
bool
tqReader
;
}
SReadHandle
;
}
SReadHandle
;
...
...
include/libs/nodes/nodes.h
浏览文件 @
406d35d4
...
@@ -22,8 +22,8 @@ extern "C" {
...
@@ -22,8 +22,8 @@ extern "C" {
#include "tdef.h"
#include "tdef.h"
#define nodeType(nodeptr) (((const SNode*)(nodeptr))->type)
#define nodeType(nodeptr)
(((const SNode*)(nodeptr))->type)
#define setNodeType(nodeptr,
type) (((SNode*)(nodeptr))->type = (
type))
#define setNodeType(nodeptr,
nodetype) (((SNode*)(nodeptr))->type = (node
type))
#define LIST_LENGTH(l) (NULL != (l) ? (l)->length : 0)
#define LIST_LENGTH(l) (NULL != (l) ? (l)->length : 0)
...
@@ -119,6 +119,7 @@ typedef enum ENodeType {
...
@@ -119,6 +119,7 @@ typedef enum ENodeType {
QUERY_NODE_DROP_TABLE_STMT
,
QUERY_NODE_DROP_TABLE_STMT
,
QUERY_NODE_DROP_SUPER_TABLE_STMT
,
QUERY_NODE_DROP_SUPER_TABLE_STMT
,
QUERY_NODE_ALTER_TABLE_STMT
,
QUERY_NODE_ALTER_TABLE_STMT
,
QUERY_NODE_ALTER_SUPER_TABLE_STMT
,
QUERY_NODE_CREATE_USER_STMT
,
QUERY_NODE_CREATE_USER_STMT
,
QUERY_NODE_ALTER_USER_STMT
,
QUERY_NODE_ALTER_USER_STMT
,
QUERY_NODE_DROP_USER_STMT
,
QUERY_NODE_DROP_USER_STMT
,
...
...
include/libs/nodes/plannodes.h
浏览文件 @
406d35d4
...
@@ -320,6 +320,7 @@ typedef struct SInterpFuncPhysiNode {
...
@@ -320,6 +320,7 @@ typedef struct SInterpFuncPhysiNode {
SNodeList
*
pFuncs
;
SNodeList
*
pFuncs
;
STimeWindow
timeRange
;
STimeWindow
timeRange
;
int64_t
interval
;
int64_t
interval
;
int8_t
intervalUnit
;
EFillMode
fillMode
;
EFillMode
fillMode
;
SNode
*
pFillValues
;
// SNodeListNode
SNode
*
pFillValues
;
// SNodeListNode
SNode
*
pTimeSeries
;
// SColumnNode
SNode
*
pTimeSeries
;
// SColumnNode
...
...
include/libs/scalar/scalar.h
浏览文件 @
406d35d4
...
@@ -25,6 +25,8 @@ extern "C" {
...
@@ -25,6 +25,8 @@ extern "C" {
typedef
struct
SFilterInfo
SFilterInfo
;
typedef
struct
SFilterInfo
SFilterInfo
;
int32_t
scalarGetOperatorResultType
(
SDataType
left
,
SDataType
right
,
EOperatorType
op
,
SDataType
*
pRes
);
/*
/*
pNode will be freed in API;
pNode will be freed in API;
*pRes need to freed in caller
*pRes need to freed in caller
...
...
include/libs/scheduler/scheduler.h
浏览文件 @
406d35d4
...
@@ -130,7 +130,7 @@ void schedulerStopQueryHb(void *pTrans);
...
@@ -130,7 +130,7 @@ void schedulerStopQueryHb(void *pTrans);
* Free the query job
* Free the query job
* @param pJob
* @param pJob
*/
*/
void
schedulerFreeJob
(
int64_t
job
,
int32_t
errCode
);
void
schedulerFreeJob
(
int64_t
*
job
,
int32_t
errCode
);
void
schedulerDestroy
(
void
);
void
schedulerDestroy
(
void
);
...
...
include/libs/sync/sync.h
浏览文件 @
406d35d4
...
@@ -31,6 +31,12 @@ extern bool gRaftDetailLog;
...
@@ -31,6 +31,12 @@ extern bool gRaftDetailLog;
#define SYNC_INDEX_INVALID -1
#define SYNC_INDEX_INVALID -1
#define SYNC_TERM_INVALID 0xFFFFFFFFFFFFFFFF
#define SYNC_TERM_INVALID 0xFFFFFFFFFFFFFFFF
typedef
enum
{
SYNC_STRATEGY_NO_SNAPSHOT
=
0
,
SYNC_STRATEGY_STANDARD_SNAPSHOT
=
1
,
SYNC_STRATEGY_WAL_FIRST
=
2
,
}
ESyncStrategy
;
typedef
uint64_t
SyncNodeId
;
typedef
uint64_t
SyncNodeId
;
typedef
int32_t
SyncGroupId
;
typedef
int32_t
SyncGroupId
;
typedef
int64_t
SyncIndex
;
typedef
int64_t
SyncIndex
;
...
@@ -48,11 +54,6 @@ typedef enum {
...
@@ -48,11 +54,6 @@ typedef enum {
TAOS_SYNC_STATE_ERROR
=
103
,
TAOS_SYNC_STATE_ERROR
=
103
,
}
ESyncState
;
}
ESyncState
;
typedef
enum
{
TAOS_SYNC_FSM_CB_SUCCESS
=
0
,
TAOS_SYNC_FSM_CB_OTHER_ERROR
=
1
,
}
ESyncFsmCbCode
;
typedef
struct
SNodeInfo
{
typedef
struct
SNodeInfo
{
uint16_t
nodePort
;
uint16_t
nodePort
;
char
nodeFqdn
[
TSDB_FQDN_LEN
];
char
nodeFqdn
[
TSDB_FQDN_LEN
];
...
@@ -96,6 +97,11 @@ typedef struct SReConfigCbMeta {
...
@@ -96,6 +97,11 @@ typedef struct SReConfigCbMeta {
}
SReConfigCbMeta
;
}
SReConfigCbMeta
;
typedef
struct
SSnapshotParam
{
SyncIndex
start
;
SyncIndex
end
;
}
SSnapshotParam
;
typedef
struct
SSnapshot
{
typedef
struct
SSnapshot
{
void
*
data
;
void
*
data
;
SyncIndex
lastApplyIndex
;
SyncIndex
lastApplyIndex
;
...
@@ -125,7 +131,7 @@ typedef struct SSyncFSM {
...
@@ -125,7 +131,7 @@ typedef struct SSyncFSM {
int32_t
(
*
FpSnapshotStopRead
)(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
);
int32_t
(
*
FpSnapshotStopRead
)(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
);
int32_t
(
*
FpSnapshotDoRead
)(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
,
void
**
ppBuf
,
int32_t
*
len
);
int32_t
(
*
FpSnapshotDoRead
)(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
,
void
**
ppBuf
,
int32_t
*
len
);
int32_t
(
*
FpSnapshotStartWrite
)(
struct
SSyncFSM
*
pFsm
,
void
**
ppWriter
);
int32_t
(
*
FpSnapshotStartWrite
)(
struct
SSyncFSM
*
pFsm
,
void
*
pWriterParam
,
void
*
*
ppWriter
);
int32_t
(
*
FpSnapshotStopWrite
)(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
bool
isApply
);
int32_t
(
*
FpSnapshotStopWrite
)(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
bool
isApply
);
int32_t
(
*
FpSnapshotDoWrite
)(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
void
*
pBuf
,
int32_t
len
);
int32_t
(
*
FpSnapshotDoWrite
)(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
void
*
pBuf
,
int32_t
len
);
...
@@ -178,15 +184,15 @@ typedef struct SSyncLogStore {
...
@@ -178,15 +184,15 @@ typedef struct SSyncLogStore {
}
SSyncLogStore
;
}
SSyncLogStore
;
typedef
struct
SSyncInfo
{
typedef
struct
SSyncInfo
{
bool
isStandBy
;
bool
isStandBy
;
bool
snapshotEnable
;
ESyncStrategy
snapshotStrategy
;
SyncGroupId
vgId
;
SyncGroupId
vgId
;
int32_t
batchSize
;
int32_t
batchSize
;
SSyncCfg
syncCfg
;
SSyncCfg
syncCfg
;
char
path
[
TSDB_FILENAME_LEN
];
char
path
[
TSDB_FILENAME_LEN
];
SWal
*
pWal
;
SWal
*
pWal
;
SSyncFSM
*
pFsm
;
SSyncFSM
*
pFsm
;
SMsgCb
*
msgcb
;
SMsgCb
*
msgcb
;
int32_t
(
*
FpSendMsg
)(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
int32_t
(
*
FpSendMsg
)(
const
SEpSet
*
pEpSet
,
SRpcMsg
*
pMsg
);
int32_t
(
*
FpEqMsg
)(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
);
int32_t
(
*
FpEqMsg
)(
const
SMsgCb
*
msgcb
,
SRpcMsg
*
pMsg
);
}
SSyncInfo
;
}
SSyncInfo
;
...
@@ -205,7 +211,7 @@ SyncGroupId syncGetVgId(int64_t rid);
...
@@ -205,7 +211,7 @@ SyncGroupId syncGetVgId(int64_t rid);
void
syncGetEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
void
syncGetEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
void
syncGetRetryEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
void
syncGetRetryEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
int32_t
syncPropose
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
);
int32_t
syncPropose
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
);
//
int32_t syncProposeBatch(int64_t rid, SRpcMsg* pMsgArr, bool* pIsWeakArr, int32_t arrSize);
int32_t
syncProposeBatch
(
int64_t
rid
,
SRpcMsg
*
pMsgArr
,
bool
*
pIsWeakArr
,
int32_t
arrSize
);
bool
syncEnvIsStart
();
bool
syncEnvIsStart
();
const
char
*
syncStr
(
ESyncState
state
);
const
char
*
syncStr
(
ESyncState
state
);
bool
syncIsRestoreFinish
(
int64_t
rid
);
bool
syncIsRestoreFinish
(
int64_t
rid
);
...
...
include/libs/sync/syncTools.h
浏览文件 @
406d35d4
...
@@ -191,12 +191,12 @@ void syncTimeoutLog2(char* s, const SyncTimeout* pMsg);
...
@@ -191,12 +191,12 @@ void syncTimeoutLog2(char* s, const SyncTimeout* pMsg);
typedef
struct
SyncClientRequest
{
typedef
struct
SyncClientRequest
{
uint32_t
bytes
;
uint32_t
bytes
;
int32_t
vgId
;
int32_t
vgId
;
uint32_t
msgType
;
//
SyncClientRequest msgType
uint32_t
msgType
;
//
TDMT_SYNC_CLIENT_REQUEST
uint32_t
originalRpcType
;
//
user
RpcMsg msgType
uint32_t
originalRpcType
;
//
origin
RpcMsg msgType
uint64_t
seqNum
;
uint64_t
seqNum
;
bool
isWeak
;
bool
isWeak
;
uint32_t
dataLen
;
//
user
RpcMsg.contLen
uint32_t
dataLen
;
//
origin
RpcMsg.contLen
char
data
[];
//
user
RpcMsg.pCont
char
data
[];
//
origin
RpcMsg.pCont
}
SyncClientRequest
;
}
SyncClientRequest
;
SyncClientRequest
*
syncClientRequestBuild
(
uint32_t
dataLen
);
SyncClientRequest
*
syncClientRequestBuild
(
uint32_t
dataLen
);
...
@@ -220,11 +220,6 @@ void syncClientRequestLog(const SyncClientRequest* pMsg);
...
@@ -220,11 +220,6 @@ void syncClientRequestLog(const SyncClientRequest* pMsg);
void
syncClientRequestLog2
(
char
*
s
,
const
SyncClientRequest
*
pMsg
);
void
syncClientRequestLog2
(
char
*
s
,
const
SyncClientRequest
*
pMsg
);
// ---------------------------------------------
// ---------------------------------------------
typedef
struct
SOffsetAndContLen
{
int32_t
offset
;
int32_t
contLen
;
}
SOffsetAndContLen
;
typedef
struct
SRaftMeta
{
typedef
struct
SRaftMeta
{
uint64_t
seqNum
;
uint64_t
seqNum
;
bool
isWeak
;
bool
isWeak
;
...
@@ -232,20 +227,33 @@ typedef struct SRaftMeta {
...
@@ -232,20 +227,33 @@ typedef struct SRaftMeta {
// block1:
// block1:
// block2: SRaftMeta array
// block2: SRaftMeta array
// block3: rpc msg array (with pCont)
// block3: rpc msg array (with pCont
pointer
)
typedef
struct
SyncClientRequestBatch
{
typedef
struct
SyncClientRequestBatch
{
uint32_t
bytes
;
uint32_t
bytes
;
int32_t
vgId
;
int32_t
vgId
;
uint32_t
msgType
;
//
SyncClientRequestBatch msgType
uint32_t
msgType
;
//
TDMT_SYNC_CLIENT_REQUEST_BATCH
uint32_t
dataCount
;
uint32_t
dataCount
;
uint32_t
dataLen
;
// user RpcMsg.contLen
uint32_t
dataLen
;
char
data
[];
// user RpcMsg.pCont
char
data
[];
// block2, block3
}
SyncClientRequestBatch
;
}
SyncClientRequestBatch
;
SyncClientRequestBatch
*
syncClientRequestBatchBuild
(
SRpcMsg
*
rpcMsgArr
,
SRaftMeta
*
raftArr
,
int32_t
arrSize
,
SyncClientRequestBatch
*
syncClientRequestBatchBuild
(
SRpcMsg
*
rpcMsgArr
,
SRaftMeta
*
raftArr
,
int32_t
arrSize
,
int32_t
vgId
);
int32_t
vgId
);
void
syncClientRequestBatch2RpcMsg
(
const
SyncClientRequestBatch
*
pSyncMsg
,
SRpcMsg
*
pRpcMsg
);
void
syncClientRequestBatch2RpcMsg
(
const
SyncClientRequestBatch
*
pSyncMsg
,
SRpcMsg
*
pRpcMsg
);
void
syncClientRequestBatchDestroy
(
SyncClientRequestBatch
*
pMsg
);
void
syncClientRequestBatchDestroyDeep
(
SyncClientRequestBatch
*
pMsg
);
SRaftMeta
*
syncClientRequestBatchMetaArr
(
const
SyncClientRequestBatch
*
pSyncMsg
);
SRpcMsg
*
syncClientRequestBatchRpcMsgArr
(
const
SyncClientRequestBatch
*
pSyncMsg
);
SyncClientRequestBatch
*
syncClientRequestBatchFromRpcMsg
(
const
SRpcMsg
*
pRpcMsg
);
cJSON
*
syncClientRequestBatch2Json
(
const
SyncClientRequestBatch
*
pMsg
);
char
*
syncClientRequestBatch2Str
(
const
SyncClientRequestBatch
*
pMsg
);
// for debug ----------------------
void
syncClientRequestBatchPrint
(
const
SyncClientRequestBatch
*
pMsg
);
void
syncClientRequestBatchPrint2
(
char
*
s
,
const
SyncClientRequestBatch
*
pMsg
);
void
syncClientRequestBatchLog
(
const
SyncClientRequestBatch
*
pMsg
);
void
syncClientRequestBatchLog2
(
char
*
s
,
const
SyncClientRequestBatch
*
pMsg
);
// ---------------------------------------------
// ---------------------------------------------
typedef
struct
SyncClientRequestReply
{
typedef
struct
SyncClientRequestReply
{
...
@@ -318,12 +326,15 @@ void syncRequestVoteReplyLog(const SyncRequestVoteReply* pMsg);
...
@@ -318,12 +326,15 @@ void syncRequestVoteReplyLog(const SyncRequestVoteReply* pMsg);
void
syncRequestVoteReplyLog2
(
char
*
s
,
const
SyncRequestVoteReply
*
pMsg
);
void
syncRequestVoteReplyLog2
(
char
*
s
,
const
SyncRequestVoteReply
*
pMsg
);
// ---------------------------------------------
// ---------------------------------------------
// data: entry
typedef
struct
SyncAppendEntries
{
typedef
struct
SyncAppendEntries
{
uint32_t
bytes
;
uint32_t
bytes
;
int32_t
vgId
;
int32_t
vgId
;
uint32_t
msgType
;
uint32_t
msgType
;
SRaftId
srcId
;
SRaftId
srcId
;
SRaftId
destId
;
SRaftId
destId
;
// private data
// private data
SyncTerm
term
;
SyncTerm
term
;
SyncIndex
prevLogIndex
;
SyncIndex
prevLogIndex
;
...
@@ -354,18 +365,14 @@ void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg);
...
@@ -354,18 +365,14 @@ void syncAppendEntriesLog2(char* s, const SyncAppendEntries* pMsg);
// ---------------------------------------------
// ---------------------------------------------
// define ahead
/*
typedef
struct
SOffsetAndContLen
{
typedef
struct
SOffsetAndContLen
{
int32_t
offset
;
int32_t
offset
;
int32_t
contLen
;
int32_t
contLen
;
}
SOffsetAndContLen
;
}
SOffsetAndContLen
;
*/
// block1: SOffsetAndContLen
// data:
// block2: SOffsetAndContLen Array
// block1: SOffsetAndContLen Array
// block3: SRpcMsg Array
// block2: entry Array
// block4: SRpcMsg pCont Array
typedef
struct
SyncAppendEntriesBatch
{
typedef
struct
SyncAppendEntriesBatch
{
uint32_t
bytes
;
uint32_t
bytes
;
...
@@ -382,10 +389,11 @@ typedef struct SyncAppendEntriesBatch {
...
@@ -382,10 +389,11 @@ typedef struct SyncAppendEntriesBatch {
SyncTerm
privateTerm
;
SyncTerm
privateTerm
;
int32_t
dataCount
;
int32_t
dataCount
;
uint32_t
dataLen
;
uint32_t
dataLen
;
char
data
[];
char
data
[];
// block1, block2
}
SyncAppendEntriesBatch
;
}
SyncAppendEntriesBatch
;
SyncAppendEntriesBatch
*
syncAppendEntriesBatchBuild
(
SRpcMsg
*
rpcMsgArr
,
int32_t
arrSize
,
int32_t
vgId
);
SyncAppendEntriesBatch
*
syncAppendEntriesBatchBuild
(
SSyncRaftEntry
**
entryPArr
,
int32_t
arrSize
,
int32_t
vgId
);
SOffsetAndContLen
*
syncAppendEntriesBatchMetaTableArray
(
SyncAppendEntriesBatch
*
pMsg
);
void
syncAppendEntriesBatchDestroy
(
SyncAppendEntriesBatch
*
pMsg
);
void
syncAppendEntriesBatchDestroy
(
SyncAppendEntriesBatch
*
pMsg
);
void
syncAppendEntriesBatchSerialize
(
const
SyncAppendEntriesBatch
*
pMsg
,
char
*
buf
,
uint32_t
bufLen
);
void
syncAppendEntriesBatchSerialize
(
const
SyncAppendEntriesBatch
*
pMsg
,
char
*
buf
,
uint32_t
bufLen
);
void
syncAppendEntriesBatchDeserialize
(
const
char
*
buf
,
uint32_t
len
,
SyncAppendEntriesBatch
*
pMsg
);
void
syncAppendEntriesBatchDeserialize
(
const
char
*
buf
,
uint32_t
len
,
SyncAppendEntriesBatch
*
pMsg
);
...
@@ -396,8 +404,6 @@ void syncAppendEntriesBatchFromRpcMsg(const SRpcMsg* pRpcMsg,
...
@@ -396,8 +404,6 @@ void syncAppendEntriesBatchFromRpcMsg(const SRpcMsg* pRpcMsg,
SyncAppendEntriesBatch
*
syncAppendEntriesBatchFromRpcMsg2
(
const
SRpcMsg
*
pRpcMsg
);
SyncAppendEntriesBatch
*
syncAppendEntriesBatchFromRpcMsg2
(
const
SRpcMsg
*
pRpcMsg
);
cJSON
*
syncAppendEntriesBatch2Json
(
const
SyncAppendEntriesBatch
*
pMsg
);
cJSON
*
syncAppendEntriesBatch2Json
(
const
SyncAppendEntriesBatch
*
pMsg
);
char
*
syncAppendEntriesBatch2Str
(
const
SyncAppendEntriesBatch
*
pMsg
);
char
*
syncAppendEntriesBatch2Str
(
const
SyncAppendEntriesBatch
*
pMsg
);
void
syncAppendEntriesBatch2RpcMsgArray
(
SyncAppendEntriesBatch
*
pSyncMsg
,
SRpcMsg
*
rpcMsgArr
,
int32_t
maxArrSize
,
int32_t
*
pRetArrSize
);
// for debug ----------------------
// for debug ----------------------
void
syncAppendEntriesBatchPrint
(
const
SyncAppendEntriesBatch
*
pMsg
);
void
syncAppendEntriesBatchPrint
(
const
SyncAppendEntriesBatch
*
pMsg
);
...
@@ -477,9 +483,10 @@ typedef struct SyncSnapshotSend {
...
@@ -477,9 +483,10 @@ typedef struct SyncSnapshotSend {
SRaftId
destId
;
SRaftId
destId
;
SyncTerm
term
;
SyncTerm
term
;
SyncIndex
lastIndex
;
// lastIndex of snapshot
SyncIndex
beginIndex
;
// snapshot.beginIndex
SyncTerm
lastTerm
;
// lastTerm of snapshot
SyncIndex
lastIndex
;
// snapshot.lastIndex
SyncIndex
lastConfigIndex
;
SyncTerm
lastTerm
;
// snapshot.lastTerm
SyncIndex
lastConfigIndex
;
// snapshot.lastConfigIndex
SSyncCfg
lastConfig
;
SSyncCfg
lastConfig
;
SyncTerm
privateTerm
;
SyncTerm
privateTerm
;
int32_t
seq
;
int32_t
seq
;
...
@@ -617,6 +624,9 @@ int32_t syncNodeOnRequestVoteReplySnapshotCb(SSyncNode* ths, SyncRequestVoteRepl
...
@@ -617,6 +624,9 @@ int32_t syncNodeOnRequestVoteReplySnapshotCb(SSyncNode* ths, SyncRequestVoteRepl
int32_t
syncNodeOnAppendEntriesSnapshotCb
(
SSyncNode
*
ths
,
SyncAppendEntries
*
pMsg
);
int32_t
syncNodeOnAppendEntriesSnapshotCb
(
SSyncNode
*
ths
,
SyncAppendEntries
*
pMsg
);
int32_t
syncNodeOnAppendEntriesReplySnapshotCb
(
SSyncNode
*
ths
,
SyncAppendEntriesReply
*
pMsg
);
int32_t
syncNodeOnAppendEntriesReplySnapshotCb
(
SSyncNode
*
ths
,
SyncAppendEntriesReply
*
pMsg
);
int32_t
syncNodeOnAppendEntriesSnapshot2Cb
(
SSyncNode
*
ths
,
SyncAppendEntriesBatch
*
pMsg
);
int32_t
syncNodeOnAppendEntriesReplySnapshot2Cb
(
SSyncNode
*
ths
,
SyncAppendEntriesReply
*
pMsg
);
int32_t
syncNodeOnSnapshotSendCb
(
SSyncNode
*
ths
,
SyncSnapshotSend
*
pMsg
);
int32_t
syncNodeOnSnapshotSendCb
(
SSyncNode
*
ths
,
SyncSnapshotSend
*
pMsg
);
int32_t
syncNodeOnSnapshotRspCb
(
SSyncNode
*
ths
,
SyncSnapshotRsp
*
pMsg
);
int32_t
syncNodeOnSnapshotRspCb
(
SSyncNode
*
ths
,
SyncSnapshotRsp
*
pMsg
);
...
@@ -633,7 +643,8 @@ typedef int32_t (*FpOnSnapshotSendCb)(SSyncNode* ths, SyncSnapshotSend* pMsg);
...
@@ -633,7 +643,8 @@ typedef int32_t (*FpOnSnapshotSendCb)(SSyncNode* ths, SyncSnapshotSend* pMsg);
typedef
int32_t
(
*
FpOnSnapshotRspCb
)(
SSyncNode
*
ths
,
SyncSnapshotRsp
*
pMsg
);
typedef
int32_t
(
*
FpOnSnapshotRspCb
)(
SSyncNode
*
ths
,
SyncSnapshotRsp
*
pMsg
);
// option ----------------------------------
// option ----------------------------------
bool
syncNodeSnapshotEnable
(
SSyncNode
*
pSyncNode
);
bool
syncNodeSnapshotEnable
(
SSyncNode
*
pSyncNode
);
ESyncStrategy
syncNodeStrategy
(
SSyncNode
*
pSyncNode
);
// ---------------------------------------------
// ---------------------------------------------
...
...
include/libs/transport/trpc.h
浏览文件 @
406d35d4
...
@@ -110,12 +110,15 @@ typedef struct {
...
@@ -110,12 +110,15 @@ typedef struct {
}
SRpcCtx
;
}
SRpcCtx
;
int32_t
rpcInit
();
int32_t
rpcInit
();
void
rpcCleanup
();
void
*
rpcOpen
(
const
SRpcInit
*
pRpc
);
void
rpcCleanup
();
void
rpcClose
(
void
*
);
void
*
rpcOpen
(
const
SRpcInit
*
pRpc
);
void
*
rpcMallocCont
(
int32_t
contLen
);
void
rpcFreeCont
(
void
*
pCont
);
void
rpcClose
(
void
*
);
void
*
rpcReallocCont
(
void
*
ptr
,
int32_t
contLen
);
void
rpcCloseImpl
(
void
*
);
void
*
rpcMallocCont
(
int32_t
contLen
);
void
rpcFreeCont
(
void
*
pCont
);
void
*
rpcReallocCont
(
void
*
ptr
,
int32_t
contLen
);
// Because taosd supports multi-process mode
// Because taosd supports multi-process mode
// These functions should not be used on the server side
// These functions should not be used on the server side
...
...
include/util/tRealloc.h
浏览文件 @
406d35d4
...
@@ -38,7 +38,7 @@ static FORCE_INLINE int32_t tRealloc(uint8_t **ppBuf, int64_t size) {
...
@@ -38,7 +38,7 @@ static FORCE_INLINE int32_t tRealloc(uint8_t **ppBuf, int64_t size) {
bsize
*=
2
;
bsize
*=
2
;
}
}
pBuf
=
taosMemoryRealloc
(
*
ppBuf
?
(
*
ppBuf
)
-
sizeof
(
int64_t
)
:
*
ppBuf
,
bsize
+
sizeof
(
int64_t
));
pBuf
=
(
uint8_t
*
)
taosMemoryRealloc
(
*
ppBuf
?
(
*
ppBuf
)
-
sizeof
(
int64_t
)
:
*
ppBuf
,
bsize
+
sizeof
(
int64_t
));
if
(
pBuf
==
NULL
)
{
if
(
pBuf
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_exit
;
goto
_exit
;
...
@@ -61,4 +61,4 @@ static FORCE_INLINE void tFree(uint8_t *pBuf) {
...
@@ -61,4 +61,4 @@ static FORCE_INLINE void tFree(uint8_t *pBuf) {
}
}
#endif
#endif
#endif
/*_TD_UTIL_TREALLOC_H_*/
#endif
/*_TD_UTIL_TREALLOC_H_*/
\ No newline at end of file
include/util/taoserror.h
浏览文件 @
406d35d4
...
@@ -174,11 +174,12 @@ int32_t* taosGetErrno();
...
@@ -174,11 +174,12 @@ int32_t* taosGetErrno();
#define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0341)
#define TSDB_CODE_MND_DNODE_NOT_EXIST TAOS_DEF_ERROR_CODE(0, 0x0341)
#define TSDB_CODE_MND_TOO_MANY_DNODES TAOS_DEF_ERROR_CODE(0, 0x0342)
#define TSDB_CODE_MND_TOO_MANY_DNODES TAOS_DEF_ERROR_CODE(0, 0x0342)
#define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0343)
#define TSDB_CODE_MND_NO_ENOUGH_DNODES TAOS_DEF_ERROR_CODE(0, 0x0343)
#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0344)
#define TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE TAOS_DEF_ERROR_CODE(0, 0x0344)
#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x0345)
#define TSDB_CODE_MND_INVALID_CLUSTER_CFG TAOS_DEF_ERROR_CODE(0, 0x0345)
#define TSDB_CODE_MND_INVALID_DNODE_CFG TAOS_DEF_ERROR_CODE(0, 0x0346)
#define TSDB_CODE_MND_INVALID_CLUSTER_ID TAOS_DEF_ERROR_CODE(0, 0x0346)
#define TSDB_CODE_MND_INVALID_DNODE_EP TAOS_DEF_ERROR_CODE(0, 0x0347)
#define TSDB_CODE_MND_INVALID_DNODE_CFG TAOS_DEF_ERROR_CODE(0, 0x0347)
#define TSDB_CODE_MND_INVALID_DNODE_ID TAOS_DEF_ERROR_CODE(0, 0x0348)
#define TSDB_CODE_MND_INVALID_DNODE_EP TAOS_DEF_ERROR_CODE(0, 0x0348)
#define TSDB_CODE_MND_INVALID_DNODE_ID TAOS_DEF_ERROR_CODE(0, 0x0349)
// mnode-node
// mnode-node
#define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0350)
#define TSDB_CODE_MND_MNODE_ALREADY_EXIST TAOS_DEF_ERROR_CODE(0, 0x0350)
...
@@ -429,6 +430,7 @@ int32_t* taosGetErrno();
...
@@ -429,6 +430,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_SYN_PROPOSE_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0911)
#define TSDB_CODE_SYN_PROPOSE_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0911)
#define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912)
#define TSDB_CODE_SYN_STANDBY_NOT_READY TAOS_DEF_ERROR_CODE(0, 0x0912)
#define TSDB_CODE_SYN_BATCH_ERROR TAOS_DEF_ERROR_CODE(0, 0x0913)
#define TSDB_CODE_SYN_BATCH_ERROR TAOS_DEF_ERROR_CODE(0, 0x0913)
#define TSDB_CODE_SYN_TIMEOUT TAOS_DEF_ERROR_CODE(0, 0x0914)
#define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF)
#define TSDB_CODE_SYN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x09FF)
// tq
// tq
...
@@ -579,6 +581,7 @@ int32_t* taosGetErrno();
...
@@ -579,6 +581,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_PAR_INVALID_TABLE_OPTION TAOS_DEF_ERROR_CODE(0, 0x265C)
#define TSDB_CODE_PAR_INVALID_TABLE_OPTION TAOS_DEF_ERROR_CODE(0, 0x265C)
#define TSDB_CODE_PAR_INVALID_INTERP_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x265D)
#define TSDB_CODE_PAR_INVALID_INTERP_CLAUSE TAOS_DEF_ERROR_CODE(0, 0x265D)
#define TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN TAOS_DEF_ERROR_CODE(0, 0x265E)
#define TSDB_CODE_PAR_NO_VALID_FUNC_IN_WIN TAOS_DEF_ERROR_CODE(0, 0x265E)
#define TSDB_CODE_PAR_ONLY_SUPPORT_SINGLE_TABLE TAOS_DEF_ERROR_CODE(0, 0x265F)
//planner
//planner
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
#define TSDB_CODE_PLAN_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x2700)
...
...
include/util/tdef.h
浏览文件 @
406d35d4
...
@@ -334,6 +334,9 @@ typedef enum ELogicConditionType {
...
@@ -334,6 +334,9 @@ typedef enum ELogicConditionType {
#define TSDB_MIN_DB_CACHE_LAST_ROW 0
#define TSDB_MIN_DB_CACHE_LAST_ROW 0
#define TSDB_MAX_DB_CACHE_LAST_ROW 3
#define TSDB_MAX_DB_CACHE_LAST_ROW 3
#define TSDB_DEFAULT_CACHE_LAST_ROW 0
#define TSDB_DEFAULT_CACHE_LAST_ROW 0
#define TSDB_MIN_DB_LAST_ROW_MEM 1 // MB
#define TSDB_MAX_DB_LAST_ROW_MEM 65536
#define TSDB_DEFAULT_LAST_ROW_MEM 1
#define TSDB_DB_STREAM_MODE_OFF 0
#define TSDB_DB_STREAM_MODE_OFF 0
#define TSDB_DB_STREAM_MODE_ON 1
#define TSDB_DB_STREAM_MODE_ON 1
#define TSDB_DEFAULT_DB_STREAM_MODE 0
#define TSDB_DEFAULT_DB_STREAM_MODE 0
...
...
source/client/inc/clientInt.h
浏览文件 @
406d35d4
...
@@ -65,7 +65,7 @@ enum {
...
@@ -65,7 +65,7 @@ enum {
typedef
struct
SAppInstInfo
SAppInstInfo
;
typedef
struct
SAppInstInfo
SAppInstInfo
;
typedef
struct
{
typedef
struct
{
char
*
key
;
char
*
key
;
// statistics
// statistics
int32_t
reportCnt
;
int32_t
reportCnt
;
int32_t
connKeyCnt
;
int32_t
connKeyCnt
;
...
@@ -177,14 +177,14 @@ typedef struct SReqResultInfo {
...
@@ -177,14 +177,14 @@ typedef struct SReqResultInfo {
}
SReqResultInfo
;
}
SReqResultInfo
;
typedef
struct
SRequestSendRecvBody
{
typedef
struct
SRequestSendRecvBody
{
tsem_t
rspSem
;
// not used now
tsem_t
rspSem
;
// not used now
__taos_async_fn_t
queryFp
;
__taos_async_fn_t
queryFp
;
__taos_async_fn_t
fetchFp
;
__taos_async_fn_t
fetchFp
;
void
*
param
;
void
*
param
;
SDataBuf
requestMsg
;
SDataBuf
requestMsg
;
int64_t
queryJob
;
// query job, created according to sql query DAG.
int64_t
queryJob
;
// query job, created according to sql query DAG.
int32_t
subplanNum
;
int32_t
subplanNum
;
SReqResultInfo
resInfo
;
SReqResultInfo
resInfo
;
}
SRequestSendRecvBody
;
}
SRequestSendRecvBody
;
typedef
struct
{
typedef
struct
{
...
@@ -284,6 +284,7 @@ static FORCE_INLINE SReqResultInfo* tscGetCurResInfo(TAOS_RES* res) {
...
@@ -284,6 +284,7 @@ static FORCE_INLINE SReqResultInfo* tscGetCurResInfo(TAOS_RES* res) {
extern
SAppInfo
appInfo
;
extern
SAppInfo
appInfo
;
extern
int32_t
clientReqRefPool
;
extern
int32_t
clientReqRefPool
;
extern
int32_t
clientConnRefPool
;
extern
int32_t
clientConnRefPool
;
extern
void
*
tscQhandle
;
__async_send_cb_fn_t
getMsgRspHandle
(
int32_t
msgType
);
__async_send_cb_fn_t
getMsgRspHandle
(
int32_t
msgType
);
...
@@ -301,7 +302,7 @@ void destroyRequest(SRequestObj* pRequest);
...
@@ -301,7 +302,7 @@ void destroyRequest(SRequestObj* pRequest);
SRequestObj
*
acquireRequest
(
int64_t
rid
);
SRequestObj
*
acquireRequest
(
int64_t
rid
);
int32_t
releaseRequest
(
int64_t
rid
);
int32_t
releaseRequest
(
int64_t
rid
);
int32_t
removeRequest
(
int64_t
rid
);
int32_t
removeRequest
(
int64_t
rid
);
void
doDestroyRequest
(
void
*
p
);
void
doDestroyRequest
(
void
*
p
);
char
*
getDbOfConnection
(
STscObj
*
pObj
);
char
*
getDbOfConnection
(
STscObj
*
pObj
);
void
setConnectionDB
(
STscObj
*
pTscObj
,
const
char
*
db
);
void
setConnectionDB
(
STscObj
*
pTscObj
,
const
char
*
db
);
...
@@ -336,8 +337,9 @@ int hbHandleRsp(SClientHbBatchRsp* hbRsp);
...
@@ -336,8 +337,9 @@ int hbHandleRsp(SClientHbBatchRsp* hbRsp);
// cluster level
// cluster level
SAppHbMgr
*
appHbMgrInit
(
SAppInstInfo
*
pAppInstInfo
,
char
*
key
);
SAppHbMgr
*
appHbMgrInit
(
SAppInstInfo
*
pAppInstInfo
,
char
*
key
);
void
appHbMgrCleanup
(
void
);
void
appHbMgrCleanup
(
void
);
void
hbRemoveAppHbMrg
(
SAppHbMgr
**
pAppHbMgr
);
void
hbRemoveAppHbMrg
(
SAppHbMgr
**
pAppHbMgr
);
void
closeAllRequests
(
SHashObj
*
pRequests
);
void
destroyAllRequests
(
SHashObj
*
pRequests
);
void
stopAllRequests
(
SHashObj
*
pRequests
);
// conn level
// conn level
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int8_t
connType
);
int
hbRegisterConn
(
SAppHbMgr
*
pAppHbMgr
,
int64_t
tscRefId
,
int64_t
clusterId
,
int8_t
connType
);
...
@@ -356,6 +358,9 @@ int32_t removeMeta(STscObj* pTscObj, SArray* tbList); // todo move to clie
...
@@ -356,6 +358,9 @@ int32_t removeMeta(STscObj* pTscObj, SArray* tbList); // todo move to clie
int32_t
handleAlterTbExecRes
(
void
*
res
,
struct
SCatalog
*
pCatalog
);
// todo move to xxx
int32_t
handleAlterTbExecRes
(
void
*
res
,
struct
SCatalog
*
pCatalog
);
// todo move to xxx
bool
qnodeRequired
(
SRequestObj
*
pRequest
);
bool
qnodeRequired
(
SRequestObj
*
pRequest
);
void
initTscQhandle
();
void
cleanupTscQhandle
();
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/client/src/clientEnv.c
浏览文件 @
406d35d4
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "tmsg.h"
#include "tmsg.h"
#include "tref.h"
#include "tref.h"
#include "trpc.h"
#include "trpc.h"
#include "tsched.h"
#include "ttime.h"
#include "ttime.h"
#define TSC_VAR_NOT_RELEASE 1
#define TSC_VAR_NOT_RELEASE 1
...
@@ -34,9 +35,20 @@ SAppInfo appInfo;
...
@@ -34,9 +35,20 @@ SAppInfo appInfo;
int32_t
clientReqRefPool
=
-
1
;
int32_t
clientReqRefPool
=
-
1
;
int32_t
clientConnRefPool
=
-
1
;
int32_t
clientConnRefPool
=
-
1
;
void
*
tscQhandle
=
NULL
;
static
TdThreadOnce
tscinit
=
PTHREAD_ONCE_INIT
;
static
TdThreadOnce
tscinit
=
PTHREAD_ONCE_INIT
;
volatile
int32_t
tscInitRes
=
0
;
volatile
int32_t
tscInitRes
=
0
;
void
initTscQhandle
()
{
// init handle
tscQhandle
=
taosInitScheduler
(
4096
,
5
,
"tsc"
);
}
void
cleanupTscQhandle
()
{
// destroy handle
taosCleanUpScheduler
(
tscQhandle
);
}
static
int32_t
registerRequest
(
SRequestObj
*
pRequest
)
{
static
int32_t
registerRequest
(
SRequestObj
*
pRequest
)
{
STscObj
*
pTscObj
=
acquireTscObj
(
pRequest
->
pTscObj
->
id
);
STscObj
*
pTscObj
=
acquireTscObj
(
pRequest
->
pTscObj
->
id
);
if
(
NULL
==
pTscObj
)
{
if
(
NULL
==
pTscObj
)
{
...
@@ -121,12 +133,31 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) {
...
@@ -121,12 +133,31 @@ void *openTransporter(const char *user, const char *auth, int32_t numOfThread) {
return
pDnodeConn
;
return
pDnodeConn
;
}
}
void
closeAllRequests
(
SHashObj
*
pRequests
)
{
void
destroyAllRequests
(
SHashObj
*
pRequests
)
{
void
*
pIter
=
taosHashIterate
(
pRequests
,
NULL
);
while
(
pIter
!=
NULL
)
{
int64_t
*
rid
=
pIter
;
SRequestObj
*
pRequest
=
acquireRequest
(
*
rid
);
if
(
pRequest
)
{
destroyRequest
(
pRequest
);
releaseRequest
(
*
rid
);
}
pIter
=
taosHashIterate
(
pRequests
,
pIter
);
}
}
void
stopAllRequests
(
SHashObj
*
pRequests
)
{
void
*
pIter
=
taosHashIterate
(
pRequests
,
NULL
);
void
*
pIter
=
taosHashIterate
(
pRequests
,
NULL
);
while
(
pIter
!=
NULL
)
{
while
(
pIter
!=
NULL
)
{
int64_t
*
rid
=
pIter
;
int64_t
*
rid
=
pIter
;
removeRequest
(
*
rid
);
SRequestObj
*
pRequest
=
acquireRequest
(
*
rid
);
if
(
pRequest
)
{
taos_stop_query
(
pRequest
);
releaseRequest
(
*
rid
);
}
pIter
=
taosHashIterate
(
pRequests
,
pIter
);
pIter
=
taosHashIterate
(
pRequests
,
pIter
);
}
}
...
@@ -153,12 +184,18 @@ void destroyAppInst(SAppInstInfo *pAppInfo) {
...
@@ -153,12 +184,18 @@ void destroyAppInst(SAppInstInfo *pAppInfo) {
}
}
void
destroyTscObj
(
void
*
pObj
)
{
void
destroyTscObj
(
void
*
pObj
)
{
if
(
NULL
==
pObj
)
{
return
;
}
STscObj
*
pTscObj
=
pObj
;
STscObj
*
pTscObj
=
pObj
;
int64_t
tscId
=
pTscObj
->
id
;
tscTrace
(
"begin to destroy tscObj %"
PRIx64
" p:%p"
,
tscId
,
pTscObj
);
SClientHbKey
connKey
=
{.
tscRid
=
pTscObj
->
id
,
.
connType
=
pTscObj
->
connType
};
SClientHbKey
connKey
=
{.
tscRid
=
pTscObj
->
id
,
.
connType
=
pTscObj
->
connType
};
hbDeregisterConn
(
pTscObj
->
pAppInfo
->
pAppHbMgr
,
connKey
);
hbDeregisterConn
(
pTscObj
->
pAppInfo
->
pAppHbMgr
,
connKey
);
int64_t
connNum
=
atomic_sub_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
int64_t
connNum
=
atomic_sub_fetch_64
(
&
pTscObj
->
pAppInfo
->
numOfConns
,
1
);
close
AllRequests
(
pTscObj
->
pRequests
);
destroy
AllRequests
(
pTscObj
->
pRequests
);
schedulerStopQueryHb
(
pTscObj
->
pAppInfo
->
pTransporter
);
schedulerStopQueryHb
(
pTscObj
->
pAppInfo
->
pTransporter
);
tscDebug
(
"connObj 0x%"
PRIx64
" p:%p destroyed, remain inst totalConn:%"
PRId64
,
pTscObj
->
id
,
pTscObj
,
tscDebug
(
"connObj 0x%"
PRIx64
" p:%p destroyed, remain inst totalConn:%"
PRId64
,
pTscObj
->
id
,
pTscObj
,
pTscObj
->
pAppInfo
->
numOfConns
);
pTscObj
->
pAppInfo
->
numOfConns
);
...
@@ -167,7 +204,9 @@ void destroyTscObj(void *pObj) {
...
@@ -167,7 +204,9 @@ void destroyTscObj(void *pObj) {
destroyAppInst
(
pTscObj
->
pAppInfo
);
destroyAppInst
(
pTscObj
->
pAppInfo
);
}
}
taosThreadMutexDestroy
(
&
pTscObj
->
mutex
);
taosThreadMutexDestroy
(
&
pTscObj
->
mutex
);
taosMemoryFreeClear
(
pTscObj
);
taosMemoryFree
(
pTscObj
);
tscTrace
(
"end to destroy tscObj %"
PRIx64
" p:%p"
,
tscId
,
pTscObj
);
}
}
void
*
createTscObj
(
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
int32_t
connType
,
SAppInstInfo
*
pAppInfo
)
{
void
*
createTscObj
(
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
int32_t
connType
,
SAppInstInfo
*
pAppInfo
)
{
...
@@ -261,14 +300,18 @@ int32_t releaseRequest(int64_t rid) { return taosReleaseRef(clientReqRefPool, ri
...
@@ -261,14 +300,18 @@ int32_t releaseRequest(int64_t rid) { return taosReleaseRef(clientReqRefPool, ri
int32_t
removeRequest
(
int64_t
rid
)
{
return
taosRemoveRef
(
clientReqRefPool
,
rid
);
}
int32_t
removeRequest
(
int64_t
rid
)
{
return
taosRemoveRef
(
clientReqRefPool
,
rid
);
}
void
doDestroyRequest
(
void
*
p
)
{
void
doDestroyRequest
(
void
*
p
)
{
assert
(
p
!=
NULL
);
if
(
NULL
==
p
)
{
return
;
}
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
p
;
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
p
;
int64_t
reqId
=
pRequest
->
self
;
tscTrace
(
"begin to destroy request %"
PRIx64
" p:%p"
,
reqId
,
pRequest
);
taosHashRemove
(
pRequest
->
pTscObj
->
pRequests
,
&
pRequest
->
self
,
sizeof
(
pRequest
->
self
));
taosHashRemove
(
pRequest
->
pTscObj
->
pRequests
,
&
pRequest
->
self
,
sizeof
(
pRequest
->
self
));
if
(
pRequest
->
body
.
queryJob
!=
0
)
{
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
0
);
schedulerFreeJob
(
pRequest
->
body
.
queryJob
,
0
);
}
taosMemoryFreeClear
(
pRequest
->
msgBuf
);
taosMemoryFreeClear
(
pRequest
->
msgBuf
);
taosMemoryFreeClear
(
pRequest
->
sqlstr
);
taosMemoryFreeClear
(
pRequest
->
sqlstr
);
...
@@ -284,7 +327,9 @@ void doDestroyRequest(void *p) {
...
@@ -284,7 +327,9 @@ void doDestroyRequest(void *p) {
if
(
pRequest
->
self
)
{
if
(
pRequest
->
self
)
{
deregisterRequest
(
pRequest
);
deregisterRequest
(
pRequest
);
}
}
taosMemoryFreeClear
(
pRequest
);
taosMemoryFree
(
pRequest
);
tscTrace
(
"end to destroy request %"
PRIx64
" p:%p"
,
reqId
,
pRequest
);
}
}
void
destroyRequest
(
SRequestObj
*
pRequest
)
{
void
destroyRequest
(
SRequestObj
*
pRequest
)
{
...
@@ -292,6 +337,8 @@ void destroyRequest(SRequestObj *pRequest) {
...
@@ -292,6 +337,8 @@ void destroyRequest(SRequestObj *pRequest) {
return
;
return
;
}
}
taos_stop_query
(
pRequest
);
removeRequest
(
pRequest
->
self
);
removeRequest
(
pRequest
->
self
);
}
}
...
@@ -299,7 +346,7 @@ void taos_init_imp(void) {
...
@@ -299,7 +346,7 @@ void taos_init_imp(void) {
// In the APIs of other program language, taos_cleanup is not available yet.
// In the APIs of other program language, taos_cleanup is not available yet.
// So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning.
// So, to make sure taos_cleanup will be invoked to clean up the allocated resource to suppress the valgrind warning.
atexit
(
taos_cleanup
);
atexit
(
taos_cleanup
);
initTscQhandle
();
errno
=
TSDB_CODE_SUCCESS
;
errno
=
TSDB_CODE_SUCCESS
;
taosSeedRand
(
taosGetTimestampSec
());
taosSeedRand
(
taosGetTimestampSec
());
...
...
source/client/src/clientImpl.c
浏览文件 @
406d35d4
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "tmsgtype.h"
#include "tmsgtype.h"
#include "tpagedbuf.h"
#include "tpagedbuf.h"
#include "tref.h"
#include "tref.h"
#include "tsched.h"
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
);
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
);
...
@@ -56,14 +57,14 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i
...
@@ -56,14 +57,14 @@ static char* getClusterKey(const char* user, const char* auth, const char* ip, i
}
}
bool
chkRequestKilled
(
void
*
param
)
{
bool
chkRequestKilled
(
void
*
param
)
{
bool
killed
=
false
;
bool
killed
=
false
;
SRequestObj
*
pRequest
=
acquireRequest
((
int64_t
)
param
);
SRequestObj
*
pRequest
=
acquireRequest
((
int64_t
)
param
);
if
(
NULL
==
pRequest
||
pRequest
->
killed
)
{
if
(
NULL
==
pRequest
||
pRequest
->
killed
)
{
killed
=
true
;
killed
=
true
;
}
}
releaseRequest
((
int64_t
)
param
);
releaseRequest
((
int64_t
)
param
);
return
killed
;
return
killed
;
}
}
...
@@ -645,9 +646,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
...
@@ -645,9 +646,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
pRequest
->
body
.
resInfo
.
execRes
=
res
.
res
;
pRequest
->
body
.
resInfo
.
execRes
=
res
.
res
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
pRequest
->
body
.
queryJob
!=
0
)
{
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
0
);
schedulerFreeJob
(
pRequest
->
body
.
queryJob
,
0
);
}
pRequest
->
code
=
code
;
pRequest
->
code
=
code
;
terrno
=
code
;
terrno
=
code
;
...
@@ -658,9 +657,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
...
@@ -658,9 +657,7 @@ int32_t scheduleQuery(SRequestObj* pRequest, SQueryPlan* pDag, SArray* pNodeList
TDMT_VND_CREATE_TABLE
==
pRequest
->
type
)
{
TDMT_VND_CREATE_TABLE
==
pRequest
->
type
)
{
pRequest
->
body
.
resInfo
.
numOfRows
=
res
.
numOfRows
;
pRequest
->
body
.
resInfo
.
numOfRows
=
res
.
numOfRows
;
if
(
pRequest
->
body
.
queryJob
!=
0
)
{
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
0
);
schedulerFreeJob
(
pRequest
->
body
.
queryJob
,
0
);
}
}
}
pRequest
->
code
=
res
.
code
;
pRequest
->
code
=
res
.
code
;
...
@@ -769,7 +766,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) {
...
@@ -769,7 +766,7 @@ int32_t handleQueryExecRsp(SRequestObj* pRequest) {
code
=
handleSubmitExecRes
(
pRequest
,
pRes
->
res
,
pCatalog
,
&
epset
);
code
=
handleSubmitExecRes
(
pRequest
,
pRes
->
res
,
pCatalog
,
&
epset
);
break
;
break
;
}
}
case
TDMT_SCH_QUERY
:
case
TDMT_SCH_QUERY
:
case
TDMT_SCH_MERGE_QUERY
:
{
case
TDMT_SCH_MERGE_QUERY
:
{
code
=
handleQueryExecRes
(
pRequest
,
pRes
->
res
,
pCatalog
,
&
epset
);
code
=
handleQueryExecRes
(
pRequest
,
pRes
->
res
,
pCatalog
,
&
epset
);
break
;
break
;
...
@@ -792,10 +789,7 @@ void schedulerExecCb(SQueryResult* pResult, void* param, int32_t code) {
...
@@ -792,10 +789,7 @@ void schedulerExecCb(SQueryResult* pResult, void* param, int32_t code) {
TDMT_VND_CREATE_TABLE
==
pRequest
->
type
)
{
TDMT_VND_CREATE_TABLE
==
pRequest
->
type
)
{
pRequest
->
body
.
resInfo
.
numOfRows
=
pResult
->
numOfRows
;
pRequest
->
body
.
resInfo
.
numOfRows
=
pResult
->
numOfRows
;
if
(
pRequest
->
body
.
queryJob
!=
0
)
{
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
0
);
schedulerFreeJob
(
pRequest
->
body
.
queryJob
,
0
);
pRequest
->
body
.
queryJob
=
0
;
}
}
}
taosMemoryFree
(
pResult
);
taosMemoryFree
(
pResult
);
...
@@ -1239,7 +1233,16 @@ void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg,
...
@@ -1239,7 +1233,16 @@ void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg,
}
}
}
}
void
processMsgFromServer
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
typedef
struct
SchedArg
{
SRpcMsg
msg
;
SEpSet
*
pEpset
;
}
SchedArg
;
void
doProcessMsgFromServer
(
SSchedMsg
*
schedMsg
)
{
SchedArg
*
arg
=
(
SchedArg
*
)
schedMsg
->
ahandle
;
SRpcMsg
*
pMsg
=
&
arg
->
msg
;
SEpSet
*
pEpSet
=
arg
->
pEpset
;
SMsgSendInfo
*
pSendInfo
=
(
SMsgSendInfo
*
)
pMsg
->
info
.
ahandle
;
SMsgSendInfo
*
pSendInfo
=
(
SMsgSendInfo
*
)
pMsg
->
info
.
ahandle
;
assert
(
pMsg
->
info
.
ahandle
!=
NULL
);
assert
(
pMsg
->
info
.
ahandle
!=
NULL
);
STscObj
*
pTscObj
=
NULL
;
STscObj
*
pTscObj
=
NULL
;
...
@@ -1272,7 +1275,8 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
...
@@ -1272,7 +1275,8 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
updateTargetEpSet
(
pSendInfo
,
pTscObj
,
pMsg
,
pEpSet
);
updateTargetEpSet
(
pSendInfo
,
pTscObj
,
pMsg
,
pEpSet
);
SDataBuf
buf
=
{.
msgType
=
pMsg
->
msgType
,
.
len
=
pMsg
->
contLen
,
.
pData
=
NULL
,
.
handle
=
pMsg
->
info
.
handle
,
.
pEpSet
=
pEpSet
};
SDataBuf
buf
=
{
.
msgType
=
pMsg
->
msgType
,
.
len
=
pMsg
->
contLen
,
.
pData
=
NULL
,
.
handle
=
pMsg
->
info
.
handle
,
.
pEpSet
=
pEpSet
};
if
(
pMsg
->
contLen
>
0
)
{
if
(
pMsg
->
contLen
>
0
)
{
buf
.
pData
=
taosMemoryCalloc
(
1
,
pMsg
->
contLen
);
buf
.
pData
=
taosMemoryCalloc
(
1
,
pMsg
->
contLen
);
...
@@ -1287,6 +1291,25 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
...
@@ -1287,6 +1291,25 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
pSendInfo
->
fp
(
pSendInfo
->
param
,
&
buf
,
pMsg
->
code
);
pSendInfo
->
fp
(
pSendInfo
->
param
,
&
buf
,
pMsg
->
code
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
destroySendMsgInfo
(
pSendInfo
);
destroySendMsgInfo
(
pSendInfo
);
taosMemoryFree
(
arg
);
}
void
processMsgFromServer
(
void
*
parent
,
SRpcMsg
*
pMsg
,
SEpSet
*
pEpSet
)
{
SSchedMsg
schedMsg
=
{
0
};
SEpSet
*
tEpSet
=
pEpSet
!=
NULL
?
taosMemoryCalloc
(
1
,
sizeof
(
SEpSet
))
:
NULL
;
if
(
tEpSet
!=
NULL
)
{
*
tEpSet
=
*
pEpSet
;
}
SchedArg
*
arg
=
taosMemoryCalloc
(
1
,
sizeof
(
SchedArg
));
arg
->
msg
=
*
pMsg
;
arg
->
pEpset
=
tEpSet
;
schedMsg
.
fp
=
doProcessMsgFromServer
;
schedMsg
.
ahandle
=
arg
;
taosScheduleTask
(
tscQhandle
,
&
schedMsg
);
}
}
TAOS
*
taos_connect_auth
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
)
{
TAOS
*
taos_connect_auth
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
)
{
...
@@ -1415,7 +1438,7 @@ void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertU
...
@@ -1415,7 +1438,7 @@ void* doAsyncFetchRows(SRequestObj* pRequest, bool setupOneRowPtr, bool convertU
pParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SSyncQueryParam
));
pParam
=
taosMemoryCalloc
(
1
,
sizeof
(
SSyncQueryParam
));
tsem_init
(
&
pParam
->
sem
,
0
,
0
);
tsem_init
(
&
pParam
->
sem
,
0
,
0
);
}
}
// convert ucs4 to native multi-bytes string
// convert ucs4 to native multi-bytes string
pResultInfo
->
convertUcs4
=
convertUcs4
;
pResultInfo
->
convertUcs4
=
convertUcs4
;
...
...
source/client/src/clientMain.c
浏览文件 @
406d35d4
...
@@ -47,11 +47,9 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
...
@@ -47,11 +47,9 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
atomic_store_32
(
&
lock
,
0
);
atomic_store_32
(
&
lock
,
0
);
return
ret
;
return
ret
;
}
}
// this function may be called by user or system, or by both simultaneously.
// this function may be called by user or system, or by both simultaneously.
void
taos_cleanup
(
void
)
{
void
taos_cleanup
(
void
)
{
tscInfo
(
"start to cleanup client environment"
);
tscInfo
(
"start to cleanup client environment"
);
if
(
atomic_val_compare_exchange_32
(
&
sentinel
,
TSC_VAR_NOT_RELEASE
,
TSC_VAR_RELEASED
)
!=
TSC_VAR_NOT_RELEASE
)
{
if
(
atomic_val_compare_exchange_32
(
&
sentinel
,
TSC_VAR_NOT_RELEASE
,
TSC_VAR_RELEASED
)
!=
TSC_VAR_NOT_RELEASE
)
{
return
;
return
;
}
}
...
@@ -74,8 +72,8 @@ void taos_cleanup(void) {
...
@@ -74,8 +72,8 @@ void taos_cleanup(void) {
catalogDestroy
();
catalogDestroy
();
schedulerDestroy
();
schedulerDestroy
();
cleanupTscQhandle
();
rpcCleanup
();
rpcCleanup
();
tscInfo
(
"all local resources released"
);
tscInfo
(
"all local resources released"
);
taosCleanupCfg
();
taosCleanupCfg
();
taosCloseLog
();
taosCloseLog
();
...
@@ -108,7 +106,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
...
@@ -108,7 +106,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
if
(
pObj
)
{
if
(
pObj
)
{
int64_t
*
rid
=
taosMemoryCalloc
(
1
,
sizeof
(
int64_t
));
int64_t
*
rid
=
taosMemoryCalloc
(
1
,
sizeof
(
int64_t
));
*
rid
=
pObj
->
id
;
*
rid
=
pObj
->
id
;
return
(
TAOS
*
)
rid
;
return
(
TAOS
*
)
rid
;
}
}
return
NULL
;
return
NULL
;
...
@@ -196,10 +194,10 @@ void taos_kill_query(TAOS *taos) {
...
@@ -196,10 +194,10 @@ void taos_kill_query(TAOS *taos) {
if
(
NULL
==
taos
)
{
if
(
NULL
==
taos
)
{
return
;
return
;
}
}
int64_t
rid
=
*
(
int64_t
*
)
taos
;
int64_t
rid
=
*
(
int64_t
*
)
taos
;
STscObj
*
pTscObj
=
acquireTscObj
(
rid
);
STscObj
*
pTscObj
=
acquireTscObj
(
rid
);
close
AllRequests
(
pTscObj
->
pRequests
);
stop
AllRequests
(
pTscObj
->
pRequests
);
releaseTscObj
(
rid
);
releaseTscObj
(
rid
);
}
}
...
@@ -244,7 +242,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
...
@@ -244,7 +242,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
#endif
#endif
}
else
if
(
TD_RES_TMQ
(
res
))
{
}
else
if
(
TD_RES_TMQ
(
res
))
{
SMqRspObj
*
msg
=
((
SMqRspObj
*
)
res
);
SMqRspObj
*
msg
=
((
SMqRspObj
*
)
res
);
SReqResultInfo
*
pResultInfo
;
SReqResultInfo
*
pResultInfo
;
if
(
msg
->
resIter
==
-
1
)
{
if
(
msg
->
resIter
==
-
1
)
{
pResultInfo
=
tmqGetNextResInfo
(
res
,
true
);
pResultInfo
=
tmqGetNextResInfo
(
res
,
true
);
...
@@ -420,7 +418,7 @@ int taos_affected_rows(TAOS_RES *res) {
...
@@ -420,7 +418,7 @@ int taos_affected_rows(TAOS_RES *res) {
return
0
;
return
0
;
}
}
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
SReqResultInfo
*
pResInfo
=
&
pRequest
->
body
.
resInfo
;
return
pResInfo
->
numOfRows
;
return
pResInfo
->
numOfRows
;
}
}
...
@@ -480,9 +478,7 @@ void taos_stop_query(TAOS_RES *res) {
...
@@ -480,9 +478,7 @@ void taos_stop_query(TAOS_RES *res) {
return
;
return
;
}
}
if
(
pRequest
->
body
.
queryJob
)
{
schedulerFreeJob
(
&
pRequest
->
body
.
queryJob
,
TSDB_CODE_TSC_QUERY_KILLED
);
schedulerFreeJob
(
pRequest
->
body
.
queryJob
,
TSDB_CODE_TSC_QUERY_KILLED
);
}
tscDebug
(
"request %"
PRIx64
" killed"
,
pRequest
->
requestId
);
tscDebug
(
"request %"
PRIx64
" killed"
,
pRequest
->
requestId
);
}
}
...
@@ -606,7 +602,7 @@ int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) {
...
@@ -606,7 +602,7 @@ int *taos_get_column_data_offset(TAOS_RES *res, int columnIndex) {
}
}
SReqResultInfo
*
pResInfo
=
tscGetCurResInfo
(
res
);
SReqResultInfo
*
pResInfo
=
tscGetCurResInfo
(
res
);
TAOS_FIELD
*
pField
=
&
pResInfo
->
userFields
[
columnIndex
];
TAOS_FIELD
*
pField
=
&
pResInfo
->
userFields
[
columnIndex
];
if
(
!
IS_VAR_DATA_TYPE
(
pField
->
type
))
{
if
(
!
IS_VAR_DATA_TYPE
(
pField
->
type
))
{
return
0
;
return
0
;
}
}
...
@@ -650,8 +646,8 @@ const char *taos_get_server_info(TAOS *taos) {
...
@@ -650,8 +646,8 @@ const char *taos_get_server_info(TAOS *taos) {
typedef
struct
SqlParseWrapper
{
typedef
struct
SqlParseWrapper
{
SParseContext
*
pCtx
;
SParseContext
*
pCtx
;
SCatalogReq
catalogReq
;
SCatalogReq
catalogReq
;
SRequestObj
*
pRequest
;
SRequestObj
*
pRequest
;
SQuery
*
pQuery
;
SQuery
*
pQuery
;
}
SqlParseWrapper
;
}
SqlParseWrapper
;
static
void
destorySqlParseWrapper
(
SqlParseWrapper
*
pWrapper
)
{
static
void
destorySqlParseWrapper
(
SqlParseWrapper
*
pWrapper
)
{
...
@@ -672,8 +668,8 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
...
@@ -672,8 +668,8 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) {
tscDebug
(
"enter meta callback, code %s"
,
tstrerror
(
code
));
tscDebug
(
"enter meta callback, code %s"
,
tstrerror
(
code
));
SqlParseWrapper
*
pWrapper
=
(
SqlParseWrapper
*
)
param
;
SqlParseWrapper
*
pWrapper
=
(
SqlParseWrapper
*
)
param
;
SQuery
*
pQuery
=
pWrapper
->
pQuery
;
SQuery
*
pQuery
=
pWrapper
->
pQuery
;
SRequestObj
*
pRequest
=
pWrapper
->
pRequest
;
SRequestObj
*
pRequest
=
pWrapper
->
pRequest
;
if
(
code
==
TSDB_CODE_SUCCESS
)
{
if
(
code
==
TSDB_CODE_SUCCESS
)
{
code
=
qAnalyseSqlSemantic
(
pWrapper
->
pCtx
,
&
pWrapper
->
catalogReq
,
pResultMeta
,
pQuery
);
code
=
qAnalyseSqlSemantic
(
pWrapper
->
pCtx
,
&
pWrapper
->
catalogReq
,
pResultMeta
,
pQuery
);
...
@@ -722,31 +718,29 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
...
@@ -722,31 +718,29 @@ int32_t createParseContext(const SRequestObj *pRequest, SParseContext **pCxt) {
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
**
pCxt
=
(
SParseContext
){
**
pCxt
=
(
SParseContext
){.
requestId
=
pRequest
->
requestId
,
.
requestId
=
pRequest
->
requestId
,
.
requestRid
=
pRequest
->
self
,
.
requestRid
=
pRequest
->
self
,
.
acctId
=
pTscObj
->
acctId
,
.
acctId
=
pTscObj
->
acctId
,
.
db
=
pRequest
->
pDb
,
.
db
=
pRequest
->
pDb
,
.
topicQuery
=
false
,
.
topicQuery
=
false
,
.
pSql
=
pRequest
->
sqlstr
,
.
pSql
=
pRequest
->
sqlstr
,
.
sqlLen
=
pRequest
->
sqlLen
,
.
sqlLen
=
pRequest
->
sqlLen
,
.
pMsg
=
pRequest
->
msgBuf
,
.
pMsg
=
pRequest
->
msgBuf
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
msgLen
=
ERROR_MSG_BUF_DEFAULT_SIZE
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pTransporter
=
pTscObj
->
pAppInfo
->
pTransporter
,
.
pStmtCb
=
NULL
,
.
pStmtCb
=
NULL
,
.
pUser
=
pTscObj
->
user
,
.
pUser
=
pTscObj
->
user
,
.
schemalessType
=
pTscObj
->
schemalessType
,
.
schemalessType
=
pTscObj
->
schemalessType
,
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
)),
.
isSuperUser
=
(
0
==
strcmp
(
pTscObj
->
user
,
TSDB_DEFAULT_USER
)),
.
async
=
true
,
.
async
=
true
,
.
svrVer
=
pTscObj
->
sVer
,
.
svrVer
=
pTscObj
->
sVer
,
.
nodeOffline
=
(
pTscObj
->
pAppInfo
->
onlineDnodes
<
pTscObj
->
pAppInfo
->
totalDnodes
)};
.
nodeOffline
=
(
pTscObj
->
pAppInfo
->
onlineDnodes
<
pTscObj
->
pAppInfo
->
totalDnodes
)
};
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
void
doAsyncQuery
(
SRequestObj
*
pRequest
,
bool
updateMetaForce
)
{
void
doAsyncQuery
(
SRequestObj
*
pRequest
,
bool
updateMetaForce
)
{
SParseContext
*
pCxt
=
NULL
;
SParseContext
*
pCxt
=
NULL
;
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
STscObj
*
pTscObj
=
pRequest
->
pTscObj
;
int32_t
code
=
0
;
int32_t
code
=
0
;
if
(
pRequest
->
retry
++
>
REQUEST_TOTAL_EXEC_TIMES
)
{
if
(
pRequest
->
retry
++
>
REQUEST_TOTAL_EXEC_TIMES
)
{
...
@@ -911,10 +905,10 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
...
@@ -911,10 +905,10 @@ int taos_load_table_info(TAOS *taos, const char *tableNameList) {
return
terrno
;
return
terrno
;
}
}
int64_t
rid
=
*
(
int64_t
*
)
taos
;
int64_t
rid
=
*
(
int64_t
*
)
taos
;
const
int32_t
MAX_TABLE_NAME_LENGTH
=
12
*
1024
*
1024
;
// 12MB list
const
int32_t
MAX_TABLE_NAME_LENGTH
=
12
*
1024
*
1024
;
// 12MB list
int32_t
code
=
0
;
int32_t
code
=
0
;
SRequestObj
*
pRequest
=
NULL
;
SRequestObj
*
pRequest
=
NULL
;
SCatalogReq
catalogReq
=
{
0
};
SCatalogReq
catalogReq
=
{
0
};
if
(
NULL
==
tableNameList
)
{
if
(
NULL
==
tableNameList
)
{
...
...
source/common/src/tdatablock.c
浏览文件 @
406d35d4
...
@@ -895,7 +895,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
...
@@ -895,7 +895,7 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
SBlockOrderInfo
*
pOrder
=
taosArrayGet
(
pOrderInfo
,
0
);
SBlockOrderInfo
*
pOrder
=
taosArrayGet
(
pOrderInfo
,
0
);
int64_t
p0
=
taosGetTimestampUs
();
int64_t
p0
=
taosGetTimestampUs
();
__compar_fn_t
fn
=
getKeyComparFunc
(
pColInfoData
->
info
.
type
,
pOrder
->
order
);
__compar_fn_t
fn
=
getKeyComparFunc
(
pColInfoData
->
info
.
type
,
pOrder
->
order
);
taosSort
(
pColInfoData
->
pData
,
pDataBlock
->
info
.
rows
,
pColInfoData
->
info
.
bytes
,
fn
);
taosSort
(
pColInfoData
->
pData
,
pDataBlock
->
info
.
rows
,
pColInfoData
->
info
.
bytes
,
fn
);
...
@@ -923,8 +923,9 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
...
@@ -923,8 +923,9 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo) {
pInfo
->
pColData
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pInfo
->
slotId
);
pInfo
->
pColData
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pInfo
->
slotId
);
}
}
terrno
=
0
;
taosqsort
(
index
,
rows
,
sizeof
(
int32_t
),
&
helper
,
dataBlockCompar
);
taosqsort
(
index
,
rows
,
sizeof
(
int32_t
),
&
helper
,
dataBlockCompar
);
if
(
terrno
)
return
terrno
;
if
(
terrno
)
return
terrno
;
int64_t
p1
=
taosGetTimestampUs
();
int64_t
p1
=
taosGetTimestampUs
();
...
@@ -1438,21 +1439,21 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
...
@@ -1438,21 +1439,21 @@ static void doShiftBitmap(char* nullBitmap, size_t n, size_t total) {
}
}
}
}
static
int32_t
colDataMoveVarData
(
SColumnInfoData
*
pColInfoData
,
size_t
start
,
size_t
end
){
static
int32_t
colDataMoveVarData
(
SColumnInfoData
*
pColInfoData
,
size_t
start
,
size_t
end
)
{
int32_t
dataOffset
=
-
1
;
int32_t
dataOffset
=
-
1
;
int32_t
dataLen
=
0
;
int32_t
dataLen
=
0
;
int32_t
beigin
=
start
;
int32_t
beigin
=
start
;
while
(
beigin
<
end
)
{
while
(
beigin
<
end
)
{
int32_t
offset
=
pColInfoData
->
varmeta
.
offset
[
beigin
];
int32_t
offset
=
pColInfoData
->
varmeta
.
offset
[
beigin
];
if
(
offset
==
-
1
)
{
if
(
offset
==
-
1
)
{
beigin
++
;
beigin
++
;
continue
;
continue
;
}
}
if
(
start
!=
0
)
{
if
(
start
!=
0
)
{
pColInfoData
->
varmeta
.
offset
[
beigin
]
=
dataLen
;
pColInfoData
->
varmeta
.
offset
[
beigin
]
=
dataLen
;
}
}
char
*
data
=
pColInfoData
->
pData
+
offset
;
char
*
data
=
pColInfoData
->
pData
+
offset
;
if
(
dataOffset
==
-
1
)
dataOffset
=
offset
;
// mark the begin of data
if
(
dataOffset
==
-
1
)
dataOffset
=
offset
;
// mark the begin of data
int32_t
type
=
pColInfoData
->
info
.
type
;
int32_t
type
=
pColInfoData
->
info
.
type
;
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
dataLen
+=
getJsonValueLen
(
data
);
dataLen
+=
getJsonValueLen
(
data
);
...
@@ -1461,7 +1462,7 @@ static int32_t colDataMoveVarData(SColumnInfoData* pColInfoData, size_t start, s
...
@@ -1461,7 +1462,7 @@ static int32_t colDataMoveVarData(SColumnInfoData* pColInfoData, size_t start, s
}
}
beigin
++
;
beigin
++
;
}
}
if
(
dataOffset
>
0
)
{
if
(
dataOffset
>
0
)
{
memmove
(
pColInfoData
->
pData
,
pColInfoData
->
pData
+
dataOffset
,
dataLen
);
memmove
(
pColInfoData
->
pData
,
pColInfoData
->
pData
+
dataOffset
,
dataLen
);
memmove
(
pColInfoData
->
varmeta
.
offset
,
&
pColInfoData
->
varmeta
.
offset
[
start
],
(
end
-
start
)
*
sizeof
(
int32_t
));
memmove
(
pColInfoData
->
varmeta
.
offset
,
&
pColInfoData
->
varmeta
.
offset
[
start
],
(
end
-
start
)
*
sizeof
(
int32_t
));
}
}
...
...
source/common/src/tmsg.c
浏览文件 @
406d35d4
...
@@ -947,8 +947,10 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -947,8 +947,10 @@ int32_t tSerializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if
(
tEncodeI64
(
&
encoder
,
pReq
->
clusterId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
clusterId
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
rebootTime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
rebootTime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
updateTime
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
updateTime
)
<
0
)
return
-
1
;
if
(
tEncode
I32
(
&
encoder
,
pReq
->
numOfCores
)
<
0
)
return
-
1
;
if
(
tEncode
Float
(
&
encoder
,
pReq
->
numOfCores
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
numOfSupportVnodes
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
numOfSupportVnodes
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
memTotal
)
<
0
)
return
-
1
;
if
(
tEncodeI64
(
&
encoder
,
pReq
->
memAvail
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
dnodeEp
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
dnodeEp
)
<
0
)
return
-
1
;
// cluster cfg
// cluster cfg
...
@@ -1008,8 +1010,10 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
...
@@ -1008,8 +1010,10 @@ int32_t tDeserializeSStatusReq(void *buf, int32_t bufLen, SStatusReq *pReq) {
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
clusterId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
clusterId
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
rebootTime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
rebootTime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
updateTime
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
updateTime
)
<
0
)
return
-
1
;
if
(
tDecode
I32
(
&
decoder
,
&
pReq
->
numOfCores
)
<
0
)
return
-
1
;
if
(
tDecode
Float
(
&
decoder
,
&
pReq
->
numOfCores
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfSupportVnodes
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfSupportVnodes
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
memTotal
)
<
0
)
return
-
1
;
if
(
tDecodeI64
(
&
decoder
,
&
pReq
->
memAvail
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
dnodeEp
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
dnodeEp
)
<
0
)
return
-
1
;
// cluster cfg
// cluster cfg
...
@@ -1974,6 +1978,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
...
@@ -1974,6 +1978,7 @@ int32_t tSerializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq) {
if
(
tEncodeI32
(
&
encoder
,
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
lastRowMem
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
...
@@ -2015,6 +2020,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
...
@@ -2015,6 +2020,7 @@ int32_t tDeserializeSCreateDbReq(void *buf, int32_t bufLen, SCreateDbReq *pReq)
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
lastRowMem
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
...
@@ -2069,6 +2075,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
...
@@ -2069,6 +2075,7 @@ int32_t tSerializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tEncodeI32
(
&
encoder
,
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
lastRowMem
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
...
@@ -2094,6 +2101,7 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
...
@@ -2094,6 +2101,7 @@ int32_t tDeserializeSAlterDbReq(void *buf, int32_t bufLen, SAlterDbReq *pReq) {
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
lastRowMem
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
...
@@ -2679,10 +2687,12 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
...
@@ -2679,10 +2687,12 @@ int32_t tDeserializeSDbCfgRsp(void *buf, int32_t bufLen, SDbCfgRsp *pRsp) {
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
strict
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI8
(
&
decoder
,
&
pRsp
->
cacheLastRow
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfRetensions
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pRsp
->
numOfRetensions
)
<
0
)
return
-
1
;
pRsp
->
pRetensions
=
taosArrayInit
(
pRsp
->
numOfRetensions
,
sizeof
(
SRetention
));
if
(
pRsp
->
numOfRetensions
>
0
)
{
if
(
pRsp
->
pRetensions
==
NULL
)
{
pRsp
->
pRetensions
=
taosArrayInit
(
pRsp
->
numOfRetensions
,
sizeof
(
SRetention
));
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
if
(
pRsp
->
pRetensions
==
NULL
)
{
return
-
1
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
}
}
for
(
int32_t
i
=
0
;
i
<
pRsp
->
numOfRetensions
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pRsp
->
numOfRetensions
;
++
i
)
{
...
@@ -3586,6 +3596,7 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
...
@@ -3586,6 +3596,7 @@ int32_t tSerializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *pR
if
(
tEncodeI32
(
&
encoder
,
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
lastRowMem
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
...
@@ -3643,6 +3654,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
...
@@ -3643,6 +3654,7 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
lastRowMem
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
...
@@ -3665,7 +3677,6 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
...
@@ -3665,7 +3677,6 @@ int32_t tDeserializeSCreateVnodeReq(void *buf, int32_t bufLen, SCreateVnodeReq *
SReplica
*
pReplica
=
&
pReq
->
replicas
[
i
];
SReplica
*
pReplica
=
&
pReq
->
replicas
[
i
];
if
(
tDecodeSReplica
(
&
decoder
,
pReplica
)
<
0
)
return
-
1
;
if
(
tDecodeSReplica
(
&
decoder
,
pReplica
)
<
0
)
return
-
1
;
}
}
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfRetensions
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
numOfRetensions
)
<
0
)
return
-
1
;
pReq
->
pRetensions
=
taosArrayInit
(
pReq
->
numOfRetensions
,
sizeof
(
SRetention
));
pReq
->
pRetensions
=
taosArrayInit
(
pReq
->
numOfRetensions
,
sizeof
(
SRetention
));
if
(
pReq
->
pRetensions
==
NULL
)
{
if
(
pReq
->
pRetensions
==
NULL
)
{
...
@@ -3768,6 +3779,7 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq
...
@@ -3768,6 +3779,7 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq
if
(
tEncodeI32
(
&
encoder
,
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
lastRowMem
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
...
@@ -3782,7 +3794,6 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq
...
@@ -3782,7 +3794,6 @@ int32_t tSerializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pReq
SReplica
*
pReplica
=
&
pReq
->
replicas
[
i
];
SReplica
*
pReplica
=
&
pReq
->
replicas
[
i
];
if
(
tEncodeSReplica
(
&
encoder
,
pReplica
)
<
0
)
return
-
1
;
if
(
tEncodeSReplica
(
&
encoder
,
pReplica
)
<
0
)
return
-
1
;
}
}
tEndEncode
(
&
encoder
);
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
int32_t
tlen
=
encoder
.
pos
;
...
@@ -3799,6 +3810,7 @@ int32_t tDeserializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pR
...
@@ -3799,6 +3810,7 @@ int32_t tDeserializeSAlterVnodeReq(void *buf, int32_t bufLen, SAlterVnodeReq *pR
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
buffer
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pageSize
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
pages
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
lastRowMem
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysPerFile
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep0
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
daysToKeep1
)
<
0
)
return
-
1
;
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
406d35d4
...
@@ -67,6 +67,8 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
...
@@ -67,6 +67,8 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
req
.
updateTime
=
pMgmt
->
pData
->
updateTime
;
req
.
updateTime
=
pMgmt
->
pData
->
updateTime
;
req
.
numOfCores
=
tsNumOfCores
;
req
.
numOfCores
=
tsNumOfCores
;
req
.
numOfSupportVnodes
=
tsNumOfSupportVnodes
;
req
.
numOfSupportVnodes
=
tsNumOfSupportVnodes
;
req
.
memTotal
=
tsTotalMemoryKB
*
1024
;
req
.
memAvail
=
req
.
memTotal
-
tsRpcQueueMemoryAllowed
-
16
*
1024
*
1024
;
tstrncpy
(
req
.
dnodeEp
,
tsLocalEp
,
TSDB_EP_LEN
);
tstrncpy
(
req
.
dnodeEp
,
tsLocalEp
,
TSDB_EP_LEN
);
req
.
clusterCfg
.
statusInterval
=
tsStatusInterval
;
req
.
clusterCfg
.
statusInterval
=
tsStatusInterval
;
...
...
source/dnode/mgmt/node_mgmt/src/dmProc.c
浏览文件 @
406d35d4
...
@@ -87,8 +87,8 @@ static SProcQueue *dmInitProcQueue(SProc *proc, char *ptr, int32_t size) {
...
@@ -87,8 +87,8 @@ static SProcQueue *dmInitProcQueue(SProc *proc, char *ptr, int32_t size) {
static
void
dmCleanupProcQueue
(
SProcQueue
*
queue
)
{}
static
void
dmCleanupProcQueue
(
SProcQueue
*
queue
)
{}
static
inline
int32_t
dmPushToProcQueue
(
SProc
*
proc
,
SProcQueue
*
queue
,
SRpcMsg
*
pMsg
,
EProcFuncType
ftype
)
{
static
inline
int32_t
dmPushToProcQueue
(
SProc
*
proc
,
SProcQueue
*
queue
,
SRpcMsg
*
pMsg
,
EProcFuncType
ftype
)
{
const
void
*
pHead
=
pMsg
;
const
void
*
pHead
=
pMsg
;
const
void
*
pBody
=
pMsg
->
pCont
;
const
void
*
pBody
=
pMsg
->
pCont
;
const
int16_t
rawHeadLen
=
sizeof
(
SRpcMsg
);
const
int16_t
rawHeadLen
=
sizeof
(
SRpcMsg
);
const
int32_t
rawBodyLen
=
pMsg
->
contLen
;
const
int32_t
rawBodyLen
=
pMsg
->
contLen
;
const
int16_t
headLen
=
CEIL8
(
rawHeadLen
);
const
int16_t
headLen
=
CEIL8
(
rawHeadLen
);
...
@@ -257,7 +257,7 @@ int32_t dmInitProc(struct SMgmtWrapper *pWrapper) {
...
@@ -257,7 +257,7 @@ int32_t dmInitProc(struct SMgmtWrapper *pWrapper) {
proc
->
wrapper
=
pWrapper
;
proc
->
wrapper
=
pWrapper
;
proc
->
name
=
pWrapper
->
name
;
proc
->
name
=
pWrapper
->
name
;
SShm
*
shm
=
&
proc
->
shm
;
SShm
*
shm
=
&
proc
->
shm
;
int32_t
cstart
=
0
;
int32_t
cstart
=
0
;
int32_t
csize
=
CEIL8
(
shm
->
size
/
2
);
int32_t
csize
=
CEIL8
(
shm
->
size
/
2
);
int32_t
pstart
=
csize
;
int32_t
pstart
=
csize
;
...
@@ -281,13 +281,13 @@ int32_t dmInitProc(struct SMgmtWrapper *pWrapper) {
...
@@ -281,13 +281,13 @@ int32_t dmInitProc(struct SMgmtWrapper *pWrapper) {
}
}
static
void
*
dmConsumChildQueue
(
void
*
param
)
{
static
void
*
dmConsumChildQueue
(
void
*
param
)
{
SProc
*
proc
=
param
;
SProc
*
proc
=
param
;
SMgmtWrapper
*
pWrapper
=
proc
->
wrapper
;
SMgmtWrapper
*
pWrapper
=
proc
->
wrapper
;
SProcQueue
*
queue
=
proc
->
cqueue
;
SProcQueue
*
queue
=
proc
->
cqueue
;
int32_t
numOfMsgs
=
0
;
int32_t
numOfMsgs
=
0
;
int32_t
code
=
0
;
int32_t
code
=
0
;
EProcFuncType
ftype
=
DND_FUNC_REQ
;
EProcFuncType
ftype
=
DND_FUNC_REQ
;
SRpcMsg
*
pMsg
=
NULL
;
SRpcMsg
*
pMsg
=
NULL
;
dDebug
(
"node:%s, start to consume from cqueue"
,
proc
->
name
);
dDebug
(
"node:%s, start to consume from cqueue"
,
proc
->
name
);
do
{
do
{
...
@@ -324,13 +324,13 @@ static void *dmConsumChildQueue(void *param) {
...
@@ -324,13 +324,13 @@ static void *dmConsumChildQueue(void *param) {
}
}
static
void
*
dmConsumParentQueue
(
void
*
param
)
{
static
void
*
dmConsumParentQueue
(
void
*
param
)
{
SProc
*
proc
=
param
;
SProc
*
proc
=
param
;
SMgmtWrapper
*
pWrapper
=
proc
->
wrapper
;
SMgmtWrapper
*
pWrapper
=
proc
->
wrapper
;
SProcQueue
*
queue
=
proc
->
pqueue
;
SProcQueue
*
queue
=
proc
->
pqueue
;
int32_t
numOfMsgs
=
0
;
int32_t
numOfMsgs
=
0
;
int32_t
code
=
0
;
int32_t
code
=
0
;
EProcFuncType
ftype
=
DND_FUNC_REQ
;
EProcFuncType
ftype
=
DND_FUNC_REQ
;
SRpcMsg
*
pMsg
=
NULL
;
SRpcMsg
*
pMsg
=
NULL
;
dDebug
(
"node:%s, start to consume from pqueue"
,
proc
->
name
);
dDebug
(
"node:%s, start to consume from pqueue"
,
proc
->
name
);
do
{
do
{
...
@@ -353,7 +353,7 @@ static void *dmConsumParentQueue(void *param) {
...
@@ -353,7 +353,7 @@ static void *dmConsumParentQueue(void *param) {
rpcRegisterBrokenLinkArg
(
pMsg
);
rpcRegisterBrokenLinkArg
(
pMsg
);
}
else
if
(
ftype
==
DND_FUNC_RELEASE
)
{
}
else
if
(
ftype
==
DND_FUNC_RELEASE
)
{
dmRemoveProcRpcHandle
(
proc
,
pMsg
->
info
.
handle
);
dmRemoveProcRpcHandle
(
proc
,
pMsg
->
info
.
handle
);
rpcReleaseHandle
(
pMsg
->
info
.
handle
,
(
int8_t
)
pMsg
->
code
);
rpcReleaseHandle
(
&
pMsg
->
info
,
TAOS_CONN_SERVER
);
}
else
{
}
else
{
dError
(
"node:%s, invalid ftype:%d from pqueue"
,
proc
->
name
,
ftype
);
dError
(
"node:%s, invalid ftype:%d from pqueue"
,
proc
->
name
,
ftype
);
rpcFreeCont
(
pMsg
->
pCont
);
rpcFreeCont
(
pMsg
->
pCont
);
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
406d35d4
...
@@ -245,7 +245,7 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) {
...
@@ -245,7 +245,7 @@ static inline void dmReleaseHandle(SRpcHandleInfo *pHandle, int8_t type) {
SRpcMsg
msg
=
{.
code
=
type
,
.
info
=
*
pHandle
};
SRpcMsg
msg
=
{.
code
=
type
,
.
info
=
*
pHandle
};
dmPutToProcPQueue
(
&
pWrapper
->
proc
,
&
msg
,
DND_FUNC_RELEASE
);
dmPutToProcPQueue
(
&
pWrapper
->
proc
,
&
msg
,
DND_FUNC_RELEASE
);
}
else
{
}
else
{
rpcReleaseHandle
(
pHandle
->
handle
,
type
);
rpcReleaseHandle
(
pHandle
,
type
);
}
}
}
}
...
...
source/dnode/mgmt/node_util/src/dmEps.c
浏览文件 @
406d35d4
...
@@ -280,7 +280,7 @@ static void dmPrintEps(SDnodeData *pData) {
...
@@ -280,7 +280,7 @@ static void dmPrintEps(SDnodeData *pData) {
dDebug
(
"print dnode list, num:%d"
,
numOfEps
);
dDebug
(
"print dnode list, num:%d"
,
numOfEps
);
for
(
int32_t
i
=
0
;
i
<
numOfEps
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
numOfEps
;
i
++
)
{
SDnodeEp
*
pEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
SDnodeEp
*
pEp
=
taosArrayGet
(
pData
->
dnodeEps
,
i
);
dDebug
(
"dnode:%d, fqdn:%s port:%u is
_m
node:%d"
,
pEp
->
id
,
pEp
->
ep
.
fqdn
,
pEp
->
ep
.
port
,
pEp
->
isMnode
);
dDebug
(
"dnode:%d, fqdn:%s port:%u is
M
node:%d"
,
pEp
->
id
,
pEp
->
ep
.
fqdn
,
pEp
->
ep
.
port
,
pEp
->
isMnode
);
}
}
}
}
...
...
source/dnode/mgmt/test/sut/src/sut.cpp
浏览文件 @
406d35d4
...
@@ -30,12 +30,14 @@ void Testbase::InitLog(const char* path) {
...
@@ -30,12 +30,14 @@ void Testbase::InitLog(const char* path) {
tsdbDebugFlag
=
0
;
tsdbDebugFlag
=
0
;
tsLogEmbedded
=
1
;
tsLogEmbedded
=
1
;
tsAsyncLog
=
0
;
tsAsyncLog
=
0
;
tsRpcQueueMemoryAllowed
=
1024
*
1024
*
64
;
taosRemoveDir
(
path
);
taosRemoveDir
(
path
);
taosMkDir
(
path
);
taosMkDir
(
path
);
tstrncpy
(
tsLogDir
,
path
,
PATH_MAX
);
tstrncpy
(
tsLogDir
,
path
,
PATH_MAX
);
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
taosGetSystemInfo
();
tsRpcQueueMemoryAllowed
=
tsTotalMemoryKB
*
0.1
;
if
(
taosInitLog
(
"taosdlog"
,
1
)
!=
0
)
{
printf
(
"failed to init log file
\n
"
);
printf
(
"failed to init log file
\n
"
);
}
}
}
}
...
...
source/dnode/mnode/impl/inc/mndDef.h
浏览文件 @
406d35d4
...
@@ -148,7 +148,10 @@ typedef struct {
...
@@ -148,7 +148,10 @@ typedef struct {
int32_t
accessTimes
;
int32_t
accessTimes
;
int32_t
numOfVnodes
;
int32_t
numOfVnodes
;
int32_t
numOfSupportVnodes
;
int32_t
numOfSupportVnodes
;
int32_t
numOfCores
;
float
numOfCores
;
int64_t
memTotal
;
int64_t
memAvail
;
int64_t
memUsed
;
EDndReason
offlineReason
;
EDndReason
offlineReason
;
uint16_t
port
;
uint16_t
port
;
char
fqdn
[
TSDB_FQDN_LEN
];
char
fqdn
[
TSDB_FQDN_LEN
];
...
@@ -243,6 +246,7 @@ typedef struct {
...
@@ -243,6 +246,7 @@ typedef struct {
int32_t
buffer
;
int32_t
buffer
;
int32_t
pageSize
;
int32_t
pageSize
;
int32_t
pages
;
int32_t
pages
;
int32_t
lastRowMem
;
int32_t
daysPerFile
;
int32_t
daysPerFile
;
int32_t
daysToKeep0
;
int32_t
daysToKeep0
;
int32_t
daysToKeep1
;
int32_t
daysToKeep1
;
...
@@ -255,8 +259,8 @@ typedef struct {
...
@@ -255,8 +259,8 @@ typedef struct {
int8_t
compression
;
int8_t
compression
;
int8_t
replications
;
int8_t
replications
;
int8_t
strict
;
int8_t
strict
;
int8_t
cacheLastRow
;
int8_t
hashMethod
;
// default is 1
int8_t
hashMethod
;
// default is 1
int8_t
cacheLastRow
;
int32_t
numOfRetensions
;
int32_t
numOfRetensions
;
SArray
*
pRetensions
;
SArray
*
pRetensions
;
int8_t
schemaless
;
int8_t
schemaless
;
...
...
source/dnode/mnode/impl/inc/mndVgroup.h
浏览文件 @
406d35d4
...
@@ -30,6 +30,8 @@ SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup);
...
@@ -30,6 +30,8 @@ SSdbRaw *mndVgroupActionEncode(SVgObj *pVgroup);
SEpSet
mndGetVgroupEpset
(
SMnode
*
pMnode
,
const
SVgObj
*
pVgroup
);
SEpSet
mndGetVgroupEpset
(
SMnode
*
pMnode
,
const
SVgObj
*
pVgroup
);
int32_t
mndGetVnodesNum
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
int32_t
mndGetVnodesNum
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
void
mndSortVnodeGid
(
SVgObj
*
pVgroup
);
void
mndSortVnodeGid
(
SVgObj
*
pVgroup
);
int64_t
mndGetVnodesMemory
(
SMnode
*
pMnode
,
int32_t
dnodeId
);
int64_t
mndGetVgroupMemory
(
SMnode
*
pMnode
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
SArray
*
mndBuildDnodesArray
(
SMnode
*
,
int32_t
exceptDnodeId
);
SArray
*
mndBuildDnodesArray
(
SMnode
*
,
int32_t
exceptDnodeId
);
int32_t
mndAllocSmaVgroup
(
SMnode
*
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
int32_t
mndAllocSmaVgroup
(
SMnode
*
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
);
...
...
source/dnode/mnode/impl/src/mndDb.c
浏览文件 @
406d35d4
...
@@ -93,6 +93,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
...
@@ -93,6 +93,7 @@ static SSdbRaw *mndDbActionEncode(SDbObj *pDb) {
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
buffer
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
buffer
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
pageSize
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
pageSize
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
pages
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
pages
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
lastRowMem
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
daysPerFile
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
daysPerFile
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
daysToKeep0
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
daysToKeep0
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
daysToKeep1
,
_OVER
)
SDB_SET_INT32
(
pRaw
,
dataPos
,
pDb
->
cfg
.
daysToKeep1
,
_OVER
)
...
@@ -165,6 +166,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
...
@@ -165,6 +166,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) {
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
buffer
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
buffer
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
pageSize
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
pageSize
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
pages
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
pages
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
lastRowMem
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
daysPerFile
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
daysPerFile
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
daysToKeep0
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
daysToKeep0
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
daysToKeep1
,
_OVER
)
SDB_GET_INT32
(
pRaw
,
dataPos
,
&
pDb
->
cfg
.
daysToKeep1
,
_OVER
)
...
@@ -230,8 +232,9 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
...
@@ -230,8 +232,9 @@ static int32_t mndDbActionUpdate(SSdb *pSdb, SDbObj *pOld, SDbObj *pNew) {
pOld
->
cfgVersion
=
pNew
->
cfgVersion
;
pOld
->
cfgVersion
=
pNew
->
cfgVersion
;
pOld
->
vgVersion
=
pNew
->
vgVersion
;
pOld
->
vgVersion
=
pNew
->
vgVersion
;
pOld
->
cfg
.
buffer
=
pNew
->
cfg
.
buffer
;
pOld
->
cfg
.
buffer
=
pNew
->
cfg
.
buffer
;
pOld
->
cfg
.
pages
=
pNew
->
cfg
.
pages
;
pOld
->
cfg
.
pageSize
=
pNew
->
cfg
.
pageSize
;
pOld
->
cfg
.
pageSize
=
pNew
->
cfg
.
pageSize
;
pOld
->
cfg
.
pages
=
pNew
->
cfg
.
pages
;
pOld
->
cfg
.
lastRowMem
=
pNew
->
cfg
.
lastRowMem
;
pOld
->
cfg
.
daysPerFile
=
pNew
->
cfg
.
daysPerFile
;
pOld
->
cfg
.
daysPerFile
=
pNew
->
cfg
.
daysPerFile
;
pOld
->
cfg
.
daysToKeep0
=
pNew
->
cfg
.
daysToKeep0
;
pOld
->
cfg
.
daysToKeep0
=
pNew
->
cfg
.
daysToKeep0
;
pOld
->
cfg
.
daysToKeep1
=
pNew
->
cfg
.
daysToKeep1
;
pOld
->
cfg
.
daysToKeep1
=
pNew
->
cfg
.
daysToKeep1
;
...
@@ -288,6 +291,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
...
@@ -288,6 +291,7 @@ static int32_t mndCheckDbCfg(SMnode *pMnode, SDbCfg *pCfg) {
if
(
pCfg
->
buffer
<
TSDB_MIN_BUFFER_PER_VNODE
||
pCfg
->
buffer
>
TSDB_MAX_BUFFER_PER_VNODE
)
return
-
1
;
if
(
pCfg
->
buffer
<
TSDB_MIN_BUFFER_PER_VNODE
||
pCfg
->
buffer
>
TSDB_MAX_BUFFER_PER_VNODE
)
return
-
1
;
if
(
pCfg
->
pageSize
<
TSDB_MIN_PAGESIZE_PER_VNODE
||
pCfg
->
pageSize
>
TSDB_MAX_PAGESIZE_PER_VNODE
)
return
-
1
;
if
(
pCfg
->
pageSize
<
TSDB_MIN_PAGESIZE_PER_VNODE
||
pCfg
->
pageSize
>
TSDB_MAX_PAGESIZE_PER_VNODE
)
return
-
1
;
if
(
pCfg
->
pages
<
TSDB_MIN_PAGES_PER_VNODE
||
pCfg
->
pages
>
TSDB_MAX_PAGES_PER_VNODE
)
return
-
1
;
if
(
pCfg
->
pages
<
TSDB_MIN_PAGES_PER_VNODE
||
pCfg
->
pages
>
TSDB_MAX_PAGES_PER_VNODE
)
return
-
1
;
if
(
pCfg
->
lastRowMem
<
TSDB_MIN_DB_LAST_ROW_MEM
||
pCfg
->
lastRowMem
>
TSDB_MAX_DB_LAST_ROW_MEM
)
return
-
1
;
if
(
pCfg
->
daysPerFile
<
TSDB_MIN_DAYS_PER_FILE
||
pCfg
->
daysPerFile
>
TSDB_MAX_DAYS_PER_FILE
)
return
-
1
;
if
(
pCfg
->
daysPerFile
<
TSDB_MIN_DAYS_PER_FILE
||
pCfg
->
daysPerFile
>
TSDB_MAX_DAYS_PER_FILE
)
return
-
1
;
if
(
pCfg
->
daysToKeep0
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep0
>
TSDB_MAX_KEEP
)
return
-
1
;
if
(
pCfg
->
daysToKeep0
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep0
>
TSDB_MAX_KEEP
)
return
-
1
;
if
(
pCfg
->
daysToKeep1
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep1
>
TSDB_MAX_KEEP
)
return
-
1
;
if
(
pCfg
->
daysToKeep1
<
TSDB_MIN_KEEP
||
pCfg
->
daysToKeep1
>
TSDB_MAX_KEEP
)
return
-
1
;
...
@@ -336,6 +340,7 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
...
@@ -336,6 +340,7 @@ static void mndSetDefaultDbCfg(SDbCfg *pCfg) {
if
(
pCfg
->
replications
<
0
)
pCfg
->
replications
=
TSDB_DEFAULT_DB_REPLICA
;
if
(
pCfg
->
replications
<
0
)
pCfg
->
replications
=
TSDB_DEFAULT_DB_REPLICA
;
if
(
pCfg
->
strict
<
0
)
pCfg
->
strict
=
TSDB_DEFAULT_DB_STRICT
;
if
(
pCfg
->
strict
<
0
)
pCfg
->
strict
=
TSDB_DEFAULT_DB_STRICT
;
if
(
pCfg
->
cacheLastRow
<
0
)
pCfg
->
cacheLastRow
=
TSDB_DEFAULT_CACHE_LAST_ROW
;
if
(
pCfg
->
cacheLastRow
<
0
)
pCfg
->
cacheLastRow
=
TSDB_DEFAULT_CACHE_LAST_ROW
;
if
(
pCfg
->
lastRowMem
<=
0
)
pCfg
->
lastRowMem
=
TSDB_DEFAULT_LAST_ROW_MEM
;
if
(
pCfg
->
numOfRetensions
<
0
)
pCfg
->
numOfRetensions
=
0
;
if
(
pCfg
->
numOfRetensions
<
0
)
pCfg
->
numOfRetensions
=
0
;
if
(
pCfg
->
schemaless
<
0
)
pCfg
->
schemaless
=
TSDB_DB_SCHEMALESS_OFF
;
if
(
pCfg
->
schemaless
<
0
)
pCfg
->
schemaless
=
TSDB_DB_SCHEMALESS_OFF
;
}
}
...
@@ -434,6 +439,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
...
@@ -434,6 +439,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
.
buffer
=
pCreate
->
buffer
,
.
buffer
=
pCreate
->
buffer
,
.
pageSize
=
pCreate
->
pageSize
,
.
pageSize
=
pCreate
->
pageSize
,
.
pages
=
pCreate
->
pages
,
.
pages
=
pCreate
->
pages
,
.
lastRowMem
=
pCreate
->
lastRowMem
,
.
daysPerFile
=
pCreate
->
daysPerFile
,
.
daysPerFile
=
pCreate
->
daysPerFile
,
.
daysToKeep0
=
pCreate
->
daysToKeep0
,
.
daysToKeep0
=
pCreate
->
daysToKeep0
,
.
daysToKeep1
=
pCreate
->
daysToKeep1
,
.
daysToKeep1
=
pCreate
->
daysToKeep1
,
...
@@ -475,7 +481,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
...
@@ -475,7 +481,7 @@ static int32_t mndCreateDb(SMnode *pMnode, SRpcMsg *pReq, SCreateDbReq *pCreate,
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB
,
pReq
);
STrans
*
pTrans
=
mndTransCreate
(
pMnode
,
TRN_POLICY_RETRY
,
TRN_CONFLICT_DB
,
pReq
);
if
(
pTrans
==
NULL
)
goto
_OVER
;
if
(
pTrans
==
NULL
)
goto
_OVER
;
// mndTransSetSerial(pTrans);
mDebug
(
"trans:%d, used to create db:%s"
,
pTrans
->
id
,
pCreate
->
db
);
mDebug
(
"trans:%d, used to create db:%s"
,
pTrans
->
id
,
pCreate
->
db
);
mndTransSetDbName
(
pTrans
,
dbObj
.
name
,
NULL
);
mndTransSetDbName
(
pTrans
,
dbObj
.
name
,
NULL
);
...
@@ -622,6 +628,11 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) {
...
@@ -622,6 +628,11 @@ static int32_t mndSetDbCfgFromAlterDbReq(SDbObj *pDb, SAlterDbReq *pAlter) {
terrno
=
0
;
terrno
=
0
;
}
}
if
(
pAlter
->
lastRowMem
>
0
&&
pAlter
->
lastRowMem
!=
pDb
->
cfg
.
lastRowMem
)
{
pDb
->
cfg
.
lastRowMem
=
pAlter
->
lastRowMem
;
terrno
=
0
;
}
if
(
pAlter
->
replications
>
0
&&
pAlter
->
replications
!=
pDb
->
cfg
.
replications
)
{
if
(
pAlter
->
replications
>
0
&&
pAlter
->
replications
!=
pDb
->
cfg
.
replications
)
{
#if 1
#if 1
terrno
=
TSDB_CODE_OPS_NOT_SUPPORT
;
terrno
=
TSDB_CODE_OPS_NOT_SUPPORT
;
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
406d35d4
...
@@ -15,8 +15,8 @@
...
@@ -15,8 +15,8 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "mndDnode.h"
#include "mndDnode.h"
#include "mndPrivilege.h"
#include "mndMnode.h"
#include "mndMnode.h"
#include "mndPrivilege.h"
#include "mndQnode.h"
#include "mndQnode.h"
#include "mndShow.h"
#include "mndShow.h"
#include "mndSnode.h"
#include "mndSnode.h"
...
@@ -432,7 +432,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
...
@@ -432,7 +432,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
}
}
if
(
!
online
)
{
if
(
!
online
)
{
mInfo
(
"dnode:%d, from offline to online"
,
pDnode
->
id
);
mInfo
(
"dnode:%d, from offline to online, memory avail:%"
PRId64
" total:%"
PRId64
" cores:%.2f"
,
pDnode
->
id
,
statusReq
.
memAvail
,
statusReq
.
memTotal
,
statusReq
.
numOfCores
);
}
else
{
}
else
{
mDebug
(
"dnode:%d, send dnode epset, online:%d dnodeVer:%"
PRId64
":%"
PRId64
" reboot:%d"
,
pDnode
->
id
,
online
,
mDebug
(
"dnode:%d, send dnode epset, online:%d dnodeVer:%"
PRId64
":%"
PRId64
" reboot:%d"
,
pDnode
->
id
,
online
,
statusReq
.
dnodeVer
,
dnodeVer
,
reboot
);
statusReq
.
dnodeVer
,
dnodeVer
,
reboot
);
...
@@ -441,6 +442,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
...
@@ -441,6 +442,8 @@ static int32_t mndProcessStatusReq(SRpcMsg *pReq) {
pDnode
->
rebootTime
=
statusReq
.
rebootTime
;
pDnode
->
rebootTime
=
statusReq
.
rebootTime
;
pDnode
->
numOfCores
=
statusReq
.
numOfCores
;
pDnode
->
numOfCores
=
statusReq
.
numOfCores
;
pDnode
->
numOfSupportVnodes
=
statusReq
.
numOfSupportVnodes
;
pDnode
->
numOfSupportVnodes
=
statusReq
.
numOfSupportVnodes
;
pDnode
->
memAvail
=
statusReq
.
memAvail
;
pDnode
->
memTotal
=
statusReq
.
memTotal
;
SStatusRsp
statusRsp
=
{
0
};
SStatusRsp
statusRsp
=
{
0
};
statusRsp
.
dnodeVer
=
dnodeVer
;
statusRsp
.
dnodeVer
=
dnodeVer
;
...
@@ -580,7 +583,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
...
@@ -580,7 +583,7 @@ static int32_t mndProcessShowVariablesReq(SRpcMsg *pReq) {
strcpy
(
info
.
name
,
"timezone"
);
strcpy
(
info
.
name
,
"timezone"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsTimezoneStr
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsTimezoneStr
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
strcpy
(
info
.
name
,
"locale"
);
strcpy
(
info
.
name
,
"locale"
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsLocale
);
snprintf
(
info
.
value
,
TSDB_CONFIG_VALUE_LEN
,
"%s"
,
tsLocale
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
taosArrayPush
(
rsp
.
variables
,
&
info
);
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
406d35d4
...
@@ -58,7 +58,7 @@ static void *mndBuildTimerMsg(int32_t *pContLen) {
...
@@ -58,7 +58,7 @@ static void *mndBuildTimerMsg(int32_t *pContLen) {
static
void
mndPullupTrans
(
SMnode
*
pMnode
)
{
static
void
mndPullupTrans
(
SMnode
*
pMnode
)
{
int32_t
contLen
=
0
;
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
if
(
pReq
!=
NULL
)
{
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TRANS_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TRANS_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
&
rpcMsg
);
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
&
rpcMsg
);
...
@@ -67,14 +67,14 @@ static void mndPullupTrans(SMnode *pMnode) {
...
@@ -67,14 +67,14 @@ static void mndPullupTrans(SMnode *pMnode) {
static
void
mndTtlTimer
(
SMnode
*
pMnode
)
{
static
void
mndTtlTimer
(
SMnode
*
pMnode
)
{
int32_t
contLen
=
0
;
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TTL_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TTL_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
&
rpcMsg
);
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
WRITE_QUEUE
,
&
rpcMsg
);
}
}
static
void
mndCalMqRebalance
(
SMnode
*
pMnode
)
{
static
void
mndCalMqRebalance
(
SMnode
*
pMnode
)
{
int32_t
contLen
=
0
;
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
if
(
pReq
!=
NULL
)
{
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_MQ_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_MQ_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
READ_QUEUE
,
&
rpcMsg
);
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
READ_QUEUE
,
&
rpcMsg
);
...
@@ -83,7 +83,7 @@ static void mndCalMqRebalance(SMnode *pMnode) {
...
@@ -83,7 +83,7 @@ static void mndCalMqRebalance(SMnode *pMnode) {
static
void
mndPullupTelem
(
SMnode
*
pMnode
)
{
static
void
mndPullupTelem
(
SMnode
*
pMnode
)
{
int32_t
contLen
=
0
;
int32_t
contLen
=
0
;
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
void
*
pReq
=
mndBuildTimerMsg
(
&
contLen
);
if
(
pReq
!=
NULL
)
{
if
(
pReq
!=
NULL
)
{
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TELEM_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_MND_TELEM_TIMER
,
.
pCont
=
pReq
,
.
contLen
=
contLen
};
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
READ_QUEUE
,
&
rpcMsg
);
tmsgPutToQueue
(
&
pMnode
->
msgCb
,
READ_QUEUE
,
&
rpcMsg
);
...
@@ -395,7 +395,7 @@ void mndStop(SMnode *pMnode) {
...
@@ -395,7 +395,7 @@ void mndStop(SMnode *pMnode) {
}
}
int32_t
mndProcessSyncMsg
(
SRpcMsg
*
pMsg
)
{
int32_t
mndProcessSyncMsg
(
SRpcMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
SSyncMgmt
*
pMgmt
=
&
pMnode
->
syncMgmt
;
int32_t
code
=
0
;
int32_t
code
=
0
;
...
@@ -413,7 +413,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
...
@@ -413,7 +413,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
}
}
do
{
do
{
char
*
syncNodeStr
=
sync2SimpleStr
(
pMgmt
->
sync
);
char
*
syncNodeStr
=
sync2SimpleStr
(
pMgmt
->
sync
);
static
int64_t
mndTick
=
0
;
static
int64_t
mndTick
=
0
;
if
(
++
mndTick
%
10
==
1
)
{
if
(
++
mndTick
%
10
==
1
)
{
mTrace
(
"vgId:%d, sync trace msg:%s, %s"
,
syncGetVgId
(
pMgmt
->
sync
),
TMSG_INFO
(
pMsg
->
msgType
),
syncNodeStr
);
mTrace
(
"vgId:%d, sync trace msg:%s, %s"
,
syncGetVgId
(
pMgmt
->
sync
),
TMSG_INFO
(
pMsg
->
msgType
),
syncNodeStr
);
...
@@ -427,7 +427,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
...
@@ -427,7 +427,7 @@ int32_t mndProcessSyncMsg(SRpcMsg *pMsg) {
}
while
(
0
);
}
while
(
0
);
// ToDo: ugly! use function pointer
// ToDo: ugly! use function pointer
if
(
syncNodeS
napshotEnable
(
pSyncNode
)
)
{
if
(
syncNodeS
trategy
(
pSyncNode
)
==
SYNC_STRATEGY_STANDARD_SNAPSHOT
)
{
if
(
pMsg
->
msgType
==
TDMT_SYNC_TIMEOUT
)
{
if
(
pMsg
->
msgType
==
TDMT_SYNC_TIMEOUT
)
{
SyncTimeout
*
pSyncMsg
=
syncTimeoutFromRpcMsg2
(
pMsg
);
SyncTimeout
*
pSyncMsg
=
syncTimeoutFromRpcMsg2
(
pMsg
);
code
=
syncNodeOnTimeoutCb
(
pSyncNode
,
pSyncMsg
);
code
=
syncNodeOnTimeoutCb
(
pSyncNode
,
pSyncMsg
);
...
@@ -579,7 +579,7 @@ static int32_t mndCheckMsgContent(SRpcMsg *pMsg) {
...
@@ -579,7 +579,7 @@ static int32_t mndCheckMsgContent(SRpcMsg *pMsg) {
}
}
int32_t
mndProcessRpcMsg
(
SRpcMsg
*
pMsg
)
{
int32_t
mndProcessRpcMsg
(
SRpcMsg
*
pMsg
)
{
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
SMnode
*
pMnode
=
pMsg
->
info
.
node
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
const
STraceId
*
trace
=
&
pMsg
->
info
.
traceId
;
MndMsgFp
fp
=
pMnode
->
msgFp
[
TMSG_INDEX
(
pMsg
->
msgType
)];
MndMsgFp
fp
=
pMnode
->
msgFp
[
TMSG_INDEX
(
pMsg
->
msgType
)];
...
@@ -632,7 +632,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -632,7 +632,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
SMonStbInfo
*
pStbInfo
,
SMonGrantInfo
*
pGrantInfo
)
{
SMonStbInfo
*
pStbInfo
,
SMonGrantInfo
*
pGrantInfo
)
{
if
(
mndAcquireRpcRef
(
pMnode
)
!=
0
)
return
-
1
;
if
(
mndAcquireRpcRef
(
pMnode
)
!=
0
)
return
-
1
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int64_t
ms
=
taosGetTimestampMs
();
int64_t
ms
=
taosGetTimestampMs
();
pClusterInfo
->
dnodes
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_DNODE
),
sizeof
(
SMonDnodeDesc
));
pClusterInfo
->
dnodes
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_DNODE
),
sizeof
(
SMonDnodeDesc
));
...
@@ -713,7 +713,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -713,7 +713,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
pGrantInfo
->
timeseries_used
+=
pVgroup
->
numOfTimeSeries
;
pGrantInfo
->
timeseries_used
+=
pVgroup
->
numOfTimeSeries
;
tstrncpy
(
desc
.
status
,
"unsynced"
,
sizeof
(
desc
.
status
));
tstrncpy
(
desc
.
status
,
"unsynced"
,
sizeof
(
desc
.
status
));
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
replica
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
replica
;
++
i
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
i
];
SMonVnodeDesc
*
pVnDesc
=
&
desc
.
vnodes
[
i
];
SMonVnodeDesc
*
pVnDesc
=
&
desc
.
vnodes
[
i
];
pVnDesc
->
dnode_id
=
pVgid
->
dnodeId
;
pVnDesc
->
dnode_id
=
pVgid
->
dnodeId
;
tstrncpy
(
pVnDesc
->
vnode_role
,
syncStr
(
pVgid
->
role
),
sizeof
(
pVnDesc
->
vnode_role
));
tstrncpy
(
pVnDesc
->
vnode_role
,
syncStr
(
pVgid
->
role
),
sizeof
(
pVnDesc
->
vnode_role
));
...
...
source/dnode/mnode/impl/src/mndSync.c
浏览文件 @
406d35d4
...
@@ -134,7 +134,7 @@ int32_t mndSnapshotDoRead(struct SSyncFSM *pFsm, void *pReader, void **ppBuf, in
...
@@ -134,7 +134,7 @@ int32_t mndSnapshotDoRead(struct SSyncFSM *pFsm, void *pReader, void **ppBuf, in
return
sdbDoRead
(
pMnode
->
pSdb
,
pReader
,
ppBuf
,
len
);
return
sdbDoRead
(
pMnode
->
pSdb
,
pReader
,
ppBuf
,
len
);
}
}
int32_t
mndSnapshotStartWrite
(
struct
SSyncFSM
*
pFsm
,
void
**
ppWriter
)
{
int32_t
mndSnapshotStartWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pParam
,
void
*
*
ppWriter
)
{
mInfo
(
"start to apply snapshot to sdb"
);
mInfo
(
"start to apply snapshot to sdb"
);
SMnode
*
pMnode
=
pFsm
->
data
;
SMnode
*
pMnode
=
pFsm
->
data
;
return
sdbStartWrite
(
pMnode
->
pSdb
,
(
SSdbIter
**
)
ppWriter
);
return
sdbStartWrite
(
pMnode
->
pSdb
,
(
SSdbIter
**
)
ppWriter
);
...
@@ -178,7 +178,7 @@ int32_t mndInitSync(SMnode *pMnode) {
...
@@ -178,7 +178,7 @@ int32_t mndInitSync(SMnode *pMnode) {
syncInfo
.
pWal
=
pMnode
->
pWal
;
syncInfo
.
pWal
=
pMnode
->
pWal
;
syncInfo
.
pFsm
=
mndSyncMakeFsm
(
pMnode
);
syncInfo
.
pFsm
=
mndSyncMakeFsm
(
pMnode
);
syncInfo
.
isStandBy
=
pMgmt
->
standby
;
syncInfo
.
isStandBy
=
pMgmt
->
standby
;
syncInfo
.
snapshot
Enable
=
true
;
syncInfo
.
snapshot
Strategy
=
SYNC_STRATEGY_STANDARD_SNAPSHOT
;
mInfo
(
"start to open mnode sync, standby:%d"
,
pMgmt
->
standby
);
mInfo
(
"start to open mnode sync, standby:%d"
,
pMgmt
->
standby
);
if
(
pMgmt
->
standby
||
pMgmt
->
replica
.
id
>
0
)
{
if
(
pMgmt
->
standby
||
pMgmt
->
replica
.
id
>
0
)
{
...
...
source/dnode/mnode/impl/src/mndVgroup.c
浏览文件 @
406d35d4
...
@@ -207,6 +207,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
...
@@ -207,6 +207,7 @@ void *mndBuildCreateVnodeReq(SMnode *pMnode, SDnodeObj *pDnode, SDbObj *pDb, SVg
createReq
.
buffer
=
pDb
->
cfg
.
buffer
;
createReq
.
buffer
=
pDb
->
cfg
.
buffer
;
createReq
.
pageSize
=
pDb
->
cfg
.
pageSize
;
createReq
.
pageSize
=
pDb
->
cfg
.
pageSize
;
createReq
.
pages
=
pDb
->
cfg
.
pages
;
createReq
.
pages
=
pDb
->
cfg
.
pages
;
createReq
.
lastRowMem
=
pDb
->
cfg
.
lastRowMem
;
createReq
.
daysPerFile
=
pDb
->
cfg
.
daysPerFile
;
createReq
.
daysPerFile
=
pDb
->
cfg
.
daysPerFile
;
createReq
.
daysToKeep0
=
pDb
->
cfg
.
daysToKeep0
;
createReq
.
daysToKeep0
=
pDb
->
cfg
.
daysToKeep0
;
createReq
.
daysToKeep1
=
pDb
->
cfg
.
daysToKeep1
;
createReq
.
daysToKeep1
=
pDb
->
cfg
.
daysToKeep1
;
...
@@ -274,8 +275,9 @@ void *mndBuildAlterVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_
...
@@ -274,8 +275,9 @@ void *mndBuildAlterVnodeReq(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup, int32_
SAlterVnodeReq
alterReq
=
{
0
};
SAlterVnodeReq
alterReq
=
{
0
};
alterReq
.
vgVersion
=
pVgroup
->
version
;
alterReq
.
vgVersion
=
pVgroup
->
version
;
alterReq
.
buffer
=
pDb
->
cfg
.
buffer
;
alterReq
.
buffer
=
pDb
->
cfg
.
buffer
;
alterReq
.
pages
=
pDb
->
cfg
.
pages
;
alterReq
.
pageSize
=
pDb
->
cfg
.
pageSize
;
alterReq
.
pageSize
=
pDb
->
cfg
.
pageSize
;
alterReq
.
pages
=
pDb
->
cfg
.
pages
;
alterReq
.
lastRowMem
=
pDb
->
cfg
.
lastRowMem
;
alterReq
.
daysPerFile
=
pDb
->
cfg
.
daysPerFile
;
alterReq
.
daysPerFile
=
pDb
->
cfg
.
daysPerFile
;
alterReq
.
daysToKeep0
=
pDb
->
cfg
.
daysToKeep0
;
alterReq
.
daysToKeep0
=
pDb
->
cfg
.
daysToKeep0
;
alterReq
.
daysToKeep1
=
pDb
->
cfg
.
daysToKeep1
;
alterReq
.
daysToKeep1
=
pDb
->
cfg
.
daysToKeep1
;
...
@@ -392,9 +394,10 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
...
@@ -392,9 +394,10 @@ static bool mndBuildDnodesArrayFp(SMnode *pMnode, void *pObj, void *p1, void *p2
bool
online
=
mndIsDnodeOnline
(
pDnode
,
curMs
);
bool
online
=
mndIsDnodeOnline
(
pDnode
,
curMs
);
bool
isMnode
=
mndIsMnode
(
pMnode
,
pDnode
->
id
);
bool
isMnode
=
mndIsMnode
(
pMnode
,
pDnode
->
id
);
pDnode
->
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
pDnode
->
numOfVnodes
=
mndGetVnodesNum
(
pMnode
,
pDnode
->
id
);
pDnode
->
memUsed
=
mndGetVnodesMemory
(
pMnode
,
pDnode
->
id
);
mDebug
(
"dnode:%d, vnodes:%d support
_vnodes:%d is_mnode:%d online:%d"
,
pDnode
->
id
,
pDnode
->
numOfVnodes
,
mDebug
(
"dnode:%d, vnodes:%d support
Vnodes:%d isMnode:%d online:%d memory avail:%"
PRId64
" used:%"
PRId64
,
pDnode
->
id
,
pDnode
->
numOf
SupportVnodes
,
isMnode
,
online
);
pDnode
->
numOf
Vnodes
,
pDnode
->
numOfSupportVnodes
,
isMnode
,
online
,
pDnode
->
memAvail
,
pDnode
->
memUsed
);
if
(
isMnode
)
{
if
(
isMnode
)
{
pDnode
->
numOfVnodes
++
;
pDnode
->
numOfVnodes
++
;
...
@@ -426,15 +429,7 @@ static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { return
...
@@ -426,15 +429,7 @@ static int32_t mndCompareDnodeId(int32_t *dnode1Id, int32_t *dnode2Id) { return
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
;
#if 0
if (d1Score == d2Score) {
return pDnode2->id - pDnode1->id;
} else {
return d1Score >= d2Score ? 1 : 0;
}
#else
return
d1Score
>=
d2Score
?
1
:
0
;
return
d1Score
>=
d2Score
?
1
:
0
;
#endif
}
}
void
mndSortVnodeGid
(
SVgObj
*
pVgroup
)
{
void
mndSortVnodeGid
(
SVgObj
*
pVgroup
)
{
...
@@ -447,7 +442,7 @@ void mndSortVnodeGid(SVgObj *pVgroup) {
...
@@ -447,7 +442,7 @@ void mndSortVnodeGid(SVgObj *pVgroup) {
}
}
}
}
static
int32_t
mndGetAvailableDnode
(
SMnode
*
pMnode
,
SVgObj
*
pVgroup
,
SArray
*
pArray
)
{
static
int32_t
mndGetAvailableDnode
(
SMnode
*
pMnode
,
S
DbObj
*
pDb
,
S
VgObj
*
pVgroup
,
SArray
*
pArray
)
{
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
int32_t
allocedVnodes
=
0
;
int32_t
allocedVnodes
=
0
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
...
@@ -470,6 +465,16 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pAr
...
@@ -470,6 +465,16 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pAr
return
-
1
;
return
-
1
;
}
}
int64_t
vgMem
=
mndGetVgroupMemory
(
pMnode
,
pDb
,
pVgroup
);
if
(
pDnode
->
memAvail
-
vgMem
-
pDnode
->
memUsed
<=
0
)
{
mError
(
"db:%s, vgId:%d, no enough memory:%"
PRId64
" in dnode:%d, avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
vgMem
,
pDnode
->
id
,
pDnode
->
memAvail
,
pDnode
->
memUsed
);
terrno
=
TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE
;
return
-
1
;
}
else
{
pDnode
->
memUsed
+=
vgMem
;
}
pVgid
->
dnodeId
=
pDnode
->
id
;
pVgid
->
dnodeId
=
pDnode
->
id
;
if
(
pVgroup
->
replica
==
1
)
{
if
(
pVgroup
->
replica
==
1
)
{
pVgid
->
role
=
TAOS_SYNC_STATE_LEADER
;
pVgid
->
role
=
TAOS_SYNC_STATE_LEADER
;
...
@@ -477,7 +482,8 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pAr
...
@@ -477,7 +482,8 @@ static int32_t mndGetAvailableDnode(SMnode *pMnode, SVgObj *pVgroup, SArray *pAr
pVgid
->
role
=
TAOS_SYNC_STATE_FOLLOWER
;
pVgid
->
role
=
TAOS_SYNC_STATE_FOLLOWER
;
}
}
mInfo
(
"db:%s, vgId:%d, vn:%d dnode:%d is alloced"
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
v
,
pVgid
->
dnodeId
);
mInfo
(
"db:%s, vgId:%d, vn:%d is alloced, memory:%"
PRId64
", dnode:%d avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
v
,
vgMem
,
pVgid
->
dnodeId
,
pDnode
->
memAvail
,
pDnode
->
memUsed
);
pDnode
->
numOfVnodes
++
;
pDnode
->
numOfVnodes
++
;
}
}
...
@@ -498,7 +504,7 @@ int32_t mndAllocSmaVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup) {
...
@@ -498,7 +504,7 @@ int32_t mndAllocSmaVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj *pVgroup) {
pVgroup
->
dbUid
=
pDb
->
uid
;
pVgroup
->
dbUid
=
pDb
->
uid
;
pVgroup
->
replica
=
1
;
pVgroup
->
replica
=
1
;
if
(
mndGetAvailableDnode
(
pMnode
,
pVgroup
,
pArray
)
!=
0
)
return
-
1
;
if
(
mndGetAvailableDnode
(
pMnode
,
p
Db
,
p
Vgroup
,
pArray
)
!=
0
)
return
-
1
;
mInfo
(
"db:%s, sma vgId:%d is alloced"
,
pDb
->
name
,
pVgroup
->
vgId
);
mInfo
(
"db:%s, sma vgId:%d is alloced"
,
pDb
->
name
,
pVgroup
->
vgId
);
return
0
;
return
0
;
...
@@ -546,8 +552,7 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups) {
...
@@ -546,8 +552,7 @@ int32_t mndAllocVgroup(SMnode *pMnode, SDbObj *pDb, SVgObj **ppVgroups) {
pVgroup
->
dbUid
=
pDb
->
uid
;
pVgroup
->
dbUid
=
pDb
->
uid
;
pVgroup
->
replica
=
pDb
->
cfg
.
replications
;
pVgroup
->
replica
=
pDb
->
cfg
.
replications
;
if
(
mndGetAvailableDnode
(
pMnode
,
pVgroup
,
pArray
)
!=
0
)
{
if
(
mndGetAvailableDnode
(
pMnode
,
pDb
,
pVgroup
,
pArray
)
!=
0
)
{
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
goto
_OVER
;
goto
_OVER
;
}
}
...
@@ -728,6 +733,43 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) {
...
@@ -728,6 +733,43 @@ int32_t mndGetVnodesNum(SMnode *pMnode, int32_t dnodeId) {
return
numOfVnodes
;
return
numOfVnodes
;
}
}
int64_t
mndGetVgroupMemory
(
SMnode
*
pMnode
,
SDbObj
*
pDbInput
,
SVgObj
*
pVgroup
)
{
SDbObj
*
pDb
=
pDbInput
;
if
(
pDbInput
==
NULL
)
{
pDb
=
mndAcquireDb
(
pMnode
,
pVgroup
->
dbName
);
}
int64_t
vgroupMemroy
=
(
int64_t
)
pDb
->
cfg
.
buffer
*
1024
*
1024
+
(
int64_t
)
pDb
->
cfg
.
pages
*
pDb
->
cfg
.
pageSize
*
1024
;
if
(
pDb
->
cfg
.
cacheLastRow
>
0
)
{
vgroupMemroy
+=
(
int64_t
)
pDb
->
cfg
.
lastRowMem
*
1024
*
1024
;
}
if
(
pDbInput
==
NULL
)
{
mndReleaseDb
(
pMnode
,
pDb
);
}
return
vgroupMemroy
;
}
static
bool
mndGetVnodeMemroyFp
(
SMnode
*
pMnode
,
void
*
pObj
,
void
*
p1
,
void
*
p2
,
void
*
p3
)
{
SVgObj
*
pVgroup
=
pObj
;
int32_t
dnodeId
=
*
(
int32_t
*
)
p1
;
int64_t
*
pVnodeMemory
=
(
int64_t
*
)
p2
;
for
(
int32_t
v
=
0
;
v
<
pVgroup
->
replica
;
++
v
)
{
if
(
pVgroup
->
vnodeGid
[
v
].
dnodeId
==
dnodeId
)
{
*
pVnodeMemory
+=
mndGetVgroupMemory
(
pMnode
,
NULL
,
pVgroup
);
}
}
return
true
;
}
int64_t
mndGetVnodesMemory
(
SMnode
*
pMnode
,
int32_t
dnodeId
)
{
int64_t
vnodeMemory
=
0
;
sdbTraverse
(
pMnode
->
pSdb
,
SDB_VGROUP
,
mndGetVnodeMemroyFp
,
&
dnodeId
,
&
vnodeMemory
,
NULL
);
return
vnodeMemory
;
}
static
int32_t
mndRetrieveVnodes
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
static
int32_t
mndRetrieveVnodes
(
SRpcMsg
*
pReq
,
SShowObj
*
pShow
,
SSDataBlock
*
pBlock
,
int32_t
rows
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
@@ -807,9 +849,20 @@ int32_t mndAddVnodeToVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray) {
...
@@ -807,9 +849,20 @@ int32_t mndAddVnodeToVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray) {
return
-
1
;
return
-
1
;
}
}
int64_t
vgMem
=
mndGetVgroupMemory
(
pMnode
,
NULL
,
pVgroup
);
if
(
pDnode
->
memAvail
-
vgMem
-
pDnode
->
memUsed
<=
0
)
{
mError
(
"db:%s, vgId:%d, no enough memory:%"
PRId64
" in dnode:%d avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
vgMem
,
pDnode
->
id
,
pDnode
->
memAvail
,
pDnode
->
memUsed
);
terrno
=
TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE
;
return
-
1
;
}
else
{
pDnode
->
memUsed
+=
vgMem
;
}
pVgid
->
dnodeId
=
pDnode
->
id
;
pVgid
->
dnodeId
=
pDnode
->
id
;
pVgid
->
role
=
TAOS_SYNC_STATE_ERROR
;
pVgid
->
role
=
TAOS_SYNC_STATE_ERROR
;
mInfo
(
"db:%s, vgId:%d, vn:%d dnode:%d, is added"
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
pVgroup
->
replica
,
pVgid
->
dnodeId
);
mInfo
(
"db:%s, vgId:%d, vn:%d is added, memory:%"
PRId64
", dnode:%d avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
pVgroup
->
replica
,
vgMem
,
pVgid
->
dnodeId
,
pDnode
->
memAvail
,
pDnode
->
memUsed
);
pVgroup
->
replica
++
;
pVgroup
->
replica
++
;
pDnode
->
numOfVnodes
++
;
pDnode
->
numOfVnodes
++
;
...
@@ -835,7 +888,10 @@ int32_t mndRemoveVnodeFromVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray
...
@@ -835,7 +888,10 @@ int32_t mndRemoveVnodeFromVgroup(SMnode *pMnode, SVgObj *pVgroup, SArray *pArray
for
(
int32_t
vn
=
0
;
vn
<
pVgroup
->
replica
;
++
vn
)
{
for
(
int32_t
vn
=
0
;
vn
<
pVgroup
->
replica
;
++
vn
)
{
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
vn
];
SVnodeGid
*
pVgid
=
&
pVgroup
->
vnodeGid
[
vn
];
if
(
pVgid
->
dnodeId
==
pDnode
->
id
)
{
if
(
pVgid
->
dnodeId
==
pDnode
->
id
)
{
mInfo
(
"db:%s, vgId:%d, vn:%d dnode:%d, is removed"
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
vn
,
pVgid
->
dnodeId
);
int64_t
vgMem
=
mndGetVgroupMemory
(
pMnode
,
NULL
,
pVgroup
);
pDnode
->
memUsed
-=
vgMem
;
mInfo
(
"db:%s, vgId:%d, vn:%d is removed, memory:%"
PRId64
", dnode:%d avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
vn
,
vgMem
,
pVgid
->
dnodeId
,
pDnode
->
memAvail
,
pDnode
->
memUsed
);
pDnode
->
numOfVnodes
--
;
pDnode
->
numOfVnodes
--
;
pVgroup
->
replica
--
;
pVgroup
->
replica
--
;
*
pDelVgid
=
*
pVgid
;
*
pDelVgid
=
*
pVgid
;
...
@@ -1161,6 +1217,17 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
...
@@ -1161,6 +1217,17 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
goto
_OVER
;
goto
_OVER
;
}
}
int64_t
vgMem
=
mndGetVgroupMemory
(
pMnode
,
NULL
,
pVgroup
);
if
(
pNew1
->
memAvail
-
vgMem
-
pNew1
->
memUsed
<=
0
)
{
mError
(
"db:%s, vgId:%d, no enough memory:%"
PRId64
" in dnode:%d avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
vgMem
,
pNew1
->
id
,
pNew1
->
memAvail
,
pNew1
->
memUsed
);
terrno
=
TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE
;
return
-
1
;
}
else
{
pNew1
->
memUsed
+=
vgMem
;
}
if
(
mndAddIncVgroupReplicaToTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pNew1
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddIncVgroupReplicaToTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pNew1
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddDecVgroupReplicaFromTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pOld1
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddDecVgroupReplicaFromTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pOld1
->
id
)
!=
0
)
goto
_OVER
;
}
}
...
@@ -1173,6 +1240,15 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
...
@@ -1173,6 +1240,15 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
goto
_OVER
;
goto
_OVER
;
}
}
int64_t
vgMem
=
mndGetVgroupMemory
(
pMnode
,
NULL
,
pVgroup
);
if
(
pNew2
->
memAvail
-
vgMem
-
pNew2
->
memUsed
<=
0
)
{
mError
(
"db:%s, vgId:%d, no enough memory:%"
PRId64
" in dnode:%d avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
vgMem
,
pNew2
->
id
,
pNew2
->
memAvail
,
pNew2
->
memUsed
);
terrno
=
TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE
;
return
-
1
;
}
else
{
pNew2
->
memUsed
+=
vgMem
;
}
if
(
mndAddIncVgroupReplicaToTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pNew2
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddIncVgroupReplicaToTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pNew2
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddDecVgroupReplicaFromTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pOld2
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddDecVgroupReplicaFromTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pOld2
->
id
)
!=
0
)
goto
_OVER
;
}
}
...
@@ -1185,6 +1261,15 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
...
@@ -1185,6 +1261,15 @@ static int32_t mndRedistributeVgroup(SMnode *pMnode, SRpcMsg *pReq, SDbObj *pDb,
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
terrno
=
TSDB_CODE_MND_NO_ENOUGH_DNODES
;
goto
_OVER
;
goto
_OVER
;
}
}
int64_t
vgMem
=
mndGetVgroupMemory
(
pMnode
,
NULL
,
pVgroup
);
if
(
pNew3
->
memAvail
-
vgMem
-
pNew3
->
memUsed
<=
0
)
{
mError
(
"db:%s, vgId:%d, no enough memory:%"
PRId64
" in dnode:%d avail:%"
PRId64
" used:%"
PRId64
,
pVgroup
->
dbName
,
pVgroup
->
vgId
,
vgMem
,
pNew3
->
id
,
pNew3
->
memAvail
,
pNew3
->
memUsed
);
terrno
=
TSDB_CODE_MND_NO_ENOUGH_MEM_IN_DNODE
;
return
-
1
;
}
else
{
pNew3
->
memUsed
+=
vgMem
;
}
if
(
mndAddIncVgroupReplicaToTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pNew3
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddIncVgroupReplicaToTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pNew3
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddDecVgroupReplicaFromTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pOld3
->
id
)
!=
0
)
goto
_OVER
;
if
(
mndAddDecVgroupReplicaFromTrans
(
pMnode
,
pTrans
,
pDb
,
&
newVg
,
pOld3
->
id
)
!=
0
)
goto
_OVER
;
}
}
...
@@ -1415,7 +1500,7 @@ _OVER:
...
@@ -1415,7 +1500,7 @@ _OVER:
mndReleaseDb
(
pMnode
,
pDb
);
mndReleaseDb
(
pMnode
,
pDb
);
return
code
;
return
code
;
#endif
#endif
}
}
int32_t
mndBuildAlterVgroupAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
SArray
*
pArray
)
{
int32_t
mndBuildAlterVgroupAction
(
SMnode
*
pMnode
,
STrans
*
pTrans
,
SDbObj
*
pDb
,
SVgObj
*
pVgroup
,
SArray
*
pArray
)
{
...
@@ -1654,9 +1739,9 @@ static int32_t mndBalanceVgroupBetweenDnode(SMnode *pMnode, STrans *pTrans, SDno
...
@@ -1654,9 +1739,9 @@ static int32_t mndBalanceVgroupBetweenDnode(SMnode *pMnode, STrans *pTrans, SDno
}
}
static
int32_t
mndBalanceVgroup
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SArray
*
pArray
)
{
static
int32_t
mndBalanceVgroup
(
SMnode
*
pMnode
,
SRpcMsg
*
pReq
,
SArray
*
pArray
)
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
int32_t
numOfVgroups
=
0
;
int32_t
numOfVgroups
=
0
;
STrans
*
pTrans
=
NULL
;
STrans
*
pTrans
=
NULL
;
SHashObj
*
pBalancedVgroups
=
NULL
;
SHashObj
*
pBalancedVgroups
=
NULL
;
pBalancedVgroups
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
false
,
HASH_NO_LOCK
);
pBalancedVgroups
=
taosHashInit
(
16
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
false
,
HASH_NO_LOCK
);
...
@@ -1721,7 +1806,7 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) {
...
@@ -1721,7 +1806,7 @@ static int32_t mndProcessBalanceVgroupMsg(SRpcMsg *pReq) {
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SArray
*
pArray
=
NULL
;
SArray
*
pArray
=
NULL
;
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
int64_t
curMs
=
taosGetTimestampMs
();
int64_t
curMs
=
taosGetTimestampMs
();
SBalanceVgroupReq
req
=
{
0
};
SBalanceVgroupReq
req
=
{
0
};
...
@@ -1766,7 +1851,7 @@ _OVER:
...
@@ -1766,7 +1851,7 @@ _OVER:
taosArrayDestroy
(
pArray
);
taosArrayDestroy
(
pArray
);
return
code
;
return
code
;
#endif
#endif
}
}
bool
mndVgroupInDb
(
SVgObj
*
pVgroup
,
int64_t
dbUid
)
{
return
!
pVgroup
->
isTsma
&&
pVgroup
->
dbUid
==
dbUid
;
}
bool
mndVgroupInDb
(
SVgObj
*
pVgroup
,
int64_t
dbUid
)
{
return
!
pVgroup
->
isTsma
&&
pVgroup
->
dbUid
==
dbUid
;
}
\ No newline at end of file
source/dnode/vnode/inc/vnode.h
浏览文件 @
406d35d4
...
@@ -128,7 +128,7 @@ bool tsdbNextDataBlock(STsdbReader *pReader);
...
@@ -128,7 +128,7 @@ bool tsdbNextDataBlock(STsdbReader *pReader);
void
tsdbRetrieveDataBlockInfo
(
STsdbReader
*
pReader
,
SDataBlockInfo
*
pDataBlockInfo
);
void
tsdbRetrieveDataBlockInfo
(
STsdbReader
*
pReader
,
SDataBlockInfo
*
pDataBlockInfo
);
int32_t
tsdbRetrieveDataBlockStatisInfo
(
STsdbReader
*
pReader
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
);
int32_t
tsdbRetrieveDataBlockStatisInfo
(
STsdbReader
*
pReader
,
SColumnDataAgg
***
pBlockStatis
,
bool
*
allHave
);
SArray
*
tsdbRetrieveDataBlock
(
STsdbReader
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
SArray
*
tsdbRetrieveDataBlock
(
STsdbReader
*
pTsdbReadHandle
,
SArray
*
pColumnIdList
);
void
tsdbResetReadHandle
(
STsdbReader
*
pReader
,
SQueryTableDataCond
*
pCond
,
int32_t
tWinIdx
);
int32_t
tsdbReaderReset
(
STsdbReader
*
pReader
,
SQueryTableDataCond
*
pCond
,
int32_t
tWinIdx
);
int32_t
tsdbGetFileBlocksDistInfo
(
STsdbReader
*
pReader
,
STableBlockDistInfo
*
pTableBlockInfo
);
int32_t
tsdbGetFileBlocksDistInfo
(
STsdbReader
*
pReader
,
STableBlockDistInfo
*
pTableBlockInfo
);
int64_t
tsdbGetNumOfRowsInMemTable
(
STsdbReader
*
pHandle
);
int64_t
tsdbGetNumOfRowsInMemTable
(
STsdbReader
*
pHandle
);
...
...
source/dnode/vnode/src/sma/smaCommit.c
浏览文件 @
406d35d4
...
@@ -83,8 +83,8 @@ int32_t smaBegin(SSma *pSma) {
...
@@ -83,8 +83,8 @@ int32_t smaBegin(SSma *pSma) {
/**
/**
* @brief pre-commit for rollup sma.
* @brief pre-commit for rollup sma.
* 1) set trigger stat of rsma timer TASK_TRIGGER_STAT_PAUSED.
* 1) set trigger stat of rsma timer TASK_TRIGGER_STAT_PAUSED.
* 2)
perform persist task for qTaskInfo
* 2)
wait all triggered fetch tasks finished
* 3)
wait all triggered fetch tasks finished
* 3)
perform persist task for qTaskInfo
*
*
* @param pSma
* @param pSma
* @return int32_t
* @return int32_t
...
@@ -102,10 +102,7 @@ static int32_t tdProcessRSmaPreCommitImpl(SSma *pSma) {
...
@@ -102,10 +102,7 @@ static int32_t tdProcessRSmaPreCommitImpl(SSma *pSma) {
// step 1: set persistence task paused
// step 1: set persistence task paused
atomic_store_8
(
RSMA_TRIGGER_STAT
(
pRSmaStat
),
TASK_TRIGGER_STAT_PAUSED
);
atomic_store_8
(
RSMA_TRIGGER_STAT
(
pRSmaStat
),
TASK_TRIGGER_STAT_PAUSED
);
// step 2: perform persist task for qTaskInfo
// step 2: wait all triggered fetch tasks finished
tdRSmaPersistExecImpl
(
pRSmaStat
);
// step 3: wait all triggered fetch tasks finished
int32_t
nLoops
=
0
;
int32_t
nLoops
=
0
;
while
(
1
)
{
while
(
1
)
{
if
(
T_REF_VAL_GET
(
pStat
)
==
0
)
{
if
(
T_REF_VAL_GET
(
pStat
)
==
0
)
{
...
@@ -121,6 +118,9 @@ static int32_t tdProcessRSmaPreCommitImpl(SSma *pSma) {
...
@@ -121,6 +118,9 @@ static int32_t tdProcessRSmaPreCommitImpl(SSma *pSma) {
}
}
}
}
// step 3: perform persist task for qTaskInfo
tdRSmaPersistExecImpl
(
pRSmaStat
);
smaDebug
(
"vgId:%d, rsma pre commit succeess"
,
SMA_VID
(
pSma
));
smaDebug
(
"vgId:%d, rsma pre commit succeess"
,
SMA_VID
(
pSma
));
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
...
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
406d35d4
...
@@ -915,9 +915,9 @@ static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *
...
@@ -915,9 +915,9 @@ static int32_t tdRSmaQTaskInfoItemRestore(SSma *pSma, const SRSmaQTaskInfoItem *
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
if
(
pItem
->
type
==
1
)
{
if
(
pItem
->
type
==
TSDB_RETENTION_L
1
)
{
qTaskInfo
=
pRSmaInfo
->
items
[
0
].
taskInfo
;
qTaskInfo
=
pRSmaInfo
->
items
[
0
].
taskInfo
;
}
else
if
(
pItem
->
type
==
2
)
{
}
else
if
(
pItem
->
type
==
TSDB_RETENTION_L
2
)
{
qTaskInfo
=
pRSmaInfo
->
items
[
1
].
taskInfo
;
qTaskInfo
=
pRSmaInfo
->
items
[
1
].
taskInfo
;
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
...
@@ -1233,7 +1233,6 @@ static void tdRSmaPersistTask(SRSmaStat *pRSmaStat) {
...
@@ -1233,7 +1233,6 @@ static void tdRSmaPersistTask(SRSmaStat *pRSmaStat) {
}
else
{
}
else
{
smaWarn
(
"vgId:%d, persist task in abnormal stat %"
PRIi8
,
SMA_VID
(
pRSmaStat
->
pSma
),
smaWarn
(
"vgId:%d, persist task in abnormal stat %"
PRIi8
,
SMA_VID
(
pRSmaStat
->
pSma
),
atomic_load_8
(
RSMA_TRIGGER_STAT
(
pRSmaStat
)));
atomic_load_8
(
RSMA_TRIGGER_STAT
(
pRSmaStat
)));
ASSERT
(
0
);
}
}
atomic_store_8
(
RSMA_RUNNING_STAT
(
pRSmaStat
),
0
);
atomic_store_8
(
RSMA_RUNNING_STAT
(
pRSmaStat
),
0
);
taosReleaseRef
(
smaMgmt
.
smaRef
,
pRSmaStat
->
refId
);
taosReleaseRef
(
smaMgmt
.
smaRef
,
pRSmaStat
->
refId
);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/dnode/vnode/src/tsdb/tsdbReaderWriter.c
浏览文件 @
406d35d4
...
@@ -345,8 +345,14 @@ int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData
...
@@ -345,8 +345,14 @@ int32_t tsdbReadDelData(SDelFReader *pReader, SDelIdx *pDelIdx, SArray *aDelData
ASSERT
(
pHdr
->
suid
==
pDelIdx
->
suid
);
ASSERT
(
pHdr
->
suid
==
pDelIdx
->
suid
);
ASSERT
(
pHdr
->
uid
==
pDelIdx
->
uid
);
ASSERT
(
pHdr
->
uid
==
pDelIdx
->
uid
);
n
+=
sizeof
(
*
pHdr
);
n
+=
sizeof
(
*
pHdr
);
taosArrayClear
(
aDelData
);
while
(
n
<
size
-
sizeof
(
TSCKSUM
))
{
while
(
n
<
size
-
sizeof
(
TSCKSUM
))
{
n
+=
tGetDelData
(
*
ppBuf
+
n
,
pDelData
);
n
+=
tGetDelData
(
*
ppBuf
+
n
,
pDelData
);
if
(
taosArrayPush
(
aDelData
,
pDelData
)
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_err
;
}
}
}
ASSERT
(
n
==
size
-
sizeof
(
TSCKSUM
));
ASSERT
(
n
==
size
-
sizeof
(
TSCKSUM
));
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
406d35d4
...
@@ -229,15 +229,15 @@ int32_t tCmprBlockIdx(void const *lhs, void const *rhs) {
...
@@ -229,15 +229,15 @@ int32_t tCmprBlockIdx(void const *lhs, void const *rhs) {
SBlockIdx
*
lBlockIdx
=
*
(
SBlockIdx
**
)
lhs
;
SBlockIdx
*
lBlockIdx
=
*
(
SBlockIdx
**
)
lhs
;
SBlockIdx
*
rBlockIdx
=
*
(
SBlockIdx
**
)
rhs
;
SBlockIdx
*
rBlockIdx
=
*
(
SBlockIdx
**
)
rhs
;
if
(
lBlockIdx
->
suid
<
l
BlockIdx
->
suid
)
{
if
(
lBlockIdx
->
suid
<
r
BlockIdx
->
suid
)
{
return
-
1
;
return
-
1
;
}
else
if
(
lBlockIdx
->
suid
>
l
BlockIdx
->
suid
)
{
}
else
if
(
lBlockIdx
->
suid
>
r
BlockIdx
->
suid
)
{
return
1
;
return
1
;
}
}
if
(
lBlockIdx
->
uid
<
l
BlockIdx
->
uid
)
{
if
(
lBlockIdx
->
uid
<
r
BlockIdx
->
uid
)
{
return
-
1
;
return
-
1
;
}
else
if
(
lBlockIdx
->
uid
>
l
BlockIdx
->
uid
)
{
}
else
if
(
lBlockIdx
->
uid
>
r
BlockIdx
->
uid
)
{
return
1
;
return
1
;
}
}
...
@@ -385,15 +385,15 @@ int32_t tCmprDelIdx(void const *lhs, void const *rhs) {
...
@@ -385,15 +385,15 @@ int32_t tCmprDelIdx(void const *lhs, void const *rhs) {
SDelIdx
*
lDelIdx
=
*
(
SDelIdx
**
)
lhs
;
SDelIdx
*
lDelIdx
=
*
(
SDelIdx
**
)
lhs
;
SDelIdx
*
rDelIdx
=
*
(
SDelIdx
**
)
rhs
;
SDelIdx
*
rDelIdx
=
*
(
SDelIdx
**
)
rhs
;
if
(
lDelIdx
->
suid
<
l
DelIdx
->
suid
)
{
if
(
lDelIdx
->
suid
<
r
DelIdx
->
suid
)
{
return
-
1
;
return
-
1
;
}
else
if
(
lDelIdx
->
suid
>
l
DelIdx
->
suid
)
{
}
else
if
(
lDelIdx
->
suid
>
r
DelIdx
->
suid
)
{
return
1
;
return
1
;
}
}
if
(
lDelIdx
->
uid
<
l
DelIdx
->
uid
)
{
if
(
lDelIdx
->
uid
<
r
DelIdx
->
uid
)
{
return
-
1
;
return
-
1
;
}
else
if
(
lDelIdx
->
uid
>
l
DelIdx
->
uid
)
{
}
else
if
(
lDelIdx
->
uid
>
r
DelIdx
->
uid
)
{
return
1
;
return
1
;
}
}
...
...
source/dnode/vnode/src/vnd/vnodeSync.c
浏览文件 @
406d35d4
...
@@ -256,70 +256,133 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
...
@@ -256,70 +256,133 @@ int32_t vnodeProcessSyncReq(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
SRpcMsg
*
pRpcMsg
=
pMsg
;
SRpcMsg
*
pRpcMsg
=
pMsg
;
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_TIMEOUT
)
{
// ToDo: ugly! use function pointer
SyncTimeout
*
pSyncMsg
=
syncTimeoutFromRpcMsg2
(
pRpcMsg
);
// use different strategy
assert
(
pSyncMsg
!=
NULL
);
if
(
syncNodeStrategy
(
pSyncNode
)
==
SYNC_STRATEGY_NO_SNAPSHOT
)
{
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_TIMEOUT
)
{
ret
=
syncNodeOnTimeoutCb
(
pSyncNode
,
pSyncMsg
);
SyncTimeout
*
pSyncMsg
=
syncTimeoutFromRpcMsg2
(
pRpcMsg
);
syncTimeoutDestroy
(
pSyncMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnTimeoutCb
(
pSyncNode
,
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_PING
)
{
syncTimeoutDestroy
(
pSyncMsg
);
SyncPing
*
pSyncMsg
=
syncPingFromRpcMsg2
(
pRpcMsg
);
assert
(
pSyncMsg
!=
NULL
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_PING
)
{
SyncPing
*
pSyncMsg
=
syncPingFromRpcMsg2
(
pRpcMsg
);
ret
=
syncNodeOnPingCb
(
pSyncNode
,
pSyncMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
syncPingDestroy
(
pSyncMsg
);
ret
=
syncNodeOnPingCb
(
pSyncNode
,
pSyncMsg
);
syncPingDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_PING_REPLY
)
{
SyncPingReply
*
pSyncMsg
=
syncPingReplyFromRpcMsg2
(
pRpcMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_PING_REPLY
)
{
assert
(
pSyncMsg
!=
NULL
);
SyncPingReply
*
pSyncMsg
=
syncPingReplyFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnPingReplyCb
(
pSyncNode
,
pSyncMsg
);
ret
=
syncNodeOnPingReplyCb
(
pSyncNode
,
pSyncMsg
);
syncPingReplyDestroy
(
pSyncMsg
);
syncPingReplyDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_CLIENT_REQUEST
)
{
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_CLIENT_REQUEST
)
{
SyncClientRequest
*
pSyncMsg
=
syncClientRequestFromRpcMsg2
(
pRpcMsg
);
SyncClientRequest
*
pSyncMsg
=
syncClientRequestFromRpcMsg2
(
pRpcMsg
);
assert
(
pSyncMsg
!=
NULL
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnClientRequestCb
(
pSyncNode
,
pSyncMsg
,
NULL
);
ret
=
syncNodeOnClientRequestCb
(
pSyncNode
,
pSyncMsg
,
NULL
);
syncClientRequestDestroy
(
pSyncMsg
);
syncClientRequestDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_REQUEST_VOTE
)
{
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_REQUEST_VOTE
)
{
SyncRequestVote
*
pSyncMsg
=
syncRequestVoteFromRpcMsg2
(
pRpcMsg
);
SyncRequestVote
*
pSyncMsg
=
syncRequestVoteFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
assert
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnRequestVoteCb
(
pSyncNode
,
pSyncMsg
);
syncRequestVoteDestroy
(
pSyncMsg
);
ret
=
syncNodeOnRequestVoteCb
(
pSyncNode
,
pSyncMsg
);
syncRequestVoteDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_REQUEST_VOTE_REPLY
)
{
SyncRequestVoteReply
*
pSyncMsg
=
syncRequestVoteReplyFromRpcMsg2
(
pRpcMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_REQUEST_VOTE_REPLY
)
{
ASSERT
(
pSyncMsg
!=
NULL
);
SyncRequestVoteReply
*
pSyncMsg
=
syncRequestVoteReplyFromRpcMsg2
(
pRpcMsg
);
ret
=
syncNodeOnRequestVoteReplyCb
(
pSyncNode
,
pSyncMsg
);
assert
(
pSyncMsg
!=
NULL
);
syncRequestVoteReplyDestroy
(
pSyncMsg
);
ret
=
syncNodeOnRequestVoteReplyCb
(
pSyncNode
,
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_APPEND_ENTRIES
)
{
syncRequestVoteReplyDestroy
(
pSyncMsg
);
SyncAppendEntries
*
pSyncMsg
=
syncAppendEntriesFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_APPEND_ENTRIES
)
{
ret
=
syncNodeOnAppendEntriesCb
(
pSyncNode
,
pSyncMsg
);
SyncAppendEntries
*
pSyncMsg
=
syncAppendEntriesFromRpcMsg2
(
pRpcMsg
);
syncAppendEntriesDestroy
(
pSyncMsg
);
assert
(
pSyncMsg
!=
NULL
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_APPEND_ENTRIES_REPLY
)
{
ret
=
syncNodeOnAppendEntriesCb
(
pSyncNode
,
pSyncMsg
);
SyncAppendEntriesReply
*
pSyncMsg
=
syncAppendEntriesReplyFromRpcMsg2
(
pRpcMsg
);
syncAppendEntriesDestroy
(
pSyncMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnAppendEntriesReplyCb
(
pSyncNode
,
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_APPEND_ENTRIES_REPLY
)
{
syncAppendEntriesReplyDestroy
(
pSyncMsg
);
SyncAppendEntriesReply
*
pSyncMsg
=
syncAppendEntriesReplyFromRpcMsg2
(
pRpcMsg
);
assert
(
pSyncMsg
!=
NULL
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_SET_VNODE_STANDBY
)
{
ret
=
vnodeSetStandBy
(
pVnode
);
ret
=
syncNodeOnAppendEntriesReplyCb
(
pSyncNode
,
pSyncMsg
);
if
(
ret
!=
0
&&
terrno
!=
0
)
ret
=
terrno
;
syncAppendEntriesReplyDestroy
(
pSyncMsg
);
SRpcMsg
rsp
=
{.
code
=
ret
,
.
info
=
pMsg
->
info
};
tmsgSendRsp
(
&
rsp
);
}
else
{
vError
(
"==vnodeProcessSyncReq== error msg type:%d"
,
pRpcMsg
->
msgType
);
ret
=
-
1
;
}
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_SET_VNODE_STANDBY
)
{
ret
=
vnodeSetStandBy
(
pVnode
);
if
(
ret
!=
0
&&
terrno
!=
0
)
ret
=
terrno
;
SRpcMsg
rsp
=
{.
code
=
ret
,
.
info
=
pMsg
->
info
};
tmsgSendRsp
(
&
rsp
);
}
else
{
}
else
{
vError
(
"==vnodeProcessSyncReq== error msg type:%d"
,
pRpcMsg
->
msgType
);
// use wal first strategy
ret
=
-
1
;
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_TIMEOUT
)
{
SyncTimeout
*
pSyncMsg
=
syncTimeoutFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnTimeoutCb
(
pSyncNode
,
pSyncMsg
);
syncTimeoutDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_PING
)
{
SyncPing
*
pSyncMsg
=
syncPingFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnPingCb
(
pSyncNode
,
pSyncMsg
);
syncPingDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_PING_REPLY
)
{
SyncPingReply
*
pSyncMsg
=
syncPingReplyFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnPingReplyCb
(
pSyncNode
,
pSyncMsg
);
syncPingReplyDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_CLIENT_REQUEST
)
{
SyncClientRequest
*
pSyncMsg
=
syncClientRequestFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnClientRequestCb
(
pSyncNode
,
pSyncMsg
,
NULL
);
syncClientRequestDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_CLIENT_REQUEST_BATCH
)
{
SyncClientRequestBatch
*
pSyncMsg
=
syncClientRequestBatchFromRpcMsg
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnClientRequestBatchCb
(
pSyncNode
,
pSyncMsg
);
syncClientRequestBatchDestroyDeep
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_REQUEST_VOTE
)
{
SyncRequestVote
*
pSyncMsg
=
syncRequestVoteFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnRequestVoteCb
(
pSyncNode
,
pSyncMsg
);
syncRequestVoteDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_REQUEST_VOTE_REPLY
)
{
SyncRequestVoteReply
*
pSyncMsg
=
syncRequestVoteReplyFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnRequestVoteReplyCb
(
pSyncNode
,
pSyncMsg
);
syncRequestVoteReplyDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_APPEND_ENTRIES_BATCH
)
{
SyncAppendEntriesBatch
*
pSyncMsg
=
syncAppendEntriesBatchFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnAppendEntriesSnapshot2Cb
(
pSyncNode
,
pSyncMsg
);
syncAppendEntriesBatchDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_APPEND_ENTRIES_REPLY
)
{
SyncAppendEntriesReply
*
pSyncMsg
=
syncAppendEntriesReplyFromRpcMsg2
(
pRpcMsg
);
ASSERT
(
pSyncMsg
!=
NULL
);
ret
=
syncNodeOnAppendEntriesReplySnapshot2Cb
(
pSyncNode
,
pSyncMsg
);
syncAppendEntriesReplyDestroy
(
pSyncMsg
);
}
else
if
(
pRpcMsg
->
msgType
==
TDMT_SYNC_SET_VNODE_STANDBY
)
{
ret
=
vnodeSetStandBy
(
pVnode
);
if
(
ret
!=
0
&&
terrno
!=
0
)
ret
=
terrno
;
SRpcMsg
rsp
=
{.
code
=
ret
,
.
info
=
pMsg
->
info
};
tmsgSendRsp
(
&
rsp
);
}
else
{
vError
(
"==vnodeProcessSyncReq== error msg type:%d"
,
pRpcMsg
->
msgType
);
ret
=
-
1
;
}
}
}
syncNodeRelease
(
pSyncNode
);
syncNodeRelease
(
pSyncNode
);
...
@@ -415,7 +478,7 @@ static int32_t vnodeSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) { ret
...
@@ -415,7 +478,7 @@ static int32_t vnodeSnapshotStopRead(struct SSyncFSM *pFsm, void *pReader) { ret
static
int32_t
vnodeSnapshotDoRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
,
void
**
ppBuf
,
int32_t
*
len
)
{
return
0
;
}
static
int32_t
vnodeSnapshotDoRead
(
struct
SSyncFSM
*
pFsm
,
void
*
pReader
,
void
**
ppBuf
,
int32_t
*
len
)
{
return
0
;
}
static
int32_t
vnodeSnapshotStartWrite
(
struct
SSyncFSM
*
pFsm
,
void
**
ppWriter
)
{
return
0
;
}
static
int32_t
vnodeSnapshotStartWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pParam
,
void
*
*
ppWriter
)
{
return
0
;
}
static
int32_t
vnodeSnapshotStopWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
bool
isApply
)
{
return
0
;
}
static
int32_t
vnodeSnapshotStopWrite
(
struct
SSyncFSM
*
pFsm
,
void
*
pWriter
,
bool
isApply
)
{
return
0
;
}
...
@@ -442,7 +505,8 @@ static SSyncFSM *vnodeSyncMakeFsm(SVnode *pVnode) {
...
@@ -442,7 +505,8 @@ static SSyncFSM *vnodeSyncMakeFsm(SVnode *pVnode) {
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
)
{
int32_t
vnodeSyncOpen
(
SVnode
*
pVnode
,
char
*
path
)
{
SSyncInfo
syncInfo
=
{
SSyncInfo
syncInfo
=
{
.
snapshotEnable
=
false
,
.
snapshotStrategy
=
SYNC_STRATEGY_NO_SNAPSHOT
,
.
batchSize
=
10
,
.
vgId
=
pVnode
->
config
.
vgId
,
.
vgId
=
pVnode
->
config
.
vgId
,
.
isStandBy
=
pVnode
->
config
.
standby
,
.
isStandBy
=
pVnode
->
config
.
standby
,
.
syncCfg
=
pVnode
->
config
.
syncCfg
,
.
syncCfg
=
pVnode
->
config
.
syncCfg
,
...
...
source/libs/command/inc/commandInt.h
浏览文件 @
406d35d4
...
@@ -29,13 +29,17 @@ extern "C" {
...
@@ -29,13 +29,17 @@ extern "C" {
#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s"
#define EXPLAIN_TAG_SCAN_FORMAT "Tag Scan on %s"
#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s"
#define EXPLAIN_TBL_SCAN_FORMAT "Table Scan on %s"
#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s"
#define EXPLAIN_SYSTBL_SCAN_FORMAT "System Table Scan on %s"
#define EXPLAIN_DISTBLK_SCAN_FORMAT "Block Dist Scan on %s"
#define EXPLAIN_LASTROW_SCAN_FORMAT "Last Row Scan on %s"
#define EXPLAIN_PROJECTION_FORMAT "Projection"
#define EXPLAIN_PROJECTION_FORMAT "Projection"
#define EXPLAIN_JOIN_FORMAT "%s"
#define EXPLAIN_JOIN_FORMAT "%s"
#define EXPLAIN_AGG_FORMAT "Aggragate"
#define EXPLAIN_AGG_FORMAT "Aggragate"
#define EXPLAIN_INDEF_ROWS_FORMAT "Indefinite Rows Function"
#define EXPLAIN_INDEF_ROWS_FORMAT "Indefinite Rows Function"
#define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1"
#define EXPLAIN_EXCHANGE_FORMAT "Data Exchange %d:1"
#define EXPLAIN_SORT_FORMAT "Sort"
#define EXPLAIN_SORT_FORMAT "Sort"
#define EXPLAIN_GROUP_SORT_FORMAT "Group Sort"
#define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s"
#define EXPLAIN_INTERVAL_FORMAT "Interval on Column %s"
#define EXPLAIN_MERGE_INTERVAL_FORMAT "Merge Interval on Column %s"
#define EXPLAIN_FILL_FORMAT "Fill"
#define EXPLAIN_FILL_FORMAT "Fill"
#define EXPLAIN_SESSION_FORMAT "Session"
#define EXPLAIN_SESSION_FORMAT "Session"
#define EXPLAIN_STATE_WINDOW_FORMAT "StateWindow on Column %s"
#define EXPLAIN_STATE_WINDOW_FORMAT "StateWindow on Column %s"
...
@@ -62,10 +66,12 @@ extern "C" {
...
@@ -62,10 +66,12 @@ extern "C" {
#define EXPLAIN_COST_FORMAT "cost=%.2f..%.2f"
#define EXPLAIN_COST_FORMAT "cost=%.2f..%.2f"
#define EXPLAIN_ROWS_FORMAT "rows=%" PRIu64
#define EXPLAIN_ROWS_FORMAT "rows=%" PRIu64
#define EXPLAIN_COLUMNS_FORMAT "columns=%d"
#define EXPLAIN_COLUMNS_FORMAT "columns=%d"
#define EXPLAIN_PSEUDO_COLUMNS_FORMAT "pseudo_columns=%d"
#define EXPLAIN_WIDTH_FORMAT "width=%d"
#define EXPLAIN_WIDTH_FORMAT "width=%d"
#define EXPLAIN_TABLE_SCAN_FORMAT "order=[asc|%d desc|%d]"
#define EXPLAIN_TABLE_SCAN_FORMAT "order=[asc|%d desc|%d]"
#define EXPLAIN_GROUPS_FORMAT "groups=%d"
#define EXPLAIN_GROUPS_FORMAT "groups=%d"
#define EXPLAIN_WIDTH_FORMAT "width=%d"
#define EXPLAIN_WIDTH_FORMAT "width=%d"
#define EXPLAIN_INTERVAL_VALUE_FORMAT "interval=%" PRId64 "%c"
#define EXPLAIN_FUNCTIONS_FORMAT "functions=%d"
#define EXPLAIN_FUNCTIONS_FORMAT "functions=%d"
#define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64
#define EXPLAIN_EXECINFO_FORMAT "cost=%.3f..%.3f rows=%" PRIu64
#define EXPLAIN_MODE_FORMAT "mode=%s"
#define EXPLAIN_MODE_FORMAT "mode=%s"
...
...
source/libs/command/src/explain.c
浏览文件 @
406d35d4
...
@@ -199,6 +199,31 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo
...
@@ -199,6 +199,31 @@ int32_t qExplainGenerateResChildren(SPhysiNode *pNode, SExplainGroup *group, SNo
pPhysiChildren
=
mergePhysiNode
->
scan
.
node
.
pChildren
;
pPhysiChildren
=
mergePhysiNode
->
scan
.
node
.
pChildren
;
break
;
break
;
}
}
case
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN
:
{
SBlockDistScanPhysiNode
*
distPhysiNode
=
(
SBlockDistScanPhysiNode
*
)
pNode
;
pPhysiChildren
=
distPhysiNode
->
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN
:
{
SLastRowScanPhysiNode
*
lastRowPhysiNode
=
(
SLastRowScanPhysiNode
*
)
pNode
;
pPhysiChildren
=
lastRowPhysiNode
->
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT
:
{
SGroupSortPhysiNode
*
groupSortPhysiNode
=
(
SGroupSortPhysiNode
*
)
pNode
;
pPhysiChildren
=
groupSortPhysiNode
->
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL
:
{
SMergeIntervalPhysiNode
*
mergeIntPhysiNode
=
(
SMergeIntervalPhysiNode
*
)
pNode
;
pPhysiChildren
=
mergeIntPhysiNode
->
window
.
node
.
pChildren
;
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC
:
{
SInterpFuncPhysiNode
*
interpPhysiNode
=
(
SInterpFuncPhysiNode
*
)
pNode
;
pPhysiChildren
=
interpPhysiNode
->
node
.
pChildren
;
break
;
}
default:
default:
qError
(
"not supported physical node type %d"
,
pNode
->
type
);
qError
(
"not supported physical node type %d"
,
pNode
->
type
);
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
...
@@ -378,6 +403,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
...
@@ -378,6 +403,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pTagScanNode
->
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pTagScanNode
->
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
if
(
pTagScanNode
->
pScanPseudoCols
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pTagScanNode
->
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pTagScanNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pTagScanNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
EXPLAIN_ROW_END
();
...
@@ -415,6 +444,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
...
@@ -415,6 +444,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pTblScanNode
->
scan
.
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pTblScanNode
->
scan
.
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
if
(
pTblScanNode
->
scan
.
pScanPseudoCols
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pTblScanNode
->
scan
.
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pTblScanNode
->
scan
.
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pTblScanNode
->
scan
.
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_TABLE_SCAN_FORMAT
,
pTblScanNode
->
scanSeq
[
0
],
pTblScanNode
->
scanSeq
[
1
]);
EXPLAIN_ROW_APPEND
(
EXPLAIN_TABLE_SCAN_FORMAT
,
pTblScanNode
->
scanSeq
[
0
],
pTblScanNode
->
scanSeq
[
1
]);
...
@@ -516,6 +549,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
...
@@ -516,6 +549,10 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pSTblScanNode
->
scan
.
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pSTblScanNode
->
scan
.
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
if
(
pSTblScanNode
->
scan
.
pScanPseudoCols
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pSTblScanNode
->
scan
.
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pSTblScanNode
->
scan
.
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pSTblScanNode
->
scan
.
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
...
@@ -1131,6 +1168,258 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
...
@@ -1131,6 +1168,258 @@ int32_t qExplainResNodeToRowsImpl(SExplainResNode *pResNode, SExplainCtx *ctx, i
}
}
break
;
break
;
}
}
case
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN
:
{
SBlockDistScanPhysiNode
*
pDistScanNode
=
(
SBlockDistScanPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_DISTBLK_SCAN_FORMAT
,
pDistScanNode
->
tableName
.
tname
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pDistScanNode
->
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
if
(
pDistScanNode
->
pScanPseudoCols
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pDistScanNode
->
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pDistScanNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pDistScanNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pDistScanNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pDistScanNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pDistScanNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_LAST_ROW_SCAN
:
{
SLastRowScanPhysiNode
*
pLastRowNode
=
(
SLastRowScanPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_LASTROW_SCAN_FORMAT
,
pLastRowNode
->
tableName
.
tname
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
pLastRowNode
->
pScanCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
if
(
pLastRowNode
->
pScanPseudoCols
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_PSEUDO_COLUMNS_FORMAT
,
pLastRowNode
->
pScanPseudoCols
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pLastRowNode
->
node
.
pOutputDataBlockDesc
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pLastRowNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pLastRowNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pLastRowNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pLastRowNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT
:
{
SGroupSortPhysiNode
*
pSortNode
=
(
SGroupSortPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_GROUP_SORT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
SDataBlockDescNode
*
pDescNode
=
pSortNode
->
node
.
pOutputDataBlockDesc
;
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pDescNode
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pDescNode
->
totalRowSize
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
EXPLAIN_MODE_ANALYZE
==
ctx
->
mode
)
{
// sort key
EXPLAIN_ROW_NEW
(
level
+
1
,
"Sort Key: "
);
if
(
pResNode
->
pExecInfo
)
{
for
(
int32_t
i
=
0
;
i
<
LIST_LENGTH
(
pSortNode
->
pSortKeys
);
++
i
)
{
SOrderByExprNode
*
ptn
=
(
SOrderByExprNode
*
)
nodesListGetNode
(
pSortNode
->
pSortKeys
,
i
);
EXPLAIN_ROW_APPEND
(
"%s "
,
nodesGetNameFromColumnNode
(
ptn
->
pExpr
));
}
}
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
// sort method
EXPLAIN_ROW_NEW
(
level
+
1
,
"Sort Method: "
);
int32_t
nodeNum
=
taosArrayGetSize
(
pResNode
->
pExecInfo
);
SExplainExecInfo
*
execInfo
=
taosArrayGet
(
pResNode
->
pExecInfo
,
0
);
SSortExecInfo
*
pExecInfo
=
(
SSortExecInfo
*
)
execInfo
->
verboseInfo
;
EXPLAIN_ROW_APPEND
(
"%s"
,
pExecInfo
->
sortMethod
==
SORT_QSORT_T
?
"quicksort"
:
"merge sort"
);
if
(
pExecInfo
->
sortBuffer
>
1024
*
1024
)
{
EXPLAIN_ROW_APPEND
(
" Buffers:%.2f Mb"
,
pExecInfo
->
sortBuffer
/
(
1024
*
1024
.
0
));
}
else
if
(
pExecInfo
->
sortBuffer
>
1024
)
{
EXPLAIN_ROW_APPEND
(
" Buffers:%.2f Kb"
,
pExecInfo
->
sortBuffer
/
(
1024
.
0
));
}
else
{
EXPLAIN_ROW_APPEND
(
" Buffers:%d b"
,
pExecInfo
->
sortBuffer
);
}
EXPLAIN_ROW_APPEND
(
" loops:%d"
,
pExecInfo
->
loops
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
}
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pSortNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pSortNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pSortNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pSortNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_MERGE_INTERVAL
:
{
SMergeIntervalPhysiNode
*
pIntNode
=
(
SMergeIntervalPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_MERGE_INTERVAL_FORMAT
,
nodesGetNameFromColumnNode
(
pIntNode
->
window
.
pTspk
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_FUNCTIONS_FORMAT
,
pIntNode
->
window
.
pFuncs
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pIntNode
->
window
.
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pIntNode
->
window
.
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
uint8_t
precision
=
getIntervalPrecision
(
pIntNode
);
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_TIME_WINDOWS_FORMAT
,
INVERAL_TIME_FROM_PRECISION_TO_UNIT
(
pIntNode
->
interval
,
pIntNode
->
intervalUnit
,
precision
),
pIntNode
->
intervalUnit
,
pIntNode
->
offset
,
getPrecisionUnit
(
precision
),
INVERAL_TIME_FROM_PRECISION_TO_UNIT
(
pIntNode
->
sliding
,
pIntNode
->
slidingUnit
,
precision
),
pIntNode
->
slidingUnit
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pIntNode
->
window
.
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pIntNode
->
window
.
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
case
QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC
:
{
SInterpFuncPhysiNode
*
pInterpNode
=
(
SInterpFuncPhysiNode
*
)
pNode
;
EXPLAIN_ROW_NEW
(
level
,
EXPLAIN_AGG_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_LEFT_PARENTHESIS_FORMAT
);
if
(
pResNode
->
pExecInfo
)
{
QRY_ERR_RET
(
qExplainBufAppendExecInfo
(
pResNode
->
pExecInfo
,
tbuf
,
&
tlen
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
if
(
pInterpNode
->
pFuncs
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_FUNCTIONS_FORMAT
,
pInterpNode
->
pFuncs
->
length
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
EXPLAIN_ROW_APPEND
(
EXPLAIN_MODE_FORMAT
,
nodesGetFillModeString
(
pInterpNode
->
fillMode
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_RIGHT_PARENTHESIS_FORMAT
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
));
if
(
verbose
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_OUTPUT_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_COLUMNS_FORMAT
,
nodesGetOutputNumFromSlotList
(
pInterpNode
->
node
.
pOutputDataBlockDesc
->
pSlots
));
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_WIDTH_FORMAT
,
pInterpNode
->
node
.
pOutputDataBlockDesc
->
outputRowSize
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pInterpNode
->
pFillValues
)
{
SNodeListNode
*
pValues
=
(
SNodeListNode
*
)
pInterpNode
->
pFillValues
;
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILL_VALUE_FORMAT
);
SNode
*
tNode
=
NULL
;
int32_t
i
=
0
;
FOREACH
(
tNode
,
pValues
->
pNodeList
)
{
if
(
i
)
{
EXPLAIN_ROW_APPEND
(
EXPLAIN_BLANK_FORMAT
);
}
SValueNode
*
tValue
=
(
SValueNode
*
)
tNode
;
char
*
value
=
nodesGetStrValueFromNode
(
tValue
);
EXPLAIN_ROW_APPEND
(
EXPLAIN_STRING_TYPE_FORMAT
,
value
);
taosMemoryFree
(
value
);
++
i
;
}
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_INTERVAL_VALUE_FORMAT
,
pInterpNode
->
interval
,
pInterpNode
->
intervalUnit
);
EXPLAIN_ROW_END
();
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_TIMERANGE_FORMAT
,
pInterpNode
->
timeRange
.
skey
,
pInterpNode
->
timeRange
.
ekey
);
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
if
(
pInterpNode
->
node
.
pConditions
)
{
EXPLAIN_ROW_NEW
(
level
+
1
,
EXPLAIN_FILTER_FORMAT
);
QRY_ERR_RET
(
nodesNodeToSQL
(
pInterpNode
->
node
.
pConditions
,
tbuf
+
VARSTR_HEADER_SIZE
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
&
tlen
));
EXPLAIN_ROW_END
();
QRY_ERR_RET
(
qExplainResAppendRow
(
ctx
,
tbuf
,
tlen
,
level
+
1
));
}
}
break
;
}
default:
default:
qError
(
"not supported physical node type %d"
,
pNode
->
type
);
qError
(
"not supported physical node type %d"
,
pNode
->
type
);
return
TSDB_CODE_QRY_APP_ERROR
;
return
TSDB_CODE_QRY_APP_ERROR
;
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
406d35d4
...
@@ -151,10 +151,6 @@ typedef struct SExecTaskInfo {
...
@@ -151,10 +151,6 @@ typedef struct SExecTaskInfo {
jmp_buf
env
;
// jump to this position when error happens.
jmp_buf
env
;
// jump to this position when error happens.
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
EOPTR_EXEC_MODEL
execModel
;
// operator execution model [batch model|stream model]
struct
SOperatorInfo
*
pRoot
;
struct
SOperatorInfo
*
pRoot
;
/* XXXXXXXXXXXXXXXXXXXX */
SReadHandle
*
pHandle
;
/* XXXXXXXXXXXXXXXXXXXX */
}
SExecTaskInfo
;
}
SExecTaskInfo
;
enum
{
enum
{
...
...
source/libs/executor/src/executorMain.c
浏览文件 @
406d35d4
...
@@ -139,29 +139,8 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
...
@@ -139,29 +139,8 @@ int32_t qExecTask(qTaskInfo_t tinfo, SSDataBlock** pRes, uint64_t* useconds) {
qDebug
(
"%s execTask is launched"
,
GET_TASKID
(
pTaskInfo
));
qDebug
(
"%s execTask is launched"
,
GET_TASKID
(
pTaskInfo
));
int64_t
st
=
taosGetTimestampUs
();
int64_t
st
=
taosGetTimestampUs
();
/* XXXXXXXXXXXXXXXXXXXX */
if
(
pTaskInfo
->
pHandle
->
deleteQuery
)
{
*
pRes
=
pTaskInfo
->
pRoot
->
fpSet
.
getNextFn
(
pTaskInfo
->
pRoot
);
static
int32_t
first
=
1
;
if
(
first
)
{
*
pRes
=
createDataBlock
();
int64_t
rows
=
33
;
SColumnInfoData
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_BIGINT
,
8
,
1
);
blockDataAppendColInfo
(
*
pRes
,
&
infoData
);
blockDataEnsureCapacity
(
*
pRes
,
1
);
(
*
pRes
)
->
info
.
rows
=
1
;
SColumnInfoData
*
pCol1
=
taosArrayGet
((
*
pRes
)
->
pDataBlock
,
0
);
colDataAppend
(
pCol1
,
0
,
(
char
*
)
&
rows
,
false
);
first
=
0
;
}
else
{
*
pRes
=
NULL
;
}
}
else
{
/* XXXXXXXXXXXXXXXXXXXX */
*
pRes
=
pTaskInfo
->
pRoot
->
fpSet
.
getNextFn
(
pTaskInfo
->
pRoot
);
/* XXXXXXXXXXXXXXXXXXXX */
}
/* XXXXXXXXXXXXXXXXXXXX */
uint64_t
el
=
(
taosGetTimestampUs
()
-
st
);
uint64_t
el
=
(
taosGetTimestampUs
()
-
st
);
pTaskInfo
->
cost
.
elapsedTime
+=
el
;
pTaskInfo
->
cost
.
elapsedTime
+=
el
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
406d35d4
...
@@ -13,8 +13,6 @@
...
@@ -13,8 +13,6 @@
* 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 <executorimpl.h>
#include <vnode.h>
#include "filter.h"
#include "filter.h"
#include "function.h"
#include "function.h"
#include "functionMgt.h"
#include "functionMgt.h"
...
@@ -2845,11 +2843,18 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan
...
@@ -2845,11 +2843,18 @@ int32_t getTableScanInfo(SOperatorInfo* pOperator, int32_t* order, int32_t* scan
int32_t
doPrepareScan
(
SOperatorInfo
*
pOperator
,
uint64_t
uid
,
int64_t
ts
)
{
int32_t
doPrepareScan
(
SOperatorInfo
*
pOperator
,
uint64_t
uid
,
int64_t
ts
)
{
int32_t
type
=
pOperator
->
operatorType
;
int32_t
type
=
pOperator
->
operatorType
;
pOperator
->
status
=
OP_OPENED
;
if
(
type
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
)
{
if
(
type
==
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
)
{
SStreamBlockScanInfo
*
pScanInfo
=
pOperator
->
info
;
SStreamBlockScanInfo
*
pScanInfo
=
pOperator
->
info
;
pScanInfo
->
blockType
=
STREAM_INPUT__DATA_SCAN
;
pScanInfo
->
blockType
=
STREAM_INPUT__DATA_SCAN
;
pScanInfo
->
pSnapshotReadOp
->
status
=
OP_OPENED
;
STableScanInfo
*
pInfo
=
pScanInfo
->
pSnapshotReadOp
->
info
;
STableScanInfo
*
pInfo
=
pScanInfo
->
pSnapshotReadOp
->
info
;
ASSERT
(
pInfo
->
scanMode
==
TABLE_SCAN__TABLE_ORDER
);
if
(
uid
==
0
)
{
if
(
uid
==
0
)
{
pInfo
->
noTable
=
1
;
pInfo
->
noTable
=
1
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -2863,14 +2868,6 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) {
...
@@ -2863,14 +2868,6 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) {
pInfo
->
noTable
=
0
;
pInfo
->
noTable
=
0
;
if
(
pInfo
->
lastStatus
.
uid
!=
uid
||
pInfo
->
lastStatus
.
ts
!=
ts
)
{
if
(
pInfo
->
lastStatus
.
uid
!=
uid
||
pInfo
->
lastStatus
.
ts
!=
ts
)
{
tsdbSetTableId
(
pInfo
->
dataReader
,
uid
);
int64_t
oldSkey
=
pInfo
->
cond
.
twindows
[
0
].
skey
;
pInfo
->
cond
.
twindows
[
0
].
skey
=
ts
+
1
;
tsdbResetReadHandle
(
pInfo
->
dataReader
,
&
pInfo
->
cond
,
0
);
pInfo
->
cond
.
twindows
[
0
].
skey
=
oldSkey
;
pInfo
->
scanTimes
=
0
;
pInfo
->
curTWinIdx
=
0
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
int32_t
tableSz
=
taosArrayGetSize
(
pTaskInfo
->
tableqinfoList
.
pTableList
);
int32_t
tableSz
=
taosArrayGetSize
(
pTaskInfo
->
tableqinfoList
.
pTableList
);
...
@@ -2882,8 +2879,17 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) {
...
@@ -2882,8 +2879,17 @@ int32_t doPrepareScan(SOperatorInfo* pOperator, uint64_t uid, int64_t ts) {
pInfo
->
currentTable
=
i
;
pInfo
->
currentTable
=
i
;
}
}
}
}
// TODO after processing drop,
// TODO after processing drop,
found can be false
ASSERT
(
found
);
ASSERT
(
found
);
tsdbSetTableId
(
pInfo
->
dataReader
,
uid
);
int64_t
oldSkey
=
pInfo
->
cond
.
twindows
[
0
].
skey
;
pInfo
->
cond
.
twindows
[
0
].
skey
=
ts
+
1
;
tsdbReaderReset
(
pInfo
->
dataReader
,
&
pInfo
->
cond
,
0
);
pInfo
->
cond
.
twindows
[
0
].
skey
=
oldSkey
;
pInfo
->
scanTimes
=
0
;
pInfo
->
curTWinIdx
=
0
;
qDebug
(
"tsdb reader offset seek to uid %ld ts %ld, table cur set to %d , all table num %d"
,
uid
,
ts
,
qDebug
(
"tsdb reader offset seek to uid %ld ts %ld, table cur set to %d , all table num %d"
,
uid
,
ts
,
pInfo
->
currentTable
,
tableSz
);
pInfo
->
currentTable
,
tableSz
);
}
}
...
@@ -4763,10 +4769,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
...
@@ -4763,10 +4769,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
(
*
pTaskInfo
)
->
pRoot
=
createOperatorTree
(
pPlan
->
pNode
,
*
pTaskInfo
,
pHandle
,
queryId
,
taskId
,
(
*
pTaskInfo
)
->
pRoot
=
createOperatorTree
(
pPlan
->
pNode
,
*
pTaskInfo
,
pHandle
,
queryId
,
taskId
,
&
(
*
pTaskInfo
)
->
tableqinfoList
,
pPlan
->
user
);
&
(
*
pTaskInfo
)
->
tableqinfoList
,
pPlan
->
user
);
/* XXXXXXXXXXXXXXXXXXXX */
(
*
pTaskInfo
)
->
pHandle
=
pHandle
;
/* XXXXXXXXXXXXXXXXXXXX */
if
(
NULL
==
(
*
pTaskInfo
)
->
pRoot
)
{
if
(
NULL
==
(
*
pTaskInfo
)
->
pRoot
)
{
code
=
(
*
pTaskInfo
)
->
code
;
code
=
(
*
pTaskInfo
)
->
code
;
goto
_complete
;
goto
_complete
;
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
406d35d4
...
@@ -440,7 +440,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
...
@@ -440,7 +440,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
}
}
pTableScanInfo
->
curTWinIdx
+=
1
;
pTableScanInfo
->
curTWinIdx
+=
1
;
if
(
pTableScanInfo
->
curTWinIdx
<
pTableScanInfo
->
cond
.
numOfTWindows
)
{
if
(
pTableScanInfo
->
curTWinIdx
<
pTableScanInfo
->
cond
.
numOfTWindows
)
{
tsdbRe
setReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
pTableScanInfo
->
curTWinIdx
);
tsdbRe
aderReset
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
pTableScanInfo
->
curTWinIdx
);
}
}
}
}
...
@@ -455,7 +455,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
...
@@ -455,7 +455,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
qDebug
(
"%s qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
qDebug
(
"%s qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
}
}
// do prepare for the next round table scan operation
// do prepare for the next round table scan operation
tsdbRe
setReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
tsdbRe
aderReset
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
pTableScanInfo
->
curTWinIdx
=
0
;
pTableScanInfo
->
curTWinIdx
=
0
;
}
}
}
}
...
@@ -464,7 +464,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
...
@@ -464,7 +464,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
if
(
pTableScanInfo
->
scanTimes
<
total
)
{
if
(
pTableScanInfo
->
scanTimes
<
total
)
{
if
(
pTableScanInfo
->
cond
.
order
==
TSDB_ORDER_ASC
)
{
if
(
pTableScanInfo
->
cond
.
order
==
TSDB_ORDER_ASC
)
{
prepareForDescendingScan
(
pTableScanInfo
,
pTableScanInfo
->
pCtx
,
0
);
prepareForDescendingScan
(
pTableScanInfo
,
pTableScanInfo
->
pCtx
,
0
);
tsdbRe
setReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
tsdbRe
aderReset
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
pTableScanInfo
->
curTWinIdx
=
0
;
pTableScanInfo
->
curTWinIdx
=
0
;
}
}
...
@@ -482,7 +482,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
...
@@ -482,7 +482,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
}
}
pTableScanInfo
->
curTWinIdx
+=
1
;
pTableScanInfo
->
curTWinIdx
+=
1
;
if
(
pTableScanInfo
->
curTWinIdx
<
pTableScanInfo
->
cond
.
numOfTWindows
)
{
if
(
pTableScanInfo
->
curTWinIdx
<
pTableScanInfo
->
cond
.
numOfTWindows
)
{
tsdbRe
setReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
pTableScanInfo
->
curTWinIdx
);
tsdbRe
aderReset
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
pTableScanInfo
->
curTWinIdx
);
}
}
}
}
...
@@ -498,7 +498,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
...
@@ -498,7 +498,7 @@ static SSDataBlock* doTableScanGroup(SOperatorInfo* pOperator) {
STimeWindow
*
pWin
=
&
pTableScanInfo
->
cond
.
twindows
[
i
];
STimeWindow
*
pWin
=
&
pTableScanInfo
->
cond
.
twindows
[
i
];
qDebug
(
"%s qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
qDebug
(
"%s qrange:%"
PRId64
"-%"
PRId64
,
GET_TASKID
(
pTaskInfo
),
pWin
->
skey
,
pWin
->
ekey
);
}
}
tsdbRe
setReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
tsdbRe
aderReset
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
pTableScanInfo
->
curTWinIdx
=
0
;
pTableScanInfo
->
curTWinIdx
=
0
;
}
}
}
}
...
@@ -526,7 +526,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
...
@@ -526,7 +526,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
}
}
STableKeyInfo
*
pTableInfo
=
taosArrayGet
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
pInfo
->
currentTable
);
STableKeyInfo
*
pTableInfo
=
taosArrayGet
(
pTaskInfo
->
tableqinfoList
.
pTableList
,
pInfo
->
currentTable
);
tsdbSetTableId
(
pInfo
->
dataReader
,
pTableInfo
->
uid
);
tsdbSetTableId
(
pInfo
->
dataReader
,
pTableInfo
->
uid
);
tsdbRe
setReadHandle
(
pInfo
->
dataReader
,
&
pInfo
->
cond
,
0
);
tsdbRe
aderReset
(
pInfo
->
dataReader
,
&
pInfo
->
cond
,
0
);
pInfo
->
scanTimes
=
0
;
pInfo
->
scanTimes
=
0
;
pInfo
->
curTWinIdx
=
0
;
pInfo
->
curTWinIdx
=
0
;
}
}
...
@@ -560,7 +560,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
...
@@ -560,7 +560,7 @@ static SSDataBlock* doTableScan(SOperatorInfo* pOperator) {
SArray
*
tableList
=
taosArrayGetP
(
pTaskInfo
->
tableqinfoList
.
pGroupList
,
pInfo
->
currentGroupId
);
SArray
*
tableList
=
taosArrayGetP
(
pTaskInfo
->
tableqinfoList
.
pGroupList
,
pInfo
->
currentGroupId
);
// tsdbSetTableList(pInfo->dataReader, tableList);
// tsdbSetTableList(pInfo->dataReader, tableList);
tsdbRe
setReadHandle
(
pInfo
->
dataReader
,
&
pInfo
->
cond
,
0
);
tsdbRe
aderReset
(
pInfo
->
dataReader
,
&
pInfo
->
cond
,
0
);
pInfo
->
curTWinIdx
=
0
;
pInfo
->
curTWinIdx
=
0
;
pInfo
->
scanTimes
=
0
;
pInfo
->
scanTimes
=
0
;
...
@@ -859,7 +859,7 @@ static bool prepareDataScan(SStreamBlockScanInfo* pInfo, SSDataBlock* pSDB, int3
...
@@ -859,7 +859,7 @@ static bool prepareDataScan(SStreamBlockScanInfo* pInfo, SSDataBlock* pSDB, int3
STableScanInfo
*
pTableScanInfo
=
pInfo
->
pSnapshotReadOp
->
info
;
STableScanInfo
*
pTableScanInfo
=
pInfo
->
pSnapshotReadOp
->
info
;
pTableScanInfo
->
cond
.
twindows
[
0
]
=
win
;
pTableScanInfo
->
cond
.
twindows
[
0
]
=
win
;
pTableScanInfo
->
curTWinIdx
=
0
;
pTableScanInfo
->
curTWinIdx
=
0
;
// tsdbRe
setReadHandle
(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0);
// tsdbRe
aderReset
(pTableScanInfo->dataReader, &pTableScanInfo->cond, 0);
// if (!pTableScanInfo->dataReader) {
// if (!pTableScanInfo->dataReader) {
// return false;
// return false;
// }
// }
...
...
source/libs/function/src/builtins.c
浏览文件 @
406d35d4
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "querynodes.h"
#include "querynodes.h"
#include "scalar.h"
#include "scalar.h"
#include "taoserror.h"
#include "taoserror.h"
#include "cJSON.h"
static
int32_t
buildFuncErrMsg
(
char
*
pErrBuf
,
int32_t
len
,
int32_t
errCode
,
const
char
*
pFormat
,
...)
{
static
int32_t
buildFuncErrMsg
(
char
*
pErrBuf
,
int32_t
len
,
int32_t
errCode
,
const
char
*
pFormat
,
...)
{
va_list
vArgList
;
va_list
vArgList
;
...
@@ -796,6 +797,165 @@ static int32_t translateLeastSQR(SFunctionNode* pFunc, char* pErrBuf, int32_t le
...
@@ -796,6 +797,165 @@ static int32_t translateLeastSQR(SFunctionNode* pFunc, char* pErrBuf, int32_t le
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
typedef
enum
{
UNKNOWN_BIN
=
0
,
USER_INPUT_BIN
,
LINEAR_BIN
,
LOG_BIN
}
EHistoBinType
;
static
int8_t
validateHistogramBinType
(
char
*
binTypeStr
)
{
int8_t
binType
;
if
(
strcasecmp
(
binTypeStr
,
"user_input"
)
==
0
)
{
binType
=
USER_INPUT_BIN
;
}
else
if
(
strcasecmp
(
binTypeStr
,
"linear_bin"
)
==
0
)
{
binType
=
LINEAR_BIN
;
}
else
if
(
strcasecmp
(
binTypeStr
,
"log_bin"
)
==
0
)
{
binType
=
LOG_BIN
;
}
else
{
binType
=
UNKNOWN_BIN
;
}
return
binType
;
}
static
bool
validateHistogramBinDesc
(
char
*
binDescStr
,
int8_t
binType
,
char
*
errMsg
,
int32_t
msgLen
)
{
const
char
*
msg1
=
"HISTOGRAM function requires four parameters"
;
const
char
*
msg3
=
"HISTOGRAM function invalid format for binDesc parameter"
;
const
char
*
msg4
=
"HISTOGRAM function binDesc parameter
\"
count
\"
should be in range [1, 1000]"
;
const
char
*
msg5
=
"HISTOGRAM function bin/parameter should be in range [-DBL_MAX, DBL_MAX]"
;
const
char
*
msg6
=
"HISTOGRAM function binDesc parameter
\"
width
\"
cannot be 0"
;
const
char
*
msg7
=
"HISTOGRAM function binDesc parameter
\"
start
\"
cannot be 0 with
\"
log_bin
\"
type"
;
const
char
*
msg8
=
"HISTOGRAM function binDesc parameter
\"
factor
\"
cannot be negative or equal to 0/1"
;
cJSON
*
binDesc
=
cJSON_Parse
(
binDescStr
);
int32_t
numOfBins
;
double
*
intervals
;
if
(
cJSON_IsObject
(
binDesc
))
{
/* linaer/log bins */
int32_t
numOfParams
=
cJSON_GetArraySize
(
binDesc
);
int32_t
startIndex
;
if
(
numOfParams
!=
4
)
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg1
);
return
false
;
}
cJSON
*
start
=
cJSON_GetObjectItem
(
binDesc
,
"start"
);
cJSON
*
factor
=
cJSON_GetObjectItem
(
binDesc
,
"factor"
);
cJSON
*
width
=
cJSON_GetObjectItem
(
binDesc
,
"width"
);
cJSON
*
count
=
cJSON_GetObjectItem
(
binDesc
,
"count"
);
cJSON
*
infinity
=
cJSON_GetObjectItem
(
binDesc
,
"infinity"
);
if
(
!
cJSON_IsNumber
(
start
)
||
!
cJSON_IsNumber
(
count
)
||
!
cJSON_IsBool
(
infinity
))
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg3
);
return
false
;
}
if
(
count
->
valueint
<=
0
||
count
->
valueint
>
1000
)
{
// limit count to 1000
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg4
);
return
false
;
}
if
(
isinf
(
start
->
valuedouble
)
||
(
width
!=
NULL
&&
isinf
(
width
->
valuedouble
))
||
(
factor
!=
NULL
&&
isinf
(
factor
->
valuedouble
))
||
(
count
!=
NULL
&&
isinf
(
count
->
valuedouble
)))
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg5
);
return
false
;
}
int32_t
counter
=
(
int32_t
)
count
->
valueint
;
if
(
infinity
->
valueint
==
false
)
{
startIndex
=
0
;
numOfBins
=
counter
+
1
;
}
else
{
startIndex
=
1
;
numOfBins
=
counter
+
3
;
}
intervals
=
taosMemoryCalloc
(
numOfBins
,
sizeof
(
double
));
if
(
cJSON_IsNumber
(
width
)
&&
factor
==
NULL
&&
binType
==
LINEAR_BIN
)
{
// linear bin process
if
(
width
->
valuedouble
==
0
)
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg6
);
taosMemoryFree
(
intervals
);
return
false
;
}
for
(
int
i
=
0
;
i
<
counter
+
1
;
++
i
)
{
intervals
[
startIndex
]
=
start
->
valuedouble
+
i
*
width
->
valuedouble
;
if
(
isinf
(
intervals
[
startIndex
]))
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg5
);
taosMemoryFree
(
intervals
);
return
false
;
}
startIndex
++
;
}
}
else
if
(
cJSON_IsNumber
(
factor
)
&&
width
==
NULL
&&
binType
==
LOG_BIN
)
{
// log bin process
if
(
start
->
valuedouble
==
0
)
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg7
);
taosMemoryFree
(
intervals
);
return
false
;
}
if
(
factor
->
valuedouble
<
0
||
factor
->
valuedouble
==
0
||
factor
->
valuedouble
==
1
)
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg8
);
taosMemoryFree
(
intervals
);
return
false
;
}
for
(
int
i
=
0
;
i
<
counter
+
1
;
++
i
)
{
intervals
[
startIndex
]
=
start
->
valuedouble
*
pow
(
factor
->
valuedouble
,
i
*
1
.
0
);
if
(
isinf
(
intervals
[
startIndex
]))
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg5
);
taosMemoryFree
(
intervals
);
return
false
;
}
startIndex
++
;
}
}
else
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg3
);
taosMemoryFree
(
intervals
);
return
false
;
}
if
(
infinity
->
valueint
==
true
)
{
intervals
[
0
]
=
-
INFINITY
;
intervals
[
numOfBins
-
1
]
=
INFINITY
;
// in case of desc bin orders, -inf/inf should be swapped
ASSERT
(
numOfBins
>=
4
);
if
(
intervals
[
1
]
>
intervals
[
numOfBins
-
2
])
{
TSWAP
(
intervals
[
0
],
intervals
[
numOfBins
-
1
]);
}
}
}
else
if
(
cJSON_IsArray
(
binDesc
))
{
/* user input bins */
if
(
binType
!=
USER_INPUT_BIN
)
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg3
);
return
false
;
}
numOfBins
=
cJSON_GetArraySize
(
binDesc
);
intervals
=
taosMemoryCalloc
(
numOfBins
,
sizeof
(
double
));
cJSON
*
bin
=
binDesc
->
child
;
if
(
bin
==
NULL
)
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg3
);
taosMemoryFree
(
intervals
);
return
false
;
}
int
i
=
0
;
while
(
bin
)
{
intervals
[
i
]
=
bin
->
valuedouble
;
if
(
!
cJSON_IsNumber
(
bin
))
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg3
);
taosMemoryFree
(
intervals
);
return
false
;
}
if
(
i
!=
0
&&
intervals
[
i
]
<=
intervals
[
i
-
1
])
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg3
);
taosMemoryFree
(
intervals
);
return
false
;
}
bin
=
bin
->
next
;
i
++
;
}
}
else
{
snprintf
(
errMsg
,
msgLen
,
"%s"
,
msg3
);
return
false
;
}
taosMemoryFree
(
intervals
);
return
true
;
}
static
int32_t
translateHistogram
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
static
int32_t
translateHistogram
(
SFunctionNode
*
pFunc
,
char
*
pErrBuf
,
int32_t
len
)
{
int32_t
numOfParams
=
LIST_LENGTH
(
pFunc
->
pParameterList
);
int32_t
numOfParams
=
LIST_LENGTH
(
pFunc
->
pParameterList
);
if
(
4
!=
numOfParams
)
{
if
(
4
!=
numOfParams
)
{
...
@@ -814,6 +974,8 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l
...
@@ -814,6 +974,8 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
int8_t
binType
;
char
*
binDesc
;
for
(
int32_t
i
=
1
;
i
<
numOfParams
;
++
i
)
{
for
(
int32_t
i
=
1
;
i
<
numOfParams
;
++
i
)
{
SNode
*
pParamNode
=
nodesListGetNode
(
pFunc
->
pParameterList
,
i
);
SNode
*
pParamNode
=
nodesListGetNode
(
pFunc
->
pParameterList
,
i
);
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pParamNode
))
{
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pParamNode
))
{
...
@@ -824,6 +986,23 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l
...
@@ -824,6 +986,23 @@ static int32_t translateHistogram(SFunctionNode* pFunc, char* pErrBuf, int32_t l
pValue
->
notReserved
=
true
;
pValue
->
notReserved
=
true
;
if
(
i
==
1
)
{
binType
=
validateHistogramBinType
(
varDataVal
(
pValue
->
datum
.
p
));
if
(
binType
==
UNKNOWN_BIN
)
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"HISTOGRAM function binType parameter should be "
"
\"
user_input
\"
,
\"
log_bin
\"
or
\"
linear_bin
\"
"
);
}
}
if
(
i
==
2
)
{
char
errMsg
[
128
]
=
{
0
};
binDesc
=
varDataVal
(
pValue
->
datum
.
p
);
if
(
!
validateHistogramBinDesc
(
binDesc
,
binType
,
errMsg
,
(
int32_t
)
sizeof
(
errMsg
)))
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
errMsg
);
}
}
if
(
i
==
3
&&
pValue
->
datum
.
i
!=
1
&&
pValue
->
datum
.
i
!=
0
)
{
if
(
i
==
3
&&
pValue
->
datum
.
i
!=
1
&&
pValue
->
datum
.
i
!=
0
)
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"HISTOGRAM function normalized parameter should be 0/1"
);
"HISTOGRAM function normalized parameter should be 0/1"
);
...
@@ -853,6 +1032,8 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32
...
@@ -853,6 +1032,8 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
return
invaildFuncParaTypeErrMsg
(
pErrBuf
,
len
,
pFunc
->
functionName
);
}
}
int8_t
binType
;
char
*
binDesc
;
for
(
int32_t
i
=
1
;
i
<
numOfParams
;
++
i
)
{
for
(
int32_t
i
=
1
;
i
<
numOfParams
;
++
i
)
{
SNode
*
pParamNode
=
nodesListGetNode
(
pFunc
->
pParameterList
,
i
);
SNode
*
pParamNode
=
nodesListGetNode
(
pFunc
->
pParameterList
,
i
);
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pParamNode
))
{
if
(
QUERY_NODE_VALUE
!=
nodeType
(
pParamNode
))
{
...
@@ -863,6 +1044,23 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32
...
@@ -863,6 +1044,23 @@ static int32_t translateHistogramImpl(SFunctionNode* pFunc, char* pErrBuf, int32
pValue
->
notReserved
=
true
;
pValue
->
notReserved
=
true
;
if
(
i
==
1
)
{
binType
=
validateHistogramBinType
(
varDataVal
(
pValue
->
datum
.
p
));
if
(
binType
==
UNKNOWN_BIN
)
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"HISTOGRAM function binType parameter should be "
"
\"
user_input
\"
,
\"
log_bin
\"
or
\"
linear_bin
\"
"
);
}
}
if
(
i
==
2
)
{
char
errMsg
[
128
]
=
{
0
};
binDesc
=
varDataVal
(
pValue
->
datum
.
p
);
if
(
!
validateHistogramBinDesc
(
binDesc
,
binType
,
errMsg
,
(
int32_t
)
sizeof
(
errMsg
)))
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
errMsg
);
}
}
if
(
i
==
3
&&
pValue
->
datum
.
i
!=
1
&&
pValue
->
datum
.
i
!=
0
)
{
if
(
i
==
3
&&
pValue
->
datum
.
i
!=
1
&&
pValue
->
datum
.
i
!=
0
)
{
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
return
buildFuncErrMsg
(
pErrBuf
,
len
,
TSDB_CODE_FUNC_FUNTION_ERROR
,
"HISTOGRAM function normalized parameter should be 0/1"
);
"HISTOGRAM function normalized parameter should be 0/1"
);
...
@@ -2105,7 +2303,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
...
@@ -2105,7 +2303,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
{
{
.
name
=
"histogram"
,
.
name
=
"histogram"
,
.
type
=
FUNCTION_TYPE_HISTOGRAM
,
.
type
=
FUNCTION_TYPE_HISTOGRAM
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_FORBID_FILL_FUNC
,
.
classification
=
FUNC_MGT_AGG_FUNC
|
FUNC_MGT_
INDEFINITE_ROWS_FUNC
|
FUNC_MGT_
FORBID_FILL_FUNC
,
.
translateFunc
=
translateHistogram
,
.
translateFunc
=
translateHistogram
,
.
getEnvFunc
=
getHistogramFuncEnv
,
.
getEnvFunc
=
getHistogramFuncEnv
,
.
initFunc
=
histogramFunctionSetup
,
.
initFunc
=
histogramFunctionSetup
,
...
...
source/libs/function/src/functionMgt.c
浏览文件 @
406d35d4
...
@@ -260,7 +260,7 @@ bool fmIsSameInOutType(int32_t funcId) {
...
@@ -260,7 +260,7 @@ bool fmIsSameInOutType(int32_t funcId) {
}
}
static
int32_t
getFuncInfo
(
SFunctionNode
*
pFunc
)
{
static
int32_t
getFuncInfo
(
SFunctionNode
*
pFunc
)
{
char
msg
[
64
]
=
{
0
};
char
msg
[
128
]
=
{
0
};
return
fmGetFuncInfo
(
pFunc
,
msg
,
sizeof
(
msg
));
return
fmGetFuncInfo
(
pFunc
,
msg
,
sizeof
(
msg
));
}
}
...
...
source/libs/nodes/src/nodesUtilFuncs.c
浏览文件 @
406d35d4
...
@@ -19,8 +19,8 @@
...
@@ -19,8 +19,8 @@
#include "querynodes.h"
#include "querynodes.h"
#include "taos.h"
#include "taos.h"
#include "taoserror.h"
#include "taoserror.h"
#include "thash.h"
#include "tdatablock.h"
#include "tdatablock.h"
#include "thash.h"
static
SNode
*
makeNode
(
ENodeType
type
,
size_t
size
)
{
static
SNode
*
makeNode
(
ENodeType
type
,
size_t
size
)
{
SNode
*
p
=
taosMemoryCalloc
(
1
,
size
);
SNode
*
p
=
taosMemoryCalloc
(
1
,
size
);
...
@@ -1501,13 +1501,18 @@ typedef struct SCollectFuncsCxt {
...
@@ -1501,13 +1501,18 @@ typedef struct SCollectFuncsCxt {
int32_t
errCode
;
int32_t
errCode
;
FFuncClassifier
classifier
;
FFuncClassifier
classifier
;
SNodeList
*
pFuncs
;
SNodeList
*
pFuncs
;
SHashObj
*
pAliasName
;
}
SCollectFuncsCxt
;
}
SCollectFuncsCxt
;
static
EDealRes
collectFuncs
(
SNode
*
pNode
,
void
*
pContext
)
{
static
EDealRes
collectFuncs
(
SNode
*
pNode
,
void
*
pContext
)
{
SCollectFuncsCxt
*
pCxt
=
(
SCollectFuncsCxt
*
)
pContext
;
SCollectFuncsCxt
*
pCxt
=
(
SCollectFuncsCxt
*
)
pContext
;
if
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
pCxt
->
classifier
(((
SFunctionNode
*
)
pNode
)
->
funcId
)
&&
if
(
QUERY_NODE_FUNCTION
==
nodeType
(
pNode
)
&&
pCxt
->
classifier
(((
SFunctionNode
*
)
pNode
)
->
funcId
)
&&
!
(((
SExprNode
*
)
pNode
)
->
orderAlias
))
{
!
(((
SExprNode
*
)
pNode
)
->
orderAlias
))
{
pCxt
->
errCode
=
nodesListStrictAppend
(
pCxt
->
pFuncs
,
nodesCloneNode
(
pNode
));
SExprNode
*
pExpr
=
(
SExprNode
*
)
pNode
;
if
(
NULL
==
taosHashGet
(
pCxt
->
pAliasName
,
pExpr
->
aliasName
,
strlen
(
pExpr
->
aliasName
)))
{
pCxt
->
errCode
=
nodesListStrictAppend
(
pCxt
->
pFuncs
,
nodesCloneNode
(
pNode
));
taosHashPut
(
pCxt
->
pAliasName
,
pExpr
->
aliasName
,
strlen
(
pExpr
->
aliasName
),
&
pExpr
,
POINTER_BYTES
);
}
return
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
?
DEAL_RES_IGNORE_CHILD
:
DEAL_RES_ERROR
);
return
(
TSDB_CODE_SUCCESS
==
pCxt
->
errCode
?
DEAL_RES_IGNORE_CHILD
:
DEAL_RES_ERROR
);
}
}
return
DEAL_RES_CONTINUE
;
return
DEAL_RES_CONTINUE
;
...
@@ -1519,23 +1524,27 @@ int32_t nodesCollectFuncs(SSelectStmt* pSelect, ESqlClause clause, FFuncClassifi
...
@@ -1519,23 +1524,27 @@ int32_t nodesCollectFuncs(SSelectStmt* pSelect, ESqlClause clause, FFuncClassifi
}
}
SCollectFuncsCxt
cxt
=
{
SCollectFuncsCxt
cxt
=
{
.
errCode
=
TSDB_CODE_SUCCESS
,
.
classifier
=
classifier
,
.
pFuncs
=
(
NULL
==
*
pFuncs
?
nodesMakeList
()
:
*
pFuncs
)};
.
errCode
=
TSDB_CODE_SUCCESS
,
.
classifier
=
classifier
,
.
pFuncs
=
(
NULL
==
*
pFuncs
?
nodesMakeList
()
:
*
pFuncs
),
.
pAliasName
=
taosHashInit
(
4
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_VARCHAR
),
false
,
false
)};
if
(
NULL
==
cxt
.
pFuncs
)
{
if
(
NULL
==
cxt
.
pFuncs
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
*
pFuncs
=
NULL
;
*
pFuncs
=
NULL
;
nodesWalkSelectStmt
(
pSelect
,
clause
,
collectFuncs
,
&
cxt
);
nodesWalkSelectStmt
(
pSelect
,
clause
,
collectFuncs
,
&
cxt
);
if
(
TSDB_CODE_SUCCESS
!
=
cxt
.
errCode
)
{
if
(
TSDB_CODE_SUCCESS
=
=
cxt
.
errCode
)
{
nodesDestroyList
(
cxt
.
pFuncs
);
if
(
LIST_LENGTH
(
cxt
.
pFuncs
)
>
0
)
{
return
cxt
.
errCode
;
*
pFuncs
=
cxt
.
pFuncs
;
}
}
else
{
if
(
LIST_LENGTH
(
cxt
.
pFuncs
)
>
0
)
{
nodesDestroyList
(
cxt
.
pFuncs
);
*
pFuncs
=
cxt
.
pFuncs
;
}
}
else
{
}
else
{
nodesDestroyList
(
cxt
.
pFuncs
);
nodesDestroyList
(
cxt
.
pFuncs
);
}
}
taosHashCleanup
(
cxt
.
pAliasName
);
return
TSDB_CODE_SUCCESS
;
return
cxt
.
errCode
;
}
}
typedef
struct
SCollectSpecialNodesCxt
{
typedef
struct
SCollectSpecialNodesCxt
{
...
...
source/libs/parser/inc/parAst.h
浏览文件 @
406d35d4
...
@@ -155,6 +155,7 @@ SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_
...
@@ -155,6 +155,7 @@ SNode* createAlterTableDropCol(SAstCreateContext* pCxt, SNode* pRealTable, int8_
SNode
*
createAlterTableRenameCol
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
int8_t
alterType
,
SToken
*
pOldColName
,
SNode
*
createAlterTableRenameCol
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
int8_t
alterType
,
SToken
*
pOldColName
,
SToken
*
pNewColName
);
SToken
*
pNewColName
);
SNode
*
createAlterTableSetTag
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
SToken
*
pTagName
,
SNode
*
pVal
);
SNode
*
createAlterTableSetTag
(
SAstCreateContext
*
pCxt
,
SNode
*
pRealTable
,
SToken
*
pTagName
,
SNode
*
pVal
);
SNode
*
setAlterSuperTableType
(
SNode
*
pStmt
);
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
);
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
);
SNode
*
createShowStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
);
SNode
*
createShowStmt
(
SAstCreateContext
*
pCxt
,
ENodeType
type
);
SNode
*
createShowStmtWithCond
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
SNode
*
pDbName
,
SNode
*
pTbName
,
SNode
*
createShowStmtWithCond
(
SAstCreateContext
*
pCxt
,
ENodeType
type
,
SNode
*
pDbName
,
SNode
*
pTbName
,
...
...
source/libs/parser/inc/parUtil.h
浏览文件 @
406d35d4
...
@@ -53,6 +53,7 @@ typedef struct SParseMetaCache {
...
@@ -53,6 +53,7 @@ typedef struct SParseMetaCache {
}
SParseMetaCache
;
}
SParseMetaCache
;
int32_t
generateSyntaxErrMsg
(
SMsgBuf
*
pBuf
,
int32_t
errCode
,
...);
int32_t
generateSyntaxErrMsg
(
SMsgBuf
*
pBuf
,
int32_t
errCode
,
...);
int32_t
generateSyntaxErrMsgExt
(
SMsgBuf
*
pBuf
,
int32_t
errCode
,
const
char
*
pFormat
,
...);
int32_t
buildInvalidOperationMsg
(
SMsgBuf
*
pMsgBuf
,
const
char
*
msg
);
int32_t
buildInvalidOperationMsg
(
SMsgBuf
*
pMsgBuf
,
const
char
*
msg
);
int32_t
buildSyntaxErrMsg
(
SMsgBuf
*
pBuf
,
const
char
*
additionalInfo
,
const
char
*
sourceStr
);
int32_t
buildSyntaxErrMsg
(
SMsgBuf
*
pBuf
,
const
char
*
additionalInfo
,
const
char
*
sourceStr
);
...
...
source/libs/parser/inc/sql.y
浏览文件 @
406d35d4
...
@@ -233,7 +233,7 @@ cmd ::= DROP TABLE multi_drop_clause(A).
...
@@ -233,7 +233,7 @@ cmd ::= DROP TABLE multi_drop_clause(A).
cmd ::= DROP STABLE exists_opt(A) full_table_name(B). { pCxt->pRootNode = createDropSuperTableStmt(pCxt, A, B); }
cmd ::= DROP STABLE exists_opt(A) full_table_name(B). { pCxt->pRootNode = createDropSuperTableStmt(pCxt, A, B); }
cmd ::= ALTER TABLE alter_table_clause(A). { pCxt->pRootNode = A; }
cmd ::= ALTER TABLE alter_table_clause(A). { pCxt->pRootNode = A; }
cmd ::= ALTER STABLE alter_table_clause(A). { pCxt->pRootNode =
A
; }
cmd ::= ALTER STABLE alter_table_clause(A). { pCxt->pRootNode =
setAlterSuperTableType(A)
; }
alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); }
alter_table_clause(A) ::= full_table_name(B) alter_table_options(C). { A = createAlterTableModifyOptions(pCxt, B, C); }
alter_table_clause(A) ::=
alter_table_clause(A) ::=
...
@@ -260,7 +260,7 @@ multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C).
...
@@ -260,7 +260,7 @@ multi_create_clause(A) ::= multi_create_clause(B) create_subtable_clause(C).
create_subtable_clause(A) ::=
create_subtable_clause(A) ::=
not_exists_opt(B) full_table_name(C) USING full_table_name(D)
not_exists_opt(B) full_table_name(C) USING full_table_name(D)
specific_tags_opt(E) TAGS NK_LP
literal_list(F) NK_RP table_options(G).
{ A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); }
specific_tags_opt(E) TAGS NK_LP
expression_list(F) NK_RP table_options(G).
{ A = createCreateSubTableClause(pCxt, B, C, D, E, F, G); }
%type multi_drop_clause { SNodeList* }
%type multi_drop_clause { SNodeList* }
%destructor multi_drop_clause { nodesDestroyList($$); }
%destructor multi_drop_clause { nodesDestroyList($$); }
...
...
source/libs/parser/src/parAstCreater.c
浏览文件 @
406d35d4
...
@@ -1138,6 +1138,11 @@ SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken
...
@@ -1138,6 +1138,11 @@ SNode* createAlterTableSetTag(SAstCreateContext* pCxt, SNode* pRealTable, SToken
return
createAlterTableStmtFinalize
(
pRealTable
,
pStmt
);
return
createAlterTableStmtFinalize
(
pRealTable
,
pStmt
);
}
}
SNode
*
setAlterSuperTableType
(
SNode
*
pStmt
)
{
setNodeType
(
pStmt
,
QUERY_NODE_ALTER_SUPER_TABLE_STMT
);
return
pStmt
;
}
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
)
{
SNode
*
createUseDatabaseStmt
(
SAstCreateContext
*
pCxt
,
SToken
*
pDbName
)
{
CHECK_PARSER_STATUS
(
pCxt
);
CHECK_PARSER_STATUS
(
pCxt
);
if
(
!
checkDbName
(
pCxt
,
pDbName
,
false
))
{
if
(
!
checkDbName
(
pCxt
,
pDbName
,
false
))
{
...
...
source/libs/parser/src/parAstParser.c
浏览文件 @
406d35d4
...
@@ -251,6 +251,10 @@ static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTabl
...
@@ -251,6 +251,10 @@ static int32_t collectMetaKeyFromAlterTable(SCollectMetaKeyCxt* pCxt, SAlterTabl
return
code
;
return
code
;
}
}
static
int32_t
collectMetaKeyFromAlterStable
(
SCollectMetaKeyCxt
*
pCxt
,
SAlterTableStmt
*
pStmt
)
{
return
reserveTableMetaInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pStmt
->
tableName
,
pCxt
->
pMetaCache
);
}
static
int32_t
collectMetaKeyFromUseDatabase
(
SCollectMetaKeyCxt
*
pCxt
,
SUseDatabaseStmt
*
pStmt
)
{
static
int32_t
collectMetaKeyFromUseDatabase
(
SCollectMetaKeyCxt
*
pCxt
,
SUseDatabaseStmt
*
pStmt
)
{
return
reserveDbVgVersionInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pCxt
->
pMetaCache
);
return
reserveDbVgVersionInCache
(
pCxt
->
pParseCxt
->
acctId
,
pStmt
->
dbName
,
pCxt
->
pMetaCache
);
}
}
...
@@ -489,6 +493,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
...
@@ -489,6 +493,8 @@ static int32_t collectMetaKeyFromQuery(SCollectMetaKeyCxt* pCxt, SNode* pStmt) {
return
collectMetaKeyFromDropTable
(
pCxt
,
(
SDropTableStmt
*
)
pStmt
);
return
collectMetaKeyFromDropTable
(
pCxt
,
(
SDropTableStmt
*
)
pStmt
);
case
QUERY_NODE_ALTER_TABLE_STMT
:
case
QUERY_NODE_ALTER_TABLE_STMT
:
return
collectMetaKeyFromAlterTable
(
pCxt
,
(
SAlterTableStmt
*
)
pStmt
);
return
collectMetaKeyFromAlterTable
(
pCxt
,
(
SAlterTableStmt
*
)
pStmt
);
case
QUERY_NODE_ALTER_SUPER_TABLE_STMT
:
return
collectMetaKeyFromAlterStable
(
pCxt
,
(
SAlterTableStmt
*
)
pStmt
);
case
QUERY_NODE_USE_DATABASE_STMT
:
case
QUERY_NODE_USE_DATABASE_STMT
:
return
collectMetaKeyFromUseDatabase
(
pCxt
,
(
SUseDatabaseStmt
*
)
pStmt
);
return
collectMetaKeyFromUseDatabase
(
pCxt
,
(
SUseDatabaseStmt
*
)
pStmt
);
case
QUERY_NODE_CREATE_INDEX_STMT
:
case
QUERY_NODE_CREATE_INDEX_STMT
:
...
...
source/libs/parser/src/parInsert.c
浏览文件 @
406d35d4
...
@@ -48,6 +48,12 @@
...
@@ -48,6 +48,12 @@
pSql += sToken.n; \
pSql += sToken.n; \
} while (TK_NK_SPACE == sToken.type)
} while (TK_NK_SPACE == sToken.type)
typedef
struct
SInsertParseBaseContext
{
SParseContext
*
pComCxt
;
char
*
pSql
;
SMsgBuf
msg
;
}
SInsertParseBaseContext
;
typedef
struct
SInsertParseContext
{
typedef
struct
SInsertParseContext
{
SParseContext
*
pComCxt
;
// input
SParseContext
*
pComCxt
;
// input
char
*
pSql
;
// input
char
*
pSql
;
// input
...
@@ -1105,6 +1111,32 @@ static int32_t storeTableMeta(SInsertParseContext* pCxt, SHashObj* pHash, SName*
...
@@ -1105,6 +1111,32 @@ static int32_t storeTableMeta(SInsertParseContext* pCxt, SHashObj* pHash, SName*
return
taosHashPut
(
pHash
,
pName
,
len
,
&
pBackup
,
POINTER_BYTES
);
return
taosHashPut
(
pHash
,
pName
,
len
,
&
pBackup
,
POINTER_BYTES
);
}
}
static
int32_t
skipParentheses
(
SInsertParseSyntaxCxt
*
pCxt
)
{
SToken
sToken
;
int32_t
expectRightParenthesis
=
1
;
while
(
1
)
{
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
if
(
TK_NK_LP
==
sToken
.
type
)
{
++
expectRightParenthesis
;
}
else
if
(
TK_NK_RP
==
sToken
.
type
&&
0
==
--
expectRightParenthesis
)
{
break
;
}
if
(
0
==
sToken
.
n
)
{
return
buildSyntaxErrMsg
(
&
pCxt
->
msg
,
") expected"
,
NULL
);
}
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
skipBoundColumns
(
SInsertParseSyntaxCxt
*
pCxt
)
{
return
skipParentheses
(
pCxt
);
}
static
int32_t
ignoreBoundColumns
(
SInsertParseContext
*
pCxt
)
{
SInsertParseSyntaxCxt
cxt
=
{.
pComCxt
=
pCxt
->
pComCxt
,
.
pSql
=
pCxt
->
pSql
,
.
msg
=
pCxt
->
msg
,
.
pMetaCache
=
NULL
};
int32_t
code
=
skipBoundColumns
(
&
cxt
);
pCxt
->
pSql
=
cxt
.
pSql
;
return
code
;
}
static
int32_t
skipUsingClause
(
SInsertParseSyntaxCxt
*
pCxt
);
static
int32_t
skipUsingClause
(
SInsertParseSyntaxCxt
*
pCxt
);
// pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...)
// pSql -> stb_name [(tag1_name, ...)] TAGS (tag1_value, ...)
...
@@ -1453,12 +1485,29 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
...
@@ -1453,12 +1485,29 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
tNameGetFullDbName
(
&
name
,
dbFName
);
tNameGetFullDbName
(
&
name
,
dbFName
);
CHECK_CODE
(
taosHashPut
(
pCxt
->
pDbFNameHashObj
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
sizeof
(
dbFName
)));
CHECK_CODE
(
taosHashPut
(
pCxt
->
pDbFNameHashObj
,
dbFName
,
strlen
(
dbFName
),
dbFName
,
sizeof
(
dbFName
)));
bool
existedUsing
=
false
;
// USING clause
// USING clause
if
(
TK_USING
==
sToken
.
type
)
{
if
(
TK_USING
==
sToken
.
type
)
{
existedUsing
=
true
;
CHECK_CODE
(
parseUsingClause
(
pCxt
,
&
name
,
tbFName
));
CHECK_CODE
(
parseUsingClause
(
pCxt
,
&
name
,
tbFName
));
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
autoCreateTbl
=
true
;
autoCreateTbl
=
true
;
}
else
{
}
char
*
pBoundColsStart
=
NULL
;
if
(
TK_NK_LP
==
sToken
.
type
)
{
// pSql -> field1_name, ...)
pBoundColsStart
=
pCxt
->
pSql
;
CHECK_CODE
(
ignoreBoundColumns
(
pCxt
));
// CHECK_CODE(parseBoundColumns(pCxt, &dataBuf->boundColumnInfo, getTableColumnSchema(pCxt->pTableMeta)));
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
}
if
(
TK_USING
==
sToken
.
type
)
{
CHECK_CODE
(
parseUsingClause
(
pCxt
,
&
name
,
tbFName
));
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
autoCreateTbl
=
true
;
}
else
if
(
!
existedUsing
)
{
CHECK_CODE
(
getTableMeta
(
pCxt
,
&
name
,
dbFName
));
CHECK_CODE
(
getTableMeta
(
pCxt
,
&
name
,
dbFName
));
}
}
...
@@ -1467,10 +1516,11 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
...
@@ -1467,10 +1516,11 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
sizeof
(
SSubmitBlk
),
getTableInfo
(
pCxt
->
pTableMeta
).
rowSize
,
pCxt
->
pTableMeta
,
sizeof
(
SSubmitBlk
),
getTableInfo
(
pCxt
->
pTableMeta
).
rowSize
,
pCxt
->
pTableMeta
,
&
dataBuf
,
NULL
,
&
pCxt
->
createTblReq
));
&
dataBuf
,
NULL
,
&
pCxt
->
createTblReq
));
if
(
TK_NK_LP
==
sToken
.
type
)
{
if
(
NULL
!=
pBoundColsStart
)
{
// pSql -> field1_name, ...)
char
*
pCurrPos
=
pCxt
->
pSql
;
pCxt
->
pSql
=
pBoundColsStart
;
CHECK_CODE
(
parseBoundColumns
(
pCxt
,
&
dataBuf
->
boundColumnInfo
,
getTableColumnSchema
(
pCxt
->
pTableMeta
)));
CHECK_CODE
(
parseBoundColumns
(
pCxt
,
&
dataBuf
->
boundColumnInfo
,
getTableColumnSchema
(
pCxt
->
pTableMeta
)));
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
)
;
pCxt
->
pSql
=
pCurrPos
;
}
}
if
(
TK_VALUES
==
sToken
.
type
)
{
if
(
TK_VALUES
==
sToken
.
type
)
{
...
@@ -1610,25 +1660,6 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache
...
@@ -1610,25 +1660,6 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery, SParseMetaCache
return
code
;
return
code
;
}
}
static
int32_t
skipParentheses
(
SInsertParseSyntaxCxt
*
pCxt
)
{
SToken
sToken
;
int32_t
expectRightParenthesis
=
1
;
while
(
1
)
{
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
if
(
TK_NK_LP
==
sToken
.
type
)
{
++
expectRightParenthesis
;
}
else
if
(
TK_NK_RP
==
sToken
.
type
&&
0
==
--
expectRightParenthesis
)
{
break
;
}
if
(
0
==
sToken
.
n
)
{
return
buildSyntaxErrMsg
(
&
pCxt
->
msg
,
") expected"
,
NULL
);
}
}
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
skipBoundColumns
(
SInsertParseSyntaxCxt
*
pCxt
)
{
return
skipParentheses
(
pCxt
);
}
// pSql -> (field1_value, ...) [(field1_value2, ...) ...]
// pSql -> (field1_value, ...) [(field1_value2, ...) ...]
static
int32_t
skipValuesClause
(
SInsertParseSyntaxCxt
*
pCxt
)
{
static
int32_t
skipValuesClause
(
SInsertParseSyntaxCxt
*
pCxt
)
{
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
...
@@ -1717,15 +1748,15 @@ static int32_t parseInsertBodySyntax(SInsertParseSyntaxCxt* pCxt) {
...
@@ -1717,15 +1748,15 @@ static int32_t parseInsertBodySyntax(SInsertParseSyntaxCxt* pCxt) {
SToken
tbnameToken
=
sToken
;
SToken
tbnameToken
=
sToken
;
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
bool
existedUsing
=
false
;
// USING clause
// USING clause
if
(
TK_USING
==
sToken
.
type
)
{
if
(
TK_USING
==
sToken
.
type
)
{
existedUsing
=
true
;
CHECK_CODE
(
collectAutoCreateTableMetaKey
(
pCxt
,
&
tbnameToken
));
CHECK_CODE
(
collectAutoCreateTableMetaKey
(
pCxt
,
&
tbnameToken
));
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
CHECK_CODE
(
collectTableMetaKey
(
pCxt
,
&
sToken
));
CHECK_CODE
(
collectTableMetaKey
(
pCxt
,
&
sToken
));
CHECK_CODE
(
skipUsingClause
(
pCxt
));
CHECK_CODE
(
skipUsingClause
(
pCxt
));
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
}
else
{
CHECK_CODE
(
collectTableMetaKey
(
pCxt
,
&
tbnameToken
));
}
}
if
(
TK_NK_LP
==
sToken
.
type
)
{
if
(
TK_NK_LP
==
sToken
.
type
)
{
...
@@ -1734,6 +1765,17 @@ static int32_t parseInsertBodySyntax(SInsertParseSyntaxCxt* pCxt) {
...
@@ -1734,6 +1765,17 @@ static int32_t parseInsertBodySyntax(SInsertParseSyntaxCxt* pCxt) {
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
}
}
if
(
TK_USING
==
sToken
.
type
&&
!
existedUsing
)
{
existedUsing
=
true
;
CHECK_CODE
(
collectAutoCreateTableMetaKey
(
pCxt
,
&
tbnameToken
));
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
CHECK_CODE
(
collectTableMetaKey
(
pCxt
,
&
sToken
));
CHECK_CODE
(
skipUsingClause
(
pCxt
));
NEXT_TOKEN
(
pCxt
->
pSql
,
sToken
);
}
else
{
CHECK_CODE
(
collectTableMetaKey
(
pCxt
,
&
tbnameToken
));
}
if
(
TK_VALUES
==
sToken
.
type
)
{
if
(
TK_VALUES
==
sToken
.
type
)
{
// pSql -> (field1_value, ...) [(field1_value2, ...) ...]
// pSql -> (field1_value, ...) [(field1_value2, ...) ...]
CHECK_CODE
(
skipValuesClause
(
pCxt
));
CHECK_CODE
(
skipValuesClause
(
pCxt
));
...
...
source/libs/parser/src/parTranslater.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/parser/src/parUtil.c
浏览文件 @
406d35d4
...
@@ -215,13 +215,21 @@ int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...) {
...
@@ -215,13 +215,21 @@ int32_t generateSyntaxErrMsg(SMsgBuf* pBuf, int32_t errCode, ...) {
return
errCode
;
return
errCode
;
}
}
int32_t
generateSyntaxErrMsgExt
(
SMsgBuf
*
pBuf
,
int32_t
errCode
,
const
char
*
pFormat
,
...)
{
va_list
vArgList
;
va_start
(
vArgList
,
pFormat
);
vsnprintf
(
pBuf
->
buf
,
pBuf
->
len
,
pFormat
,
vArgList
);
va_end
(
vArgList
);
return
errCode
;
}
int32_t
buildInvalidOperationMsg
(
SMsgBuf
*
pBuf
,
const
char
*
msg
)
{
int32_t
buildInvalidOperationMsg
(
SMsgBuf
*
pBuf
,
const
char
*
msg
)
{
strncpy
(
pBuf
->
buf
,
msg
,
pBuf
->
len
);
strncpy
(
pBuf
->
buf
,
msg
,
pBuf
->
len
);
return
TSDB_CODE_TSC_INVALID_OPERATION
;
return
TSDB_CODE_TSC_INVALID_OPERATION
;
}
}
int32_t
buildSyntaxErrMsg
(
SMsgBuf
*
pBuf
,
const
char
*
additionalInfo
,
const
char
*
sourceStr
)
{
int32_t
buildSyntaxErrMsg
(
SMsgBuf
*
pBuf
,
const
char
*
additionalInfo
,
const
char
*
sourceStr
)
{
if
(
pBuf
==
NULL
)
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
if
(
pBuf
==
NULL
)
return
TSDB_CODE_TSC_SQL_SYNTAX_ERROR
;
const
char
*
msgFormat1
=
"syntax error near
\'
%s
\'
"
;
const
char
*
msgFormat1
=
"syntax error near
\'
%s
\'
"
;
const
char
*
msgFormat2
=
"syntax error near
\'
%s
\'
(%s)"
;
const
char
*
msgFormat2
=
"syntax error near
\'
%s
\'
(%s)"
;
const
char
*
msgFormat3
=
"%s"
;
const
char
*
msgFormat3
=
"%s"
;
...
...
source/libs/parser/src/sql.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/parser/test/mockCatalog.cpp
浏览文件 @
406d35d4
...
@@ -159,7 +159,7 @@ void generatePerformanceSchema(MockCatalogService* mcs) {
...
@@ -159,7 +159,7 @@ void generatePerformanceSchema(MockCatalogService* mcs) {
* c4 | column | DOUBLE | 8 |
* c4 | column | DOUBLE | 8 |
* c5 | column | DOUBLE | 8 |
* c5 | column | DOUBLE | 8 |
*/
*/
void
generateTestT
1
(
MockCatalogService
*
mcs
)
{
void
generateTestT
ables
(
MockCatalogService
*
mcs
)
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"t1"
,
TSDB_NORMAL_TABLE
,
6
)
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"t1"
,
TSDB_NORMAL_TABLE
,
6
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
setVgid
(
1
)
.
setVgid
(
1
)
...
@@ -183,23 +183,7 @@ void generateTestT1(MockCatalogService* mcs) {
...
@@ -183,23 +183,7 @@ void generateTestT1(MockCatalogService* mcs) {
* tag2 | tag | VARCHAR | 20 |
* tag2 | tag | VARCHAR | 20 |
* tag3 | tag | TIMESTAMP | 8 |
* tag3 | tag | TIMESTAMP | 8 |
* Child Table: st1s1, st1s2
* Child Table: st1s1, st1s2
*/
*
void
generateTestST1
(
MockCatalogService
*
mcs
)
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st1"
,
TSDB_SUPER_TABLE
,
3
,
3
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"tag1"
,
TSDB_DATA_TYPE_INT
)
.
addTag
(
"tag2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"tag3"
,
TSDB_DATA_TYPE_TIMESTAMP
);
builder
.
done
();
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s1"
,
1
);
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s2"
,
2
);
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s3"
,
1
);
}
/*
* Super Table: st2
* Super Table: st2
* Field | Type | DataType | Bytes |
* Field | Type | DataType | Bytes |
* ==========================================================================
* ==========================================================================
...
@@ -209,16 +193,32 @@ void generateTestST1(MockCatalogService* mcs) {
...
@@ -209,16 +193,32 @@ void generateTestST1(MockCatalogService* mcs) {
* jtag | tag | json | -- |
* jtag | tag | json | -- |
* Child Table: st2s1, st2s2
* Child Table: st2s1, st2s2
*/
*/
void
generateTestST2
(
MockCatalogService
*
mcs
)
{
void
generateTestStables
(
MockCatalogService
*
mcs
)
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st2"
,
TSDB_SUPER_TABLE
,
3
,
1
)
{
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st1"
,
TSDB_SUPER_TABLE
,
3
,
3
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addTag
(
"jtag"
,
TSDB_DATA_TYPE_JSON
);
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
builder
.
done
();
.
addTag
(
"tag1"
,
TSDB_DATA_TYPE_INT
)
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s1"
,
1
);
.
addTag
(
"tag2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s2"
,
2
);
.
addTag
(
"tag3"
,
TSDB_DATA_TYPE_TIMESTAMP
);
builder
.
done
();
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s1"
,
1
);
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s2"
,
2
);
mcs
->
createSubTable
(
"test"
,
"st1"
,
"st1s3"
,
1
);
}
{
ITableBuilder
&
builder
=
mcs
->
createTableBuilder
(
"test"
,
"st2"
,
TSDB_SUPER_TABLE
,
3
,
1
)
.
setPrecision
(
TSDB_TIME_PRECISION_MILLI
)
.
addColumn
(
"ts"
,
TSDB_DATA_TYPE_TIMESTAMP
)
.
addColumn
(
"c1"
,
TSDB_DATA_TYPE_INT
)
.
addColumn
(
"c2"
,
TSDB_DATA_TYPE_BINARY
,
20
)
.
addTag
(
"jtag"
,
TSDB_DATA_TYPE_JSON
);
builder
.
done
();
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s1"
,
1
);
mcs
->
createSubTable
(
"test"
,
"st2"
,
"st2s2"
,
2
);
}
}
}
void
generateFunctions
(
MockCatalogService
*
mcs
)
{
void
generateFunctions
(
MockCatalogService
*
mcs
)
{
...
@@ -233,6 +233,11 @@ void generateDnodes(MockCatalogService* mcs) {
...
@@ -233,6 +233,11 @@ void generateDnodes(MockCatalogService* mcs) {
mcs
->
createDnode
(
3
,
"host3"
,
7030
);
mcs
->
createDnode
(
3
,
"host3"
,
7030
);
}
}
void
generateDatabases
(
MockCatalogService
*
mcs
)
{
mcs
->
createDatabase
(
"test"
);
mcs
->
createDatabase
(
"rollup_db"
,
true
);
}
}
// namespace
}
// namespace
int32_t
__catalogGetHandle
(
const
char
*
clusterId
,
struct
SCatalog
**
catalogHandle
)
{
return
0
;
}
int32_t
__catalogGetHandle
(
const
char
*
clusterId
,
struct
SCatalog
**
catalogHandle
)
{
return
0
;
}
...
@@ -262,7 +267,7 @@ int32_t __catalogGetDBVgInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char
...
@@ -262,7 +267,7 @@ int32_t __catalogGetDBVgInfo(SCatalog* pCtg, SRequestConnInfo* pConn, const char
}
}
int32_t
__catalogGetDBCfg
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
dbFName
,
SDbCfgInfo
*
pDbCfg
)
{
int32_t
__catalogGetDBCfg
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
dbFName
,
SDbCfgInfo
*
pDbCfg
)
{
return
0
;
return
g_mockCatalogService
->
catalogGetDBCfg
(
dbFName
,
pDbCfg
)
;
}
}
int32_t
__catalogChkAuth
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
user
,
const
char
*
dbFName
,
AUTH_TYPE
type
,
int32_t
__catalogChkAuth
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
user
,
const
char
*
dbFName
,
AUTH_TYPE
type
,
...
@@ -359,11 +364,11 @@ void initMetaDataEnv() {
...
@@ -359,11 +364,11 @@ void initMetaDataEnv() {
}
}
void
generateMetaData
()
{
void
generateMetaData
()
{
generateDatabases
(
g_mockCatalogService
.
get
());
generateInformationSchema
(
g_mockCatalogService
.
get
());
generateInformationSchema
(
g_mockCatalogService
.
get
());
generatePerformanceSchema
(
g_mockCatalogService
.
get
());
generatePerformanceSchema
(
g_mockCatalogService
.
get
());
generateTestT1
(
g_mockCatalogService
.
get
());
generateTestTables
(
g_mockCatalogService
.
get
());
generateTestST1
(
g_mockCatalogService
.
get
());
generateTestStables
(
g_mockCatalogService
.
get
());
generateTestST2
(
g_mockCatalogService
.
get
());
generateFunctions
(
g_mockCatalogService
.
get
());
generateFunctions
(
g_mockCatalogService
.
get
());
generateDnodes
(
g_mockCatalogService
.
get
());
generateDnodes
(
g_mockCatalogService
.
get
());
g_mockCatalogService
->
showTables
();
g_mockCatalogService
->
showTables
();
...
...
source/libs/parser/test/mockCatalogService.cpp
浏览文件 @
406d35d4
...
@@ -140,6 +140,17 @@ class MockCatalogServiceImpl {
...
@@ -140,6 +140,17 @@ class MockCatalogServiceImpl {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
catalogGetDBCfg
(
const
char
*
pDbFName
,
SDbCfgInfo
*
pDbCfg
)
const
{
std
::
string
dbFName
(
pDbFName
);
DbCfgCache
::
const_iterator
it
=
dbCfg_
.
find
(
dbFName
.
substr
(
std
::
string
(
pDbFName
).
find_last_of
(
'.'
)
+
1
));
if
(
dbCfg_
.
end
()
==
it
)
{
return
TSDB_CODE_FAILED
;
}
memcpy
(
pDbCfg
,
&
(
it
->
second
),
sizeof
(
SDbCfgInfo
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
{
int32_t
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
{
auto
it
=
udf_
.
find
(
funcName
);
auto
it
=
udf_
.
find
(
funcName
);
if
(
udf_
.
end
()
==
it
)
{
if
(
udf_
.
end
()
==
it
)
{
...
@@ -323,12 +334,21 @@ class MockCatalogServiceImpl {
...
@@ -323,12 +334,21 @@ class MockCatalogServiceImpl {
dnode_
.
insert
(
std
::
make_pair
(
dnodeId
,
epSet
));
dnode_
.
insert
(
std
::
make_pair
(
dnodeId
,
epSet
));
}
}
void
createDatabase
(
const
std
::
string
&
db
,
bool
rollup
)
{
SDbCfgInfo
cfg
=
{
0
};
if
(
rollup
)
{
cfg
.
pRetensions
=
taosArrayInit
(
TARRAY_MIN_SIZE
,
sizeof
(
SRetention
));
}
dbCfg_
.
insert
(
std
::
make_pair
(
db
,
cfg
));
}
private:
private:
typedef
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
MockTableMeta
>>
TableMetaCache
;
typedef
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
MockTableMeta
>>
TableMetaCache
;
typedef
std
::
map
<
std
::
string
,
TableMetaCache
>
DbMetaCache
;
typedef
std
::
map
<
std
::
string
,
TableMetaCache
>
DbMetaCache
;
typedef
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
SFuncInfo
>>
UdfMetaCache
;
typedef
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
SFuncInfo
>>
UdfMetaCache
;
typedef
std
::
map
<
std
::
string
,
std
::
vector
<
STableIndexInfo
>>
IndexMetaCache
;
typedef
std
::
map
<
std
::
string
,
std
::
vector
<
STableIndexInfo
>>
IndexMetaCache
;
typedef
std
::
map
<
int32_t
,
SEpSet
>
DnodeCache
;
typedef
std
::
map
<
int32_t
,
SEpSet
>
DnodeCache
;
typedef
std
::
map
<
std
::
string
,
SDbCfgInfo
>
DbCfgCache
;
uint64_t
getNextId
()
{
return
id_
++
;
}
uint64_t
getNextId
()
{
return
id_
++
;
}
...
@@ -486,6 +506,7 @@ class MockCatalogServiceImpl {
...
@@ -486,6 +506,7 @@ class MockCatalogServiceImpl {
for
(
int32_t
i
=
0
;
i
<
ndbs
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
ndbs
;
++
i
)
{
SMetaRes
res
=
{
0
};
SMetaRes
res
=
{
0
};
res
.
pRes
=
taosMemoryCalloc
(
1
,
sizeof
(
SDbCfgInfo
));
res
.
pRes
=
taosMemoryCalloc
(
1
,
sizeof
(
SDbCfgInfo
));
res
.
code
=
catalogGetDBCfg
((
const
char
*
)
taosArrayGet
(
pDbCfgReq
,
i
),
(
SDbCfgInfo
*
)
res
.
pRes
);
taosArrayPush
(
*
pDbCfgData
,
&
res
);
taosArrayPush
(
*
pDbCfgData
,
&
res
);
}
}
}
}
...
@@ -576,6 +597,7 @@ class MockCatalogServiceImpl {
...
@@ -576,6 +597,7 @@ class MockCatalogServiceImpl {
UdfMetaCache
udf_
;
UdfMetaCache
udf_
;
IndexMetaCache
index_
;
IndexMetaCache
index_
;
DnodeCache
dnode_
;
DnodeCache
dnode_
;
DbCfgCache
dbCfg_
;
};
};
MockCatalogService
::
MockCatalogService
()
:
impl_
(
new
MockCatalogServiceImpl
())
{}
MockCatalogService
::
MockCatalogService
()
:
impl_
(
new
MockCatalogServiceImpl
())
{}
...
@@ -605,6 +627,8 @@ void MockCatalogService::createDnode(int32_t dnodeId, const std::string& host, i
...
@@ -605,6 +627,8 @@ void MockCatalogService::createDnode(int32_t dnodeId, const std::string& host, i
impl_
->
createDnode
(
dnodeId
,
host
,
port
);
impl_
->
createDnode
(
dnodeId
,
host
,
port
);
}
}
void
MockCatalogService
::
createDatabase
(
const
std
::
string
&
db
,
bool
rollup
)
{
impl_
->
createDatabase
(
db
,
rollup
);
}
int32_t
MockCatalogService
::
catalogGetTableMeta
(
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
)
const
{
int32_t
MockCatalogService
::
catalogGetTableMeta
(
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
)
const
{
return
impl_
->
catalogGetTableMeta
(
pTableName
,
pTableMeta
);
return
impl_
->
catalogGetTableMeta
(
pTableName
,
pTableMeta
);
}
}
...
@@ -621,6 +645,10 @@ int32_t MockCatalogService::catalogGetDBVgInfo(const char* pDbFName, SArray** pV
...
@@ -621,6 +645,10 @@ int32_t MockCatalogService::catalogGetDBVgInfo(const char* pDbFName, SArray** pV
return
impl_
->
catalogGetDBVgInfo
(
pDbFName
,
pVgList
);
return
impl_
->
catalogGetDBVgInfo
(
pDbFName
,
pVgList
);
}
}
int32_t
MockCatalogService
::
catalogGetDBCfg
(
const
char
*
pDbFName
,
SDbCfgInfo
*
pDbCfg
)
const
{
return
impl_
->
catalogGetDBCfg
(
pDbFName
,
pDbCfg
);
}
int32_t
MockCatalogService
::
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
{
int32_t
MockCatalogService
::
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
{
return
impl_
->
catalogGetUdfInfo
(
funcName
,
pInfo
);
return
impl_
->
catalogGetUdfInfo
(
funcName
,
pInfo
);
}
}
...
...
source/libs/parser/test/mockCatalogService.h
浏览文件 @
406d35d4
...
@@ -63,11 +63,13 @@ class MockCatalogService {
...
@@ -63,11 +63,13 @@ class MockCatalogService {
void
createFunction
(
const
std
::
string
&
func
,
int8_t
funcType
,
int8_t
outputType
,
int32_t
outputLen
,
int32_t
bufSize
);
void
createFunction
(
const
std
::
string
&
func
,
int8_t
funcType
,
int8_t
outputType
,
int32_t
outputLen
,
int32_t
bufSize
);
void
createSmaIndex
(
const
SMCreateSmaReq
*
pReq
);
void
createSmaIndex
(
const
SMCreateSmaReq
*
pReq
);
void
createDnode
(
int32_t
dnodeId
,
const
std
::
string
&
host
,
int16_t
port
);
void
createDnode
(
int32_t
dnodeId
,
const
std
::
string
&
host
,
int16_t
port
);
void
createDatabase
(
const
std
::
string
&
db
,
bool
rollup
=
false
);
int32_t
catalogGetTableMeta
(
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
)
const
;
int32_t
catalogGetTableMeta
(
const
SName
*
pTableName
,
STableMeta
**
pTableMeta
)
const
;
int32_t
catalogGetTableHashVgroup
(
const
SName
*
pTableName
,
SVgroupInfo
*
vgInfo
)
const
;
int32_t
catalogGetTableHashVgroup
(
const
SName
*
pTableName
,
SVgroupInfo
*
vgInfo
)
const
;
int32_t
catalogGetTableDistVgInfo
(
const
SName
*
pTableName
,
SArray
**
pVgList
)
const
;
int32_t
catalogGetTableDistVgInfo
(
const
SName
*
pTableName
,
SArray
**
pVgList
)
const
;
int32_t
catalogGetDBVgInfo
(
const
char
*
pDbFName
,
SArray
**
pVgList
)
const
;
int32_t
catalogGetDBVgInfo
(
const
char
*
pDbFName
,
SArray
**
pVgList
)
const
;
int32_t
catalogGetDBCfg
(
const
char
*
pDbFName
,
SDbCfgInfo
*
pDbCfg
)
const
;
int32_t
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
;
int32_t
catalogGetUdfInfo
(
const
std
::
string
&
funcName
,
SFuncInfo
*
pInfo
)
const
;
int32_t
catalogGetTableIndex
(
const
SName
*
pTableName
,
SArray
**
pIndexes
)
const
;
int32_t
catalogGetTableIndex
(
const
SName
*
pTableName
,
SArray
**
pIndexes
)
const
;
int32_t
catalogGetDnodeList
(
SArray
**
pDnodes
)
const
;
int32_t
catalogGetDnodeList
(
SArray
**
pDnodes
)
const
;
...
...
source/libs/parser/test/parInitialATest.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/parser/test/parInitialCTest.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/planner/src/planOptimizer.c
浏览文件 @
406d35d4
...
@@ -720,7 +720,7 @@ static int32_t pushDownCondOptDealAgg(SOptimizeContext* pCxt, SAggLogicNode* pAg
...
@@ -720,7 +720,7 @@ static int32_t pushDownCondOptDealAgg(SOptimizeContext* pCxt, SAggLogicNode* pAg
// TODO: remove it after full implementation of pushing down to child
// TODO: remove it after full implementation of pushing down to child
if
(
1
!=
LIST_LENGTH
(
pAgg
->
node
.
pChildren
)
||
if
(
1
!=
LIST_LENGTH
(
pAgg
->
node
.
pChildren
)
||
QUERY_NODE_LOGIC_PLAN_SCAN
!=
nodeType
(
nodesListGetNode
(
pAgg
->
node
.
pChildren
,
0
))
&&
QUERY_NODE_LOGIC_PLAN_SCAN
!=
nodeType
(
nodesListGetNode
(
pAgg
->
node
.
pChildren
,
0
))
&&
QUERY_NODE_LOGIC_PLAN_PROJECT
!=
nodeType
(
nodesListGetNode
(
pAgg
->
node
.
pChildren
,
0
)))
{
QUERY_NODE_LOGIC_PLAN_PROJECT
!=
nodeType
(
nodesListGetNode
(
pAgg
->
node
.
pChildren
,
0
)))
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -1251,7 +1251,7 @@ static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) {
...
@@ -1251,7 +1251,7 @@ static SNode* partTagsCreateWrapperFunc(const char* pFuncName, SNode* pNode) {
}
}
strcpy
(
pFunc
->
functionName
,
pFuncName
);
strcpy
(
pFunc
->
functionName
,
pFuncName
);
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
))
{
if
(
QUERY_NODE_COLUMN
==
nodeType
(
pNode
)
&&
COLUMN_TYPE_TBNAME
!=
((
SColumnNode
*
)
pNode
)
->
colType
)
{
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
SColumnNode
*
pCol
=
(
SColumnNode
*
)
pNode
;
partTagsSetAlias
(
pFunc
->
node
.
aliasName
,
sizeof
(
pFunc
->
node
.
aliasName
),
pCol
->
tableAlias
,
pCol
->
colName
);
partTagsSetAlias
(
pFunc
->
node
.
aliasName
,
sizeof
(
pFunc
->
node
.
aliasName
),
pCol
->
tableAlias
,
pCol
->
colName
);
}
else
{
}
else
{
...
@@ -1868,6 +1868,8 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) {
...
@@ -1868,6 +1868,8 @@ static EDealRes mergeProjectionsExpr(SNode** pNode, void* pContext) {
pCxt
->
errCode
=
terrno
;
pCxt
->
errCode
=
terrno
;
return
DEAL_RES_ERROR
;
return
DEAL_RES_ERROR
;
}
}
snprintf
(((
SExprNode
*
)
pExpr
)
->
aliasName
,
sizeof
(((
SExprNode
*
)
pExpr
)
->
aliasName
),
"%s"
,
((
SExprNode
*
)
*
pNode
)
->
aliasName
);
nodesDestroyNode
(
*
pNode
);
nodesDestroyNode
(
*
pNode
);
*
pNode
=
pExpr
;
*
pNode
=
pExpr
;
}
}
...
...
source/libs/planner/src/planPhysiCreater.c
浏览文件 @
406d35d4
...
@@ -552,6 +552,9 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
...
@@ -552,6 +552,9 @@ static int32_t createSystemTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan*
if
(
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_USER_TABLES
)
||
if
(
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_USER_TABLES
)
||
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED
))
{
0
==
strcmp
(
pScanLogicNode
->
tableName
.
tname
,
TSDB_INS_TABLE_USER_TABLE_DISTRIBUTED
))
{
vgroupInfoToNodeAddr
(
pScanLogicNode
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
vgroupInfoToNodeAddr
(
pScanLogicNode
->
pVgroupList
->
vgroups
,
&
pSubplan
->
execNode
);
}
else
{
pSubplan
->
execNode
.
nodeId
=
MNODE_HANDLE
;
pSubplan
->
execNode
.
epSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
;
}
}
SQueryNodeLoad
node
=
{.
addr
=
{.
nodeId
=
MNODE_HANDLE
,
.
epSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
},
.
load
=
0
};
SQueryNodeLoad
node
=
{.
addr
=
{.
nodeId
=
MNODE_HANDLE
,
.
epSet
=
pCxt
->
pPlanCxt
->
mgmtEpSet
},
.
load
=
0
};
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
node
);
taosArrayPush
(
pCxt
->
pExecNodeList
,
&
node
);
...
...
source/libs/planner/src/planSpliter.c
浏览文件 @
406d35d4
...
@@ -986,6 +986,10 @@ static bool unionIsChildSubplan(SLogicNode* pLogicNode, int32_t groupId) {
...
@@ -986,6 +986,10 @@ static bool unionIsChildSubplan(SLogicNode* pLogicNode, int32_t groupId) {
return
((
SExchangeLogicNode
*
)
pLogicNode
)
->
srcGroupId
==
groupId
;
return
((
SExchangeLogicNode
*
)
pLogicNode
)
->
srcGroupId
==
groupId
;
}
}
if
(
QUERY_NODE_LOGIC_PLAN_MERGE
==
nodeType
(
pLogicNode
))
{
return
((
SMergeLogicNode
*
)
pLogicNode
)
->
srcGroupId
==
groupId
;
}
SNode
*
pChild
;
SNode
*
pChild
;
FOREACH
(
pChild
,
pLogicNode
->
pChildren
)
{
FOREACH
(
pChild
,
pLogicNode
->
pChildren
)
{
bool
isChild
=
unionIsChildSubplan
((
SLogicNode
*
)
pChild
,
groupId
);
bool
isChild
=
unionIsChildSubplan
((
SLogicNode
*
)
pChild
,
groupId
);
...
@@ -1014,14 +1018,14 @@ static int32_t unionMountSubplan(SLogicSubplan* pParent, SNodeList* pChildren) {
...
@@ -1014,14 +1018,14 @@ static int32_t unionMountSubplan(SLogicSubplan* pParent, SNodeList* pChildren) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
SLogicSubplan
*
unionCreateSubplan
(
SSplitContext
*
pCxt
,
SLogicNode
*
pNode
)
{
static
SLogicSubplan
*
unionCreateSubplan
(
SSplitContext
*
pCxt
,
SLogicNode
*
pNode
,
ESubplanType
subplanType
)
{
SLogicSubplan
*
pSubplan
=
(
SLogicSubplan
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_SUBPLAN
);
SLogicSubplan
*
pSubplan
=
(
SLogicSubplan
*
)
nodesMakeNode
(
QUERY_NODE_LOGIC_SUBPLAN
);
if
(
NULL
==
pSubplan
)
{
if
(
NULL
==
pSubplan
)
{
return
NULL
;
return
NULL
;
}
}
pSubplan
->
id
.
queryId
=
pCxt
->
queryId
;
pSubplan
->
id
.
queryId
=
pCxt
->
queryId
;
pSubplan
->
id
.
groupId
=
pCxt
->
groupId
;
pSubplan
->
id
.
groupId
=
pCxt
->
groupId
;
pSubplan
->
subplanType
=
SUBPLAN_TYPE_SCAN
;
pSubplan
->
subplanType
=
subplanType
;
pSubplan
->
pNode
=
pNode
;
pSubplan
->
pNode
=
pNode
;
pNode
->
pParent
=
NULL
;
pNode
->
pParent
=
NULL
;
return
pSubplan
;
return
pSubplan
;
...
@@ -1035,7 +1039,7 @@ static int32_t unionSplitSubplan(SSplitContext* pCxt, SLogicSubplan* pUnionSubpl
...
@@ -1035,7 +1039,7 @@ static int32_t unionSplitSubplan(SSplitContext* pCxt, SLogicSubplan* pUnionSubpl
SNode
*
pChild
=
NULL
;
SNode
*
pChild
=
NULL
;
FOREACH
(
pChild
,
pSplitNode
->
pChildren
)
{
FOREACH
(
pChild
,
pSplitNode
->
pChildren
)
{
SLogicSubplan
*
pNewSubplan
=
unionCreateSubplan
(
pCxt
,
(
SLogicNode
*
)
pChild
);
SLogicSubplan
*
pNewSubplan
=
unionCreateSubplan
(
pCxt
,
(
SLogicNode
*
)
pChild
,
pUnionSubplan
->
subplanType
);
code
=
nodesListMakeStrictAppend
(
&
pUnionSubplan
->
pChildren
,
(
SNode
*
)
pNewSubplan
);
code
=
nodesListMakeStrictAppend
(
&
pUnionSubplan
->
pChildren
,
(
SNode
*
)
pNewSubplan
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
if
(
TSDB_CODE_SUCCESS
==
code
)
{
REPLACE_NODE
(
NULL
);
REPLACE_NODE
(
NULL
);
...
...
source/libs/planner/test/planOptimizeTest.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/planner/test/planSetOpTest.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/qworker/src/qworker.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/scalar/src/scalar.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclfunc.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/scheduler/src/schJob.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/scheduler/src/schRemote.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/scheduler/src/scheduler.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/scheduler/test/schedulerTests.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncAppendEntriesReply.h
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncInt.h
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncRaftEntry.h
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncReplication.h
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncSnapshot.h
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncAppendEntries.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncAppendEntriesReply.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMain.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMessage.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftEntry.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftLog.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncReplication.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/src/syncSnapshot.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/test/CMakeLists.txt
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/test/syncAppendEntriesBatchTest.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/test/syncClientRequestBatchTest.cpp
0 → 100644
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/test/syncConfigChangeSnapshotTest.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/test/syncSnapshotReceiverTest.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/test/syncSnapshotSenderTest.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/sync/test/syncTestTool.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/tfs/src/tfs.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/transport/inc/transComm.h
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/transport/inc/transportInt.h
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/transport/src/trans.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/transport/src/transComm.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/transport/src/transSvr.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/transport/test/transUT.cpp
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/libs/wal/src/walWrite.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
source/util/src/ttimer.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/api/stopquery.c
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/jenkins/basic.txt
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/sh/deploy.sh
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/sh/stop_dnodes.sh
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/tmp/prepare.sim
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/tsim/insert/update0.sim
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/tsim/sma/rsmaPersistenceRecovery.sim
0 → 100644
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/tsim/tmq/basic1.sim
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/script/tsim/valgrind/basic.sim
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/1-insert/block_wise.py
0 → 100644
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/1-insert/create_retentions.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/1-insert/time_range_wise.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/abs.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/distribute_agg_apercentile.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/distribute_agg_avg.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/distribute_agg_count.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/distribute_agg_max.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/distribute_agg_min.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/distribute_agg_spread.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/distribute_agg_stddev.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/distribute_agg_sum.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/function_null.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/irate.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/json_tag.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/max.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/2-query/twa.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqConsFromTsdb-1ctb.py
0 → 100644
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqConsFromTsdb1-1ctb.py
0 → 100644
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqConsFromTsdb1-mutilVg.py
0 → 100644
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqConsFromTsdb1.py
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
406d35d4
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录