Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
ee821197
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看板
提交
ee821197
编写于
6月 24, 2022
作者:
C
cpwu
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' into cpwu/3.0
上级
f000a2df
5c081c33
变更
136
展开全部
显示空白变更内容
内联
并排
Showing
136 changed file
with
3736 addition
and
1682 deletion
+3736
-1682
examples/c/tmq.c
examples/c/tmq.c
+37
-4
include/client/taos.h
include/client/taos.h
+1
-1
include/common/tcommon.h
include/common/tcommon.h
+8
-8
include/common/tdatablock.h
include/common/tdatablock.h
+13
-6
include/common/tmsg.h
include/common/tmsg.h
+32
-11
include/common/tmsgdef.h
include/common/tmsgdef.h
+3
-1
include/dnode/mnode/mnode.h
include/dnode/mnode/mnode.h
+3
-1
include/libs/executor/dataSinkMgt.h
include/libs/executor/dataSinkMgt.h
+3
-2
include/libs/executor/executor.h
include/libs/executor/executor.h
+9
-0
include/libs/function/function.h
include/libs/function/function.h
+0
-17
include/libs/monitor/monitor.h
include/libs/monitor/monitor.h
+13
-0
include/libs/nodes/cmdnodes.h
include/libs/nodes/cmdnodes.h
+4
-0
include/libs/qworker/qworker.h
include/libs/qworker/qworker.h
+1
-1
include/libs/stream/tstream.h
include/libs/stream/tstream.h
+2
-0
include/libs/sync/sync.h
include/libs/sync/sync.h
+6
-5
include/libs/sync/syncTools.h
include/libs/sync/syncTools.h
+9
-12
include/util/taoserror.h
include/util/taoserror.h
+1
-0
include/util/tconfig.h
include/util/tconfig.h
+2
-0
include/util/tdef.h
include/util/tdef.h
+2
-2
source/client/src/clientMain.c
source/client/src/clientMain.c
+2
-0
source/client/src/tmq.c
source/client/src/tmq.c
+30
-15
source/common/src/systable.c
source/common/src/systable.c
+8
-1
source/common/src/tdatablock.c
source/common/src/tdatablock.c
+204
-131
source/common/src/tglobal.c
source/common/src/tglobal.c
+3
-3
source/common/src/tmsg.c
source/common/src/tmsg.c
+97
-0
source/common/src/ttime.c
source/common/src/ttime.c
+44
-14
source/common/test/commonTests.cpp
source/common/test/commonTests.cpp
+12
-34
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
+1
-0
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
+138
-2
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
+3
-0
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
+2
-1
source/dnode/mgmt/node_mgmt/src/dmTransport.c
source/dnode/mgmt/node_mgmt/src/dmTransport.c
+1
-0
source/dnode/mgmt/node_util/src/dmFile.c
source/dnode/mgmt/node_util/src/dmFile.c
+13
-3
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+106
-28
source/dnode/mnode/impl/src/mndMain.c
source/dnode/mnode/impl/src/mndMain.c
+29
-3
source/dnode/mnode/impl/src/mndScheduler.c
source/dnode/mnode/impl/src/mndScheduler.c
+1
-1
source/dnode/mnode/impl/src/mndShow.c
source/dnode/mnode/impl/src/mndShow.c
+1
-2
source/dnode/vnode/CMakeLists.txt
source/dnode/vnode/CMakeLists.txt
+1
-0
source/dnode/vnode/inc/vnode.h
source/dnode/vnode/inc/vnode.h
+2
-2
source/dnode/vnode/src/inc/sma.h
source/dnode/vnode/src/inc/sma.h
+88
-32
source/dnode/vnode/src/inc/tq.h
source/dnode/vnode/src/inc/tq.h
+1
-0
source/dnode/vnode/src/inc/vnodeInt.h
source/dnode/vnode/src/inc/vnodeInt.h
+0
-1
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+3
-4
source/dnode/vnode/src/meta/metaTable.c
source/dnode/vnode/src/meta/metaTable.c
+1
-0
source/dnode/vnode/src/sma/smaEnv.c
source/dnode/vnode/src/sma/smaEnv.c
+34
-17
source/dnode/vnode/src/sma/smaOpen.c
source/dnode/vnode/src/sma/smaOpen.c
+13
-0
source/dnode/vnode/src/sma/smaRollup.c
source/dnode/vnode/src/sma/smaRollup.c
+183
-67
source/dnode/vnode/src/sma/smaTimeRange.c
source/dnode/vnode/src/sma/smaTimeRange.c
+2
-2
source/dnode/vnode/src/sma/smaUtil.c
source/dnode/vnode/src/sma/smaUtil.c
+238
-0
source/dnode/vnode/src/tq/tq.c
source/dnode/vnode/src/tq/tq.c
+37
-8
source/dnode/vnode/src/tq/tqExec.c
source/dnode/vnode/src/tq/tqExec.c
+28
-6
source/dnode/vnode/src/tq/tqOffset.c
source/dnode/vnode/src/tq/tqOffset.c
+2
-2
source/dnode/vnode/src/tq/tqRead.c
source/dnode/vnode/src/tq/tqRead.c
+19
-31
source/dnode/vnode/src/tq/tqSink.c
source/dnode/vnode/src/tq/tqSink.c
+2
-2
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+33
-36
source/dnode/vnode/test/tsdbSmaTest.cpp
source/dnode/vnode/test/tsdbSmaTest.cpp
+1
-1
source/libs/catalog/inc/catalogInt.h
source/libs/catalog/inc/catalogInt.h
+3
-0
source/libs/catalog/src/catalog.c
source/libs/catalog/src/catalog.c
+13
-2
source/libs/catalog/src/ctgAsync.c
source/libs/catalog/src/ctgAsync.c
+61
-1
source/libs/catalog/src/ctgRemote.c
source/libs/catalog/src/ctgRemote.c
+48
-3
source/libs/catalog/src/ctgUtil.c
source/libs/catalog/src/ctgUtil.c
+12
-0
source/libs/command/src/command.c
source/libs/command/src/command.c
+99
-51
source/libs/command/src/explain.c
source/libs/command/src/explain.c
+5
-12
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+1
-2
source/libs/executor/src/dataDeleter.c
source/libs/executor/src/dataDeleter.c
+2
-2
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+6
-14
source/libs/executor/src/executor.c
source/libs/executor/src/executor.c
+11
-8
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+45
-52
source/libs/executor/src/groupoperator.c
source/libs/executor/src/groupoperator.c
+2
-2
source/libs/executor/src/scanoperator.c
source/libs/executor/src/scanoperator.c
+68
-54
source/libs/executor/src/sortoperator.c
source/libs/executor/src/sortoperator.c
+15
-8
source/libs/executor/src/tfill.c
source/libs/executor/src/tfill.c
+1
-1
source/libs/executor/src/timewindowoperator.c
source/libs/executor/src/timewindowoperator.c
+10
-8
source/libs/executor/src/tsort.c
source/libs/executor/src/tsort.c
+4
-4
source/libs/executor/test/executorTests.cpp
source/libs/executor/test/executorTests.cpp
+10
-32
source/libs/executor/test/sortTests.cpp
source/libs/executor/test/sortTests.cpp
+7
-17
source/libs/function/inc/taggfunction.h
source/libs/function/inc/taggfunction.h
+0
-13
source/libs/function/src/builtins.c
source/libs/function/src/builtins.c
+36
-3
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+17
-8
source/libs/function/src/tudf.c
source/libs/function/src/tudf.c
+15
-30
source/libs/function/src/udfd.c
source/libs/function/src/udfd.c
+3
-2
source/libs/function/test/runUdf.c
source/libs/function/test/runUdf.c
+24
-26
source/libs/index/test/index_executor_tests.cpp
source/libs/index/test/index_executor_tests.cpp
+1
-1
source/libs/monitor/src/monMain.c
source/libs/monitor/src/monMain.c
+25
-0
source/libs/monitor/src/monMsg.c
source/libs/monitor/src/monMsg.c
+36
-0
source/libs/parser/src/parAstParser.c
source/libs/parser/src/parAstParser.c
+3
-0
source/libs/parser/src/parTranslater.c
source/libs/parser/src/parTranslater.c
+22
-1
source/libs/parser/src/parUtil.c
source/libs/parser/src/parUtil.c
+6
-1
source/libs/parser/test/mockCatalogService.cpp
source/libs/parser/test/mockCatalogService.cpp
+5
-2
source/libs/qcom/src/querymsg.c
source/libs/qcom/src/querymsg.c
+42
-0
source/libs/qworker/src/qworker.c
source/libs/qworker/src/qworker.c
+1
-1
source/libs/scalar/inc/sclInt.h
source/libs/scalar/inc/sclInt.h
+1
-1
source/libs/scalar/src/filter.c
source/libs/scalar/src/filter.c
+1
-1
source/libs/scalar/src/scalar.c
source/libs/scalar/src/scalar.c
+13
-12
source/libs/scalar/src/sclfunc.c
source/libs/scalar/src/sclfunc.c
+29
-21
source/libs/scalar/src/sclvector.c
source/libs/scalar/src/sclvector.c
+2
-2
source/libs/scalar/test/filter/filterTests.cpp
source/libs/scalar/test/filter/filterTests.cpp
+131
-151
source/libs/scalar/test/scalar/scalarTests.cpp
source/libs/scalar/test/scalar/scalarTests.cpp
+30
-47
source/libs/stream/inc/streamInc.h
source/libs/stream/inc/streamInc.h
+1
-1
source/libs/stream/src/streamDispatch.c
source/libs/stream/src/streamDispatch.c
+10
-5
source/libs/stream/src/streamExec.c
source/libs/stream/src/streamExec.c
+25
-21
source/libs/sync/inc/syncEnv.h
source/libs/sync/inc/syncEnv.h
+6
-6
source/libs/sync/inc/syncRaftLog.h
source/libs/sync/inc/syncRaftLog.h
+5
-3
source/libs/sync/src/syncAppendEntries.c
source/libs/sync/src/syncAppendEntries.c
+33
-41
source/libs/sync/src/syncAppendEntriesReply.c
source/libs/sync/src/syncAppendEntriesReply.c
+19
-23
source/libs/sync/src/syncMain.c
source/libs/sync/src/syncMain.c
+91
-10
source/libs/sync/src/syncRaftCfg.c
source/libs/sync/src/syncRaftCfg.c
+21
-17
source/libs/sync/src/syncRaftLog.c
source/libs/sync/src/syncRaftLog.c
+219
-71
source/libs/sync/src/syncReplication.c
source/libs/sync/src/syncReplication.c
+20
-0
source/libs/sync/src/syncSnapshot.c
source/libs/sync/src/syncSnapshot.c
+12
-3
source/libs/sync/test/syncRaftLogTest2.cpp
source/libs/sync/test/syncRaftLogTest2.cpp
+29
-4
source/libs/sync/test/syncRaftLogTest3.cpp
source/libs/sync/test/syncRaftLogTest3.cpp
+3
-1
source/libs/tdb/src/db/tdbBtree.c
source/libs/tdb/src/db/tdbBtree.c
+15
-15
source/libs/transport/src/transCli.c
source/libs/transport/src/transCli.c
+21
-19
source/libs/wal/src/walRead.c
source/libs/wal/src/walRead.c
+13
-2
source/libs/wal/src/walWrite.c
source/libs/wal/src/walWrite.c
+1
-0
source/util/src/tconfig.c
source/util/src/tconfig.c
+33
-1
source/util/src/terror.c
source/util/src/terror.c
+2
-1
source/util/src/tlog.c
source/util/src/tlog.c
+1
-1
tests/pytest/util/cluster.py
tests/pytest/util/cluster.py
+26
-236
tests/script/general/parser/udf.sim
tests/script/general/parser/udf.sim
+1
-0
tests/script/jenkins/basic.txt
tests/script/jenkins/basic.txt
+1
-0
tests/script/tmp/monitor.sim
tests/script/tmp/monitor.sim
+2
-0
tests/script/tsim/query/udf.sim
tests/script/tsim/query/udf.sim
+1
-0
tests/script/tsim/show/basic.sim
tests/script/tsim/show/basic.sim
+17
-2
tests/script/tsim/tmq/consume.sh
tests/script/tsim/tmq/consume.sh
+7
-3
tests/script/tsim/tmq/snapshot.sim
tests/script/tsim/tmq/snapshot.sim
+289
-0
tests/system-test/6-cluster/5dnode3mnodeStop.py
tests/system-test/6-cluster/5dnode3mnodeStop.py
+0
-10
tests/system-test/7-tmq/tmq3mnodeSwitch.py
tests/system-test/7-tmq/tmq3mnodeSwitch.py
+272
-0
tests/system-test/7-tmq/tmqCommon.py
tests/system-test/7-tmq/tmqCommon.py
+40
-0
tests/system-test/7-tmq/tmqUdf.py
tests/system-test/7-tmq/tmqUdf.py
+1
-1
tests/system-test/fulltest.sh
tests/system-test/fulltest.sh
+2
-1
tests/system-test/simpletest.bat
tests/system-test/simpletest.bat
+1
-1
tests/system-test/test.py
tests/system-test/test.py
+10
-6
tests/test/c/tmqSim.c
tests/test/c/tmqSim.c
+77
-60
tools/shell/src/shellEngine.c
tools/shell/src/shellEngine.c
+11
-1
未找到文件。
examples/c/tmq.c
浏览文件 @
ee821197
...
@@ -26,6 +26,14 @@ static void msg_process(TAOS_RES* msg) {
...
@@ -26,6 +26,14 @@ static void msg_process(TAOS_RES* msg) {
printf
(
"topic: %s
\n
"
,
tmq_get_topic_name
(
msg
));
printf
(
"topic: %s
\n
"
,
tmq_get_topic_name
(
msg
));
printf
(
"db: %s
\n
"
,
tmq_get_db_name
(
msg
));
printf
(
"db: %s
\n
"
,
tmq_get_db_name
(
msg
));
printf
(
"vg: %d
\n
"
,
tmq_get_vgroup_id
(
msg
));
printf
(
"vg: %d
\n
"
,
tmq_get_vgroup_id
(
msg
));
if
(
tmq_get_res_type
(
msg
)
==
TMQ_RES_TABLE_META
)
{
void
*
meta
;
int32_t
metaLen
;
tmq_get_raw_meta
(
msg
,
&
meta
,
&
metaLen
);
printf
(
"meta, len is %d
\n
"
,
metaLen
);
return
;
}
while
(
1
)
{
while
(
1
)
{
TAOS_ROW
row
=
taos_fetch_row
(
msg
);
TAOS_ROW
row
=
taos_fetch_row
(
msg
);
if
(
row
==
NULL
)
break
;
if
(
row
==
NULL
)
break
;
...
@@ -76,19 +84,41 @@ int32_t init_env() {
...
@@ -76,19 +84,41 @@ int32_t init_env() {
}
}
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"insert into ct0 values(now, 1, 2, 'a')"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to insert into ct0, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create table if not exists ct1 using st1 tags(2000)"
);
pRes
=
taos_query
(
pConn
,
"create table if not exists ct1 using st1 tags(2000)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create child table
tu2
, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to create child table
ct1
, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
}
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"insert into ct1 values(now, 3, 4, 'b')"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to insert into ct1, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"create table if not exists ct3 using st1 tags(3000)"
);
pRes
=
taos_query
(
pConn
,
"create table if not exists ct3 using st1 tags(3000)"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create child table
tu
3, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to create child table
ct
3, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
}
}
taos_free_result
(
pRes
);
pRes
=
taos_query
(
pConn
,
"insert into ct3 values(now, 5, 6, 'c')"
);
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to insert into ct3, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
}
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
return
0
;
return
0
;
}
}
...
@@ -107,8 +137,8 @@ int32_t create_topic() {
...
@@ -107,8 +137,8 @@ int32_t create_topic() {
}
}
taos_free_result
(
pRes
);
taos_free_result
(
pRes
);
/*pRes = taos_query(pConn, "create topic topic_ctb_column as database abc1");*/
pRes
=
taos_query
(
pConn
,
"create topic topic_ctb_column with meta as database abc1"
);
pRes
=
taos_query
(
pConn
,
"create topic topic_ctb_column as select ts, c1, c2, c3 from st1"
);
/*pRes = taos_query(pConn, "create topic topic_ctb_column as select ts, c1, c2, c3 from st1");*/
if
(
taos_errno
(
pRes
)
!=
0
)
{
if
(
taos_errno
(
pRes
)
!=
0
)
{
printf
(
"failed to create topic topic_ctb_column, reason:%s
\n
"
,
taos_errstr
(
pRes
));
printf
(
"failed to create topic topic_ctb_column, reason:%s
\n
"
,
taos_errstr
(
pRes
));
return
-
1
;
return
-
1
;
...
@@ -168,6 +198,9 @@ tmq_t* build_consumer() {
...
@@ -168,6 +198,9 @@ tmq_t* build_consumer() {
tmq_conf_set
(
conf
,
"td.connect.pass"
,
"taosdata"
);
tmq_conf_set
(
conf
,
"td.connect.pass"
,
"taosdata"
);
tmq_conf_set
(
conf
,
"msg.with.table.name"
,
"true"
);
tmq_conf_set
(
conf
,
"msg.with.table.name"
,
"true"
);
tmq_conf_set
(
conf
,
"enable.auto.commit"
,
"true"
);
tmq_conf_set
(
conf
,
"enable.auto.commit"
,
"true"
);
tmq_conf_set
(
conf
,
"experiment.use.snapshot"
,
"false"
);
tmq_conf_set_auto_commit_cb
(
conf
,
tmq_commit_cb_print
,
NULL
);
tmq_conf_set_auto_commit_cb
(
conf
,
tmq_commit_cb_print
,
NULL
);
tmq_t
*
tmq
=
tmq_consumer_new
(
conf
,
NULL
,
0
);
tmq_t
*
tmq
=
tmq_consumer_new
(
conf
,
NULL
,
0
);
assert
(
tmq
);
assert
(
tmq
);
...
...
include/client/taos.h
浏览文件 @
ee821197
...
@@ -261,7 +261,7 @@ enum tmq_res_t {
...
@@ -261,7 +261,7 @@ enum tmq_res_t {
typedef
enum
tmq_res_t
tmq_res_t
;
typedef
enum
tmq_res_t
tmq_res_t
;
DLL_EXPORT
tmq_res_t
tmq_get_res_type
(
TAOS_RES
*
res
);
DLL_EXPORT
tmq_res_t
tmq_get_res_type
(
TAOS_RES
*
res
);
DLL_EXPORT
int32_t
tmq_get_raw_meta
(
TAOS_RES
*
res
,
const
void
**
raw_meta
,
int32_t
*
raw_meta_len
);
DLL_EXPORT
int32_t
tmq_get_raw_meta
(
TAOS_RES
*
res
,
void
**
raw_meta
,
int32_t
*
raw_meta_len
);
DLL_EXPORT
const
char
*
tmq_get_topic_name
(
TAOS_RES
*
res
);
DLL_EXPORT
const
char
*
tmq_get_topic_name
(
TAOS_RES
*
res
);
DLL_EXPORT
const
char
*
tmq_get_db_name
(
TAOS_RES
*
res
);
DLL_EXPORT
const
char
*
tmq_get_db_name
(
TAOS_RES
*
res
);
DLL_EXPORT
int32_t
tmq_get_vgroup_id
(
TAOS_RES
*
res
);
DLL_EXPORT
int32_t
tmq_get_vgroup_id
(
TAOS_RES
*
res
);
...
...
include/common/tcommon.h
浏览文件 @
ee821197
...
@@ -54,6 +54,7 @@ typedef struct {
...
@@ -54,6 +54,7 @@ typedef struct {
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
SHashObj
*
map
;
// speedup acquire the tableQueryInfo by table uid
void
*
pTagCond
;
void
*
pTagCond
;
void
*
pTagIndexCond
;
void
*
pTagIndexCond
;
uint64_t
suid
;
}
STableListInfo
;
}
STableListInfo
;
typedef
struct
SColumnDataAgg
{
typedef
struct
SColumnDataAgg
{
...
@@ -68,14 +69,13 @@ typedef struct SColumnDataAgg {
...
@@ -68,14 +69,13 @@ typedef struct SColumnDataAgg {
typedef
struct
SDataBlockInfo
{
typedef
struct
SDataBlockInfo
{
STimeWindow
window
;
STimeWindow
window
;
int32_t
rows
;
int32_t
rows
;
// todo hide this attribute
int32_t
rowSize
;
int32_t
rowSize
;
int64_t
uid
;
// the uid of table, from which current data block comes
uint64_t
uid
;
// the uid of table, from which current data block comes
int64_t
blockId
;
// block id, generated by physical planner
uint16_t
blockId
;
// block id, generated by physical planner
uint64_t
groupId
;
// no need to serialize
uint64_t
groupId
;
// no need to serialize
int16_t
numOfCols
;
int16_t
hasVarCol
;
int16_t
hasVarCol
;
int32_t
capacity
;
uint32_t
capacity
;
// TODO: optimize and remove following
// TODO: optimize and remove following
int32_t
childId
;
// used for stream, do not serialize
int32_t
childId
;
// used for stream, do not serialize
EStreamType
type
;
// used for stream, do not serialize
EStreamType
type
;
// used for stream, do not serialize
...
@@ -96,7 +96,7 @@ typedef struct SVarColAttr {
...
@@ -96,7 +96,7 @@ typedef struct SVarColAttr {
// pBlockAgg->numOfNull == info.rows, all data are null
// pBlockAgg->numOfNull == info.rows, all data are null
// pBlockAgg->numOfNull == 0, no data are null.
// pBlockAgg->numOfNull == 0, no data are null.
typedef
struct
SColumnInfoData
{
typedef
struct
SColumnInfoData
{
SColumnInfo
info
;
//
TODO filter info needs to be removed
SColumnInfo
info
;
//
column info
bool
hasNull
;
// if current column data has null value.
bool
hasNull
;
// if current column data has null value.
char
*
pData
;
// the corresponding block data in memory
char
*
pData
;
// the corresponding block data in memory
union
{
union
{
...
@@ -115,8 +115,8 @@ typedef struct SQueryTableDataCond {
...
@@ -115,8 +115,8 @@ typedef struct SQueryTableDataCond {
int32_t
type
;
// data block load type:
int32_t
type
;
// data block load type:
int32_t
numOfTWindows
;
int32_t
numOfTWindows
;
STimeWindow
*
twindows
;
STimeWindow
*
twindows
;
int
32
_t
startVersion
;
int
64
_t
startVersion
;
int
32
_t
endVersion
;
int
64
_t
endVersion
;
}
SQueryTableDataCond
;
}
SQueryTableDataCond
;
void
*
blockDataDestroy
(
SSDataBlock
*
pBlock
);
void
*
blockDataDestroy
(
SSDataBlock
*
pBlock
);
...
...
include/common/tdatablock.h
浏览文件 @
ee821197
...
@@ -71,8 +71,8 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
...
@@ -71,8 +71,8 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
#define colDataGetData(p1_, r_) \
#define colDataGetData(p1_, r_) \
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) : colDataGetNumData(p1_, r_))
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) : colDataGetNumData(p1_, r_))
#define IS_JSON_NULL(type, data)
((type) == TSDB_DATA_TYPE_JSON &&
\
#define IS_JSON_NULL(type, data) \
(*(data) == TSDB_DATA_TYPE_NULL || tTagIsJsonNull(data)))
((type) == TSDB_DATA_TYPE_JSON &&
(*(data) == TSDB_DATA_TYPE_NULL || tTagIsJsonNull(data)))
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
static
FORCE_INLINE
bool
colDataIsNull_s
(
const
SColumnInfoData
*
pColumnInfoData
,
uint32_t
row
)
{
if
(
!
pColumnInfoData
->
hasNull
)
{
if
(
!
pColumnInfoData
->
hasNull
)
{
...
@@ -184,9 +184,10 @@ static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, u
...
@@ -184,9 +184,10 @@ static FORCE_INLINE void colDataAppendDouble(SColumnInfoData* pColumnInfoData, u
int32_t
getJsonValueLen
(
const
char
*
data
);
int32_t
getJsonValueLen
(
const
char
*
data
);
int32_t
colDataAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
);
int32_t
colDataAppend
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
currentRow
,
const
char
*
pData
,
bool
isNull
);
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
numOfRow1
,
int32_t
*
capacity
,
int32_t
colDataMergeCol
(
SColumnInfoData
*
pColumnInfoData
,
uint32_t
numOfRow1
,
u
int32_t
*
capacity
,
const
SColumnInfoData
*
pSource
,
uint32_t
numOfRow2
);
const
SColumnInfoData
*
pSource
,
uint32_t
numOfRow2
);
int32_t
colDataAssign
(
SColumnInfoData
*
pColumnInfoData
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRows
);
int32_t
colDataAssign
(
SColumnInfoData
*
pColumnInfoData
,
const
SColumnInfoData
*
pSource
,
int32_t
numOfRows
,
const
SDataBlockInfo
*
pBlockInfo
);
int32_t
blockDataUpdateTsWindow
(
SSDataBlock
*
pDataBlock
,
int32_t
tsColumnIndex
);
int32_t
blockDataUpdateTsWindow
(
SSDataBlock
*
pDataBlock
,
int32_t
tsColumnIndex
);
int32_t
colDataGetLength
(
const
SColumnInfoData
*
pColumnInfoData
,
int32_t
numOfRows
);
int32_t
colDataGetLength
(
const
SColumnInfoData
*
pColumnInfoData
,
int32_t
numOfRows
);
...
@@ -212,7 +213,7 @@ size_t blockDataGetSerialMetaSize(uint32_t numOfCols);
...
@@ -212,7 +213,7 @@ size_t blockDataGetSerialMetaSize(uint32_t numOfCols);
int32_t
blockDataSort
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
);
int32_t
blockDataSort
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
);
int32_t
blockDataSort_rv
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
,
bool
nullFirst
);
int32_t
blockDataSort_rv
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
,
bool
nullFirst
);
int32_t
colInfoDataEnsureCapacity
(
SColumnInfoData
*
pColumn
,
size_t
existRows
,
uint32_t
numOfRows
);
int32_t
colInfoDataEnsureCapacity
(
SColumnInfoData
*
pColumn
,
uint32_t
numOfRows
);
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
);
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
);
void
colInfoDataCleanup
(
SColumnInfoData
*
pColumn
,
uint32_t
numOfRows
);
void
colInfoDataCleanup
(
SColumnInfoData
*
pColumn
,
uint32_t
numOfRows
);
...
@@ -222,7 +223,13 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
...
@@ -222,7 +223,13 @@ size_t blockDataGetCapacityInRow(const SSDataBlock* pBlock, size_t pageSize);
int32_t
blockDataTrimFirstNRows
(
SSDataBlock
*
pBlock
,
size_t
n
);
int32_t
blockDataTrimFirstNRows
(
SSDataBlock
*
pBlock
,
size_t
n
);
int32_t
assignOneDataBlock
(
SSDataBlock
*
dst
,
const
SSDataBlock
*
src
);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
);
SSDataBlock
*
createOneDataBlock
(
const
SSDataBlock
*
pDataBlock
,
bool
copyData
);
SSDataBlock
*
createDataBlock
();
int32_t
blockDataAppendColInfo
(
SSDataBlock
*
pBlock
,
SColumnInfoData
*
pColInfoData
);
SColumnInfoData
createColumnInfoData
(
int16_t
type
,
int32_t
bytes
,
int16_t
colId
);
SColumnInfoData
*
bdGetColumnInfoData
(
SSDataBlock
*
pBlock
,
int32_t
index
);
void
blockCompressEncode
(
const
SSDataBlock
*
pBlock
,
char
*
data
,
int32_t
*
dataLen
,
int32_t
numOfCols
,
void
blockCompressEncode
(
const
SSDataBlock
*
pBlock
,
char
*
data
,
int32_t
*
dataLen
,
int32_t
numOfCols
,
int8_t
needCompress
);
int8_t
needCompress
);
...
@@ -236,7 +243,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks
...
@@ -236,7 +243,7 @@ int32_t buildSubmitReqFromDataBlock(SSubmitReq** pReq, const SArray* pDataBlocks
char
*
buildCtbNameByGroupId
(
const
char
*
stbName
,
uint64_t
groupId
);
char
*
buildCtbNameByGroupId
(
const
char
*
stbName
,
uint64_t
groupId
);
static
FORCE_INLINE
int32_t
blockGetEncodeSize
(
const
SSDataBlock
*
pBlock
)
{
static
FORCE_INLINE
int32_t
blockGetEncodeSize
(
const
SSDataBlock
*
pBlock
)
{
return
blockDataGetSerialMetaSize
(
pBlock
->
info
.
numOfCols
)
+
blockDataGetSize
(
pBlock
);
return
blockDataGetSerialMetaSize
(
taosArrayGetSize
(
pBlock
->
pDataBlock
)
)
+
blockDataGetSize
(
pBlock
);
}
}
static
FORCE_INLINE
int32_t
blockCompressColData
(
SColumnInfoData
*
pColRes
,
int32_t
numOfRows
,
char
*
data
,
static
FORCE_INLINE
int32_t
blockCompressColData
(
SColumnInfoData
*
pColRes
,
int32_t
numOfRows
,
char
*
data
,
...
...
include/common/tmsg.h
浏览文件 @
ee821197
...
@@ -629,11 +629,6 @@ typedef struct {
...
@@ -629,11 +629,6 @@ typedef struct {
uint8_t
scale
;
uint8_t
scale
;
}
SColumnInfo
;
}
SColumnInfo
;
typedef
struct
{
int64_t
uid
;
TSKEY
key
;
// last accessed ts, for subscription
}
STableIdInfo
;
typedef
struct
STimeWindow
{
typedef
struct
STimeWindow
{
TSKEY
skey
;
TSKEY
skey
;
TSKEY
ekey
;
TSKEY
ekey
;
...
@@ -696,12 +691,12 @@ typedef struct {
...
@@ -696,12 +691,12 @@ typedef struct {
typedef
STableCfg
STableCfgRsp
;
typedef
STableCfg
STableCfgRsp
;
int32_t
tSerializeSTableCfgReq
(
void
*
buf
,
int32_t
bufLen
,
STableCfgReq
*
pReq
);
int32_t
tSerializeSTableCfgReq
(
void
*
buf
,
int32_t
bufLen
,
STableCfgReq
*
pReq
);
int32_t
tDeserializeSTableCfgReq
(
void
*
buf
,
int32_t
bufLen
,
STableCfgReq
*
pReq
);
int32_t
tDeserializeSTableCfgReq
(
void
*
buf
,
int32_t
bufLen
,
STableCfgReq
*
pReq
);
int32_t
tSerializeSTableCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
STableCfgRsp
*
pRsp
);
int32_t
tSerializeSTableCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
STableCfgRsp
*
pRsp
);
int32_t
tDeserializeSTableCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
STableCfgRsp
*
pRsp
);
int32_t
tDeserializeSTableCfgRsp
(
void
*
buf
,
int32_t
bufLen
,
STableCfgRsp
*
pRsp
);
void
tFreeSTableCfgRsp
(
STableCfgRsp
*
pRsp
);
void
tFreeSTableCfgRsp
(
STableCfgRsp
*
pRsp
);
typedef
struct
{
typedef
struct
{
char
db
[
TSDB_DB_FNAME_LEN
];
char
db
[
TSDB_DB_FNAME_LEN
];
...
@@ -834,6 +829,14 @@ typedef struct {
...
@@ -834,6 +829,14 @@ typedef struct {
int32_t
tSerializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
int32_t
tSerializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
int32_t
tDeserializeSQnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListReq
*
pReq
);
typedef
struct
{
int32_t
rowNum
;
}
SDnodeListReq
;
int32_t
tSerializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
int32_t
tDeserializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
);
typedef
struct
SQueryNodeAddr
{
typedef
struct
SQueryNodeAddr
{
int32_t
nodeId
;
// vgId or qnodeId
int32_t
nodeId
;
// vgId or qnodeId
SEpSet
epSet
;
SEpSet
epSet
;
...
@@ -852,6 +855,15 @@ int32_t tSerializeSQnodeListRsp(void* buf, int32_t bufLen, SQnodeListRsp* pRsp);
...
@@ -852,6 +855,15 @@ int32_t tSerializeSQnodeListRsp(void* buf, int32_t bufLen, SQnodeListRsp* pRsp);
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
int32_t
tDeserializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
);
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
);
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
);
typedef
struct
{
SArray
*
dnodeList
;
// SArray<SEpSet>
}
SDnodeListRsp
;
int32_t
tSerializeSDnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListRsp
*
pRsp
);
int32_t
tDeserializeSDnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListRsp
*
pRsp
);
void
tFreeSDnodeListRsp
(
SDnodeListRsp
*
pRsp
);
typedef
struct
{
typedef
struct
{
SArray
*
pArray
;
// Array of SUseDbRsp
SArray
*
pArray
;
// Array of SUseDbRsp
}
SUseDbBatchRsp
;
}
SUseDbBatchRsp
;
...
@@ -1329,11 +1341,19 @@ typedef struct {
...
@@ -1329,11 +1341,19 @@ typedef struct {
int32_t
dnodeId
;
int32_t
dnodeId
;
char
config
[
TSDB_DNODE_CONFIG_LEN
];
char
config
[
TSDB_DNODE_CONFIG_LEN
];
char
value
[
TSDB_DNODE_VALUE_LEN
];
char
value
[
TSDB_DNODE_VALUE_LEN
];
}
SMCfgDnodeReq
,
SDCfgDnodeReq
;
}
SMCfgDnodeReq
;
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
int32_t
tSerializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
int32_t
tDeserializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
int32_t
tDeserializeSMCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SMCfgDnodeReq
*
pReq
);
typedef
struct
{
char
config
[
TSDB_DNODE_CONFIG_LEN
];
char
value
[
TSDB_DNODE_VALUE_LEN
];
}
SDCfgDnodeReq
;
int32_t
tSerializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
);
int32_t
tDeserializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
);
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
,
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
}
SMCreateMnodeReq
,
SMDropMnodeReq
,
SDDropMnodeReq
,
SMCreateQnodeReq
,
SMDropQnodeReq
,
SDCreateQnodeReq
,
SDDropQnodeReq
,
...
@@ -2652,6 +2672,7 @@ typedef struct {
...
@@ -2652,6 +2672,7 @@ typedef struct {
SMsgHead
head
;
SMsgHead
head
;
char
subKey
[
TSDB_SUBSCRIBE_KEY_LEN
];
char
subKey
[
TSDB_SUBSCRIBE_KEY_LEN
];
int8_t
withTbName
;
int8_t
withTbName
;
int8_t
useSnapshot
;
int32_t
epoch
;
int32_t
epoch
;
uint64_t
reqId
;
uint64_t
reqId
;
int64_t
consumerId
;
int64_t
consumerId
;
...
...
include/common/tmsgdef.h
浏览文件 @
ee821197
...
@@ -81,6 +81,7 @@ enum {
...
@@ -81,6 +81,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_DND_SERVER_STATUS
,
"server-status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_SERVER_STATUS
,
"server-status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_NET_TEST
,
"net-test"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_NET_TEST
,
"net-test"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CONFIG_DNODE
,
"config-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_CONFIG_DNODE
,
"config-dnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_DND_SYSTABLE_RETRIEVE
,
"dnode-retrieve"
,
NULL
,
NULL
)
TD_NEW_MSG_SEG
(
TDMT_MND_MSG
)
TD_NEW_MSG_SEG
(
TDMT_MND_MSG
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CONNECT
,
"connect"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CONNECT
,
"connect"
,
NULL
,
NULL
)
...
@@ -101,6 +102,7 @@ enum {
...
@@ -101,6 +102,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_QNODE
,
"alter-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_QNODE
,
"alter-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_QNODE
,
"drop-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_QNODE
,
"drop-qnode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_QNODE_LIST
,
"qnode-list"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_QNODE_LIST
,
"qnode-list"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DNODE_LIST
,
"dnode-list"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_SNODE
,
"create-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_CREATE_SNODE
,
"create-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_SNODE
,
"alter-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_ALTER_SNODE
,
"alter-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_SNODE
,
"drop-snode"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_DROP_SNODE
,
"drop-snode"
,
NULL
,
NULL
)
...
@@ -152,7 +154,7 @@ enum {
...
@@ -152,7 +154,7 @@ enum {
TD_DEF_MSG_TYPE
(
TDMT_MND_HEARTBEAT
,
"heartbeat"
,
SClientHbBatchReq
,
SClientHbBatchRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_HEARTBEAT
,
"heartbeat"
,
SClientHbBatchReq
,
SClientHbBatchRsp
)
TD_DEF_MSG_TYPE
(
TDMT_MND_STATUS
,
"status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_STATUS
,
"status"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW
,
"show"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SHOW
,
"show"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SYSTABLE_RETRIEVE
,
"retrieve"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_SYSTABLE_RETRIEVE
,
"
mnd-
retrieve"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_GRANT
,
"grant"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_AUTH
,
"auth"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_APPLY_MSG
,
"mnode-apply"
,
NULL
,
NULL
)
TD_DEF_MSG_TYPE
(
TDMT_MND_APPLY_MSG
,
"mnode-apply"
,
NULL
,
NULL
)
...
...
include/dnode/mnode/mnode.h
浏览文件 @
ee821197
...
@@ -73,10 +73,12 @@ void mndStop(SMnode *pMnode);
...
@@ -73,10 +73,12 @@ void mndStop(SMnode *pMnode);
* @param pMnode The mnode object.
* @param pMnode The mnode object.
* @param pCluster
* @param pCluster
* @param pVgroup
* @param pVgroup
* @param pStbInfo
* @param pGrant
* @param pGrant
* @return int32_t 0 for success, -1 for failure.
* @return int32_t 0 for success, -1 for failure.
*/
*/
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pCluster
,
SMonVgroupInfo
*
pVgroup
,
SMonGrantInfo
*
pGrant
);
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonStbInfo
*
pStbInfo
,
SMonGrantInfo
*
pGrantInfo
);
/**
/**
* @brief Get mnode loads for status msg.
* @brief Get mnode loads for status msg.
...
...
include/libs/executor/dataSinkMgt.h
浏览文件 @
ee821197
...
@@ -33,7 +33,7 @@ struct SDataSink;
...
@@ -33,7 +33,7 @@ struct SDataSink;
struct
SSDataBlock
;
struct
SSDataBlock
;
typedef
struct
SDeleterRes
{
typedef
struct
SDeleterRes
{
uint64_t
uid
;
uint64_t
s
uid
;
SArray
*
uidList
;
SArray
*
uidList
;
int64_t
skey
;
int64_t
skey
;
int64_t
ekey
;
int64_t
ekey
;
...
@@ -41,6 +41,7 @@ typedef struct SDeleterRes {
...
@@ -41,6 +41,7 @@ typedef struct SDeleterRes {
}
SDeleterRes
;
}
SDeleterRes
;
typedef
struct
SDeleterParam
{
typedef
struct
SDeleterParam
{
uint64_t
suid
;
SArray
*
pUidList
;
SArray
*
pUidList
;
}
SDeleterParam
;
}
SDeleterParam
;
...
...
include/libs/executor/executor.h
浏览文件 @
ee821197
...
@@ -36,11 +36,13 @@ typedef struct SReadHandle {
...
@@ -36,11 +36,13 @@ typedef struct SReadHandle {
void
*
vnode
;
void
*
vnode
;
void
*
mnd
;
void
*
mnd
;
SMsgCb
*
pMsgCb
;
SMsgCb
*
pMsgCb
;
int8_t
initTsdbReader
;
}
SReadHandle
;
}
SReadHandle
;
enum
{
enum
{
STREAM_DATA_TYPE_SUBMIT_BLOCK
=
1
,
STREAM_DATA_TYPE_SUBMIT_BLOCK
=
1
,
STREAM_DATA_TYPE_SSDATA_BLOCK
=
2
,
STREAM_DATA_TYPE_SSDATA_BLOCK
=
2
,
STREAM_DATA_TYPE_FROM_SNAPSHOT
=
3
,
};
};
typedef
enum
{
typedef
enum
{
...
@@ -56,6 +58,13 @@ typedef enum {
...
@@ -56,6 +58,13 @@ typedef enum {
*/
*/
qTaskInfo_t
qCreateStreamExecTaskInfo
(
void
*
msg
,
void
*
streamReadHandle
);
qTaskInfo_t
qCreateStreamExecTaskInfo
(
void
*
msg
,
void
*
streamReadHandle
);
/**
* Switch the stream scan to snapshot mode
* @param tinfo
* @return
*/
int32_t
qStreamScanSnapshot
(
qTaskInfo_t
tinfo
);
/**
/**
* Set the input data block for the stream scan.
* Set the input data block for the stream scan.
* @param tinfo
* @param tinfo
...
...
include/libs/function/function.h
浏览文件 @
ee821197
...
@@ -172,23 +172,6 @@ typedef struct tExprNode {
...
@@ -172,23 +172,6 @@ typedef struct tExprNode {
void
tExprTreeDestroy
(
tExprNode
*
pNode
,
void
(
*
fp
)(
void
*
));
void
tExprTreeDestroy
(
tExprNode
*
pNode
,
void
(
*
fp
)(
void
*
));
typedef
struct
SAggFunctionInfo
{
char
name
[
FUNCTIONS_NAME_MAX_LENGTH
];
int8_t
type
;
// Scalar function or aggregation function
uint32_t
functionId
;
// Function Id
int8_t
sFunctionId
;
// Transfer function for super table query
uint16_t
status
;
bool
(
*
init
)(
SqlFunctionCtx
*
pCtx
,
struct
SResultRowEntryInfo
*
pResultCellInfo
);
// setup the execute environment
void
(
*
addInput
)(
SqlFunctionCtx
*
pCtx
);
// finalizer must be called after all exec has been executed to generated final result.
void
(
*
finalize
)(
SqlFunctionCtx
*
pCtx
);
void
(
*
combine
)(
SqlFunctionCtx
*
pCtx
);
int32_t
(
*
dataReqFunc
)(
SqlFunctionCtx
*
pCtx
,
STimeWindow
*
w
,
int32_t
colId
);
}
SAggFunctionInfo
;
struct
SScalarParam
{
struct
SScalarParam
{
SColumnInfoData
*
columnData
;
SColumnInfoData
*
columnData
;
SHashObj
*
pHashFilter
;
SHashObj
*
pHashFilter
;
...
...
include/libs/monitor/monitor.h
浏览文件 @
ee821197
...
@@ -109,6 +109,9 @@ typedef struct {
...
@@ -109,6 +109,9 @@ typedef struct {
char
version
[
MON_VER_LEN
];
char
version
[
MON_VER_LEN
];
float
master_uptime
;
// day
float
master_uptime
;
// day
int32_t
monitor_interval
;
// sec
int32_t
monitor_interval
;
// sec
int32_t
dbs_total
;
int32_t
stbs_total
;
int64_t
tbs_total
;
int32_t
vgroups_total
;
int32_t
vgroups_total
;
int32_t
vgroups_alive
;
int32_t
vgroups_alive
;
int32_t
vnodes_total
;
int32_t
vnodes_total
;
...
@@ -135,6 +138,15 @@ typedef struct {
...
@@ -135,6 +138,15 @@ typedef struct {
SArray
*
vgroups
;
// array of SMonVgroupDesc
SArray
*
vgroups
;
// array of SMonVgroupDesc
}
SMonVgroupInfo
;
}
SMonVgroupInfo
;
typedef
struct
{
char
stb_name
[
TSDB_TABLE_NAME_LEN
];
char
database_name
[
TSDB_DB_NAME_LEN
];
}
SMonStbDesc
;
typedef
struct
{
SArray
*
stbs
;
// array of SMonStbDesc
}
SMonStbInfo
;
typedef
struct
{
typedef
struct
{
int32_t
expire_time
;
int32_t
expire_time
;
int64_t
timeseries_used
;
int64_t
timeseries_used
;
...
@@ -144,6 +156,7 @@ typedef struct {
...
@@ -144,6 +156,7 @@ typedef struct {
typedef
struct
{
typedef
struct
{
SMonClusterInfo
cluster
;
SMonClusterInfo
cluster
;
SMonVgroupInfo
vgroup
;
SMonVgroupInfo
vgroup
;
SMonStbInfo
stb
;
SMonGrantInfo
grant
;
SMonGrantInfo
grant
;
SMonSysInfo
sys
;
SMonSysInfo
sys
;
SMonLogs
log
;
SMonLogs
log
;
...
...
include/libs/nodes/cmdnodes.h
浏览文件 @
ee821197
...
@@ -36,6 +36,10 @@ extern "C" {
...
@@ -36,6 +36,10 @@ extern "C" {
#define SHOW_CREATE_TB_RESULT_FIELD1_LEN (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_TB_RESULT_FIELD1_LEN (TSDB_TABLE_NAME_LEN + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_TB_RESULT_FIELD2_LEN (TSDB_MAX_BINARY_LEN + VARSTR_HEADER_SIZE)
#define SHOW_CREATE_TB_RESULT_FIELD2_LEN (TSDB_MAX_BINARY_LEN + VARSTR_HEADER_SIZE)
#define SHOW_LOCAL_VARIABLES_RESULT_COLS 2
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN (TSDB_CONFIG_OPTION_LEN + VARSTR_HEADER_SIZE)
#define SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN (TSDB_CONFIG_VALUE_LEN + VARSTR_HEADER_SIZE)
#define PRIVILEGE_TYPE_MASK(n) (1 << n)
#define PRIVILEGE_TYPE_MASK(n) (1 << n)
...
...
include/libs/qworker/qworker.h
浏览文件 @
ee821197
...
@@ -32,7 +32,7 @@ enum {
...
@@ -32,7 +32,7 @@ enum {
};
};
typedef
struct
SDeleteRes
{
typedef
struct
SDeleteRes
{
uint64_t
uid
;
uint64_t
s
uid
;
SArray
*
uidList
;
SArray
*
uidList
;
int64_t
skey
;
int64_t
skey
;
int64_t
ekey
;
int64_t
ekey
;
...
...
include/libs/stream/tstream.h
浏览文件 @
ee821197
...
@@ -344,10 +344,12 @@ static FORCE_INLINE int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBloc
...
@@ -344,10 +344,12 @@ static FORCE_INLINE int32_t streamTaskOutput(SStreamTask* pTask, SStreamDataBloc
if
(
pTask
->
sinkType
==
TASK_SINK__TABLE
)
{
if
(
pTask
->
sinkType
==
TASK_SINK__TABLE
)
{
ASSERT
(
pTask
->
dispatchType
==
TASK_DISPATCH__NONE
);
ASSERT
(
pTask
->
dispatchType
==
TASK_DISPATCH__NONE
);
pTask
->
tbSink
.
tbSinkFunc
(
pTask
,
pTask
->
tbSink
.
vnode
,
0
,
pBlock
->
blocks
);
pTask
->
tbSink
.
tbSinkFunc
(
pTask
,
pTask
->
tbSink
.
vnode
,
0
,
pBlock
->
blocks
);
taosArrayDestroyEx
(
pBlock
->
blocks
,
(
FDelete
)
tDeleteSSDataBlock
);
taosFreeQitem
(
pBlock
);
taosFreeQitem
(
pBlock
);
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__SMA
)
{
}
else
if
(
pTask
->
sinkType
==
TASK_SINK__SMA
)
{
ASSERT
(
pTask
->
dispatchType
==
TASK_DISPATCH__NONE
);
ASSERT
(
pTask
->
dispatchType
==
TASK_DISPATCH__NONE
);
pTask
->
smaSink
.
smaSink
(
pTask
->
smaSink
.
vnode
,
pTask
->
smaSink
.
smaId
,
pBlock
->
blocks
);
pTask
->
smaSink
.
smaSink
(
pTask
->
smaSink
.
vnode
,
pTask
->
smaSink
.
smaId
,
pBlock
->
blocks
);
taosArrayDestroyEx
(
pBlock
->
blocks
,
(
FDelete
)
tDeleteSSDataBlock
);
taosFreeQitem
(
pBlock
);
taosFreeQitem
(
pBlock
);
}
else
{
}
else
{
ASSERT
(
pTask
->
dispatchType
!=
TASK_DISPATCH__NONE
);
ASSERT
(
pTask
->
dispatchType
!=
TASK_DISPATCH__NONE
);
...
...
include/libs/sync/sync.h
浏览文件 @
ee821197
...
@@ -28,6 +28,7 @@ extern bool gRaftDetailLog;
...
@@ -28,6 +28,7 @@ extern bool gRaftDetailLog;
#define SYNC_INDEX_BEGIN 0
#define SYNC_INDEX_BEGIN 0
#define SYNC_INDEX_INVALID -1
#define SYNC_INDEX_INVALID -1
#define SYNC_TERM_INVALID 0xFFFFFFFFFFFFFFFF
typedef
uint64_t
SyncNodeId
;
typedef
uint64_t
SyncNodeId
;
typedef
int32_t
SyncGroupId
;
typedef
int32_t
SyncGroupId
;
...
@@ -156,13 +157,13 @@ typedef struct SSyncLogStore {
...
@@ -156,13 +157,13 @@ typedef struct SSyncLogStore {
SyncIndex
(
*
getCommitIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
getCommitIndex
)(
struct
SSyncLogStore
*
pLogStore
);
// refactor, log[0 .. n] ==> log[m .. n]
// refactor, log[0 .. n] ==> log[m .. n]
int32_t
(
*
syncLogSetBeginIndex
)(
struct
SSyncLogStore
*
pLogStore
,
SyncIndex
beginIndex
);
//
int32_t (*syncLogSetBeginIndex)(struct SSyncLogStore* pLogStore, SyncIndex beginIndex);
int32_t
(
*
syncLogResetBeginIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogBeginIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogBeginIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogEndIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogEndIndex
)(
struct
SSyncLogStore
*
pLogStore
);
bool
(
*
syncLogIsEmpty
)(
struct
SSyncLogStore
*
pLogStore
);
bool
(
*
syncLogIsEmpty
)(
struct
SSyncLogStore
*
pLogStore
);
int32_t
(
*
syncLogEntryCount
)(
struct
SSyncLogStore
*
pLogStore
);
int32_t
(
*
syncLogEntryCount
)(
struct
SSyncLogStore
*
pLogStore
);
// bool (*syncLogInRange
)(struct SSyncLogStore* pLogStore, SyncIndex index);
int32_t
(
*
syncLogRestoreFromSnapshot
)(
struct
SSyncLogStore
*
pLogStore
,
SyncIndex
index
);
SyncIndex
(
*
syncLogWriteIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogWriteIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogLastIndex
)(
struct
SSyncLogStore
*
pLogStore
);
SyncIndex
(
*
syncLogLastIndex
)(
struct
SSyncLogStore
*
pLogStore
);
...
@@ -199,7 +200,7 @@ const char* syncGetMyRoleStr(int64_t rid);
...
@@ -199,7 +200,7 @@ const char* syncGetMyRoleStr(int64_t rid);
SyncTerm
syncGetMyTerm
(
int64_t
rid
);
SyncTerm
syncGetMyTerm
(
int64_t
rid
);
SyncGroupId
syncGetVgId
(
int64_t
rid
);
SyncGroupId
syncGetVgId
(
int64_t
rid
);
void
syncGetEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
void
syncGetEpSet
(
int64_t
rid
,
SEpSet
*
pEpSet
);
int32_t
syncPropose
(
int64_t
rid
,
const
SRpcMsg
*
pMsg
,
bool
isWeak
);
int32_t
syncPropose
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
);
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
浏览文件 @
ee821197
...
@@ -43,7 +43,7 @@ void setElectTimerMS(int64_t rid, int32_t electTimerMS);
...
@@ -43,7 +43,7 @@ void setElectTimerMS(int64_t rid, int32_t electTimerMS);
void
setHeartbeatTimerMS
(
int64_t
rid
,
int32_t
hbTimerMS
);
void
setHeartbeatTimerMS
(
int64_t
rid
,
int32_t
hbTimerMS
);
// for compatibility, the same as syncPropose
// for compatibility, the same as syncPropose
int32_t
syncForwardToPeer
(
int64_t
rid
,
const
SRpcMsg
*
pMsg
,
bool
isWeak
);
int32_t
syncForwardToPeer
(
int64_t
rid
,
SRpcMsg
*
pMsg
,
bool
isWeak
);
// utils
// utils
const
char
*
syncUtilState2String
(
ESyncState
state
);
const
char
*
syncUtilState2String
(
ESyncState
state
);
...
@@ -489,7 +489,6 @@ void syncLeaderTransferPrint2(char* s, const SyncLeaderTransfer* pMsg);
...
@@ -489,7 +489,6 @@ void syncLeaderTransferPrint2(char* s, const SyncLeaderTransfer* pMsg);
void
syncLeaderTransferLog
(
const
SyncLeaderTransfer
*
pMsg
);
void
syncLeaderTransferLog
(
const
SyncLeaderTransfer
*
pMsg
);
void
syncLeaderTransferLog2
(
char
*
s
,
const
SyncLeaderTransfer
*
pMsg
);
void
syncLeaderTransferLog2
(
char
*
s
,
const
SyncLeaderTransfer
*
pMsg
);
// ---------------------------------------------
// ---------------------------------------------
typedef
struct
SyncReconfigFinish
{
typedef
struct
SyncReconfigFinish
{
uint32_t
bytes
;
uint32_t
bytes
;
...
@@ -521,8 +520,6 @@ void syncReconfigFinishPrint2(char* s, const SyncReconfigFinish* pMsg);
...
@@ -521,8 +520,6 @@ void syncReconfigFinishPrint2(char* s, const SyncReconfigFinish* pMsg);
void
syncReconfigFinishLog
(
const
SyncReconfigFinish
*
pMsg
);
void
syncReconfigFinishLog
(
const
SyncReconfigFinish
*
pMsg
);
void
syncReconfigFinishLog2
(
char
*
s
,
const
SyncReconfigFinish
*
pMsg
);
void
syncReconfigFinishLog2
(
char
*
s
,
const
SyncReconfigFinish
*
pMsg
);
// on message ----------------------
// on message ----------------------
int32_t
syncNodeOnPingCb
(
SSyncNode
*
ths
,
SyncPing
*
pMsg
);
int32_t
syncNodeOnPingCb
(
SSyncNode
*
ths
,
SyncPing
*
pMsg
);
int32_t
syncNodeOnPingReplyCb
(
SSyncNode
*
ths
,
SyncPingReply
*
pMsg
);
int32_t
syncNodeOnPingReplyCb
(
SSyncNode
*
ths
,
SyncPingReply
*
pMsg
);
...
...
include/util/taoserror.h
浏览文件 @
ee821197
...
@@ -71,6 +71,7 @@ int32_t* taosGetErrno();
...
@@ -71,6 +71,7 @@ int32_t* taosGetErrno();
#define TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE TAOS_DEF_ERROR_CODE(0, 0x0029)
#define TSDB_CODE_OUT_OF_RPC_MEMORY_QUEUE TAOS_DEF_ERROR_CODE(0, 0x0029)
#define TSDB_CODE_INVALID_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x0030)
#define TSDB_CODE_INVALID_TIMESTAMP TAOS_DEF_ERROR_CODE(0, 0x0030)
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0031)
#define TSDB_CODE_MSG_DECODE_ERROR TAOS_DEF_ERROR_CODE(0, 0x0031)
#define TSDB_CODE_NO_AVAIL_DISK TAOS_DEF_ERROR_CODE(0, 0x0032)
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0040)
#define TSDB_CODE_REF_NO_MEMORY TAOS_DEF_ERROR_CODE(0, 0x0040)
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0041)
#define TSDB_CODE_REF_FULL TAOS_DEF_ERROR_CODE(0, 0x0041)
...
...
include/util/tconfig.h
浏览文件 @
ee821197
...
@@ -104,6 +104,8 @@ int32_t cfgAddTimezone(SConfig *pCfg, const char *name, const char *defaultVal);
...
@@ -104,6 +104,8 @@ int32_t cfgAddTimezone(SConfig *pCfg, const char *name, const char *defaultVal);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgStypeStr
(
ECfgSrcType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
const
char
*
cfgDtypeStr
(
ECfgDataType
type
);
void
cfgDumpItemValue
(
SConfigItem
*
pItem
,
char
*
buf
,
int32_t
bufSize
,
int32_t
*
pLen
);
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
,
bool
dump
);
void
cfgDumpCfg
(
SConfig
*
pCfg
,
bool
tsc
,
bool
dump
);
int32_t
cfgGetApollUrl
(
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
);
int32_t
cfgGetApollUrl
(
const
char
**
envCmd
,
const
char
*
envFile
,
char
*
apolloUrl
);
...
...
include/util/tdef.h
浏览文件 @
ee821197
...
@@ -443,8 +443,8 @@ enum {
...
@@ -443,8 +443,8 @@ enum {
#define VNODE_HANDLE -3
#define VNODE_HANDLE -3
#define BNODE_HANDLE -4
#define BNODE_HANDLE -4
#define TSDB_CONFIG_OPTION_LEN
16
#define TSDB_CONFIG_OPTION_LEN
32
#define TSDB_CON
IIG_VALUE_LEN 48
#define TSDB_CON
FIG_VALUE_LEN 64
#define TSDB_CONFIG_NUMBER 8
#define TSDB_CONFIG_NUMBER 8
#define QUERY_ID_SIZE 20
#define QUERY_ID_SIZE 20
...
...
source/client/src/clientMain.c
浏览文件 @
ee821197
...
@@ -290,6 +290,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
...
@@ -290,6 +290,8 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
pResultInfo
->
current
+=
1
;
pResultInfo
->
current
+=
1
;
return
pResultInfo
->
row
;
return
pResultInfo
->
row
;
}
}
}
else
if
(
TD_RES_TMQ_META
(
res
))
{
return
NULL
;
}
else
{
}
else
{
// assert to avoid un-initialization error
// assert to avoid un-initialization error
ASSERT
(
0
);
ASSERT
(
0
);
...
...
source/client/src/tmq.c
浏览文件 @
ee821197
...
@@ -54,6 +54,7 @@ struct tmq_conf_t {
...
@@ -54,6 +54,7 @@ struct tmq_conf_t {
int8_t
autoCommit
;
int8_t
autoCommit
;
int8_t
resetOffset
;
int8_t
resetOffset
;
int8_t
withTbName
;
int8_t
withTbName
;
int8_t
useSnapshot
;
uint16_t
port
;
uint16_t
port
;
int32_t
autoCommitInterval
;
int32_t
autoCommitInterval
;
char
*
ip
;
char
*
ip
;
...
@@ -69,6 +70,7 @@ struct tmq_t {
...
@@ -69,6 +70,7 @@ struct tmq_t {
char
groupId
[
TSDB_CGROUP_LEN
];
char
groupId
[
TSDB_CGROUP_LEN
];
char
clientId
[
256
];
char
clientId
[
256
];
int8_t
withTbName
;
int8_t
withTbName
;
int8_t
useSnapshot
;
int8_t
autoCommit
;
int8_t
autoCommit
;
int32_t
autoCommitInterval
;
int32_t
autoCommitInterval
;
int32_t
resetOffsetCfg
;
int32_t
resetOffsetCfg
;
...
@@ -282,6 +284,18 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
...
@@ -282,6 +284,18 @@ tmq_conf_res_t tmq_conf_set(tmq_conf_t* conf, const char* key, const char* value
}
}
}
}
if
(
strcmp
(
key
,
"experiment.use.snapshot"
)
==
0
)
{
if
(
strcmp
(
value
,
"true"
)
==
0
)
{
conf
->
useSnapshot
=
true
;
return
TMQ_CONF_OK
;
}
else
if
(
strcmp
(
value
,
"false"
)
==
0
)
{
conf
->
useSnapshot
=
false
;
return
TMQ_CONF_OK
;
}
else
{
return
TMQ_CONF_INVALID
;
}
}
if
(
strcmp
(
key
,
"td.connect.ip"
)
==
0
)
{
if
(
strcmp
(
key
,
"td.connect.ip"
)
==
0
)
{
conf
->
ip
=
strdup
(
value
);
conf
->
ip
=
strdup
(
value
);
return
TMQ_CONF_OK
;
return
TMQ_CONF_OK
;
...
@@ -953,6 +967,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
...
@@ -953,6 +967,7 @@ tmq_t* tmq_consumer_new(tmq_conf_t* conf, char* errstr, int32_t errstrLen) {
strcpy
(
pTmq
->
clientId
,
conf
->
clientId
);
strcpy
(
pTmq
->
clientId
,
conf
->
clientId
);
strcpy
(
pTmq
->
groupId
,
conf
->
groupId
);
strcpy
(
pTmq
->
groupId
,
conf
->
groupId
);
pTmq
->
withTbName
=
conf
->
withTbName
;
pTmq
->
withTbName
=
conf
->
withTbName
;
pTmq
->
useSnapshot
=
conf
->
useSnapshot
;
pTmq
->
autoCommit
=
conf
->
autoCommit
;
pTmq
->
autoCommit
=
conf
->
autoCommit
;
pTmq
->
autoCommitInterval
=
conf
->
autoCommitInterval
;
pTmq
->
autoCommitInterval
=
conf
->
autoCommitInterval
;
pTmq
->
commitCb
=
conf
->
commitCb
;
pTmq
->
commitCb
=
conf
->
commitCb
;
...
@@ -1145,8 +1160,6 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -1145,8 +1160,6 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
// handle meta rsp
// handle meta rsp
int8_t
rspType
=
((
SMqRspHead
*
)
pMsg
->
pData
)
->
mqMsgType
;
int8_t
rspType
=
((
SMqRspHead
*
)
pMsg
->
pData
)
->
mqMsgType
;
if
(
rspType
==
TMQ_MSG_TYPE__POLL_META_RSP
)
{
}
SMqPollRspWrapper
*
pRspWrapper
=
taosAllocateQitem
(
sizeof
(
SMqPollRspWrapper
),
DEF_QITEM
);
SMqPollRspWrapper
*
pRspWrapper
=
taosAllocateQitem
(
sizeof
(
SMqPollRspWrapper
),
DEF_QITEM
);
if
(
pRspWrapper
==
NULL
)
{
if
(
pRspWrapper
==
NULL
)
{
...
@@ -1159,19 +1172,19 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -1159,19 +1172,19 @@ int32_t tmqPollCb(void* param, const SDataBuf* pMsg, int32_t code) {
pRspWrapper
->
vgHandle
=
pVg
;
pRspWrapper
->
vgHandle
=
pVg
;
pRspWrapper
->
topicHandle
=
pTopic
;
pRspWrapper
->
topicHandle
=
pTopic
;
memcpy
(
&
pRspWrapper
->
dataRsp
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
if
(
rspType
==
TMQ_MSG_TYPE__POLL_RSP
)
{
if
(
rspType
==
TMQ_MSG_TYPE__POLL_RSP
)
{
memcpy
(
&
pRspWrapper
->
dataRsp
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
tDecodeSMqDataBlkRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRspWrapper
->
dataRsp
);
tDecodeSMqDataBlkRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRspWrapper
->
dataRsp
);
}
else
{
}
else
{
ASSERT
(
rspType
==
TMQ_MSG_TYPE__POLL_META_RSP
);
ASSERT
(
rspType
==
TMQ_MSG_TYPE__POLL_META_RSP
);
memcpy
(
&
pRspWrapper
->
metaRsp
,
pMsg
->
pData
,
sizeof
(
SMqRspHead
));
tDecodeSMqMetaRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRspWrapper
->
metaRsp
);
tDecodeSMqMetaRsp
(
POINTER_SHIFT
(
pMsg
->
pData
,
sizeof
(
SMqRspHead
)),
&
pRspWrapper
->
metaRsp
);
}
}
taosMemoryFree
(
pMsg
->
pData
);
taosMemoryFree
(
pMsg
->
pData
);
tscDebug
(
"consumer %ld recv poll: vg %d, req offset %ld, rsp offset %ld"
,
tmq
->
consumerId
,
pVg
->
vgId
,
tscDebug
(
"consumer %ld recv poll: vg %d, req offset %ld, rsp offset %ld
, type %d
"
,
tmq
->
consumerId
,
pVg
->
vgId
,
pRspWrapper
->
dataRsp
.
reqOffset
,
pRspWrapper
->
dataRsp
.
rspOffset
);
pRspWrapper
->
dataRsp
.
reqOffset
,
pRspWrapper
->
dataRsp
.
rspOffset
,
rspType
);
taosWriteQitem
(
tmq
->
mqueue
,
pRspWrapper
);
taosWriteQitem
(
tmq
->
mqueue
,
pRspWrapper
);
tsem_post
(
&
tmq
->
rspSem
);
tsem_post
(
&
tmq
->
rspSem
);
...
@@ -1534,6 +1547,8 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t timeout, SMqClientTopic*
...
@@ -1534,6 +1547,8 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t timeout, SMqClientTopic*
pReq
->
currentOffset
=
reqOffset
;
pReq
->
currentOffset
=
reqOffset
;
pReq
->
reqId
=
generateRequestId
();
pReq
->
reqId
=
generateRequestId
();
pReq
->
useSnapshot
=
tmq
->
useSnapshot
;
pReq
->
head
.
vgId
=
htonl
(
pVg
->
vgId
);
pReq
->
head
.
vgId
=
htonl
(
pVg
->
vgId
);
pReq
->
head
.
contLen
=
htonl
(
sizeof
(
SMqPollReq
));
pReq
->
head
.
contLen
=
htonl
(
sizeof
(
SMqPollReq
));
return
pReq
;
return
pReq
;
...
@@ -1541,7 +1556,7 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t timeout, SMqClientTopic*
...
@@ -1541,7 +1556,7 @@ SMqPollReq* tmqBuildConsumeReqImpl(tmq_t* tmq, int64_t timeout, SMqClientTopic*
SMqMetaRspObj
*
tmqBuildMetaRspFromWrapper
(
SMqPollRspWrapper
*
pWrapper
)
{
SMqMetaRspObj
*
tmqBuildMetaRspFromWrapper
(
SMqPollRspWrapper
*
pWrapper
)
{
SMqMetaRspObj
*
pRspObj
=
taosMemoryCalloc
(
1
,
sizeof
(
SMqMetaRspObj
));
SMqMetaRspObj
*
pRspObj
=
taosMemoryCalloc
(
1
,
sizeof
(
SMqMetaRspObj
));
pRspObj
->
resType
=
RES_TYPE__TMQ
;
pRspObj
->
resType
=
RES_TYPE__TMQ
_META
;
tstrncpy
(
pRspObj
->
topic
,
pWrapper
->
topicHandle
->
topicName
,
TSDB_TOPIC_FNAME_LEN
);
tstrncpy
(
pRspObj
->
topic
,
pWrapper
->
topicHandle
->
topicName
,
TSDB_TOPIC_FNAME_LEN
);
tstrncpy
(
pRspObj
->
db
,
pWrapper
->
topicHandle
->
db
,
TSDB_DB_FNAME_LEN
);
tstrncpy
(
pRspObj
->
db
,
pWrapper
->
topicHandle
->
db
,
TSDB_DB_FNAME_LEN
);
pRspObj
->
vgId
=
pWrapper
->
vgHandle
->
vgId
;
pRspObj
->
vgId
=
pWrapper
->
vgHandle
->
vgId
;
...
@@ -1659,7 +1674,7 @@ int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* pReset)
...
@@ -1659,7 +1674,7 @@ int32_t tmqHandleNoPollRsp(tmq_t* tmq, SMqRspWrapper* rspWrapper, bool* pReset)
return
0
;
return
0
;
}
}
SMqRspObj
*
tmqHandleAllRsp
(
tmq_t
*
tmq
,
int64_t
timeout
,
bool
pollIfReset
)
{
void
*
tmqHandleAllRsp
(
tmq_t
*
tmq
,
int64_t
timeout
,
bool
pollIfReset
)
{
while
(
1
)
{
while
(
1
)
{
SMqRspWrapper
*
rspWrapper
=
NULL
;
SMqRspWrapper
*
rspWrapper
=
NULL
;
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspWrapper
);
taosGetQitem
(
tmq
->
qall
,
(
void
**
)
&
rspWrapper
);
...
@@ -1699,18 +1714,18 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
...
@@ -1699,18 +1714,18 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
}
else
if
(
rspWrapper
->
tmqRspType
==
TMQ_MSG_TYPE__POLL_META_RSP
)
{
}
else
if
(
rspWrapper
->
tmqRspType
==
TMQ_MSG_TYPE__POLL_META_RSP
)
{
SMqPollRspWrapper
*
pollRspWrapper
=
(
SMqPollRspWrapper
*
)
rspWrapper
;
SMqPollRspWrapper
*
pollRspWrapper
=
(
SMqPollRspWrapper
*
)
rspWrapper
;
int32_t
consumerEpoch
=
atomic_load_32
(
&
tmq
->
epoch
);
int32_t
consumerEpoch
=
atomic_load_32
(
&
tmq
->
epoch
);
if
(
pollRspWrapper
->
da
taRsp
.
head
.
epoch
==
consumerEpoch
)
{
if
(
pollRspWrapper
->
me
taRsp
.
head
.
epoch
==
consumerEpoch
)
{
SMqClientVg
*
pVg
=
pollRspWrapper
->
vgHandle
;
SMqClientVg
*
pVg
=
pollRspWrapper
->
vgHandle
;
/*printf("vg %d offset %ld up to %ld\n", pVg->vgId, pVg->currentOffset, rspMsg->msg.rspOffset);*/
/*printf("vg %d offset %ld up to %ld\n", pVg->vgId, pVg->currentOffset, rspMsg->msg.rspOffset);*/
pVg
->
currentOffset
=
pollRspWrapper
->
da
taRsp
.
rspOffset
;
pVg
->
currentOffset
=
pollRspWrapper
->
me
taRsp
.
rspOffset
;
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
atomic_store_32
(
&
pVg
->
vgStatus
,
TMQ_VG_STATUS__IDLE
);
// build rsp
// build rsp
SMq
RspObj
*
pRsp
=
tmqBuild
RspFromWrapper
(
pollRspWrapper
);
SMq
MetaRspObj
*
pRsp
=
tmqBuildMeta
RspFromWrapper
(
pollRspWrapper
);
taosFreeQitem
(
pollRspWrapper
);
taosFreeQitem
(
pollRspWrapper
);
return
pRsp
;
return
pRsp
;
}
else
{
}
else
{
tscDebug
(
"msg discard since epoch mismatch: msg epoch %d, consumer epoch %d
\n
"
,
tscDebug
(
"msg discard since epoch mismatch: msg epoch %d, consumer epoch %d
\n
"
,
pollRspWrapper
->
da
taRsp
.
head
.
epoch
,
consumerEpoch
);
pollRspWrapper
->
me
taRsp
.
head
.
epoch
,
consumerEpoch
);
taosFreeQitem
(
pollRspWrapper
);
taosFreeQitem
(
pollRspWrapper
);
}
}
}
else
{
}
else
{
...
@@ -1727,7 +1742,7 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
...
@@ -1727,7 +1742,7 @@ SMqRspObj* tmqHandleAllRsp(tmq_t* tmq, int64_t timeout, bool pollIfReset) {
}
}
TAOS_RES
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
timeout
)
{
TAOS_RES
*
tmq_consumer_poll
(
tmq_t
*
tmq
,
int64_t
timeout
)
{
SMqRspObj
*
rspObj
;
void
*
rspObj
;
int64_t
startTime
=
taosGetTimestampMs
();
int64_t
startTime
=
taosGetTimestampMs
();
#if 0
#if 0
...
@@ -1856,7 +1871,7 @@ const char* tmq_get_table_name(TAOS_RES* res) {
...
@@ -1856,7 +1871,7 @@ const char* tmq_get_table_name(TAOS_RES* res) {
return
NULL
;
return
NULL
;
}
}
int32_t
tmq_get_raw_meta
(
TAOS_RES
*
res
,
const
void
**
raw_meta
,
int32_t
*
raw_meta_len
)
{
int32_t
tmq_get_raw_meta
(
TAOS_RES
*
res
,
void
**
raw_meta
,
int32_t
*
raw_meta_len
)
{
if
(
TD_RES_TMQ_META
(
res
))
{
if
(
TD_RES_TMQ_META
(
res
))
{
SMqMetaRspObj
*
pMetaRspObj
=
(
SMqMetaRspObj
*
)
res
;
SMqMetaRspObj
*
pMetaRspObj
=
(
SMqMetaRspObj
*
)
res
;
*
raw_meta
=
pMetaRspObj
->
metaRsp
.
metaRsp
;
*
raw_meta
=
pMetaRspObj
->
metaRsp
.
metaRsp
;
...
...
source/common/src/systable.c
浏览文件 @
ee821197
...
@@ -231,7 +231,13 @@ static const SSysDbTableSchema transSchema[] = {
...
@@ -231,7 +231,13 @@ static const SSysDbTableSchema transSchema[] = {
static
const
SSysDbTableSchema
configSchema
[]
=
{
static
const
SSysDbTableSchema
configSchema
[]
=
{
{.
name
=
"name"
,
.
bytes
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"name"
,
.
bytes
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"value"
,
.
bytes
=
TSDB_CONIIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"value"
,
.
bytes
=
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
static
const
SSysDbTableSchema
variablesSchema
[]
=
{
{.
name
=
"dnode_id"
,
.
bytes
=
4
,
.
type
=
TSDB_DATA_TYPE_INT
},
{.
name
=
"name"
,
.
bytes
=
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
{.
name
=
"value"
,
.
bytes
=
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
,
.
type
=
TSDB_DATA_TYPE_VARCHAR
},
};
};
static
const
SSysTableMeta
infosMeta
[]
=
{
static
const
SSysTableMeta
infosMeta
[]
=
{
...
@@ -253,6 +259,7 @@ static const SSysTableMeta infosMeta[] = {
...
@@ -253,6 +259,7 @@ static const SSysTableMeta infosMeta[] = {
{
TSDB_INS_TABLE_LICENCES
,
grantsSchema
,
tListLen
(
grantsSchema
)},
{
TSDB_INS_TABLE_LICENCES
,
grantsSchema
,
tListLen
(
grantsSchema
)},
{
TSDB_INS_TABLE_VGROUPS
,
vgroupsSchema
,
tListLen
(
vgroupsSchema
)},
{
TSDB_INS_TABLE_VGROUPS
,
vgroupsSchema
,
tListLen
(
vgroupsSchema
)},
{
TSDB_INS_TABLE_CONFIGS
,
configSchema
,
tListLen
(
configSchema
)},
{
TSDB_INS_TABLE_CONFIGS
,
configSchema
,
tListLen
(
configSchema
)},
{
TSDB_INS_TABLE_DNODE_VARIABLES
,
variablesSchema
,
tListLen
(
variablesSchema
)},
};
};
static
const
SSysDbTableSchema
connectionsSchema
[]
=
{
static
const
SSysDbTableSchema
connectionsSchema
[]
=
{
...
...
source/common/src/tdatablock.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/common/src/tglobal.c
浏览文件 @
ee821197
...
@@ -760,9 +760,9 @@ void taosCleanupCfg() {
...
@@ -760,9 +760,9 @@ void taosCleanupCfg() {
}
}
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
)
{
void
taosCfgDynamicOptions
(
const
char
*
option
,
const
char
*
value
)
{
if
(
str
casecmp
(
option
,
"debugFlag"
)
==
0
)
{
if
(
str
ncasecmp
(
option
,
"debugFlag"
,
9
)
==
0
)
{
int32_t
debugF
lag
=
atoi
(
value
);
int32_t
f
lag
=
atoi
(
value
);
taosSetAllDebugFlag
(
debugF
lag
);
taosSetAllDebugFlag
(
f
lag
);
}
}
if
(
strcasecmp
(
option
,
"resetlog"
)
==
0
)
{
if
(
strcasecmp
(
option
,
"resetlog"
)
==
0
)
{
...
...
source/common/src/tmsg.c
浏览文件 @
ee821197
...
@@ -1500,6 +1500,33 @@ int32_t tDeserializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq
...
@@ -1500,6 +1500,33 @@ int32_t tDeserializeSMCfgDnodeReq(void *buf, int32_t bufLen, SMCfgDnodeReq *pReq
return
0
;
return
0
;
}
}
int32_t
tSerializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
config
)
<
0
)
return
-
1
;
if
(
tEncodeCStr
(
&
encoder
,
pReq
->
value
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSDCfgDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SDCfgDnodeReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
config
)
<
0
)
return
-
1
;
if
(
tDecodeCStrTo
(
&
decoder
,
pReq
->
value
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
)
{
int32_t
tSerializeSCreateDnodeReq
(
void
*
buf
,
int32_t
bufLen
,
SCreateDnodeReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
@@ -2194,6 +2221,32 @@ int32_t tDeserializeSQnodeListReq(void *buf, int32_t bufLen, SQnodeListReq *pReq
...
@@ -2194,6 +2221,32 @@ int32_t tDeserializeSQnodeListReq(void *buf, int32_t bufLen, SQnodeListReq *pReq
return
0
;
return
0
;
}
}
int32_t
tSerializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
if
(
tEncodeI32
(
&
encoder
,
pReq
->
rowNum
)
<
0
)
return
-
1
;
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSDnodeListReq
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListReq
*
pReq
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
if
(
tDecodeI32
(
&
decoder
,
&
pReq
->
rowNum
)
<
0
)
return
-
1
;
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
int32_t
tSerializeSQnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SQnodeListRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
@@ -2237,6 +2290,50 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
...
@@ -2237,6 +2290,50 @@ int32_t tDeserializeSQnodeListRsp(void *buf, int32_t bufLen, SQnodeListRsp *pRsp
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
qnodeList
);
}
void
tFreeSQnodeListRsp
(
SQnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
qnodeList
);
}
int32_t
tSerializeSDnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListRsp
*
pRsp
)
{
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
if
(
tStartEncode
(
&
encoder
)
<
0
)
return
-
1
;
int32_t
num
=
taosArrayGetSize
(
pRsp
->
dnodeList
);
if
(
tEncodeI32
(
&
encoder
,
num
)
<
0
)
return
-
1
;
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SEpSet
*
pEpSet
=
taosArrayGet
(
pRsp
->
dnodeList
,
i
);
if
(
tEncodeSEpSet
(
&
encoder
,
pEpSet
)
<
0
)
return
-
1
;
}
tEndEncode
(
&
encoder
);
int32_t
tlen
=
encoder
.
pos
;
tEncoderClear
(
&
encoder
);
return
tlen
;
}
int32_t
tDeserializeSDnodeListRsp
(
void
*
buf
,
int32_t
bufLen
,
SDnodeListRsp
*
pRsp
)
{
SDecoder
decoder
=
{
0
};
tDecoderInit
(
&
decoder
,
buf
,
bufLen
);
if
(
tStartDecode
(
&
decoder
)
<
0
)
return
-
1
;
int32_t
num
=
0
;
if
(
tDecodeI32
(
&
decoder
,
&
num
)
<
0
)
return
-
1
;
if
(
NULL
==
pRsp
->
dnodeList
)
{
pRsp
->
dnodeList
=
taosArrayInit
(
num
,
sizeof
(
SEpSet
));
if
(
NULL
==
pRsp
->
dnodeList
)
return
-
1
;
}
for
(
int32_t
i
=
0
;
i
<
num
;
++
i
)
{
SEpSet
epSet
=
{
0
};
if
(
tDecodeSEpSet
(
&
decoder
,
&
epSet
)
<
0
)
return
-
1
;
taosArrayPush
(
pRsp
->
dnodeList
,
&
epSet
);
}
tEndDecode
(
&
decoder
);
tDecoderClear
(
&
decoder
);
return
0
;
}
void
tFreeSDnodeListRsp
(
SDnodeListRsp
*
pRsp
)
{
taosArrayDestroy
(
pRsp
->
dnodeList
);
}
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
int32_t
tSerializeSCompactDbReq
(
void
*
buf
,
int32_t
bufLen
,
SCompactDbReq
*
pReq
)
{
SEncoder
encoder
=
{
0
};
SEncoder
encoder
=
{
0
};
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
tEncoderInit
(
&
encoder
,
buf
,
bufLen
);
...
...
source/common/src/ttime.c
浏览文件 @
ee821197
...
@@ -76,22 +76,28 @@ void deltaToUtcInitOnce() {
...
@@ -76,22 +76,28 @@ void deltaToUtcInitOnce() {
static
int64_t
parseFraction
(
char
*
str
,
char
**
end
,
int32_t
timePrec
);
static
int64_t
parseFraction
(
char
*
str
,
char
**
end
,
int32_t
timePrec
);
static
int32_t
parseTimeWithTz
(
const
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
,
char
delim
);
static
int32_t
parseTimeWithTz
(
const
char
*
timestr
,
int64_t
*
time
,
int32_t
timePrec
,
char
delim
);
static
int32_t
parseLocaltime
(
char
*
timestr
,
int32_t
len
,
int64_t
*
utime
,
int32_t
timePrec
);
static
int32_t
parseLocaltime
(
char
*
timestr
,
int32_t
len
,
int64_t
*
utime
,
int32_t
timePrec
,
char
delim
);
static
int32_t
parseLocaltimeDst
(
char
*
timestr
,
int32_t
len
,
int64_t
*
utime
,
int32_t
timePrec
);
static
int32_t
parseLocaltimeDst
(
char
*
timestr
,
int32_t
len
,
int64_t
*
utime
,
int32_t
timePrec
,
char
delim
);
static
char
*
forwardToTimeStringEnd
(
char
*
str
);
static
char
*
forwardToTimeStringEnd
(
char
*
str
);
static
bool
checkTzPresent
(
const
char
*
str
,
int32_t
len
);
static
bool
checkTzPresent
(
const
char
*
str
,
int32_t
len
);
static
int32_t
(
*
parseLocaltimeFp
[])(
char
*
timestr
,
int32_t
len
,
int64_t
*
utime
,
int32_t
timePrec
)
=
{
parseLocaltime
,
static
int32_t
(
*
parseLocaltimeFp
[])(
char
*
timestr
,
int32_t
len
,
int64_t
*
utime
,
int32_t
timePrec
,
char
delim
)
=
{
parseLocaltime
,
parseLocaltimeDst
};
parseLocaltimeDst
};
int32_t
taosParseTime
(
const
char
*
timestr
,
int64_t
*
utime
,
int32_t
len
,
int32_t
timePrec
,
int8_t
day_light
)
{
int32_t
taosParseTime
(
const
char
*
timestr
,
int64_t
*
utime
,
int32_t
len
,
int32_t
timePrec
,
int8_t
day_light
)
{
/* parse datatime string in with tz */
/* parse datatime string in with tz */
if
(
strnchr
(
timestr
,
'T'
,
len
,
false
)
!=
NULL
)
{
if
(
strnchr
(
timestr
,
'T'
,
len
,
false
)
!=
NULL
)
{
if
(
checkTzPresent
(
timestr
,
len
))
{
return
parseTimeWithTz
(
timestr
,
utime
,
timePrec
,
'T'
);
return
parseTimeWithTz
(
timestr
,
utime
,
timePrec
,
'T'
);
}
else
if
(
checkTzPresent
(
timestr
,
len
))
{
}
else
{
return
(
*
parseLocaltimeFp
[
day_light
])((
char
*
)
timestr
,
len
,
utime
,
timePrec
,
'T'
);
}
}
else
{
if
(
checkTzPresent
(
timestr
,
len
))
{
return
parseTimeWithTz
(
timestr
,
utime
,
timePrec
,
0
);
return
parseTimeWithTz
(
timestr
,
utime
,
timePrec
,
0
);
}
else
{
}
else
{
return
(
*
parseLocaltimeFp
[
day_light
])((
char
*
)
timestr
,
len
,
utime
,
timePrec
);
return
(
*
parseLocaltimeFp
[
day_light
])((
char
*
)
timestr
,
len
,
utime
,
timePrec
,
0
);
}
}
}
}
}
...
@@ -333,14 +339,26 @@ static FORCE_INLINE bool validateTm(struct tm* pTm) {
...
@@ -333,14 +339,26 @@ static FORCE_INLINE bool validateTm(struct tm* pTm) {
return
true
;
return
true
;
}
}
int32_t
parseLocaltime
(
char
*
timestr
,
int32_t
len
,
int64_t
*
time
,
int32_t
timePrec
)
{
int32_t
parseLocaltime
(
char
*
timestr
,
int32_t
len
,
int64_t
*
time
,
int32_t
timePrec
,
char
delim
)
{
*
time
=
0
;
*
time
=
0
;
struct
tm
tm
=
{
0
};
struct
tm
tm
=
{
0
};
char
*
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
char
*
str
;
if
(
delim
==
'T'
)
{
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%dT%H:%M:%S"
,
&
tm
);
}
else
if
(
delim
==
0
)
{
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
}
else
{
str
=
NULL
;
}
if
(
str
==
NULL
||
(((
str
-
timestr
)
<
len
)
&&
(
*
str
!=
'.'
))
||
!
validateTm
(
&
tm
))
{
//if parse failed, try "%Y-%m-%d" format
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%d"
,
&
tm
);
if
(
str
==
NULL
||
(((
str
-
timestr
)
<
len
)
&&
(
*
str
!=
'.'
))
||
!
validateTm
(
&
tm
))
{
if
(
str
==
NULL
||
(((
str
-
timestr
)
<
len
)
&&
(
*
str
!=
'.'
))
||
!
validateTm
(
&
tm
))
{
return
-
1
;
return
-
1
;
}
}
}
#ifdef _MSC_VER
#ifdef _MSC_VER
#if _MSC_VER >= 1900
#if _MSC_VER >= 1900
...
@@ -367,15 +385,27 @@ int32_t parseLocaltime(char* timestr, int32_t len, int64_t* time, int32_t timePr
...
@@ -367,15 +385,27 @@ int32_t parseLocaltime(char* timestr, int32_t len, int64_t* time, int32_t timePr
return
0
;
return
0
;
}
}
int32_t
parseLocaltimeDst
(
char
*
timestr
,
int32_t
len
,
int64_t
*
time
,
int32_t
timePrec
)
{
int32_t
parseLocaltimeDst
(
char
*
timestr
,
int32_t
len
,
int64_t
*
time
,
int32_t
timePrec
,
char
delim
)
{
*
time
=
0
;
*
time
=
0
;
struct
tm
tm
=
{
0
};
struct
tm
tm
=
{
0
};
tm
.
tm_isdst
=
-
1
;
tm
.
tm_isdst
=
-
1
;
char
*
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
char
*
str
;
if
(
delim
==
'T'
)
{
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%dT%H:%M:%S"
,
&
tm
);
}
else
if
(
delim
==
0
)
{
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%d %H:%M:%S"
,
&
tm
);
}
else
{
str
=
NULL
;
}
if
(
str
==
NULL
||
(((
str
-
timestr
)
<
len
)
&&
(
*
str
!=
'.'
))
||
!
validateTm
(
&
tm
))
{
//if parse failed, try "%Y-%m-%d" format
str
=
taosStrpTime
(
timestr
,
"%Y-%m-%d"
,
&
tm
);
if
(
str
==
NULL
||
(((
str
-
timestr
)
<
len
)
&&
(
*
str
!=
'.'
))
||
!
validateTm
(
&
tm
))
{
if
(
str
==
NULL
||
(((
str
-
timestr
)
<
len
)
&&
(
*
str
!=
'.'
))
||
!
validateTm
(
&
tm
))
{
return
-
1
;
return
-
1
;
}
}
}
/* mktime will be affected by TZ, set by using taos_options */
/* mktime will be affected by TZ, set by using taos_options */
int64_t
seconds
=
taosMktime
(
&
tm
);
int64_t
seconds
=
taosMktime
(
&
tm
);
...
...
source/common/test/commonTests.cpp
浏览文件 @
ee821197
...
@@ -88,26 +88,15 @@ TEST(testCase, toInteger_test) {
...
@@ -88,26 +88,15 @@ TEST(testCase, toInteger_test) {
}
}
TEST
(
testCase
,
Datablock_test
)
{
TEST
(
testCase
,
Datablock_test
)
{
SSDataBlock
*
b
=
static_cast
<
SSDataBlock
*>
(
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
)));
SSDataBlock
*
b
=
createDataBlock
();
b
->
info
.
numOfCols
=
2
;
b
->
pDataBlock
=
taosArrayInit
(
4
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
bytes
=
4
;
infoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
infoData
.
info
.
colId
=
1
;
infoData
.
pData
=
(
char
*
)
taosMemoryCalloc
(
40
,
infoData
.
info
.
bytes
);
SColumnInfoData
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_INT
,
4
,
1
);
infoData
.
nullbitmap
=
(
char
*
)
taosMemoryCalloc
(
1
,
sizeof
(
char
)
*
(
40
/
8
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData
);
taosArrayPush
(
b
->
pDataBlock
,
&
infoData
);
blockDataAppendColInfo
(
b
,
&
infoData
);
SColumnInfoData
infoData1
=
{
0
};
SColumnInfoData
infoData1
=
createColumnInfoData
(
TSDB_DATA_TYPE_BINARY
,
40
,
2
);
infoData1
.
info
.
bytes
=
40
;
blockDataAppendColInfo
(
b
,
&
infoData1
);
infoData1
.
info
.
type
=
TSDB_DATA_TYPE_BINARY
;
blockDataEnsureCapacity
(
b
,
40
);
infoData1
.
info
.
colId
=
2
;
infoData1
.
varmeta
.
offset
=
(
int32_t
*
)
taosMemoryCalloc
(
40
,
sizeof
(
uint32_t
));
taosArrayPush
(
b
->
pDataBlock
,
&
infoData1
);
char
*
str
=
"the value of: %d"
;
char
*
str
=
"the value of: %d"
;
char
buf
[
128
]
=
{
0
};
char
buf
[
128
]
=
{
0
};
...
@@ -222,28 +211,17 @@ TEST(testCase, non_var_dataBlock_split_test) {
...
@@ -222,28 +211,17 @@ TEST(testCase, non_var_dataBlock_split_test) {
#endif
#endif
TEST
(
testCase
,
var_dataBlock_split_test
)
{
TEST
(
testCase
,
var_dataBlock_split_test
)
{
SSDataBlock
*
b
=
static_cast
<
SSDataBlock
*>
(
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
)));
b
->
info
.
numOfCols
=
2
;
b
->
pDataBlock
=
taosArrayInit
(
4
,
sizeof
(
SColumnInfoData
));
int32_t
numOfRows
=
1000000
;
int32_t
numOfRows
=
1000000
;
SColumnInfoData
infoData
=
{
0
};
SSDataBlock
*
b
=
createDataBlock
();
infoData
.
info
.
bytes
=
4
;
infoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
infoData
.
info
.
colId
=
1
;
infoData
.
pData
=
(
char
*
)
taosMemoryCalloc
(
numOfRows
,
infoData
.
info
.
bytes
);
SColumnInfoData
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_INT
,
4
,
1
);
infoData
.
nullbitmap
=
(
char
*
)
taosMemoryCalloc
(
1
,
sizeof
(
char
)
*
(
numOfRows
/
8
));
blockDataAppendColInfo
(
b
,
&
infoData
);
taosArrayPush
(
b
->
pDataBlock
,
&
infoData
);
SColumnInfoData
infoData1
=
{
0
};
SColumnInfoData
infoData1
=
createColumnInfoData
(
TSDB_DATA_TYPE_BINARY
,
40
,
2
);
infoData1
.
info
.
bytes
=
40
;
blockDataAppendColInfo
(
b
,
&
infoData1
);
infoData1
.
info
.
type
=
TSDB_DATA_TYPE_BINARY
;
infoData1
.
info
.
colId
=
2
;
infoData1
.
varmeta
.
offset
=
(
int32_t
*
)
taosMemoryCalloc
(
numOfRows
,
sizeof
(
uint32_t
));
blockDataEnsureCapacity
(
b
,
numOfRows
);
taosArrayPush
(
b
->
pDataBlock
,
&
infoData1
);
char
buf
[
41
]
=
{
0
};
char
buf
[
41
]
=
{
0
};
char
buf1
[
100
]
=
{
0
};
char
buf1
[
100
]
=
{
0
};
...
...
source/dnode/mgmt/mgmt_dnode/inc/dmInt.h
浏览文件 @
ee821197
...
@@ -45,6 +45,7 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
...
@@ -45,6 +45,7 @@ int32_t dmProcessConfigReq(SDnodeMgmt *pMgmt, SRpcMsg *pMsg);
int32_t
dmProcessAuthRsp
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessAuthRsp
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessGrantRsp
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessGrantRsp
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmProcessRetrieve
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
// dmWorker.c
// dmWorker.c
int32_t
dmPutNodeMsgToMgmtQueue
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
int32_t
dmPutNodeMsgToMgmtQueue
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
);
...
...
source/dnode/mgmt/mgmt_dnode/src/dmHandle.c
浏览文件 @
ee821197
...
@@ -15,6 +15,10 @@
...
@@ -15,6 +15,10 @@
#define _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#include "dmInt.h"
#include "dmInt.h"
#include "systable.h"
extern
SConfig
*
tsCfg
;
static
void
dmUpdateDnodeCfg
(
SDnodeMgmt
*
pMgmt
,
SDnodeCfg
*
pCfg
)
{
static
void
dmUpdateDnodeCfg
(
SDnodeMgmt
*
pMgmt
,
SDnodeCfg
*
pCfg
)
{
if
(
pMgmt
->
pData
->
dnodeId
==
0
||
pMgmt
->
pData
->
clusterId
==
0
)
{
if
(
pMgmt
->
pData
->
dnodeId
==
0
||
pMgmt
->
pData
->
clusterId
==
0
)
{
...
@@ -119,8 +123,15 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -119,8 +123,15 @@ int32_t dmProcessGrantRsp(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
}
}
int32_t
dmProcessConfigReq
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
dmProcessConfigReq
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
dError
(
"config req is received, but not supported yet"
);
SDCfgDnodeReq
cfgReq
=
{
0
};
return
TSDB_CODE_OPS_NOT_SUPPORT
;
if
(
tDeserializeSDCfgDnodeReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
cfgReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
dInfo
(
"start to config, option:%s, value:%s"
,
cfgReq
.
config
,
cfgReq
.
value
);
taosCfgDynamicOptions
(
cfgReq
.
config
,
cfgReq
.
value
);
return
0
;
}
}
static
void
dmGetServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SServerStatusRsp
*
pStatus
)
{
static
void
dmGetServerRunStatus
(
SDnodeMgmt
*
pMgmt
,
SServerStatusRsp
*
pStatus
)
{
...
@@ -175,6 +186,130 @@ int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
...
@@ -175,6 +186,130 @@ int32_t dmProcessServerRunStatus(SDnodeMgmt *pMgmt, SRpcMsg *pMsg) {
return
0
;
return
0
;
}
}
SSDataBlock
*
dmBuildVariablesBlock
(
void
)
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
size_t
size
=
0
;
const
SSysTableMeta
*
pMeta
=
NULL
;
getInfosDbMeta
(
&
pMeta
,
&
size
);
int32_t
index
=
0
;
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
if
(
strcmp
(
pMeta
[
i
].
name
,
TSDB_INS_TABLE_DNODE_VARIABLES
)
==
0
)
{
index
=
i
;
break
;
}
}
pBlock
->
pDataBlock
=
taosArrayInit
(
pMeta
[
index
].
colNum
,
sizeof
(
SColumnInfoData
));
for
(
int32_t
i
=
0
;
i
<
pMeta
[
index
].
colNum
;
++
i
)
{
SColumnInfoData
colInfoData
=
{
0
};
colInfoData
.
info
.
colId
=
i
+
1
;
colInfoData
.
info
.
type
=
pMeta
[
index
].
schema
[
i
].
type
;
colInfoData
.
info
.
bytes
=
pMeta
[
index
].
schema
[
i
].
bytes
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
}
pBlock
->
info
.
hasVarCol
=
true
;
return
pBlock
;
}
int32_t
dmAppendVariablesToBlock
(
SSDataBlock
*
pBlock
,
int32_t
dnodeId
)
{
int32_t
numOfCfg
=
taosArrayGetSize
(
tsCfg
->
array
);
int32_t
numOfRows
=
0
;
blockDataEnsureCapacity
(
pBlock
,
numOfCfg
);
for
(
int32_t
i
=
0
,
c
=
0
;
i
<
numOfCfg
;
++
i
,
c
=
0
)
{
SConfigItem
*
pItem
=
taosArrayGet
(
tsCfg
->
array
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
(
const
char
*
)
&
dnodeId
,
false
);
char
name
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pItem
->
name
,
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
name
,
false
);
char
value
[
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
int32_t
valueLen
=
0
;
cfgDumpItemValue
(
pItem
,
&
value
[
VARSTR_HEADER_SIZE
],
TSDB_CONFIG_VALUE_LEN
,
&
valueLen
);
varDataSetLen
(
value
,
valueLen
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
value
,
false
);
numOfRows
++
;
}
pBlock
->
info
.
rows
=
numOfRows
;
return
TSDB_CODE_SUCCESS
;
}
int32_t
dmProcessRetrieve
(
SDnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
size
=
0
;
int32_t
rowsRead
=
0
;
SRetrieveTableReq
retrieveReq
=
{
0
};
if
(
tDeserializeSRetrieveTableReq
(
pMsg
->
pCont
,
pMsg
->
contLen
,
&
retrieveReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
if
(
strcasecmp
(
retrieveReq
.
tb
,
TSDB_INS_TABLE_DNODE_VARIABLES
))
{
terrno
=
TSDB_CODE_INVALID_MSG
;
return
-
1
;
}
SSDataBlock
*
pBlock
=
dmBuildVariablesBlock
();
dmAppendVariablesToBlock
(
pBlock
,
pMgmt
->
pData
->
dnodeId
);
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
size
=
sizeof
(
SRetrieveMetaTableRsp
)
+
sizeof
(
int32_t
)
+
sizeof
(
SSysTableSchema
)
*
numOfCols
+
blockDataGetSize
(
pBlock
)
+
blockDataGetSerialMetaSize
(
numOfCols
);
SRetrieveMetaTableRsp
*
pRsp
=
rpcMallocCont
(
size
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
dError
(
"failed to retrieve data since %s"
,
terrstr
());
blockDataDestroy
(
pBlock
);
return
-
1
;
}
char
*
pStart
=
pRsp
->
data
;
*
(
int32_t
*
)
pStart
=
htonl
(
numOfCols
);
pStart
+=
sizeof
(
int32_t
);
// number of columns
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SSysTableSchema
*
pSchema
=
(
SSysTableSchema
*
)
pStart
;
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
pSchema
->
bytes
=
htonl
(
pColInfo
->
info
.
bytes
);
pSchema
->
colId
=
htons
(
pColInfo
->
info
.
colId
);
pSchema
->
type
=
pColInfo
->
info
.
type
;
pStart
+=
sizeof
(
SSysTableSchema
);
}
int32_t
len
=
0
;
blockCompressEncode
(
pBlock
,
pStart
,
&
len
,
numOfCols
,
false
);
pRsp
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
pRsp
->
precision
=
TSDB_TIME_PRECISION_MILLI
;
// millisecond time precision
pRsp
->
completed
=
1
;
pMsg
->
info
.
rsp
=
pRsp
;
pMsg
->
info
.
rspLen
=
size
;
dDebug
(
"dnode variables retrieve completed"
);
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
}
SArray
*
dmGetMsgHandles
()
{
SArray
*
dmGetMsgHandles
()
{
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
SArray
*
pArray
=
taosArrayInit
(
16
,
sizeof
(
SMgmtHandle
));
SArray
*
pArray
=
taosArrayInit
(
16
,
sizeof
(
SMgmtHandle
));
...
@@ -191,6 +326,7 @@ SArray *dmGetMsgHandles() {
...
@@ -191,6 +326,7 @@ SArray *dmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_BNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_DROP_BNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CONFIG_DNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_CONFIG_DNODE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_SERVER_STATUS
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_SERVER_STATUS
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_DND_SYSTABLE_RETRIEVE
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
// Requests handled by MNODE
// Requests handled by MNODE
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT_RSP
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_GRANT_RSP
,
dmPutNodeMsgToMgmtQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/mgmt_dnode/src/dmWorker.c
浏览文件 @
ee821197
...
@@ -141,6 +141,9 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
...
@@ -141,6 +141,9 @@ static void dmProcessMgmtQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) {
case
TDMT_DND_SERVER_STATUS
:
case
TDMT_DND_SERVER_STATUS
:
code
=
dmProcessServerRunStatus
(
pMgmt
,
pMsg
);
code
=
dmProcessServerRunStatus
(
pMgmt
,
pMsg
);
break
;
break
;
case
TDMT_DND_SYSTABLE_RETRIEVE
:
code
=
dmProcessRetrieve
(
pMgmt
,
pMsg
);
break
;
default:
default:
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
terrno
=
TSDB_CODE_MSG_NOT_PROCESSED
;
break
;
break
;
...
...
source/dnode/mgmt/mgmt_mnode/src/mmHandle.c
浏览文件 @
ee821197
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
#include "mmInt.h"
#include "mmInt.h"
void
mmGetMonitorInfo
(
SMnodeMgmt
*
pMgmt
,
SMonMmInfo
*
pInfo
)
{
void
mmGetMonitorInfo
(
SMnodeMgmt
*
pMgmt
,
SMonMmInfo
*
pInfo
)
{
mndGetMonitorInfo
(
pMgmt
->
pMnode
,
&
pInfo
->
cluster
,
&
pInfo
->
vgroup
,
&
pInfo
->
grant
);
mndGetMonitorInfo
(
pMgmt
->
pMnode
,
&
pInfo
->
cluster
,
&
pInfo
->
vgroup
,
&
pInfo
->
stb
,
&
pInfo
->
grant
);
}
}
int32_t
mmProcessGetMonitorInfoReq
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
int32_t
mmProcessGetMonitorInfoReq
(
SMnodeMgmt
*
pMgmt
,
SRpcMsg
*
pMsg
)
{
...
@@ -161,6 +161,7 @@ SArray *mmGetMsgHandles() {
...
@@ -161,6 +161,7 @@ SArray *mmGetMsgHandles() {
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_QNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_QNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_QNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_QNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_QNODE_LIST
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_QNODE_LIST
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DNODE_LIST
,
mmPutMsgToReadQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_SNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_SNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_SNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_DROP_SNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_BNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
if
(
dmSetMgmtHandle
(
pArray
,
TDMT_MND_CREATE_BNODE
,
mmPutMsgToWriteQueue
,
0
)
==
NULL
)
goto
_OVER
;
...
...
source/dnode/mgmt/node_mgmt/src/dmTransport.c
浏览文件 @
ee821197
...
@@ -85,6 +85,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
...
@@ -85,6 +85,7 @@ static void dmProcessRpcMsg(SDnode *pDnode, SRpcMsg *pRpc, SEpSet *pEpSet) {
dmProcessNetTestReq
(
pDnode
,
pRpc
);
dmProcessNetTestReq
(
pDnode
,
pRpc
);
return
;
return
;
case
TDMT_MND_SYSTABLE_RETRIEVE_RSP
:
case
TDMT_MND_SYSTABLE_RETRIEVE_RSP
:
case
TDMT_DND_SYSTABLE_RETRIEVE_RSP
:
case
TDMT_VND_FETCH_RSP
:
case
TDMT_VND_FETCH_RSP
:
qWorkerProcessFetchRsp
(
NULL
,
NULL
,
pRpc
,
0
);
qWorkerProcessFetchRsp
(
NULL
,
NULL
,
pRpc
,
0
);
return
;
return
;
...
...
source/dnode/mgmt/node_util/src/dmFile.c
浏览文件 @
ee821197
...
@@ -127,14 +127,24 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
...
@@ -127,14 +127,24 @@ TdFilePtr dmCheckRunning(const char *dataDir) {
return
NULL
;
return
NULL
;
}
}
int32_t
ret
=
taosLockFile
(
pFile
);
int32_t
retryTimes
=
0
;
if
(
ret
!=
0
)
{
int32_t
ret
=
0
;
do
{
ret
=
taosLockFile
(
pFile
);
if
(
ret
==
0
)
break
;
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
taosMsleep
(
100
);
retryTimes
++
;
dError
(
"failed to lock file:%s since %s, retryTimes:%d"
,
filepath
,
terrstr
(),
retryTimes
);
}
while
(
retryTimes
<
120
);
if
(
ret
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
dError
(
"failed to lock file:%s since %s"
,
filepath
,
terrstr
());
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
return
NULL
;
return
NULL
;
}
}
terrno
=
0
;
dDebug
(
"lock file:%s to prevent repeated starts"
,
filepath
);
dDebug
(
"lock file:%s to prevent repeated starts"
,
filepath
);
return
pFile
;
return
pFile
;
}
}
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
ee821197
...
@@ -47,6 +47,7 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw);
...
@@ -47,6 +47,7 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw);
static
int32_t
mndDnodeActionInsert
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionInsert
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionDelete
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionDelete
(
SSdb
*
pSdb
,
SDnodeObj
*
pDnode
);
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOld
,
SDnodeObj
*
pNew
);
static
int32_t
mndDnodeActionUpdate
(
SSdb
*
pSdb
,
SDnodeObj
*
pOld
,
SDnodeObj
*
pNew
);
static
int32_t
mndProcessDnodeListReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessDropDnodeReq
(
SRpcMsg
*
pReq
);
static
int32_t
mndProcessDropDnodeReq
(
SRpcMsg
*
pReq
);
...
@@ -76,6 +77,7 @@ int32_t mndInitDnode(SMnode *pMnode) {
...
@@ -76,6 +77,7 @@ int32_t mndInitDnode(SMnode *pMnode) {
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CONFIG_DNODE
,
mndProcessConfigDnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_CONFIG_DNODE
,
mndProcessConfigDnodeReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CONFIG_DNODE_RSP
,
mndProcessConfigDnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_DND_CONFIG_DNODE_RSP
,
mndProcessConfigDnodeRsp
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STATUS
,
mndProcessStatusReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_STATUS
,
mndProcessStatusReq
);
mndSetMsgHandle
(
pMnode
,
TDMT_MND_DNODE_LIST
,
mndProcessDnodeListReq
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndRetrieveConfigs
);
mndAddShowRetrieveHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndRetrieveConfigs
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndCancelGetNextConfig
);
mndAddShowFreeIterHandle
(
pMnode
,
TSDB_MGMT_TABLE_CONFIGS
,
mndCancelGetNextConfig
);
...
@@ -499,6 +501,59 @@ _OVER:
...
@@ -499,6 +501,59 @@ _OVER:
return
code
;
return
code
;
}
}
static
int32_t
mndProcessDnodeListReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SDnodeObj
*
pObj
=
NULL
;
void
*
pIter
=
NULL
;
SDnodeListRsp
rsp
=
{
0
};
int32_t
code
=
-
1
;
rsp
.
dnodeList
=
taosArrayInit
(
5
,
sizeof
(
SEpSet
));
if
(
NULL
==
rsp
.
dnodeList
)
{
mError
(
"failed to alloc epSet while process dnode list req"
);
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
while
(
1
)
{
pIter
=
sdbFetch
(
pSdb
,
SDB_DNODE
,
pIter
,
(
void
**
)
&
pObj
);
if
(
pIter
==
NULL
)
break
;
SEpSet
epSet
=
{
0
};
epSet
.
numOfEps
=
1
;
tstrncpy
(
epSet
.
eps
[
0
].
fqdn
,
pObj
->
fqdn
,
TSDB_FQDN_LEN
);
epSet
.
eps
[
0
].
port
=
pObj
->
port
;
(
void
)
taosArrayPush
(
rsp
.
dnodeList
,
&
epSet
);
sdbRelease
(
pSdb
,
pObj
);
}
int32_t
rspLen
=
tSerializeSDnodeListRsp
(
NULL
,
0
,
&
rsp
);
void
*
pRsp
=
rpcMallocCont
(
rspLen
);
if
(
pRsp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_OVER
;
}
tSerializeSDnodeListRsp
(
pRsp
,
rspLen
,
&
rsp
);
pReq
->
info
.
rspLen
=
rspLen
;
pReq
->
info
.
rsp
=
pRsp
;
code
=
0
;
_OVER:
if
(
code
!=
0
)
{
mError
(
"failed to get dnode list since %s"
,
terrstr
());
}
tFreeSDnodeListRsp
(
&
rsp
);
return
code
;
}
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
)
{
static
int32_t
mndProcessCreateDnodeReq
(
SRpcMsg
*
pReq
)
{
SMnode
*
pMnode
=
pReq
->
info
.
node
;
SMnode
*
pMnode
=
pReq
->
info
.
node
;
int32_t
code
=
-
1
;
int32_t
code
=
-
1
;
...
@@ -598,25 +653,25 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
...
@@ -598,25 +653,25 @@ static int32_t mndProcessDropDnodeReq(SRpcMsg *pReq) {
SMnodeObj
*
pMObj
=
NULL
;
SMnodeObj
*
pMObj
=
NULL
;
SQnodeObj
*
pQObj
=
NULL
;
SQnodeObj
*
pQObj
=
NULL
;
SSnodeObj
*
pSObj
=
NULL
;
SSnodeObj
*
pSObj
=
NULL
;
S
MDropM
nodeReq
dropReq
=
{
0
};
S
DropD
nodeReq
dropReq
=
{
0
};
if
(
tDeserializeS
CreateDropMQSBN
odeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
if
(
tDeserializeS
DropDn
odeReq
(
pReq
->
pCont
,
pReq
->
contLen
,
&
dropReq
)
!=
0
)
{
terrno
=
TSDB_CODE_INVALID_MSG
;
terrno
=
TSDB_CODE_INVALID_MSG
;
goto
_OVER
;
goto
_OVER
;
}
}
mInfo
(
"dnode:%d, start to drop"
,
dropReq
.
dnodeId
);
mInfo
(
"dnode:%d, start to drop, ep:%s:%d"
,
dropReq
.
dnodeId
,
dropReq
.
fqdn
,
dropReq
.
port
);
if
(
dropReq
.
dnodeId
<=
0
)
{
terrno
=
TSDB_CODE_MND_INVALID_DNODE_ID
;
goto
_OVER
;
}
pDnode
=
mndAcquireDnode
(
pMnode
,
dropReq
.
dnodeId
);
pDnode
=
mndAcquireDnode
(
pMnode
,
dropReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
char
ep
[
TSDB_EP_LEN
+
1
]
=
{
0
};
snprintf
(
ep
,
sizeof
(
ep
),
dropReq
.
fqdn
,
dropReq
.
port
);
pDnode
=
mndAcquireDnodeByEp
(
pMnode
,
ep
);
if
(
pDnode
==
NULL
)
{
if
(
pDnode
==
NULL
)
{
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
terrno
=
TSDB_CODE_MND_DNODE_NOT_EXIST
;
goto
_OVER
;
goto
_OVER
;
}
}
}
pQObj
=
mndAcquireQnode
(
pMnode
,
dropReq
.
dnodeId
);
pQObj
=
mndAcquireQnode
(
pMnode
,
dropReq
.
dnodeId
);
pSObj
=
mndAcquireSnode
(
pMnode
,
dropReq
.
dnodeId
);
pSObj
=
mndAcquireSnode
(
pMnode
,
dropReq
.
dnodeId
);
...
@@ -670,23 +725,46 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
...
@@ -670,23 +725,46 @@ static int32_t mndProcessConfigDnodeReq(SRpcMsg *pReq) {
return
-
1
;
return
-
1
;
}
}
mInfo
(
"dnode:%d, start to config, option:%s, value:%s"
,
cfgReq
.
dnodeId
,
cfgReq
.
config
,
cfgReq
.
value
);
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
cfgReq
.
dnodeId
);
SDnodeObj
*
pDnode
=
mndAcquireDnode
(
pMnode
,
cfgReq
.
dnodeId
);
if
(
pDnode
==
NULL
)
{
if
(
pDnode
==
NULL
)
{
mError
(
"dnode:%d, failed to config since %s "
,
cfgReq
.
dnodeId
,
terrstr
());
mError
(
"dnode:%d, failed to config since %s "
,
cfgReq
.
dnodeId
,
terrstr
());
return
-
1
;
return
-
1
;
}
}
SEpSet
epSet
=
mndGetDnodeEpset
(
pDnode
);
SEpSet
epSet
=
mndGetDnodeEpset
(
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
mndReleaseDnode
(
pMnode
,
pDnode
);
int32_t
bufLen
=
tSerializeSMCfgDnodeReq
(
NULL
,
0
,
&
cfgReq
);
SDCfgDnodeReq
dcfgReq
=
{
0
};
if
(
strncasecmp
(
cfgReq
.
config
,
"debugFlag"
,
9
)
==
0
)
{
const
char
*
value
=
cfgReq
.
value
;
int32_t
flag
=
atoi
(
value
);
if
(
flag
<=
0
)
{
flag
=
atoi
(
cfgReq
.
config
+
10
);
}
if
(
flag
<=
0
||
flag
>
255
)
{
mError
(
"dnode:%d, failed to config debugFlag since value:%d"
,
cfgReq
.
dnodeId
,
flag
);
terrno
=
TSDB_CODE_INVALID_CFG
;
return
-
1
;
}
strcpy
(
dcfgReq
.
config
,
"debugFlag"
);
snprintf
(
dcfgReq
.
value
,
TSDB_DNODE_VALUE_LEN
,
"%d"
,
flag
);
}
else
if
(
strcasecmp
(
cfgReq
.
config
,
"resetlog"
)
==
0
)
{
strcpy
(
dcfgReq
.
config
,
"resetlog"
);
}
else
{
terrno
=
TSDB_CODE_INVALID_CFG
;
mError
(
"dnode:%d, failed to config since %s"
,
cfgReq
.
dnodeId
,
terrstr
());
return
-
1
;
}
int32_t
bufLen
=
tSerializeSDCfgDnodeReq
(
NULL
,
0
,
&
dcfgReq
);
void
*
pBuf
=
rpcMallocCont
(
bufLen
);
void
*
pBuf
=
rpcMallocCont
(
bufLen
);
if
(
pBuf
==
NULL
)
return
-
1
;
if
(
pBuf
==
NULL
)
return
-
1
;
tSerializeS
MCfgDnodeReq
(
pBuf
,
bufLen
,
&
cfgReq
);
tSerializeS
DCfgDnodeReq
(
pBuf
,
bufLen
,
&
d
cfgReq
);
mDebug
(
"dnode:%d, send config req to dnode, app:%p"
,
cfgReq
.
dnodeId
,
pReq
->
info
.
ahandle
);
mDebug
(
"dnode:%d, send config req to dnode, app:%p"
,
cfgReq
.
dnodeId
,
pReq
->
info
.
ahandle
);
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
,
.
info
=
pReq
->
info
};
SRpcMsg
rpcMsg
=
{.
msgType
=
TDMT_DND_CONFIG_DNODE
,
.
pCont
=
pBuf
,
.
contLen
=
bufLen
};
return
tmsgSendReq
(
&
epSet
,
&
rpcMsg
);
return
tmsgSendReq
(
&
epSet
,
&
rpcMsg
);
}
}
...
@@ -700,28 +778,28 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -700,28 +778,28 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
int32_t
totalRows
=
0
;
int32_t
totalRows
=
0
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
char
*
cfgOpts
[
TSDB_CONFIG_NUMBER
]
=
{
0
};
char
*
cfgOpts
[
TSDB_CONFIG_NUMBER
]
=
{
0
};
char
cfgVals
[
TSDB_CONFIG_NUMBER
][
TSDB_CON
I
IG_VALUE_LEN
+
1
]
=
{
0
};
char
cfgVals
[
TSDB_CONFIG_NUMBER
][
TSDB_CON
F
IG_VALUE_LEN
+
1
]
=
{
0
};
char
*
pWrite
=
NULL
;
char
*
pWrite
=
NULL
;
int32_t
cols
=
0
;
int32_t
cols
=
0
;
cfgOpts
[
totalRows
]
=
"statusInterval"
;
cfgOpts
[
totalRows
]
=
"statusInterval"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
I
IG_VALUE_LEN
,
"%d"
,
tsStatusInterval
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
F
IG_VALUE_LEN
,
"%d"
,
tsStatusInterval
);
totalRows
++
;
totalRows
++
;
cfgOpts
[
totalRows
]
=
"timezone"
;
cfgOpts
[
totalRows
]
=
"timezone"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
I
IG_VALUE_LEN
,
"%s"
,
tsTimezoneStr
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
F
IG_VALUE_LEN
,
"%s"
,
tsTimezoneStr
);
totalRows
++
;
totalRows
++
;
cfgOpts
[
totalRows
]
=
"locale"
;
cfgOpts
[
totalRows
]
=
"locale"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
I
IG_VALUE_LEN
,
"%s"
,
tsLocale
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
F
IG_VALUE_LEN
,
"%s"
,
tsLocale
);
totalRows
++
;
totalRows
++
;
cfgOpts
[
totalRows
]
=
"charset"
;
cfgOpts
[
totalRows
]
=
"charset"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
I
IG_VALUE_LEN
,
"%s"
,
tsCharset
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CON
F
IG_VALUE_LEN
,
"%s"
,
tsCharset
);
totalRows
++
;
totalRows
++
;
char
buf
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
buf
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
bufVal
[
TSDB_CON
I
IG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
char
bufVal
[
TSDB_CON
F
IG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
totalRows
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
totalRows
;
i
++
)
{
cols
=
0
;
cols
=
0
;
...
@@ -730,7 +808,7 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
...
@@ -730,7 +808,7 @@ static int32_t mndRetrieveConfigs(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock *p
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
buf
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
buf
,
false
);
STR_WITH_MAXSIZE_TO_VARSTR
(
bufVal
,
cfgVals
[
i
],
TSDB_CON
I
IG_VALUE_LEN
);
STR_WITH_MAXSIZE_TO_VARSTR
(
bufVal
,
cfgVals
[
i
],
TSDB_CON
F
IG_VALUE_LEN
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
cols
++
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
bufVal
,
false
);
colDataAppend
(
pColInfo
,
numOfRows
,
(
const
char
*
)
bufVal
,
false
);
...
...
source/dnode/mnode/impl/src/mndMain.c
浏览文件 @
ee821197
...
@@ -614,7 +614,7 @@ int64_t mndGenerateUid(char *name, int32_t len) {
...
@@ -614,7 +614,7 @@ int64_t mndGenerateUid(char *name, int32_t len) {
}
}
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
int32_t
mndGetMonitorInfo
(
SMnode
*
pMnode
,
SMonClusterInfo
*
pClusterInfo
,
SMonVgroupInfo
*
pVgroupInfo
,
SMonGrantInfo
*
pGrantInfo
)
{
SMon
StbInfo
*
pStbInfo
,
SMon
GrantInfo
*
pGrantInfo
)
{
if
(
mndAcquireRpcRef
(
pMnode
)
!=
0
)
return
-
1
;
if
(
mndAcquireRpcRef
(
pMnode
)
!=
0
)
return
-
1
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
SSdb
*
pSdb
=
pMnode
->
pSdb
;
...
@@ -623,7 +623,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -623,7 +623,9 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
pClusterInfo
->
dnodes
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_DNODE
),
sizeof
(
SMonDnodeDesc
));
pClusterInfo
->
dnodes
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_DNODE
),
sizeof
(
SMonDnodeDesc
));
pClusterInfo
->
mnodes
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_MNODE
),
sizeof
(
SMonMnodeDesc
));
pClusterInfo
->
mnodes
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_MNODE
),
sizeof
(
SMonMnodeDesc
));
pVgroupInfo
->
vgroups
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_VGROUP
),
sizeof
(
SMonVgroupDesc
));
pVgroupInfo
->
vgroups
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_VGROUP
),
sizeof
(
SMonVgroupDesc
));
if
(
pClusterInfo
->
dnodes
==
NULL
||
pClusterInfo
->
mnodes
==
NULL
||
pVgroupInfo
->
vgroups
==
NULL
)
{
pStbInfo
->
stbs
=
taosArrayInit
(
sdbGetSize
(
pSdb
,
SDB_STB
),
sizeof
(
SMonStbDesc
));
if
(
pClusterInfo
->
dnodes
==
NULL
||
pClusterInfo
->
mnodes
==
NULL
||
pVgroupInfo
->
vgroups
==
NULL
||
pStbInfo
->
stbs
==
NULL
)
{
mndReleaseRpcRef
(
pMnode
);
mndReleaseRpcRef
(
pMnode
);
return
-
1
;
return
-
1
;
}
}
...
@@ -632,6 +634,8 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -632,6 +634,8 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
tstrncpy
(
pClusterInfo
->
version
,
version
,
sizeof
(
pClusterInfo
->
version
));
tstrncpy
(
pClusterInfo
->
version
,
version
,
sizeof
(
pClusterInfo
->
version
));
pClusterInfo
->
monitor_interval
=
tsMonitorInterval
;
pClusterInfo
->
monitor_interval
=
tsMonitorInterval
;
pClusterInfo
->
connections_total
=
mndGetNumOfConnections
(
pMnode
);
pClusterInfo
->
connections_total
=
mndGetNumOfConnections
(
pMnode
);
pClusterInfo
->
dbs_total
=
sdbGetSize
(
pSdb
,
SDB_DB
);
pClusterInfo
->
stbs_total
=
sdbGetSize
(
pSdb
,
SDB_STB
);
void
*
pIter
=
NULL
;
void
*
pIter
=
NULL
;
while
(
1
)
{
while
(
1
)
{
...
@@ -681,6 +685,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -681,6 +685,7 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
if
(
pIter
==
NULL
)
break
;
if
(
pIter
==
NULL
)
break
;
pClusterInfo
->
vgroups_total
++
;
pClusterInfo
->
vgroups_total
++
;
pClusterInfo
->
tbs_total
+=
pVgroup
->
numOfTables
;
SMonVgroupDesc
desc
=
{
0
};
SMonVgroupDesc
desc
=
{
0
};
desc
.
vgroup_id
=
pVgroup
->
vgId
;
desc
.
vgroup_id
=
pVgroup
->
vgId
;
...
@@ -711,6 +716,27 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
...
@@ -711,6 +716,27 @@ int32_t mndGetMonitorInfo(SMnode *pMnode, SMonClusterInfo *pClusterInfo, SMonVgr
sdbRelease
(
pSdb
,
pVgroup
);
sdbRelease
(
pSdb
,
pVgroup
);
}
}
// stb info
pIter
=
NULL
;
while
(
1
)
{
SStbObj
*
pStb
=
NULL
;
pIter
=
sdbFetch
(
pSdb
,
SDB_STB
,
pIter
,
(
void
**
)
&
pStb
);
if
(
pIter
==
NULL
)
break
;
SMonStbDesc
desc
=
{
0
};
SName
name1
=
{
0
};
tNameFromString
(
&
name1
,
pStb
->
db
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
tNameGetDbName
(
&
name1
,
desc
.
database_name
);
SName
name2
=
{
0
};
tNameFromString
(
&
name2
,
pStb
->
name
,
T_NAME_ACCT
|
T_NAME_DB
|
T_NAME_TABLE
);
tstrncpy
(
desc
.
stb_name
,
tNameGetTableName
(
&
name2
),
TSDB_TABLE_NAME_LEN
);
taosArrayPush
(
pStbInfo
->
stbs
,
&
desc
);
sdbRelease
(
pSdb
,
pStb
);
}
// grant info
// grant info
pGrantInfo
->
expire_time
=
(
pMnode
->
grant
.
expireTimeMS
-
ms
)
/
86400000
.
0
f
;
pGrantInfo
->
expire_time
=
(
pMnode
->
grant
.
expireTimeMS
-
ms
)
/
86400000
.
0
f
;
pGrantInfo
->
timeseries_total
=
pMnode
->
grant
.
timeseriesAllowed
;
pGrantInfo
->
timeseries_total
=
pMnode
->
grant
.
timeseriesAllowed
;
...
...
source/dnode/mnode/impl/src/mndScheduler.c
浏览文件 @
ee821197
...
@@ -509,7 +509,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
...
@@ -509,7 +509,7 @@ int32_t mndScheduleStream(SMnode* pMnode, STrans* pTrans, SStreamObj* pStream) {
SStreamTask
*
pTask
=
tNewSStreamTask
(
pStream
->
uid
);
SStreamTask
*
pTask
=
tNewSStreamTask
(
pStream
->
uid
);
mndAddTaskToTaskSet
(
taskOneLevel
,
pTask
);
mndAddTaskToTaskSet
(
taskOneLevel
,
pTask
);
//
input
//
source
pTask
->
isDataScan
=
1
;
pTask
->
isDataScan
=
1
;
// trigger
// trigger
...
...
source/dnode/mnode/impl/src/mndShow.c
浏览文件 @
ee821197
...
@@ -236,7 +236,6 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
...
@@ -236,7 +236,6 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
int32_t
numOfCols
=
pShow
->
pMeta
->
numOfColumns
;
int32_t
numOfCols
=
pShow
->
pMeta
->
numOfColumns
;
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
pBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
pBlock
->
info
.
numOfCols
=
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
idata
=
{
0
};
SColumnInfoData
idata
=
{
0
};
...
@@ -271,7 +270,7 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
...
@@ -271,7 +270,7 @@ static int32_t mndProcessRetrieveSysTableReq(SRpcMsg *pReq) {
}
}
size
=
sizeof
(
SRetrieveMetaTableRsp
)
+
sizeof
(
int32_t
)
+
sizeof
(
SSysTableSchema
)
*
pShow
->
pMeta
->
numOfColumns
+
size
=
sizeof
(
SRetrieveMetaTableRsp
)
+
sizeof
(
int32_t
)
+
sizeof
(
SSysTableSchema
)
*
pShow
->
pMeta
->
numOfColumns
+
blockDataGetSize
(
pBlock
)
+
blockDataGetSerialMetaSize
(
pBlock
->
info
.
numOfCols
);
blockDataGetSize
(
pBlock
)
+
blockDataGetSerialMetaSize
(
taosArrayGetSize
(
pBlock
->
pDataBlock
)
);
SRetrieveMetaTableRsp
*
pRsp
=
rpcMallocCont
(
size
);
SRetrieveMetaTableRsp
*
pRsp
=
rpcMallocCont
(
size
);
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
...
...
source/dnode/vnode/CMakeLists.txt
浏览文件 @
ee821197
...
@@ -29,6 +29,7 @@ target_sources(
...
@@ -29,6 +29,7 @@ target_sources(
# sma
# sma
"src/sma/sma.c"
"src/sma/sma.c"
"src/sma/smaEnv.c"
"src/sma/smaEnv.c"
"src/sma/smaUtil.c"
"src/sma/smaOpen.c"
"src/sma/smaOpen.c"
"src/sma/smaRollup.c"
"src/sma/smaRollup.c"
"src/sma/smaTimeRange.c"
"src/sma/smaTimeRange.c"
...
...
source/dnode/vnode/inc/vnode.h
浏览文件 @
ee821197
...
@@ -149,8 +149,8 @@ int32_t tqReadHandleRemoveTbUidList(STqReadHandle *pHandle, const SArray *tbUidL
...
@@ -149,8 +149,8 @@ int32_t tqReadHandleRemoveTbUidList(STqReadHandle *pHandle, const SArray *tbUidL
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
int32_t
tqReadHandleSetMsg
(
STqReadHandle
*
pHandle
,
SSubmitReq
*
pMsg
,
int64_t
ver
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
bool
tqNextDataBlock
(
STqReadHandle
*
pHandle
);
bool
tqNextDataBlockFilterOut
(
STqReadHandle
*
pHandle
,
SHashObj
*
filterOutUids
);
bool
tqNextDataBlockFilterOut
(
STqReadHandle
*
pHandle
,
SHashObj
*
filterOutUids
);
int32_t
tqRetrieveDataBlock
(
S
Array
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
tqRetrieveDataBlock
(
S
SDataBlock
*
pBlock
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
*
pNumOfRows
,
int16_t
*
pNumOfCols
);
int32_t
*
pNumOfRows
);
// sma
// sma
int32_t
smaGetTSmaDays
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
int32_t
smaGetTSmaDays
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
...
...
source/dnode/vnode/src/inc/sma.h
浏览文件 @
ee821197
...
@@ -34,7 +34,8 @@ extern "C" {
...
@@ -34,7 +34,8 @@ extern "C" {
typedef
struct
SSmaEnv
SSmaEnv
;
typedef
struct
SSmaEnv
SSmaEnv
;
typedef
struct
SSmaStat
SSmaStat
;
typedef
struct
SSmaStat
SSmaStat
;
typedef
struct
SSmaStatItem
SSmaStatItem
;
typedef
struct
STSmaStat
STSmaStat
;
typedef
struct
SRSmaStat
SRSmaStat
;
typedef
struct
SSmaKey
SSmaKey
;
typedef
struct
SSmaKey
SSmaKey
;
typedef
struct
SRSmaInfo
SRSmaInfo
;
typedef
struct
SRSmaInfo
SRSmaInfo
;
typedef
struct
SRSmaInfoItem
SRSmaInfoItem
;
typedef
struct
SRSmaInfoItem
SRSmaInfoItem
;
...
@@ -48,23 +49,35 @@ struct SSmaEnv {
...
@@ -48,23 +49,35 @@ struct SSmaEnv {
#define SMA_ENV_LOCK(env) ((env)->lock)
#define SMA_ENV_LOCK(env) ((env)->lock)
#define SMA_ENV_TYPE(env) ((env)->type)
#define SMA_ENV_TYPE(env) ((env)->type)
#define SMA_ENV_STAT(env) ((env)->pStat)
#define SMA_ENV_STAT(env) ((env)->pStat)
#define SMA_ENV_STAT_ITEM(env) ((env)->pStat->tsmaStatItem)
struct
S
SmaStatItem
{
struct
S
TSmaStat
{
int8_t
state
;
// ETsdbSmaStat
int8_t
state
;
// ETsdbSmaStat
STSma
*
pTSma
;
// cache schema
STSma
*
pTSma
;
// cache schema
STSchema
*
pTSchema
;
STSchema
*
pTSchema
;
};
};
struct
SRSmaStat
{
SSma
*
pSma
;
void
*
tmrHandle
;
tmr_h
tmrId
;
int8_t
tmrStat
;
int32_t
tmrSeconds
;
SHashObj
*
rsmaInfoHash
;
// key: stbUid, value: SRSmaInfo;
};
struct
SSmaStat
{
struct
SSmaStat
{
union
{
union
{
S
SmaStatItem
tsmaStatItem
;
S
TSmaStat
tsmaStat
;
// time-range-wise sma
S
HashObj
*
rsmaInfoHash
;
// key: stbUid, value: SRSmaInfo;
S
RSmaStat
rsmaStat
;
// rollup sma
};
};
T_REF_DECLARE
()
T_REF_DECLARE
()
};
};
#define SMA_STAT_ITEM(s) ((s)->tsmaStatItem)
#define SMA_TSMA_STAT(s) (&(s)->tsmaStat)
#define SMA_STAT_INFO_HASH(s) ((s)->rsmaInfoHash)
#define SMA_RSMA_STAT(s) (&(s)->rsmaStat)
#define SMA_RSMA_INFO_HASH(s) ((s)->rsmaStat.rsmaInfoHash)
#define SMA_RSMA_TMR_HANDLE(s) ((s)->rsmaStat.tmrHandle)
#define SMA_RSMA_TMR_STAT(s) ((s)->rsmaStat.tmrStat)
#define RSMA_INFO_HASH(r) ((r)->rsmaInfoHash)
void
tdDestroySmaEnv
(
SSmaEnv
*
pSmaEnv
);
void
tdDestroySmaEnv
(
SSmaEnv
*
pSmaEnv
);
void
*
tdFreeSmaEnv
(
SSmaEnv
*
pSmaEnv
);
void
*
tdFreeSmaEnv
(
SSmaEnv
*
pSmaEnv
);
...
@@ -107,53 +120,51 @@ static FORCE_INLINE int32_t tdUnLockSmaEnv(SSmaEnv *pEnv) {
...
@@ -107,53 +120,51 @@ static FORCE_INLINE int32_t tdUnLockSmaEnv(SSmaEnv *pEnv) {
return
0
;
return
0
;
}
}
static
FORCE_INLINE
int8_t
tdSmaStat
(
S
SmaStatItem
*
pStatItem
)
{
static
FORCE_INLINE
int8_t
tdSmaStat
(
S
TSmaStat
*
pTStat
)
{
if
(
p
StatItem
)
{
if
(
p
TStat
)
{
return
atomic_load_8
(
&
p
StatItem
->
state
);
return
atomic_load_8
(
&
p
TStat
->
state
);
}
}
return
TSDB_SMA_STAT_UNKNOWN
;
return
TSDB_SMA_STAT_UNKNOWN
;
}
}
static
FORCE_INLINE
bool
tdSmaStatIsOK
(
S
SmaStatItem
*
pStatItem
,
int8_t
*
state
)
{
static
FORCE_INLINE
bool
tdSmaStatIsOK
(
S
TSmaStat
*
pTStat
,
int8_t
*
state
)
{
if
(
!
p
StatItem
)
{
if
(
!
p
TStat
)
{
return
false
;
return
false
;
}
}
if
(
state
)
{
if
(
state
)
{
*
state
=
atomic_load_8
(
&
p
StatItem
->
state
);
*
state
=
atomic_load_8
(
&
p
TStat
->
state
);
return
*
state
==
TSDB_SMA_STAT_OK
;
return
*
state
==
TSDB_SMA_STAT_OK
;
}
}
return
atomic_load_8
(
&
p
StatItem
->
state
)
==
TSDB_SMA_STAT_OK
;
return
atomic_load_8
(
&
p
TStat
->
state
)
==
TSDB_SMA_STAT_OK
;
}
}
static
FORCE_INLINE
bool
tdSmaStatIsExpired
(
S
SmaStatItem
*
pStatItem
)
{
static
FORCE_INLINE
bool
tdSmaStatIsExpired
(
S
TSmaStat
*
pTStat
)
{
return
p
StatItem
?
(
atomic_load_8
(
&
pStatItem
->
state
)
&
TSDB_SMA_STAT_EXPIRED
)
:
true
;
return
p
TStat
?
(
atomic_load_8
(
&
pTStat
->
state
)
&
TSDB_SMA_STAT_EXPIRED
)
:
true
;
}
}
static
FORCE_INLINE
bool
tdSmaStatIsDropped
(
S
SmaStatItem
*
pStatItem
)
{
static
FORCE_INLINE
bool
tdSmaStatIsDropped
(
S
TSmaStat
*
pTStat
)
{
return
p
StatItem
?
(
atomic_load_8
(
&
pStatItem
->
state
)
&
TSDB_SMA_STAT_DROPPED
)
:
true
;
return
p
TStat
?
(
atomic_load_8
(
&
pTStat
->
state
)
&
TSDB_SMA_STAT_DROPPED
)
:
true
;
}
}
static
FORCE_INLINE
void
tdSmaStatSetOK
(
S
SmaStatItem
*
pStatItem
)
{
static
FORCE_INLINE
void
tdSmaStatSetOK
(
S
TSmaStat
*
pTStat
)
{
if
(
p
StatItem
)
{
if
(
p
TStat
)
{
atomic_store_8
(
&
p
StatItem
->
state
,
TSDB_SMA_STAT_OK
);
atomic_store_8
(
&
p
TStat
->
state
,
TSDB_SMA_STAT_OK
);
}
}
}
}
static
FORCE_INLINE
void
tdSmaStatSetExpired
(
S
SmaStatItem
*
pStatItem
)
{
static
FORCE_INLINE
void
tdSmaStatSetExpired
(
S
TSmaStat
*
pTStat
)
{
if
(
p
StatItem
)
{
if
(
p
TStat
)
{
atomic_or_fetch_8
(
&
p
StatItem
->
state
,
TSDB_SMA_STAT_EXPIRED
);
atomic_or_fetch_8
(
&
p
TStat
->
state
,
TSDB_SMA_STAT_EXPIRED
);
}
}
}
}
static
FORCE_INLINE
void
tdSmaStatSetDropped
(
S
SmaStatItem
*
pStatItem
)
{
static
FORCE_INLINE
void
tdSmaStatSetDropped
(
S
TSmaStat
*
pTStat
)
{
if
(
p
StatItem
)
{
if
(
p
TStat
)
{
atomic_or_fetch_8
(
&
p
StatItem
->
state
,
TSDB_SMA_STAT_DROPPED
);
atomic_or_fetch_8
(
&
p
TStat
->
state
,
TSDB_SMA_STAT_DROPPED
);
}
}
}
}
static
int32_t
tdInitSmaStat
(
SSmaStat
**
pSmaStat
,
int8_t
smaType
);
void
*
tdFreeSmaStatItem
(
SSmaStatItem
*
pSmaStatItem
);
static
int32_t
tdDestroySmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
);
static
int32_t
tdDestroySmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
);
void
*
tdFreeSmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
);
void
*
tdFreeSmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
);
...
@@ -163,6 +174,51 @@ int32_t tdProcessTSmaCreateImpl(SSma *pSma, int64_t version, const char *pMsg);
...
@@ -163,6 +174,51 @@ int32_t tdProcessTSmaCreateImpl(SSma *pSma, int64_t version, const char *pMsg);
int32_t
tdProcessTSmaInsertImpl
(
SSma
*
pSma
,
int64_t
indexUid
,
const
char
*
msg
);
int32_t
tdProcessTSmaInsertImpl
(
SSma
*
pSma
,
int64_t
indexUid
,
const
char
*
msg
);
int32_t
tdProcessTSmaGetDaysImpl
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
int32_t
tdProcessTSmaGetDaysImpl
(
SVnodeCfg
*
pCfg
,
void
*
pCont
,
uint32_t
contLen
,
int32_t
*
days
);
typedef
struct
STFInfo
STFInfo
;
typedef
struct
STFile
STFile
;
struct
STFInfo
{
uint32_t
magic
;
uint32_t
ftype
;
uint32_t
fver
;
uint64_t
fsize
;
};
struct
STFile
{
STFInfo
info
;
STfsFile
f
;
TdFilePtr
pFile
;
uint8_t
state
;
};
#define TD_FILE_F(tf) (&((tf)->f))
#define TD_FILE_PFILE(tf) ((tf)->pFile)
#define TD_FILE_OPENED(tf) (TD_FILE_PFILE(tf) != NULL)
#define TD_FILE_FULL_NAME(tf) (TD_FILE_F(tf)->aname)
#define TD_FILE_REL_NAME(tf) (TD_FILE_F(tf)->rname)
#define TD_FILE_OPENED(tf) (TD_FILE_PFILE(tf) != NULL)
#define TD_FILE_CLOSED(tf) (!TD_FILE_OPENED(tf))
#define TD_FILE_SET_CLOSED(f) (TD_FILE_PFILE(f) = NULL)
#define TD_FILE_STATE(tf) ((tf)->state)
#define TD_FILE_SET_STATE(tf, s) ((tf)->state = (s))
#define TD_FILE_DID(tf) (TD_FILE_F(tf)->did)
#define TD_FILE_IS_OK(tf) (TD_FILE_STATE(tf) == TD_FILE_STATE_OK)
#define TD_FILE_IS_BAD(tf) (TD_FILE_STATE(tf) == TD_FILE_STATE_BAD)
int32_t
tdInitTFile
(
STFile
*
pTFile
,
STfs
*
pTfs
,
const
char
*
fname
);
int32_t
tdCreateTFile
(
STFile
*
pTFile
,
STfs
*
pTfs
,
bool
updateHeader
,
int8_t
fType
);
int32_t
tdOpenTFile
(
STFile
*
pTFile
,
int
flags
);
int64_t
tdReadTFile
(
STFile
*
pTFile
,
void
*
buf
,
int64_t
nbyte
);
int64_t
tdSeekTFile
(
STFile
*
pTFile
,
int64_t
offset
,
int
whence
);
int64_t
tdWriteTFile
(
STFile
*
pTFile
,
void
*
buf
,
int64_t
nbyte
);
int64_t
tdAppendTFile
(
STFile
*
pTFile
,
void
*
buf
,
int64_t
nbyte
,
int64_t
*
offset
);
int32_t
tdRemoveTFile
(
STFile
*
pTFile
);
int32_t
tdLoadTFileHeader
(
STFile
*
pTFile
,
STFInfo
*
pInfo
);
int32_t
tdUpdateTFileHeader
(
STFile
*
pTFile
);
void
tdUpdateTFileMagic
(
STFile
*
pTFile
,
void
*
pCksm
);
void
tdCloseTFile
(
STFile
*
pTFile
);
void
tdGetVndFileName
(
int32_t
vid
,
const
char
*
dname
,
const
char
*
fname
,
char
*
outputName
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
source/dnode/vnode/src/inc/tq.h
浏览文件 @
ee821197
...
@@ -150,6 +150,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead*
...
@@ -150,6 +150,7 @@ int64_t tqFetchLog(STQ* pTq, STqHandle* pHandle, int64_t* fetchOffset, SWalHead*
// tqExec
// tqExec
int32_t
tqDataExec
(
STQ
*
pTq
,
STqExecHandle
*
pExec
,
SSubmitReq
*
pReq
,
SMqDataBlkRsp
*
pRsp
,
int32_t
workerId
);
int32_t
tqDataExec
(
STQ
*
pTq
,
STqExecHandle
*
pExec
,
SSubmitReq
*
pReq
,
SMqDataBlkRsp
*
pRsp
,
int32_t
workerId
);
int32_t
tqScanSnapshot
(
STQ
*
pTq
,
const
STqExecHandle
*
pExec
,
SMqDataBlkRsp
*
pRsp
,
int32_t
workerId
);
int32_t
tqSendPollRsp
(
STQ
*
pTq
,
const
SRpcMsg
*
pMsg
,
const
SMqPollReq
*
pReq
,
const
SMqDataBlkRsp
*
pRsp
);
int32_t
tqSendPollRsp
(
STQ
*
pTq
,
const
SRpcMsg
*
pMsg
,
const
SMqPollReq
*
pReq
,
const
SMqDataBlkRsp
*
pRsp
);
// tqMeta
// tqMeta
...
...
source/dnode/vnode/src/inc/vnodeInt.h
浏览文件 @
ee821197
...
@@ -247,7 +247,6 @@ struct SVnode {
...
@@ -247,7 +247,6 @@ struct SVnode {
struct
STbUidStore
{
struct
STbUidStore
{
tb_uid_t
suid
;
tb_uid_t
suid
;
tb_uid_t
uid
;
// TODO: just for debugging, remove when uid provided in SSDataBlock
SArray
*
tbUids
;
SArray
*
tbUids
;
SHashObj
*
uidHash
;
SHashObj
*
uidHash
;
};
};
...
...
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
ee821197
...
@@ -219,11 +219,9 @@ _err:
...
@@ -219,11 +219,9 @@ _err:
}
}
int
metaTtlSmaller
(
SMeta
*
pMeta
,
uint64_t
ttl
,
SArray
*
uidList
){
int
metaTtlSmaller
(
SMeta
*
pMeta
,
uint64_t
ttl
,
SArray
*
uidList
){
metaRLock
(
pMeta
);
TBC
*
pCur
;
TBC
*
pCur
;
int
ret
=
tdbTbcOpen
(
pMeta
->
pTtlIdx
,
&
pCur
,
NULL
);
int
ret
=
tdbTbcOpen
(
pMeta
->
pTtlIdx
,
&
pCur
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
metaULock
(
pMeta
);
return
ret
;
return
ret
;
}
}
...
@@ -249,6 +247,7 @@ int metaTtlSmaller(SMeta *pMeta, uint64_t ttl, SArray *uidList){
...
@@ -249,6 +247,7 @@ int metaTtlSmaller(SMeta *pMeta, uint64_t ttl, SArray *uidList){
tdbTbcClose
(
pCur
);
tdbTbcClose
(
pCur
);
tdbFree
(
pKey
);
tdbFree
(
pKey
);
return
0
;
return
0
;
}
}
...
@@ -265,8 +264,8 @@ struct SMCtbCursor {
...
@@ -265,8 +264,8 @@ struct SMCtbCursor {
SMCtbCursor
*
metaOpenCtbCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
SMCtbCursor
*
metaOpenCtbCursor
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
SMCtbCursor
*
pCtbCur
=
NULL
;
SMCtbCursor
*
pCtbCur
=
NULL
;
SCtbIdxKey
ctbIdxKey
;
SCtbIdxKey
ctbIdxKey
;
int
ret
;
int
ret
=
0
;
int
c
;
int
c
=
0
;
pCtbCur
=
(
SMCtbCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pCtbCur
));
pCtbCur
=
(
SMCtbCursor
*
)
taosMemoryCalloc
(
1
,
sizeof
(
*
pCtbCur
));
if
(
pCtbCur
==
NULL
)
{
if
(
pCtbCur
==
NULL
)
{
...
...
source/dnode/vnode/src/meta/metaTable.c
浏览文件 @
ee821197
...
@@ -375,6 +375,7 @@ int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
...
@@ -375,6 +375,7 @@ int metaTtlDropTable(SMeta *pMeta, int64_t ttl, SArray *tbUids) {
metaWLock
(
pMeta
);
metaWLock
(
pMeta
);
int
ret
=
metaTtlSmaller
(
pMeta
,
ttl
,
tbUids
);
int
ret
=
metaTtlSmaller
(
pMeta
,
ttl
,
tbUids
);
if
(
ret
!=
0
){
if
(
ret
!=
0
){
metaULock
(
pMeta
);
return
ret
;
return
ret
;
}
}
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tbUids
);
++
i
)
{
for
(
int
i
=
0
;
i
<
taosArrayGetSize
(
tbUids
);
++
i
)
{
...
...
source/dnode/vnode/src/sma/smaEnv.c
浏览文件 @
ee821197
...
@@ -21,9 +21,10 @@ typedef struct SSmaStat SSmaStat;
...
@@ -21,9 +21,10 @@ typedef struct SSmaStat SSmaStat;
// declaration of static functions
// declaration of static functions
static
int32_t
tdInitSmaStat
(
SSmaStat
**
pSmaStat
,
int8_t
smaType
);
static
int32_t
tdInitSmaStat
(
SSmaStat
**
pSmaStat
,
int8_t
smaType
,
const
SSma
*
pSma
);
static
SSmaEnv
*
tdNewSmaEnv
(
const
SSma
*
pSma
,
int8_t
smaType
,
const
char
*
path
);
static
SSmaEnv
*
tdNewSmaEnv
(
const
SSma
*
pSma
,
int8_t
smaType
,
const
char
*
path
);
static
int32_t
tdInitSmaEnv
(
SSma
*
pSma
,
int8_t
smaType
,
const
char
*
path
,
SSmaEnv
**
pEnv
);
static
int32_t
tdInitSmaEnv
(
SSma
*
pSma
,
int8_t
smaType
,
const
char
*
path
,
SSmaEnv
**
pEnv
);
static
void
*
tdFreeTSmaStat
(
STSmaStat
*
pStat
);
// implementation
// implementation
...
@@ -45,7 +46,7 @@ static SSmaEnv *tdNewSmaEnv(const SSma *pSma, int8_t smaType, const char *path)
...
@@ -45,7 +46,7 @@ static SSmaEnv *tdNewSmaEnv(const SSma *pSma, int8_t smaType, const char *path)
return
NULL
;
return
NULL
;
}
}
if
(
tdInitSmaStat
(
&
SMA_ENV_STAT
(
pEnv
),
smaType
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
tdInitSmaStat
(
&
SMA_ENV_STAT
(
pEnv
),
smaType
,
pSma
)
!=
TSDB_CODE_SUCCESS
)
{
tdFreeSmaEnv
(
pEnv
);
tdFreeSmaEnv
(
pEnv
);
return
NULL
;
return
NULL
;
}
}
...
@@ -105,7 +106,7 @@ int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
...
@@ -105,7 +106,7 @@ int32_t tdUnRefSmaStat(SSma *pSma, SSmaStat *pStat) {
return
0
;
return
0
;
}
}
static
int32_t
tdInitSmaStat
(
SSmaStat
**
pSmaStat
,
int8_t
smaType
)
{
static
int32_t
tdInitSmaStat
(
SSmaStat
**
pSmaStat
,
int8_t
smaType
,
const
SSma
*
pSma
)
{
ASSERT
(
pSmaStat
!=
NULL
);
ASSERT
(
pSmaStat
!=
NULL
);
if
(
*
pSmaStat
)
{
// no lock
if
(
*
pSmaStat
)
{
// no lock
...
@@ -125,10 +126,23 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType) {
...
@@ -125,10 +126,23 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType) {
}
}
if
(
smaType
==
TSDB_SMA_TYPE_ROLLUP
)
{
if
(
smaType
==
TSDB_SMA_TYPE_ROLLUP
)
{
SMA_STAT_INFO_HASH
(
*
pSmaStat
)
=
taosHashInit
(
SMA_RSMA_STAT
(
*
pSmaStat
)
->
pSma
=
(
SSma
*
)
pSma
;
RSMA_TASK_INFO_HASH_SLOT
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_ENTRY_LOCK
);
// init timer
SMA_RSMA_TMR_HANDLE
(
*
pSmaStat
)
=
taosTmrInit
(
10000
,
100
,
10000
,
"RSMA_G"
);
if
(
!
SMA_RSMA_TMR_HANDLE
(
*
pSmaStat
))
{
taosMemoryFreeClear
(
*
pSmaStat
);
return
TSDB_CODE_FAILED
;
}
if
(
!
SMA_STAT_INFO_HASH
(
*
pSmaStat
))
{
atomic_store_8
(
&
SMA_RSMA_TMR_STAT
(
*
pSmaStat
),
TASK_TRIGGER_STATUS__ACTIVE
);
// init hash
SMA_RSMA_INFO_HASH
(
*
pSmaStat
)
=
taosHashInit
(
RSMA_TASK_INFO_HASH_SLOT
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BIGINT
),
true
,
HASH_ENTRY_LOCK
);
if
(
!
SMA_RSMA_INFO_HASH
(
*
pSmaStat
))
{
if
(
SMA_RSMA_TMR_HANDLE
(
*
pSmaStat
))
{
taosTmrCleanUp
(
SMA_RSMA_TMR_HANDLE
(
*
pSmaStat
));
}
taosMemoryFreeClear
(
*
pSmaStat
);
taosMemoryFreeClear
(
*
pSmaStat
);
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -141,16 +155,16 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType) {
...
@@ -141,16 +155,16 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
void
*
tdFreeSmaStatItem
(
SSmaStatItem
*
pSmaStatItem
)
{
static
void
*
tdFreeTSmaStat
(
STSmaStat
*
pStat
)
{
if
(
pS
maStatItem
)
{
if
(
pS
tat
)
{
tDestroyTSma
(
pS
maStatItem
->
pTSma
);
tDestroyTSma
(
pS
tat
->
pTSma
);
taosMemoryFreeClear
(
pS
maStatItem
->
pTSma
);
taosMemoryFreeClear
(
pS
tat
->
pTSma
);
taosMemoryFreeClear
(
pS
maStatItem
);
taosMemoryFreeClear
(
pS
tat
);
}
}
return
NULL
;
return
NULL
;
}
}
void
*
tdFreeSmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
)
{
void
*
tdFreeSmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
)
{
tdDestroySmaState
(
pSmaStat
,
smaType
);
tdDestroySmaState
(
pSmaStat
,
smaType
);
taosMemoryFreeClear
(
pSmaStat
);
taosMemoryFreeClear
(
pSmaStat
);
return
NULL
;
return
NULL
;
...
@@ -165,16 +179,19 @@ void* tdFreeSmaState(SSmaStat *pSmaStat, int8_t smaType) {
...
@@ -165,16 +179,19 @@ void* tdFreeSmaState(SSmaStat *pSmaStat, int8_t smaType) {
int32_t
tdDestroySmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
)
{
int32_t
tdDestroySmaState
(
SSmaStat
*
pSmaStat
,
int8_t
smaType
)
{
if
(
pSmaStat
)
{
if
(
pSmaStat
)
{
if
(
smaType
==
TSDB_SMA_TYPE_TIME_RANGE
)
{
if
(
smaType
==
TSDB_SMA_TYPE_TIME_RANGE
)
{
tdFree
SmaStatItem
(
&
pSmaStat
->
tsmaStatItem
);
tdFree
TSmaStat
(
&
pSmaStat
->
tsmaStat
);
}
else
if
(
smaType
==
TSDB_SMA_TYPE_ROLLUP
)
{
}
else
if
(
smaType
==
TSDB_SMA_TYPE_ROLLUP
)
{
if
(
SMA_RSMA_TMR_HANDLE
(
pSmaStat
))
{
taosTmrCleanUp
(
SMA_RSMA_TMR_HANDLE
(
pSmaStat
));
}
// TODO: use taosHashSetFreeFp when taosHashSetFreeFp is ready.
// TODO: use taosHashSetFreeFp when taosHashSetFreeFp is ready.
void
*
infoHash
=
taosHashIterate
(
SMA_
STAT
_INFO_HASH
(
pSmaStat
),
NULL
);
void
*
infoHash
=
taosHashIterate
(
SMA_
RSMA
_INFO_HASH
(
pSmaStat
),
NULL
);
while
(
infoHash
)
{
while
(
infoHash
)
{
SRSmaInfo
*
pInfoHash
=
*
(
SRSmaInfo
**
)
infoHash
;
SRSmaInfo
*
pInfoHash
=
*
(
SRSmaInfo
**
)
infoHash
;
tdFreeRSmaInfo
(
pInfoHash
);
tdFreeRSmaInfo
(
pInfoHash
);
infoHash
=
taosHashIterate
(
SMA_
STAT
_INFO_HASH
(
pSmaStat
),
infoHash
);
infoHash
=
taosHashIterate
(
SMA_
RSMA
_INFO_HASH
(
pSmaStat
),
infoHash
);
}
}
taosHashCleanup
(
SMA_
STAT
_INFO_HASH
(
pSmaStat
));
taosHashCleanup
(
SMA_
RSMA
_INFO_HASH
(
pSmaStat
));
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
...
source/dnode/vnode/src/sma/smaOpen.c
浏览文件 @
ee821197
...
@@ -138,3 +138,16 @@ int32_t smaClose(SSma *pSma) {
...
@@ -138,3 +138,16 @@ int32_t smaClose(SSma *pSma) {
}
}
return
0
;
return
0
;
}
}
/**
* @brief rsma env restore
*
* @param pSma
* @return int32_t
*/
int32_t
smaRestore
(
SSma
*
pSma
)
{
if
(
!
pSma
)
return
0
;
// iterate all stables to restore the rsma env
return
TSDB_CODE_SUCCESS
;
}
\ No newline at end of file
source/dnode/vnode/src/sma/smaRollup.c
浏览文件 @
ee821197
...
@@ -16,35 +16,17 @@
...
@@ -16,35 +16,17 @@
#include "sma.h"
#include "sma.h"
#include "tstream.h"
#include "tstream.h"
static
FORCE_INLINE
int32_t
tdUidStorePut
(
STbUidStore
*
pStore
,
tb_uid_t
suid
,
tb_uid_t
*
uid
);
typedef
enum
{
TD_QTASK_TMP_FILE
=
0
,
TD_QTASK_CUR_FILE
}
TD_QTASK_FILE_T
;
static
FORCE_INLINE
int32_t
tdUpdateTbUidListImpl
(
SSma
*
pSma
,
tb_uid_t
*
suid
,
SArray
*
tbUids
);
static
const
char
*
tdQTaskInfoFname
[]
=
{
"qtaskinfo.t"
,
"qtaskinfo"
};
static
FORCE_INLINE
int32_t
tdExecuteRSmaImpl
(
SSma
*
pSma
,
const
void
*
pMsg
,
int32_t
inputType
,
SRSmaInfoItem
*
rsmaItem
,
static
int32_t
tdUidStorePut
(
STbUidStore
*
pStore
,
tb_uid_t
suid
,
tb_uid_t
*
uid
);
static
int32_t
tdUpdateTbUidListImpl
(
SSma
*
pSma
,
tb_uid_t
*
suid
,
SArray
*
tbUids
);
static
int32_t
tdSetRSmaInfoItemParams
(
SSma
*
pSma
,
SRSmaParam
*
param
,
SRSmaInfo
*
pRSmaInfo
,
SReadHandle
*
handle
,
int8_t
idx
);
static
int32_t
tdExecuteRSmaImpl
(
SSma
*
pSma
,
const
void
*
pMsg
,
int32_t
inputType
,
SRSmaInfoItem
*
rsmaItem
,
tb_uid_t
suid
,
int8_t
level
);
tb_uid_t
suid
,
int8_t
level
);
static
void
tdRSmaFetchTrigger
(
void
*
param
,
void
*
tmrId
);
#define SET_RSMA_INFO_ITEM_PARAMS(__idx, __level) \
static
void
tdRSmaPersistTrigger
(
void
*
param
,
void
*
tmrId
);
if (param->qmsg[__idx]) { \
pRSmaInfo->items[__idx].pRsmaInfo = pRSmaInfo; \
pRSmaInfo->items[__idx].taskInfo = qCreateStreamExecTaskInfo(param->qmsg[0], &handle); \
if (!pRSmaInfo->items[__idx].taskInfo) { \
goto _err; \
} \
pRSmaInfo->items[__idx].triggerStatus = TASK_TRIGGER_STATUS__IN_ACTIVE; \
if (param->maxdelay[__idx] < 1) { \
int64_t msInterval = \
convertTimeFromPrecisionToUnit(pRetention[__level].freq, pTsdbCfg->precision, TIME_UNIT_MILLISECOND); \
pRSmaInfo->items[__idx].maxDelay = msInterval; \
} else { \
pRSmaInfo->items[__idx].maxDelay = param->maxdelay[__idx]; \
} \
if (pRSmaInfo->items[__idx].maxDelay > TSDB_MAX_ROLLUP_MAX_DELAY) { \
pRSmaInfo->items[__idx].maxDelay = TSDB_MAX_ROLLUP_MAX_DELAY; \
} \
pRSmaInfo->items[__idx].level = TSDB_RETENTION_L##__level; \
pRSmaInfo->items[__idx].tmrHandle = taosTmrInit(10000, 100, 10000, "RSMA"); \
if (!pRSmaInfo->items[__idx].tmrHandle) { \
goto _err; \
} \
}
struct
SRSmaInfoItem
{
struct
SRSmaInfoItem
{
SRSmaInfo
*
pRsmaInfo
;
SRSmaInfo
*
pRsmaInfo
;
...
@@ -56,14 +38,6 @@ struct SRSmaInfoItem {
...
@@ -56,14 +38,6 @@ struct SRSmaInfoItem {
int8_t
triggerStatus
;
// TASK_TRIGGER_STATUS__IN_ACTIVE/TASK_TRIGGER_STATUS__ACTIVE
int8_t
triggerStatus
;
// TASK_TRIGGER_STATUS__IN_ACTIVE/TASK_TRIGGER_STATUS__ACTIVE
int32_t
maxDelay
;
int32_t
maxDelay
;
};
};
typedef
struct
{
int64_t
suid
;
SRSmaInfoItem
*
pItem
;
SSma
*
pSma
;
STSchema
*
pTSchema
;
}
SRSmaTriggerParam
;
struct
SRSmaInfo
{
struct
SRSmaInfo
{
STSchema
*
pTSchema
;
STSchema
*
pTSchema
;
SSma
*
pSma
;
SSma
*
pSma
;
...
@@ -81,7 +55,7 @@ static FORCE_INLINE void tdFreeTaskHandle(qTaskInfo_t *taskHandle) {
...
@@ -81,7 +55,7 @@ static FORCE_INLINE void tdFreeTaskHandle(qTaskInfo_t *taskHandle) {
void
*
tdFreeRSmaInfo
(
SRSmaInfo
*
pInfo
)
{
void
*
tdFreeRSmaInfo
(
SRSmaInfo
*
pInfo
)
{
if
(
pInfo
)
{
if
(
pInfo
)
{
for
(
int32_t
i
=
0
;
i
<
TSDB_RETENTION_
MAX
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
TSDB_RETENTION_
L2
;
++
i
)
{
SRSmaInfoItem
*
pItem
=
&
pInfo
->
items
[
i
];
SRSmaInfoItem
*
pItem
=
&
pInfo
->
items
[
i
];
if
(
pItem
->
taskInfo
)
{
if
(
pItem
->
taskInfo
)
{
tdFreeTaskHandle
(
pItem
->
taskInfo
);
tdFreeTaskHandle
(
pItem
->
taskInfo
);
...
@@ -118,7 +92,7 @@ static FORCE_INLINE int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SA
...
@@ -118,7 +92,7 @@ static FORCE_INLINE int32_t tdUpdateTbUidListImpl(SSma *pSma, tb_uid_t *suid, SA
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
pRSmaInfo
=
taosHashGet
(
SMA_
STAT
_INFO_HASH
(
pStat
),
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_
RSMA
_INFO_HASH
(
pStat
),
suid
,
sizeof
(
tb_uid_t
));
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
smaError
(
"vgId:%d, failed to get rsma info for uid:%"
PRIi64
,
SMA_VID
(
pSma
),
*
suid
);
smaError
(
"vgId:%d, failed to get rsma info for uid:%"
PRIi64
,
SMA_VID
(
pSma
),
*
suid
);
terrno
=
TSDB_CODE_RSMA_INVALID_STAT
;
terrno
=
TSDB_CODE_RSMA_INVALID_STAT
;
...
@@ -187,7 +161,7 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui
...
@@ -187,7 +161,7 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui
SSmaStat
*
pStat
=
SMA_ENV_STAT
(
pEnv
);
SSmaStat
*
pStat
=
SMA_ENV_STAT
(
pEnv
);
SHashObj
*
infoHash
=
NULL
;
SHashObj
*
infoHash
=
NULL
;
if
(
!
pStat
||
!
(
infoHash
=
SMA_
STAT
_INFO_HASH
(
pStat
)))
{
if
(
!
pStat
||
!
(
infoHash
=
SMA_
RSMA
_INFO_HASH
(
pStat
)))
{
terrno
=
TSDB_CODE_RSMA_INVALID_STAT
;
terrno
=
TSDB_CODE_RSMA_INVALID_STAT
;
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
...
@@ -213,6 +187,40 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui
...
@@ -213,6 +187,40 @@ int32_t tdFetchTbUidList(SSma *pSma, STbUidStore **ppStore, tb_uid_t suid, tb_ui
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
static
int32_t
tdSetRSmaInfoItemParams
(
SSma
*
pSma
,
SRSmaParam
*
param
,
SRSmaInfo
*
pRSmaInfo
,
SReadHandle
*
pReadHandle
,
int8_t
idx
)
{
SRetention
*
pRetention
=
SMA_RETENTION
(
pSma
);
STsdbCfg
*
pTsdbCfg
=
SMA_TSDB_CFG
(
pSma
);
if
(
param
->
qmsg
[
idx
])
{
SRSmaInfoItem
*
pItem
=
&
(
pRSmaInfo
->
items
[
idx
]);
pItem
->
pRsmaInfo
=
pRSmaInfo
;
pItem
->
taskInfo
=
qCreateStreamExecTaskInfo
(
param
->
qmsg
[
0
],
pReadHandle
);
if
(
!
pItem
->
taskInfo
)
{
goto
_err
;
}
pItem
->
triggerStatus
=
TASK_TRIGGER_STATUS__IN_ACTIVE
;
if
(
param
->
maxdelay
[
idx
]
<
TSDB_MIN_ROLLUP_MAX_DELAY
)
{
int64_t
msInterval
=
convertTimeFromPrecisionToUnit
(
pRetention
[
idx
+
1
].
freq
,
pTsdbCfg
->
precision
,
TIME_UNIT_MILLISECOND
);
pItem
->
maxDelay
=
(
int32_t
)
msInterval
;
}
else
{
pItem
->
maxDelay
=
(
int32_t
)
param
->
maxdelay
[
idx
];
}
if
(
pItem
->
maxDelay
>
TSDB_MAX_ROLLUP_MAX_DELAY
)
{
pItem
->
maxDelay
=
TSDB_MAX_ROLLUP_MAX_DELAY
;
}
pItem
->
level
=
(
idx
==
0
?
TSDB_RETENTION_L1
:
TSDB_RETENTION_L2
);
pItem
->
tmrHandle
=
taosTmrInit
(
10000
,
100
,
10000
,
"RSMA"
);
if
(
!
pItem
->
tmrHandle
)
{
goto
_err
;
}
}
return
TSDB_CODE_SUCCESS
;
_err:
return
TSDB_CODE_FAILED
;
}
/**
/**
* @brief Check and init qTaskInfo_t, only applicable to stable with SRSmaParam.
* @brief Check and init qTaskInfo_t, only applicable to stable with SRSmaParam.
*
*
...
@@ -246,7 +254,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
...
@@ -246,7 +254,7 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
SSmaStat
*
pStat
=
SMA_ENV_STAT
(
pEnv
);
SSmaStat
*
pStat
=
SMA_ENV_STAT
(
pEnv
);
SRSmaInfo
*
pRSmaInfo
=
NULL
;
SRSmaInfo
*
pRSmaInfo
=
NULL
;
pRSmaInfo
=
taosHashGet
(
SMA_
STAT
_INFO_HASH
(
pStat
),
&
pReq
->
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_
RSMA
_INFO_HASH
(
pStat
),
&
pReq
->
suid
,
sizeof
(
tb_uid_t
));
if
(
pRSmaInfo
)
{
if
(
pRSmaInfo
)
{
ASSERT
(
0
);
// TODO: free original pRSmaInfo is exists abnormally
ASSERT
(
0
);
// TODO: free original pRSmaInfo is exists abnormally
smaWarn
(
"vgId:%d, rsma info already exists for stb: %s, %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
smaWarn
(
"vgId:%d, rsma info already exists for stb: %s, %"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
name
,
pReq
->
suid
);
...
@@ -282,14 +290,14 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
...
@@ -282,14 +290,14 @@ int32_t tdProcessRSmaCreate(SVnode *pVnode, SVCreateStbReq *pReq) {
pRSmaInfo
->
pSma
=
pSma
;
pRSmaInfo
->
pSma
=
pSma
;
pRSmaInfo
->
suid
=
pReq
->
suid
;
pRSmaInfo
->
suid
=
pReq
->
suid
;
SRetention
*
pRetention
=
SMA_RETENTION
(
pSma
);
if
(
tdSetRSmaInfoItemParams
(
pSma
,
param
,
pRSmaInfo
,
&
handle
,
0
)
<
0
)
{
STsdbCfg
*
pTsdbCfg
=
SMA_TSDB_CFG
(
pSma
);
goto
_err
;
}
SET_RSMA_INFO_ITEM_PARAMS
(
0
,
1
);
if
(
tdSetRSmaInfoItemParams
(
pSma
,
param
,
pRSmaInfo
,
&
handle
,
1
)
<
0
)
{
SET_RSMA_INFO_ITEM_PARAMS
(
1
,
2
);
goto
_err
;
}
if
(
taosHashPut
(
SMA_STAT_INFO_HASH
(
pStat
),
&
pReq
->
suid
,
sizeof
(
tb_uid_t
),
&
pRSmaInfo
,
sizeof
(
pRSmaInfo
))
!=
if
(
taosHashPut
(
SMA_RSMA_INFO_HASH
(
pStat
),
&
pReq
->
suid
,
sizeof
(
tb_uid_t
),
&
pRSmaInfo
,
sizeof
(
pRSmaInfo
))
<
0
)
{
TSDB_CODE_SUCCESS
)
{
goto
_err
;
goto
_err
;
}
else
{
}
else
{
smaDebug
(
"vgId:%d, register rsma info succeed for suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
suid
);
smaDebug
(
"vgId:%d, register rsma info succeed for suid:%"
PRIi64
,
SMA_VID
(
pSma
),
pReq
->
suid
);
...
@@ -418,7 +426,6 @@ static int32_t tdFetchSubmitReqSuids(SSubmitReq *pMsg, STbUidStore *pStore) {
...
@@ -418,7 +426,6 @@ static int32_t tdFetchSubmitReqSuids(SSubmitReq *pMsg, STbUidStore *pStore) {
if
(
!
pBlock
)
break
;
if
(
!
pBlock
)
break
;
tdUidStorePut
(
pStore
,
msgIter
.
suid
,
NULL
);
tdUidStorePut
(
pStore
,
msgIter
.
suid
,
NULL
);
pStore
->
uid
=
msgIter
.
uid
;
// TODO: remove, just for debugging
}
}
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
return
-
1
;
if
(
terrno
!=
TSDB_CODE_SUCCESS
)
return
-
1
;
...
@@ -439,8 +446,9 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
...
@@ -439,8 +446,9 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
if
(
!
output
)
{
if
(
!
output
)
{
break
;
break
;
}
}
if
(
!
pResult
)
{
if
(
!
pResult
)
{
pResult
=
taosArrayInit
(
0
,
sizeof
(
SSDataBlock
));
pResult
=
taosArrayInit
(
1
,
sizeof
(
SSDataBlock
));
if
(
!
pResult
)
{
if
(
!
pResult
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
...
@@ -451,7 +459,7 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
...
@@ -451,7 +459,7 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
}
}
if
(
taosArrayGetSize
(
pResult
)
>
0
)
{
if
(
taosArrayGetSize
(
pResult
)
>
0
)
{
#if
0
#if
1
char
flag
[
10
]
=
{
0
};
char
flag
[
10
]
=
{
0
};
snprintf
(
flag
,
10
,
"level %"
PRIi8
,
pItem
->
level
);
snprintf
(
flag
,
10
,
"level %"
PRIi8
,
pItem
->
level
);
blockDebugShowData
(
pResult
,
flag
);
blockDebugShowData
(
pResult
,
flag
);
...
@@ -459,14 +467,12 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
...
@@ -459,14 +467,12 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
STsdb
*
sinkTsdb
=
(
pItem
->
level
==
TSDB_RETENTION_L1
?
pSma
->
pRSmaTsdb1
:
pSma
->
pRSmaTsdb2
);
STsdb
*
sinkTsdb
=
(
pItem
->
level
==
TSDB_RETENTION_L1
?
pSma
->
pRSmaTsdb1
:
pSma
->
pRSmaTsdb2
);
SSubmitReq
*
pReq
=
NULL
;
SSubmitReq
*
pReq
=
NULL
;
if
(
buildSubmitReqFromDataBlock
(
&
pReq
,
pResult
,
pRSmaInfo
->
pTSchema
,
SMA_VID
(
pSma
),
pRSmaInfo
->
suid
)
<
0
)
{
if
(
buildSubmitReqFromDataBlock
(
&
pReq
,
pResult
,
pRSmaInfo
->
pTSchema
,
SMA_VID
(
pSma
),
pRSmaInfo
->
suid
)
<
0
)
{
taosArrayDestroy
(
pResult
);
goto
_err
;
return
TSDB_CODE_FAILED
;
}
}
if
(
pReq
&&
tdProcessSubmitReq
(
sinkTsdb
,
INT64_MAX
,
pReq
)
<
0
)
{
if
(
pReq
&&
tdProcessSubmitReq
(
sinkTsdb
,
INT64_MAX
,
pReq
)
<
0
)
{
taosArrayDestroy
(
pResult
);
taosMemoryFreeClear
(
pReq
);
taosMemoryFreeClear
(
pReq
);
return
TSDB_CODE_FAILED
;
goto
_err
;
}
}
taosMemoryFreeClear
(
pReq
);
taosMemoryFreeClear
(
pReq
);
...
@@ -479,7 +485,10 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
...
@@ -479,7 +485,10 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
}
}
taosArrayDestroy
(
pResult
);
taosArrayDestroy
(
pResult
);
return
0
;
return
TSDB_CODE_SUCCESS
;
_err:
taosArrayDestroy
(
pResult
);
return
TSDB_CODE_FAILED
;
}
}
/**
/**
...
@@ -488,13 +497,12 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
...
@@ -488,13 +497,12 @@ static int32_t tdFetchAndSubmitRSmaResult(SRSmaInfoItem *pItem, int8_t blkType)
* @param param
* @param param
* @param tmrId
* @param tmrId
*/
*/
static
void
rsmaTriggerByTimer
(
void
*
param
,
void
*
tmrId
)
{
static
void
tdRSmaFetchTrigger
(
void
*
param
,
void
*
tmrId
)
{
// SRSmaTriggerParam *pParam = (SRSmaTriggerParam *)param;
// SRSmaInfoItem *pItem = pParam->pItem;
SRSmaInfoItem
*
pItem
=
param
;
SRSmaInfoItem
*
pItem
=
param
;
if
(
atomic_load_8
(
&
pItem
->
triggerStatus
)
==
TASK_TRIGGER_STATUS__ACTIVE
)
{
if
(
atomic_load_8
(
&
pItem
->
triggerStatus
)
==
TASK_TRIGGER_STATUS__ACTIVE
)
{
smaTrace
(
"level %"
PRIi8
" status is active for tb suid:%"
PRIi64
,
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
smaWarn
(
"%s:%d THREAD:%"
PRIi64
" level %"
PRIi8
" status is active for tb suid:%"
PRIi64
,
__func__
,
__LINE__
,
taosGetSelfPthreadId
(),
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
SSDataBlock
dataBlock
=
{.
info
.
type
=
STREAM_GET_ALL
};
SSDataBlock
dataBlock
=
{.
info
.
type
=
STREAM_GET_ALL
};
atomic_store_8
(
&
pItem
->
triggerStatus
,
TASK_TRIGGER_STATUS__IN_ACTIVE
);
atomic_store_8
(
&
pItem
->
triggerStatus
,
TASK_TRIGGER_STATUS__IN_ACTIVE
);
...
@@ -502,10 +510,11 @@ static void rsmaTriggerByTimer(void *param, void *tmrId) {
...
@@ -502,10 +510,11 @@ static void rsmaTriggerByTimer(void *param, void *tmrId) {
tdFetchAndSubmitRSmaResult
(
pItem
,
STREAM_DATA_TYPE_SSDATA_BLOCK
);
tdFetchAndSubmitRSmaResult
(
pItem
,
STREAM_DATA_TYPE_SSDATA_BLOCK
);
}
else
{
}
else
{
smaTrace
(
"level %"
PRIi8
" status is inactive for tb suid:%"
PRIi64
,
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
smaWarn
(
"%s:%d THREAD:%"
PRIi64
" level %"
PRIi8
" status is inactive for tb suid:%"
PRIi64
,
__func__
,
__LINE__
,
taosGetSelfPthreadId
(),
pItem
->
level
,
pItem
->
pRsmaInfo
->
suid
);
}
}
// taosTmrReset(
rsmaTriggerByTim
er, pItem->maxDelay, pItem, pItem->tmrHandle, &pItem->tmrId);
// taosTmrReset(
tdRSmaFetchTrigg
er, pItem->maxDelay, pItem, pItem->tmrHandle, &pItem->tmrId);
}
}
static
FORCE_INLINE
int32_t
tdExecuteRSmaImpl
(
SSma
*
pSma
,
const
void
*
pMsg
,
int32_t
inputType
,
SRSmaInfoItem
*
pItem
,
static
FORCE_INLINE
int32_t
tdExecuteRSmaImpl
(
SSma
*
pSma
,
const
void
*
pMsg
,
int32_t
inputType
,
SRSmaInfoItem
*
pItem
,
...
@@ -518,16 +527,20 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
...
@@ -518,16 +527,20 @@ static FORCE_INLINE int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int3
smaDebug
(
"vgId:%d, execute rsma %"
PRIi8
" task for qTaskInfo:%p suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
smaDebug
(
"vgId:%d, execute rsma %"
PRIi8
" task for qTaskInfo:%p suid:%"
PRIu64
,
SMA_VID
(
pSma
),
level
,
pItem
->
taskInfo
,
suid
);
pItem
->
taskInfo
,
suid
);
// inputType = STREAM_DATA_TYPE_SUBMIT_BLOCK(1)
if
(
qSetStreamInput
(
pItem
->
taskInfo
,
pMsg
,
inputType
,
true
)
<
0
)
{
// STREAM_DATA_TYPE_SUBMIT_BLOCK
if
(
qSetStreamInput
(
pItem
->
taskInfo
,
pMsg
,
inputType
,
true
)
<
0
)
{
smaError
(
"vgId:%d, rsma % "
PRIi8
" qSetStreamInput failed since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
smaError
(
"vgId:%d, rsma % "
PRIi8
" qSetStreamInput failed since %s"
,
SMA_VID
(
pSma
),
level
,
tstrerror
(
terrno
));
return
TSDB_CODE_FAILED
;
return
TSDB_CODE_FAILED
;
}
}
// SRSmaTriggerParam triggerParam = {.suid = suid, .pItem = pItem, .pSma = pSma, .pTSchema = pTSchema};
tdFetchAndSubmitRSmaResult
(
pItem
,
STREAM_DATA_TYPE_SUBMIT_BLOCK
);
tdFetchAndSubmitRSmaResult
(
pItem
,
STREAM_DATA_TYPE_SUBMIT_BLOCK
);
atomic_store_8
(
&
pItem
->
triggerStatus
,
TASK_TRIGGER_STATUS__ACTIVE
);
atomic_store_8
(
&
pItem
->
triggerStatus
,
TASK_TRIGGER_STATUS__ACTIVE
);
taosTmrReset
(
rsmaTriggerByTimer
,
pItem
->
maxDelay
,
pItem
,
pItem
->
tmrHandle
,
&
pItem
->
tmrId
);
smaWarn
(
"%s:%d THREAD:%"
PRIi64
" process rsma insert"
,
__func__
,
__LINE__
,
taosGetSelfPthreadId
());
SSmaEnv
*
pEnv
=
SMA_RSMA_ENV
(
pSma
);
SRSmaStat
*
pStat
=
SMA_RSMA_STAT
(
pEnv
->
pStat
);
taosTmrStart
(
tdRSmaPersistTrigger
,
5000
,
pStat
,
pStat
->
tmrHandle
);
taosTmrReset
(
tdRSmaFetchTrigger
,
pItem
->
maxDelay
,
pItem
,
pItem
->
tmrHandle
,
&
pItem
->
tmrId
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -542,7 +555,7 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
...
@@ -542,7 +555,7 @@ static int32_t tdExecuteRSma(SSma *pSma, const void *pMsg, int32_t inputType, tb
SSmaStat
*
pStat
=
SMA_ENV_STAT
(
pEnv
);
SSmaStat
*
pStat
=
SMA_ENV_STAT
(
pEnv
);
SRSmaInfo
*
pRSmaInfo
=
NULL
;
SRSmaInfo
*
pRSmaInfo
=
NULL
;
pRSmaInfo
=
taosHashGet
(
SMA_
STAT
_INFO_HASH
(
pStat
),
&
suid
,
sizeof
(
tb_uid_t
));
pRSmaInfo
=
taosHashGet
(
SMA_
RSMA
_INFO_HASH
(
pStat
),
&
suid
,
sizeof
(
tb_uid_t
));
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
if
(
!
pRSmaInfo
||
!
(
pRSmaInfo
=
*
(
SRSmaInfo
**
)
pRSmaInfo
))
{
smaDebug
(
"vgId:%d, return as no rsma info for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
smaDebug
(
"vgId:%d, return as no rsma info for suid:%"
PRIu64
,
SMA_VID
(
pSma
),
suid
);
...
@@ -594,3 +607,106 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, void *pMsg, int32_t inputType) {
...
@@ -594,3 +607,106 @@ int32_t tdProcessRSmaSubmit(SSma *pSma, void *pMsg, int32_t inputType) {
}
}
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
void
tdRSmaQTaskGetFName
(
int32_t
vid
,
int8_t
ftype
,
char
*
outputName
)
{
tdGetVndFileName
(
vid
,
"rsma"
,
tdQTaskInfoFname
[
ftype
],
outputName
);
}
static
void
*
tdRSmaPersistExec
(
void
*
param
)
{
setThreadName
(
"rsma-task-persist"
);
SRSmaStat
*
pRSmaStat
=
param
;
SSma
*
pSma
=
pRSmaStat
->
pSma
;
STfs
*
pTfs
=
pSma
->
pVnode
->
pTfs
;
int64_t
toffset
=
0
;
void
*
infoHash
=
taosHashIterate
(
RSMA_INFO_HASH
(
pRSmaStat
),
NULL
);
if
(
!
infoHash
)
{
goto
_end
;
}
STFile
tFile
=
{
0
};
int32_t
vid
=
2
;
char
qTaskInfoFName
[
TSDB_FILENAME_LEN
];
tdRSmaQTaskGetFName
(
vid
,
TD_QTASK_TMP_FILE
,
qTaskInfoFName
);
tdInitTFile
(
&
tFile
,
pTfs
,
qTaskInfoFName
);
tdCreateTFile
(
&
tFile
,
pTfs
,
true
,
-
1
);
while
(
infoHash
)
{
SRSmaInfo
*
pRSmaInfo
=
*
(
SRSmaInfo
**
)
infoHash
;
char
*
pOutput
=
NULL
;
int32_t
len
=
0
;
if
(
qSerializeTaskStatus
(
pRSmaInfo
->
items
[
0
].
taskInfo
,
&
pOutput
,
&
len
)
<
0
)
{
smaError
(
"serialize rsma task for table %"
PRIi64
" failed since %s"
,
pRSmaInfo
->
items
[
0
].
pRsmaInfo
->
suid
,
terrstr
(
terrno
));
}
else
{
smaWarn
(
"serialize rsma task for table %"
PRIi64
" success and len is %d"
,
pRSmaInfo
->
items
[
0
].
pRsmaInfo
->
suid
,
len
);
}
tdAppendTFile
(
&
tFile
,
&
len
,
sizeof
(
len
),
&
toffset
);
tdAppendTFile
(
&
tFile
,
pOutput
,
len
,
&
toffset
);
taosMemoryFree
(
pOutput
);
infoHash
=
taosHashIterate
(
RSMA_INFO_HASH
(
pRSmaStat
),
infoHash
);
}
_end:
if
(
tdUpdateTFileHeader
(
&
tFile
)
<
0
)
{
smaError
(
"vgId:%d, failed to update tfile %s header since %s"
,
vid
,
TD_FILE_FULL_NAME
(
&
tFile
),
tstrerror
(
terrno
));
tdCloseTFile
(
&
tFile
);
tdRemoveTFile
(
&
tFile
);
return
NULL
;
}
tdCloseTFile
(
&
tFile
);
char
newFName
[
TSDB_FILENAME_LEN
];
strncpy
(
newFName
,
TD_FILE_FULL_NAME
(
&
tFile
),
TSDB_FILENAME_LEN
);
char
*
pos
=
strstr
(
newFName
,
tdQTaskInfoFname
[
TD_QTASK_TMP_FILE
]);
strncpy
(
pos
,
tdQTaskInfoFname
[
TD_QTASK_CUR_FILE
],
TSDB_FILENAME_LEN
-
POINTER_DISTANCE
(
pos
,
newFName
));
taosRenameFile
(
TD_FILE_FULL_NAME
(
&
tFile
),
newFName
);
atomic_store_8
(
&
pRSmaStat
->
tmrStat
,
TASK_TRIGGER_STATUS__ACTIVE
);
return
NULL
;
_err:
atomic_store_8
(
&
pRSmaStat
->
tmrStat
,
TASK_TRIGGER_STATUS__ACTIVE
);
// remove the .tmp file
return
NULL
;
}
static
void
tdRSmaPersistTask
(
SRSmaStat
*
pRSmaStat
)
{
smaWarn
(
"%s:%d entry "
,
__func__
,
__LINE__
);
TdThread
threadId
;
TdThreadAttr
thAttr
;
taosThreadAttrInit
(
&
thAttr
);
taosThreadAttrSetDetachState
(
&
thAttr
,
PTHREAD_CREATE_DETACHED
);
if
(
taosThreadCreate
(
&
threadId
,
&
thAttr
,
tdRSmaPersistExec
,
pRSmaStat
)
!=
0
)
{
smaError
(
"failed to create thread to persist rsma qTaskInfo since %s"
,
strerror
(
errno
));
}
taosThreadAttrDestroy
(
&
thAttr
);
smaWarn
(
"%s:%d end "
,
__func__
,
__LINE__
);
}
/**
* @brief trigger to persist rsma qTaskInfo
*
* @param param
* @param tmrId
*/
static
void
tdRSmaPersistTrigger
(
void
*
param
,
void
*
tmrId
)
{
SRSmaStat
*
pRSmaStat
=
param
;
if
(
atomic_load_8
(
&
pRSmaStat
->
tmrStat
)
==
TASK_TRIGGER_STATUS__ACTIVE
)
{
smaWarn
(
"%s:%d THREAD:%"
PRIi64
" rsma persistence start since active"
,
__func__
,
__LINE__
,
taosGetSelfPthreadId
());
atomic_store_8
(
&
pRSmaStat
->
tmrStat
,
TASK_TRIGGER_STATUS__IN_ACTIVE
);
// execution
tdRSmaPersistTask
(
pRSmaStat
);
}
else
{
smaWarn
(
"%s:%d THREAD:%"
PRIi64
" rsma persistence not start since inactive"
,
__func__
,
__LINE__
,
taosGetSelfPthreadId
());
}
taosTmrReset
(
tdRSmaPersistTrigger
,
3600000
,
pRSmaStat
,
pRSmaStat
->
tmrHandle
,
&
pRSmaStat
->
tmrId
);
}
\ No newline at end of file
source/dnode/vnode/src/sma/smaTimeRange.c
浏览文件 @
ee821197
...
@@ -129,7 +129,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -129,7 +129,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
SSmaEnv
*
pEnv
=
SMA_TSMA_ENV
(
pSma
);
SSmaEnv
*
pEnv
=
SMA_TSMA_ENV
(
pSma
);
SSmaStat
*
pStat
=
NULL
;
SSmaStat
*
pStat
=
NULL
;
S
SmaStatItem
*
pItem
=
NULL
;
S
TSmaStat
*
pItem
=
NULL
;
if
(
!
pEnv
||
!
(
pStat
=
SMA_ENV_STAT
(
pEnv
)))
{
if
(
!
pEnv
||
!
(
pStat
=
SMA_ENV_STAT
(
pEnv
)))
{
terrno
=
TSDB_CODE_TSMA_INVALID_STAT
;
terrno
=
TSDB_CODE_TSMA_INVALID_STAT
;
...
@@ -137,7 +137,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
...
@@ -137,7 +137,7 @@ int32_t tdProcessTSmaInsertImpl(SSma *pSma, int64_t indexUid, const char *msg) {
}
}
tdRefSmaStat
(
pSma
,
pStat
);
tdRefSmaStat
(
pSma
,
pStat
);
pItem
=
&
pStat
->
tsmaStat
Item
;
pItem
=
&
pStat
->
tsmaStat
;
ASSERT
(
pItem
);
ASSERT
(
pItem
);
...
...
source/dnode/vnode/src/sma/smaUtil.c
0 → 100644
浏览文件 @
ee821197
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "sma.h"
#define TD_FILE_HEAD_SIZE 512
#define TD_FILE_STATE_OK 0
#define TD_FILE_STATE_BAD 1
#define TD_FILE_INIT_MAGIC 0xFFFFFFFF
static
int32_t
tdEncodeTFInfo
(
void
**
buf
,
STFInfo
*
pInfo
);
static
void
*
tdDecodeTFInfo
(
void
*
buf
,
STFInfo
*
pInfo
);
static
int32_t
tdEncodeTFInfo
(
void
**
buf
,
STFInfo
*
pInfo
)
{
int32_t
tlen
=
0
;
tlen
+=
taosEncodeFixedU32
(
buf
,
pInfo
->
magic
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pInfo
->
ftype
);
tlen
+=
taosEncodeFixedU32
(
buf
,
pInfo
->
fver
);
tlen
+=
taosEncodeFixedU64
(
buf
,
pInfo
->
fsize
);
return
tlen
;
}
static
void
*
tdDecodeTFInfo
(
void
*
buf
,
STFInfo
*
pInfo
)
{
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pInfo
->
magic
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pInfo
->
ftype
));
buf
=
taosDecodeFixedU32
(
buf
,
&
(
pInfo
->
fver
));
buf
=
taosDecodeFixedU64
(
buf
,
&
(
pInfo
->
fsize
));
return
buf
;
}
int64_t
tdWriteTFile
(
STFile
*
pTFile
,
void
*
buf
,
int64_t
nbyte
)
{
ASSERT
(
TD_FILE_OPENED
(
pTFile
));
int64_t
nwrite
=
taosWriteFile
(
pTFile
->
pFile
,
buf
,
nbyte
);
if
(
nwrite
<
nbyte
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
return
nwrite
;
}
int64_t
tdSeekTFile
(
STFile
*
pTFile
,
int64_t
offset
,
int
whence
)
{
ASSERT
(
TD_FILE_OPENED
(
pTFile
));
int64_t
loffset
=
taosLSeekFile
(
TD_FILE_PFILE
(
pTFile
),
offset
,
whence
);
if
(
loffset
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
return
loffset
;
}
int64_t
tdReadTFile
(
STFile
*
pTFile
,
void
*
buf
,
int64_t
nbyte
)
{
ASSERT
(
TD_FILE_OPENED
(
pTFile
));
int64_t
nread
=
taosReadFile
(
pTFile
->
pFile
,
buf
,
nbyte
);
if
(
nread
<
0
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
return
nread
;
}
int32_t
tdUpdateTFileHeader
(
STFile
*
pTFile
)
{
char
buf
[
TD_FILE_HEAD_SIZE
]
=
"
\0
"
;
if
(
tdSeekTFile
(
pTFile
,
0
,
SEEK_SET
)
<
0
)
{
return
-
1
;
}
void
*
ptr
=
buf
;
tdEncodeTFInfo
(
&
ptr
,
&
(
pTFile
->
info
));
taosCalcChecksumAppend
(
0
,
(
uint8_t
*
)
buf
,
TD_FILE_HEAD_SIZE
);
if
(
tdWriteTFile
(
pTFile
,
buf
,
TD_FILE_HEAD_SIZE
)
<
0
)
{
return
-
1
;
}
return
0
;
}
int32_t
tdLoadTFileHeader
(
STFile
*
pTFile
,
STFInfo
*
pInfo
)
{
char
buf
[
TD_FILE_HEAD_SIZE
]
=
"
\0
"
;
uint32_t
_version
;
ASSERT
(
TD_FILE_OPENED
(
pTFile
));
if
(
tdSeekTFile
(
pTFile
,
0
,
SEEK_SET
)
<
0
)
{
return
-
1
;
}
if
(
tdReadTFile
(
pTFile
,
buf
,
TD_FILE_HEAD_SIZE
)
<
0
)
{
return
-
1
;
}
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
buf
,
TD_FILE_HEAD_SIZE
))
{
terrno
=
TSDB_CODE_FILE_CORRUPTED
;
return
-
1
;
}
void
*
pBuf
=
buf
;
pBuf
=
tdDecodeTFInfo
(
pBuf
,
pInfo
);
return
0
;
}
void
tdUpdateTFileMagic
(
STFile
*
pTFile
,
void
*
pCksm
)
{
pTFile
->
info
.
magic
=
taosCalcChecksum
(
pTFile
->
info
.
magic
,
(
uint8_t
*
)(
pCksm
),
sizeof
(
TSCKSUM
));
}
int64_t
tdAppendTFile
(
STFile
*
pTFile
,
void
*
buf
,
int64_t
nbyte
,
int64_t
*
offset
)
{
ASSERT
(
TD_FILE_OPENED
(
pTFile
));
int64_t
toffset
;
if
((
toffset
=
tdSeekTFile
(
pTFile
,
0
,
SEEK_END
))
<
0
)
{
return
-
1
;
}
ASSERT
(
pTFile
->
info
.
fsize
==
toffset
);
if
(
offset
)
{
*
offset
=
toffset
;
}
if
(
tdWriteTFile
(
pTFile
,
buf
,
nbyte
)
<
0
)
{
return
-
1
;
}
pTFile
->
info
.
fsize
+=
nbyte
;
return
nbyte
;
}
int32_t
tdOpenTFile
(
STFile
*
pTFile
,
int
flags
)
{
ASSERT
(
!
TD_FILE_OPENED
(
pTFile
));
pTFile
->
pFile
=
taosOpenFile
(
TD_FILE_FULL_NAME
(
pTFile
),
flags
);
if
(
pTFile
->
pFile
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
return
0
;
}
void
tdCloseTFile
(
STFile
*
pTFile
)
{
if
(
TD_FILE_OPENED
(
pTFile
))
{
taosCloseFile
(
&
pTFile
->
pFile
);
TD_FILE_SET_CLOSED
(
pTFile
);
}
}
void
tdGetVndFileName
(
int32_t
vid
,
const
char
*
dname
,
const
char
*
fname
,
char
*
outputName
)
{
snprintf
(
outputName
,
TSDB_FILENAME_LEN
,
"vnode/vnode%d/%s/%s"
,
vid
,
dname
,
fname
);
}
int32_t
tdInitTFile
(
STFile
*
pTFile
,
STfs
*
pTfs
,
const
char
*
fname
)
{
char
fullname
[
TSDB_FILENAME_LEN
];
SDiskID
did
=
{
0
};
TD_FILE_SET_STATE
(
pTFile
,
TD_FILE_STATE_OK
);
TD_FILE_SET_CLOSED
(
pTFile
);
memset
(
&
(
pTFile
->
info
),
0
,
sizeof
(
pTFile
->
info
));
pTFile
->
info
.
magic
=
TD_FILE_INIT_MAGIC
;
if
(
tfsAllocDisk
(
pTfs
,
0
,
&
did
)
<
0
)
{
terrno
=
TSDB_CODE_NO_AVAIL_DISK
;
return
-
1
;
}
tfsInitFile
(
pTfs
,
&
(
pTFile
->
f
),
did
,
fname
);
return
0
;
}
int32_t
tdCreateTFile
(
STFile
*
pTFile
,
STfs
*
pTfs
,
bool
updateHeader
,
int8_t
fType
)
{
ASSERT
(
pTFile
->
info
.
fsize
==
0
&&
pTFile
->
info
.
magic
==
TD_FILE_INIT_MAGIC
);
pTFile
->
pFile
=
taosOpenFile
(
TD_FILE_FULL_NAME
(
pTFile
),
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_TRUNC
);
if
(
pTFile
->
pFile
==
NULL
)
{
if
(
errno
==
ENOENT
)
{
// Try to create directory recursively
char
*
s
=
strdup
(
TD_FILE_REL_NAME
(
pTFile
));
if
(
tfsMkdirRecurAt
(
pTfs
,
taosDirName
(
s
),
TD_FILE_DID
(
pTFile
))
<
0
)
{
taosMemoryFreeClear
(
s
);
return
-
1
;
}
taosMemoryFreeClear
(
s
);
pTFile
->
pFile
=
taosOpenFile
(
TD_FILE_FULL_NAME
(
pTFile
),
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_TRUNC
);
if
(
pTFile
->
pFile
==
NULL
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
}
else
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
-
1
;
}
}
if
(
!
updateHeader
)
{
return
0
;
}
pTFile
->
info
.
fsize
+=
TD_FILE_HEAD_SIZE
;
pTFile
->
info
.
fver
=
0
;
if
(
tdUpdateTFileHeader
(
pTFile
)
<
0
)
{
tdCloseTFile
(
pTFile
);
tdRemoveTFile
(
pTFile
);
return
-
1
;
}
return
0
;
}
int32_t
tdRemoveTFile
(
STFile
*
pTFile
)
{
return
tfsRemoveFile
(
TD_FILE_F
(
pTFile
));
}
\ No newline at end of file
source/dnode/vnode/src/tq/tq.c
浏览文件 @
ee821197
...
@@ -227,19 +227,16 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -227,19 +227,16 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
consumerEpoch
=
atomic_val_compare_exchange_32
(
&
pHandle
->
epoch
,
consumerEpoch
,
reqEpoch
);
consumerEpoch
=
atomic_val_compare_exchange_32
(
&
pHandle
->
epoch
,
consumerEpoch
,
reqEpoch
);
}
}
SWalHead
*
pHeadWithCkSum
=
taosMemoryMalloc
(
sizeof
(
SWalHead
)
+
2048
);
if
(
pHeadWithCkSum
==
NULL
)
{
return
-
1
;
}
walSetReaderCapacity
(
pHandle
->
pWalReader
,
2048
);
SMqDataBlkRsp
rsp
=
{
0
};
SMqDataBlkRsp
rsp
=
{
0
};
rsp
.
reqOffset
=
pReq
->
currentOffset
;
rsp
.
reqOffset
=
pReq
->
currentOffset
;
rsp
.
blockData
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
rsp
.
blockData
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
rsp
.
blockDataLen
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
rsp
.
blockDataLen
=
taosArrayInit
(
0
,
sizeof
(
int32_t
));
if
(
rsp
.
blockData
==
NULL
||
rsp
.
blockDataLen
==
NULL
)
{
return
-
1
;
}
rsp
.
withTbName
=
pReq
->
withTbName
;
rsp
.
withTbName
=
pReq
->
withTbName
;
if
(
rsp
.
withTbName
)
{
if
(
rsp
.
withTbName
)
{
rsp
.
blockTbName
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
rsp
.
blockTbName
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
...
@@ -253,6 +250,32 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -253,6 +250,32 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
rsp
.
blockSchema
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
rsp
.
blockSchema
=
taosArrayInit
(
0
,
sizeof
(
void
*
));
}
}
#if 1
if
(
pReq
->
useSnapshot
)
{
// TODO set ver into snapshot
int64_t
lastVer
=
walGetCommittedVer
(
pTq
->
pWal
);
if
(
rsp
.
reqOffset
<
lastVer
)
{
tqInfo
(
"retrieve using snapshot req offset %ld last ver %ld"
,
rsp
.
reqOffset
,
lastVer
);
tqScanSnapshot
(
pTq
,
&
pHandle
->
execHandle
,
&
rsp
,
workerId
);
if
(
rsp
.
blockNum
!=
0
)
{
rsp
.
withTbName
=
false
;
rsp
.
rspOffset
=
lastVer
;
tqInfo
(
"direct send by snapshot req offset %ld rsp offset %ld"
,
rsp
.
reqOffset
,
rsp
.
rspOffset
);
fetchOffset
=
lastVer
;
goto
SEND_RSP
;
}
}
}
#endif
SWalHead
*
pHeadWithCkSum
=
taosMemoryMalloc
(
sizeof
(
SWalHead
)
+
2048
);
if
(
pHeadWithCkSum
==
NULL
)
{
return
-
1
;
}
walSetReaderCapacity
(
pHandle
->
pWalReader
,
2048
);
while
(
1
)
{
while
(
1
)
{
consumerEpoch
=
atomic_load_32
(
&
pHandle
->
epoch
);
consumerEpoch
=
atomic_load_32
(
&
pHandle
->
epoch
);
if
(
consumerEpoch
>
reqEpoch
)
{
if
(
consumerEpoch
>
reqEpoch
)
{
...
@@ -283,7 +306,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -283,7 +306,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
pHead
->
msgType
==
TDMT_VND_DROP_STB
||
pHead
->
msgType
==
TDMT_VND_CREATE_TABLE
||
pHead
->
msgType
==
TDMT_VND_DROP_STB
||
pHead
->
msgType
==
TDMT_VND_CREATE_TABLE
||
pHead
->
msgType
==
TDMT_VND_ALTER_TABLE
||
pHead
->
msgType
==
TDMT_VND_DROP_TABLE
||
pHead
->
msgType
==
TDMT_VND_ALTER_TABLE
||
pHead
->
msgType
==
TDMT_VND_DROP_TABLE
||
pHead
->
msgType
==
TDMT_VND_DROP_TTL_TABLE
);
pHead
->
msgType
==
TDMT_VND_DROP_TTL_TABLE
);
// return
tqInfo
(
"fetch meta msg, ver: %ld, type: %d"
,
pHead
->
version
,
pHead
->
msgType
);
SMqMetaRsp
metaRsp
=
{
0
};
SMqMetaRsp
metaRsp
=
{
0
};
metaRsp
.
reqOffset
=
pReq
->
currentOffset
;
metaRsp
.
reqOffset
=
pReq
->
currentOffset
;
metaRsp
.
rspOffset
=
fetchOffset
;
metaRsp
.
rspOffset
=
fetchOffset
;
...
@@ -292,6 +315,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -292,6 +315,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
metaRsp
.
metaRsp
=
pHead
->
body
;
metaRsp
.
metaRsp
=
pHead
->
body
;
if
(
tqSendMetaPollRsp
(
pTq
,
pMsg
,
pReq
,
&
metaRsp
)
<
0
)
{
if
(
tqSendMetaPollRsp
(
pTq
,
pMsg
,
pReq
,
&
metaRsp
)
<
0
)
{
code
=
-
1
;
code
=
-
1
;
goto
OVER
;
}
}
code
=
0
;
code
=
0
;
goto
OVER
;
goto
OVER
;
...
@@ -308,6 +332,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
...
@@ -308,6 +332,7 @@ int32_t tqProcessPollReq(STQ* pTq, SRpcMsg* pMsg, int32_t workerId) {
taosMemoryFree
(
pHeadWithCkSum
);
taosMemoryFree
(
pHeadWithCkSum
);
SEND_RSP:
ASSERT
(
taosArrayGetSize
(
rsp
.
blockData
)
==
rsp
.
blockNum
);
ASSERT
(
taosArrayGetSize
(
rsp
.
blockData
)
==
rsp
.
blockNum
);
ASSERT
(
taosArrayGetSize
(
rsp
.
blockDataLen
)
==
rsp
.
blockNum
);
ASSERT
(
taosArrayGetSize
(
rsp
.
blockDataLen
)
==
rsp
.
blockNum
);
if
(
rsp
.
withSchema
)
{
if
(
rsp
.
withSchema
)
{
...
@@ -364,6 +389,7 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
...
@@ -364,6 +389,7 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
pHandle
->
epoch
=
-
1
;
pHandle
->
epoch
=
-
1
;
pHandle
->
execHandle
.
subType
=
req
.
subType
;
pHandle
->
execHandle
.
subType
=
req
.
subType
;
pHandle
->
fetchMeta
=
req
.
withMeta
;
pHandle
->
pWalReader
=
walOpenReadHandle
(
pTq
->
pVnode
->
pWal
);
pHandle
->
pWalReader
=
walOpenReadHandle
(
pTq
->
pVnode
->
pWal
);
for
(
int32_t
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
5
;
i
++
)
{
...
@@ -376,6 +402,8 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
...
@@ -376,6 +402,8 @@ int32_t tqProcessVgChangeReq(STQ* pTq, char* msg, int32_t msgLen) {
SReadHandle
handle
=
{
SReadHandle
handle
=
{
.
reader
=
pHandle
->
execHandle
.
pExecReader
[
i
],
.
reader
=
pHandle
->
execHandle
.
pExecReader
[
i
],
.
meta
=
pTq
->
pVnode
->
pMeta
,
.
meta
=
pTq
->
pVnode
->
pMeta
,
.
vnode
=
pTq
->
pVnode
,
.
initTsdbReader
=
1
,
};
};
pHandle
->
execHandle
.
execCol
.
task
[
i
]
=
qCreateStreamExecTaskInfo
(
pHandle
->
execHandle
.
execCol
.
qmsg
,
&
handle
);
pHandle
->
execHandle
.
execCol
.
task
[
i
]
=
qCreateStreamExecTaskInfo
(
pHandle
->
execHandle
.
execCol
.
qmsg
,
&
handle
);
ASSERT
(
pHandle
->
execHandle
.
execCol
.
task
[
i
]);
ASSERT
(
pHandle
->
execHandle
.
execCol
.
task
[
i
]);
...
@@ -448,6 +476,7 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) {
...
@@ -448,6 +476,7 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) {
.
reader
=
pStreamReader
,
.
reader
=
pStreamReader
,
.
meta
=
pTq
->
pVnode
->
pMeta
,
.
meta
=
pTq
->
pVnode
->
pMeta
,
.
vnode
=
pTq
->
pVnode
,
.
vnode
=
pTq
->
pVnode
,
.
initTsdbReader
=
1
,
};
};
/*pTask->exec.inputHandle = pStreamReader;*/
/*pTask->exec.inputHandle = pStreamReader;*/
pTask
->
exec
.
executor
=
qCreateStreamExecTaskInfo
(
pTask
->
exec
.
qmsg
,
&
handle
);
pTask
->
exec
.
executor
=
qCreateStreamExecTaskInfo
(
pTask
->
exec
.
qmsg
,
&
handle
);
...
...
source/dnode/vnode/src/tq/tqExec.c
浏览文件 @
ee821197
...
@@ -29,7 +29,7 @@ static int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataBlkRsp* pRs
...
@@ -29,7 +29,7 @@ static int32_t tqAddBlockDataToRsp(const SSDataBlock* pBlock, SMqDataBlkRsp* pRs
// TODO enable compress
// TODO enable compress
int32_t
actualLen
=
0
;
int32_t
actualLen
=
0
;
blockCompressEncode
(
pBlock
,
pRetrieve
->
data
,
&
actualLen
,
pBlock
->
info
.
numOfCols
,
false
);
blockCompressEncode
(
pBlock
,
pRetrieve
->
data
,
&
actualLen
,
taosArrayGetSize
(
pBlock
->
pDataBlock
)
,
false
);
actualLen
+=
sizeof
(
SRetrieveTableRsp
);
actualLen
+=
sizeof
(
SRetrieveTableRsp
);
ASSERT
(
actualLen
<=
dataStrLen
);
ASSERT
(
actualLen
<=
dataStrLen
);
taosArrayPush
(
pRsp
->
blockDataLen
,
&
actualLen
);
taosArrayPush
(
pRsp
->
blockDataLen
,
&
actualLen
);
...
@@ -60,6 +60,31 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, const STqExecHandle* pExec, SMqD
...
@@ -60,6 +60,31 @@ static int32_t tqAddTbNameToRsp(const STQ* pTq, const STqExecHandle* pExec, SMqD
return
0
;
return
0
;
}
}
int32_t
tqScanSnapshot
(
STQ
*
pTq
,
const
STqExecHandle
*
pExec
,
SMqDataBlkRsp
*
pRsp
,
int32_t
workerId
)
{
ASSERT
(
pExec
->
subType
==
TOPIC_SUB_TYPE__COLUMN
);
qTaskInfo_t
task
=
pExec
->
execCol
.
task
[
workerId
];
if
(
qStreamScanSnapshot
(
task
)
<
0
)
{
ASSERT
(
0
);
}
// set version
while
(
1
)
{
SSDataBlock
*
pDataBlock
=
NULL
;
uint64_t
ts
=
0
;
if
(
qExecTask
(
task
,
&
pDataBlock
,
&
ts
)
<
0
)
{
ASSERT
(
0
);
}
if
(
pDataBlock
==
NULL
)
break
;
ASSERT
(
pDataBlock
->
info
.
rows
!=
0
);
ASSERT
(
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
!=
0
);
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
);
pRsp
->
blockNum
++
;
}
return
0
;
}
int32_t
tqDataExec
(
STQ
*
pTq
,
STqExecHandle
*
pExec
,
SSubmitReq
*
pReq
,
SMqDataBlkRsp
*
pRsp
,
int32_t
workerId
)
{
int32_t
tqDataExec
(
STQ
*
pTq
,
STqExecHandle
*
pExec
,
SSubmitReq
*
pReq
,
SMqDataBlkRsp
*
pRsp
,
int32_t
workerId
)
{
if
(
pExec
->
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
if
(
pExec
->
subType
==
TOPIC_SUB_TYPE__COLUMN
)
{
qTaskInfo_t
task
=
pExec
->
execCol
.
task
[
workerId
];
qTaskInfo_t
task
=
pExec
->
execCol
.
task
[
workerId
];
...
@@ -74,7 +99,6 @@ int32_t tqDataExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataBlkR
...
@@ -74,7 +99,6 @@ int32_t tqDataExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataBlkR
if
(
pDataBlock
==
NULL
)
break
;
if
(
pDataBlock
==
NULL
)
break
;
ASSERT
(
pDataBlock
->
info
.
rows
!=
0
);
ASSERT
(
pDataBlock
->
info
.
rows
!=
0
);
ASSERT
(
pDataBlock
->
info
.
numOfCols
!=
0
);
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
);
tqAddBlockDataToRsp
(
pDataBlock
,
pRsp
);
if
(
pRsp
->
withTbName
)
{
if
(
pRsp
->
withTbName
)
{
...
@@ -88,8 +112,7 @@ int32_t tqDataExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataBlkR
...
@@ -88,8 +112,7 @@ int32_t tqDataExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataBlkR
tqReadHandleSetMsg
(
pReader
,
pReq
,
0
);
tqReadHandleSetMsg
(
pReader
,
pReq
,
0
);
while
(
tqNextDataBlock
(
pReader
))
{
while
(
tqNextDataBlock
(
pReader
))
{
SSDataBlock
block
=
{
0
};
SSDataBlock
block
=
{
0
};
if
(
tqRetrieveDataBlock
(
&
block
.
pDataBlock
,
pReader
,
&
block
.
info
.
groupId
,
&
block
.
info
.
uid
,
&
block
.
info
.
rows
,
if
(
tqRetrieveDataBlock
(
&
block
,
pReader
,
&
block
.
info
.
groupId
,
&
block
.
info
.
uid
,
&
block
.
info
.
rows
)
<
0
)
{
&
block
.
info
.
numOfCols
)
<
0
)
{
if
(
terrno
==
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
)
continue
;
if
(
terrno
==
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
)
continue
;
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
@@ -106,8 +129,7 @@ int32_t tqDataExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataBlkR
...
@@ -106,8 +129,7 @@ int32_t tqDataExec(STQ* pTq, STqExecHandle* pExec, SSubmitReq* pReq, SMqDataBlkR
tqReadHandleSetMsg
(
pReader
,
pReq
,
0
);
tqReadHandleSetMsg
(
pReader
,
pReq
,
0
);
while
(
tqNextDataBlockFilterOut
(
pReader
,
pExec
->
execDb
.
pFilterOutTbUid
))
{
while
(
tqNextDataBlockFilterOut
(
pReader
,
pExec
->
execDb
.
pFilterOutTbUid
))
{
SSDataBlock
block
=
{
0
};
SSDataBlock
block
=
{
0
};
if
(
tqRetrieveDataBlock
(
&
block
.
pDataBlock
,
pReader
,
&
block
.
info
.
groupId
,
&
block
.
info
.
uid
,
&
block
.
info
.
rows
,
if
(
tqRetrieveDataBlock
(
&
block
,
pReader
,
&
block
.
info
.
groupId
,
&
block
.
info
.
uid
,
&
block
.
info
.
rows
)
<
0
)
{
&
block
.
info
.
numOfCols
)
<
0
)
{
if
(
terrno
==
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
)
continue
;
if
(
terrno
==
TSDB_CODE_TQ_TABLE_SCHEMA_NOT_FOUND
)
continue
;
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
...
source/dnode/vnode/src/tq/tqOffset.c
浏览文件 @
ee821197
...
@@ -44,6 +44,7 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
...
@@ -44,6 +44,7 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
}
}
char
*
fname
=
buildFileName
(
pStore
->
pTq
->
path
);
char
*
fname
=
buildFileName
(
pStore
->
pTq
->
path
);
TdFilePtr
pFile
=
taosOpenFile
(
fname
,
TD_FILE_READ
);
TdFilePtr
pFile
=
taosOpenFile
(
fname
,
TD_FILE_READ
);
taosMemoryFree
(
fname
);
if
(
pFile
!=
NULL
)
{
if
(
pFile
!=
NULL
)
{
STqOffsetHead
head
=
{
0
};
STqOffsetHead
head
=
{
0
};
int64_t
code
;
int64_t
code
;
...
@@ -77,7 +78,6 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
...
@@ -77,7 +78,6 @@ STqOffsetStore* tqOffsetOpen(STQ* pTq) {
}
}
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
taosMemoryFree
(
fname
);
}
}
return
pStore
;
return
pStore
;
}
}
...
@@ -102,6 +102,7 @@ int32_t tqOffsetSnapshot(STqOffsetStore* pStore) {
...
@@ -102,6 +102,7 @@ int32_t tqOffsetSnapshot(STqOffsetStore* pStore) {
// TODO file name should be with a version
// TODO file name should be with a version
char
*
fname
=
buildFileName
(
pStore
->
pTq
->
path
);
char
*
fname
=
buildFileName
(
pStore
->
pTq
->
path
);
TdFilePtr
pFile
=
taosOpenFile
(
fname
,
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_APPEND
);
TdFilePtr
pFile
=
taosOpenFile
(
fname
,
TD_FILE_CREATE
|
TD_FILE_WRITE
|
TD_FILE_APPEND
);
taosMemoryFree
(
fname
);
if
(
pFile
==
NULL
)
{
if
(
pFile
==
NULL
)
{
ASSERT
(
0
);
ASSERT
(
0
);
return
-
1
;
return
-
1
;
...
@@ -140,6 +141,5 @@ int32_t tqOffsetSnapshot(STqOffsetStore* pStore) {
...
@@ -140,6 +141,5 @@ int32_t tqOffsetSnapshot(STqOffsetStore* pStore) {
}
}
// close and rename file
// close and rename file
taosCloseFile
(
&
pFile
);
taosCloseFile
(
&
pFile
);
taosMemoryFree
(
fname
);
return
0
;
return
0
;
}
}
source/dnode/vnode/src/tq/tqRead.c
浏览文件 @
ee821197
...
@@ -142,8 +142,8 @@ bool tqNextDataBlockFilterOut(STqReadHandle* pHandle, SHashObj* filterOutUids) {
...
@@ -142,8 +142,8 @@ bool tqNextDataBlockFilterOut(STqReadHandle* pHandle, SHashObj* filterOutUids) {
return
false
;
return
false
;
}
}
int32_t
tqRetrieveDataBlock
(
S
Array
**
ppCols
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
tqRetrieveDataBlock
(
S
SDataBlock
*
pBlock
,
STqReadHandle
*
pHandle
,
uint64_t
*
pGroupId
,
uint64_t
*
pUid
,
int32_t
*
pNumOfRows
,
int16_t
*
pNumOfCols
)
{
int32_t
*
pNumOfRows
)
{
*
pUid
=
0
;
*
pUid
=
0
;
// TODO set to real sversion
// TODO set to real sversion
...
@@ -151,6 +151,7 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
...
@@ -151,6 +151,7 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
int32_t
sversion
=
htonl
(
pHandle
->
pBlock
->
sversion
);
int32_t
sversion
=
htonl
(
pHandle
->
pBlock
->
sversion
);
if
(
pHandle
->
cachedSchemaSuid
==
0
||
pHandle
->
cachedSchemaVer
!=
sversion
||
if
(
pHandle
->
cachedSchemaSuid
==
0
||
pHandle
->
cachedSchemaVer
!=
sversion
||
pHandle
->
cachedSchemaSuid
!=
pHandle
->
msgIter
.
suid
)
{
pHandle
->
cachedSchemaSuid
!=
pHandle
->
msgIter
.
suid
)
{
if
(
pHandle
->
pSchema
)
taosMemoryFree
(
pHandle
->
pSchema
);
pHandle
->
pSchema
=
metaGetTbTSchema
(
pHandle
->
pVnodeMeta
,
pHandle
->
msgIter
.
uid
,
sversion
);
pHandle
->
pSchema
=
metaGetTbTSchema
(
pHandle
->
pVnodeMeta
,
pHandle
->
msgIter
.
uid
,
sversion
);
if
(
pHandle
->
pSchema
==
NULL
)
{
if
(
pHandle
->
pSchema
==
NULL
)
{
tqWarn
(
"cannot found tsschema for table: uid: %ld (suid: %ld), version %d, possibly dropped table"
,
tqWarn
(
"cannot found tsschema for table: uid: %ld (suid: %ld), version %d, possibly dropped table"
,
...
@@ -161,6 +162,7 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
...
@@ -161,6 +162,7 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
}
}
// this interface use suid instead of uid
// this interface use suid instead of uid
if
(
pHandle
->
pSchemaWrapper
)
tDeleteSSchemaWrapper
(
pHandle
->
pSchemaWrapper
);
pHandle
->
pSchemaWrapper
=
metaGetTableSchema
(
pHandle
->
pVnodeMeta
,
pHandle
->
msgIter
.
uid
,
sversion
,
true
);
pHandle
->
pSchemaWrapper
=
metaGetTableSchema
(
pHandle
->
pVnodeMeta
,
pHandle
->
msgIter
.
uid
,
sversion
,
true
);
if
(
pHandle
->
pSchemaWrapper
==
NULL
)
{
if
(
pHandle
->
pSchemaWrapper
==
NULL
)
{
tqWarn
(
"cannot found schema wrapper for table: suid: %ld, version %d, possibly dropped table"
,
tqWarn
(
"cannot found schema wrapper for table: suid: %ld, version %d, possibly dropped table"
,
...
@@ -180,23 +182,14 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
...
@@ -180,23 +182,14 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
int32_t
colNumNeed
=
taosArrayGetSize
(
pHandle
->
pColIdList
);
int32_t
colNumNeed
=
taosArrayGetSize
(
pHandle
->
pColIdList
);
if
(
colNumNeed
==
0
)
{
if
(
colNumNeed
==
0
)
{
*
ppCols
=
taosArrayInit
(
pSchemaWrapper
->
nCols
,
sizeof
(
SColumnInfoData
));
if
(
*
ppCols
==
NULL
)
{
return
-
1
;
}
int32_t
colMeta
=
0
;
int32_t
colMeta
=
0
;
while
(
colMeta
<
pSchemaWrapper
->
nCols
)
{
while
(
colMeta
<
pSchemaWrapper
->
nCols
)
{
SSchema
*
pColSchema
=
&
pSchemaWrapper
->
pSchema
[
colMeta
];
SSchema
*
pColSchema
=
&
pSchemaWrapper
->
pSchema
[
colMeta
];
SColumnInfoData
colInfo
=
{
0
};
SColumnInfoData
colInfo
=
createColumnInfoData
(
pColSchema
->
type
,
pColSchema
->
bytes
,
pColSchema
->
colId
);
colInfo
.
info
.
bytes
=
pColSchema
->
bytes
;
int32_t
code
=
blockDataAppendColInfo
(
pBlock
,
&
colInfo
);
colInfo
.
info
.
colId
=
pColSchema
->
colId
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
colInfo
.
info
.
type
=
pColSchema
->
type
;
if
(
colInfoDataEnsureCapacity
(
&
colInfo
,
0
,
*
pNumOfRows
)
<
0
)
{
goto
FAIL
;
goto
FAIL
;
}
}
taosArrayPush
(
*
ppCols
,
&
colInfo
);
colMeta
++
;
colMeta
++
;
}
}
}
else
{
}
else
{
...
@@ -204,11 +197,6 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
...
@@ -204,11 +197,6 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
colNumNeed
=
pSchemaWrapper
->
nCols
;
colNumNeed
=
pSchemaWrapper
->
nCols
;
}
}
*
ppCols
=
taosArrayInit
(
colNumNeed
,
sizeof
(
SColumnInfoData
));
if
(
*
ppCols
==
NULL
)
{
return
-
1
;
}
int32_t
colMeta
=
0
;
int32_t
colMeta
=
0
;
int32_t
colNeed
=
0
;
int32_t
colNeed
=
0
;
while
(
colMeta
<
pSchemaWrapper
->
nCols
&&
colNeed
<
colNumNeed
)
{
while
(
colMeta
<
pSchemaWrapper
->
nCols
&&
colNeed
<
colNumNeed
)
{
...
@@ -220,23 +208,22 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
...
@@ -220,23 +208,22 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
}
else
if
(
colIdSchema
>
colIdNeed
)
{
}
else
if
(
colIdSchema
>
colIdNeed
)
{
colNeed
++
;
colNeed
++
;
}
else
{
}
else
{
SColumnInfoData
colInfo
=
{
0
};
SColumnInfoData
colInfo
=
createColumnInfoData
(
pColSchema
->
type
,
pColSchema
->
bytes
,
pColSchema
->
colId
);
colInfo
.
info
.
bytes
=
pColSchema
->
bytes
;
int32_t
code
=
blockDataAppendColInfo
(
pBlock
,
&
colInfo
);
colInfo
.
info
.
colId
=
pColSchema
->
colId
;
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
colInfo
.
info
.
type
=
pColSchema
->
type
;
if
(
colInfoDataEnsureCapacity
(
&
colInfo
,
0
,
*
pNumOfRows
)
<
0
)
{
goto
FAIL
;
goto
FAIL
;
}
}
taosArrayPush
(
*
ppCols
,
&
colInfo
);
colMeta
++
;
colMeta
++
;
colNeed
++
;
colNeed
++
;
}
}
}
}
}
}
int32_t
colActual
=
taosArrayGetSize
(
*
ppCols
);
if
(
blockDataEnsureCapacity
(
pBlock
,
*
pNumOfRows
)
<
0
)
{
*
pNumOfCols
=
colActual
;
goto
FAIL
;
}
int32_t
colActual
=
blockDataGetNumOfCols
(
pBlock
);
// TODO in stream shuffle case, fetch groupId
// TODO in stream shuffle case, fetch groupId
*
pGroupId
=
0
;
*
pGroupId
=
0
;
...
@@ -253,7 +240,7 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
...
@@ -253,7 +240,7 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
tdSTSRowIterReset
(
&
iter
,
row
);
tdSTSRowIterReset
(
&
iter
,
row
);
// get all wanted col of that block
// get all wanted col of that block
for
(
int32_t
i
=
0
;
i
<
colActual
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
colActual
;
i
++
)
{
SColumnInfoData
*
pColData
=
taosArrayGet
(
*
ppCols
,
i
);
SColumnInfoData
*
pColData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SCellVal
sVal
=
{
0
};
SCellVal
sVal
=
{
0
};
if
(
!
tdSTSRowIterNext
(
&
iter
,
pColData
->
info
.
colId
,
pColData
->
info
.
type
,
&
sVal
))
{
if
(
!
tdSTSRowIterNext
(
&
iter
,
pColData
->
info
.
colId
,
pColData
->
info
.
type
,
&
sVal
))
{
break
;
break
;
...
@@ -265,8 +252,9 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
...
@@ -265,8 +252,9 @@ int32_t tqRetrieveDataBlock(SArray** ppCols, STqReadHandle* pHandle, uint64_t* p
curRow
++
;
curRow
++
;
}
}
return
0
;
return
0
;
FAIL:
if
(
*
ppCols
)
taosArrayDestroy
(
*
ppCols
);
FAIL:
// todo refactor here
// if (*ppCols) taosArrayDestroy(*ppCols);
return
-
1
;
return
-
1
;
}
}
...
...
source/dnode/vnode/src/tq/tqSink.c
浏览文件 @
ee821197
...
@@ -44,7 +44,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
...
@@ -44,7 +44,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
createTbReq
.
ctb
.
suid
=
suid
;
createTbReq
.
ctb
.
suid
=
suid
;
STagVal
tagVal
=
{
STagVal
tagVal
=
{
.
cid
=
pDataBlock
->
info
.
numOfCols
+
1
,
.
cid
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
+
1
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
groupId
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
groupId
,
};
};
...
@@ -107,7 +107,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
...
@@ -107,7 +107,7 @@ SSubmitReq* tdBlockToSubmit(const SArray* pBlocks, const STSchema* pTSchema, boo
createTbReq
.
ctb
.
suid
=
suid
;
createTbReq
.
ctb
.
suid
=
suid
;
STagVal
tagVal
=
{
STagVal
tagVal
=
{
.
cid
=
pDataBlock
->
info
.
numOfCols
+
1
,
.
cid
=
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
+
1
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
type
=
TSDB_DATA_TYPE_UBIGINT
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
groupId
,
.
i64
=
(
int64_t
)
pDataBlock
->
info
.
groupId
,
};
};
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
ee821197
...
@@ -16,13 +16,11 @@
...
@@ -16,13 +16,11 @@
#include "tsdb.h"
#include "tsdb.h"
#include "vnode.h"
#include "vnode.h"
#define EXTRA_BYTES 2
#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC)
#define ASCENDING_TRAVERSE(o) (o == TSDB_ORDER_ASC)
#define QH_GET_NUM_OF_COLS(handle) ((size_t)(taosArrayGetSize((handle)->p
Columns
)))
#define QH_GET_NUM_OF_COLS(handle) ((size_t)(taosArrayGetSize((handle)->p
ResBlock->pDataBlock
)))
#define GET_FILE_DATA_BLOCK_INFO(_checkInfo, _block) \
#define GET_FILE_DATA_BLOCK_INFO(_checkInfo, _block) \
((SDataBlockInfo){.window = {.skey = (_block)->minKey.ts, .ekey = (_block)->maxKey.ts}, \
((SDataBlockInfo){.window = {.skey = (_block)->minKey.ts, .ekey = (_block)->maxKey.ts}, \
.numOfCols = (_block)->numOfCols, \
.rows = (_block)->numOfRows, \
.rows = (_block)->numOfRows, \
.uid = (_checkInfo)->tableId})
.uid = (_checkInfo)->tableId})
...
@@ -115,7 +113,8 @@ typedef struct STsdbReadHandle {
...
@@ -115,7 +113,8 @@ typedef struct STsdbReadHandle {
// SColumnDataAgg* statis; // query level statistics, only one table block statistics info exists at any time
// SColumnDataAgg* statis; // query level statistics, only one table block statistics info exists at any time
// SColumnDataAgg** pstatis;// the ptr array list to return to caller
// SColumnDataAgg** pstatis;// the ptr array list to return to caller
int32_t
numOfBlocks
;
int32_t
numOfBlocks
;
SArray
*
pColumns
;
// column list, SColumnInfoData array list
SSDataBlock
*
pResBlock
;
// SArray* pColumns; // column list, SColumnInfoData array list
bool
locateStart
;
bool
locateStart
;
int32_t
outputCapacity
;
int32_t
outputCapacity
;
int32_t
realNumOfRows
;
int32_t
realNumOfRows
;
...
@@ -177,7 +176,7 @@ static SArray* getColumnIdList(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -177,7 +176,7 @@ static SArray* getColumnIdList(STsdbReadHandle* pTsdbReadHandle) {
SArray
*
pIdList
=
taosArrayInit
(
numOfCols
,
sizeof
(
int16_t
));
SArray
*
pIdList
=
taosArrayInit
(
numOfCols
,
sizeof
(
int16_t
));
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pCol
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
i
);
SColumnInfoData
*
pCol
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
i
);
taosArrayPush
(
pIdList
,
&
pCol
->
info
.
colId
);
taosArrayPush
(
pIdList
,
&
pCol
->
info
.
colId
);
}
}
...
@@ -425,23 +424,21 @@ static STsdbReadHandle* tsdbQueryTablesImpl(SVnode* pVnode, SQueryTableDataCond*
...
@@ -425,23 +424,21 @@ static STsdbReadHandle* tsdbQueryTablesImpl(SVnode* pVnode, SQueryTableDataCond*
}
}
// todo: use list instead of array?
// todo: use list instead of array?
pReadHandle
->
p
Columns
=
taosArrayInit
(
pCond
->
numOfCols
,
sizeof
(
SColumnInfoData
)
);
pReadHandle
->
p
ResBlock
=
createDataBlock
(
);
if
(
pReadHandle
->
p
Columns
==
NULL
)
{
if
(
pReadHandle
->
p
ResBlock
==
NULL
)
{
goto
_end
;
goto
_end
;
}
}
for
(
int32_t
i
=
0
;
i
<
pCond
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pCond
->
numOfCols
;
++
i
)
{
SColumnInfoData
colInfo
=
{{
0
},
0
};
SColumnInfoData
colInfo
=
{.
info
=
pCond
->
colList
[
i
],
0
};
colInfo
.
info
=
pCond
->
colList
[
i
];
int32_t
code
=
blockDataAppendColInfo
(
pReadHandle
->
pResBlock
,
&
colInfo
);
if
(
code
!=
TSDB_CODE_SUCCESS
){
int32_t
code
=
colInfoDataEnsureCapacity
(
&
colInfo
,
0
,
pReadHandle
->
outputCapacity
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_end
;
goto
_end
;
}
}
taosArrayPush
(
pReadHandle
->
pColumns
,
&
colInfo
);
}
}
blockDataEnsureCapacity
(
pReadHandle
->
pResBlock
,
pReadHandle
->
outputCapacity
);
pReadHandle
->
suppInfo
.
defaultLoadColumn
=
getDefaultLoadColumns
(
pReadHandle
,
true
);
pReadHandle
->
suppInfo
.
defaultLoadColumn
=
getDefaultLoadColumns
(
pReadHandle
,
true
);
size_t
size
=
taosArrayGetSize
(
pReadHandle
->
suppInfo
.
defaultLoadColumn
);
size_t
size
=
taosArrayGetSize
(
pReadHandle
->
suppInfo
.
defaultLoadColumn
);
...
@@ -1536,12 +1533,12 @@ static int32_t doCopyRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, int32_t
...
@@ -1536,12 +1533,12 @@ static int32_t doCopyRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, int32_t
int32_t
trueEnd
=
ascScan
?
end
:
start
;
int32_t
trueEnd
=
ascScan
?
end
:
start
;
int32_t
step
=
ascScan
?
1
:
-
1
;
int32_t
step
=
ascScan
?
1
:
-
1
;
int32_t
requiredNumOfCols
=
(
int32_t
)
taosArrayGetSize
(
pTsdbReadHandle
->
p
Columns
);
int32_t
requiredNumOfCols
=
(
int32_t
)
taosArrayGetSize
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
);
// data in buffer has greater timestamp, copy data in file block
// data in buffer has greater timestamp, copy data in file block
int32_t
i
=
0
,
j
=
0
;
int32_t
i
=
0
,
j
=
0
;
while
(
i
<
requiredNumOfCols
&&
j
<
pCols
->
numOfCols
)
{
while
(
i
<
requiredNumOfCols
&&
j
<
pCols
->
numOfCols
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
i
);
SDataCol
*
src
=
&
pCols
->
cols
[
j
];
SDataCol
*
src
=
&
pCols
->
cols
[
j
];
if
(
src
->
colId
<
pColInfo
->
info
.
colId
)
{
if
(
src
->
colId
<
pColInfo
->
info
.
colId
)
{
...
@@ -1592,7 +1589,7 @@ static int32_t doCopyRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, int32_t
...
@@ -1592,7 +1589,7 @@ static int32_t doCopyRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, int32_t
}
}
while
(
i
<
requiredNumOfCols
)
{
// the remain columns are all null data
while
(
i
<
requiredNumOfCols
)
{
// the remain columns are all null data
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
i
);
colDataAppendNNULL
(
pColInfo
,
numOfRows
,
num
);
colDataAppendNNULL
(
pColInfo
,
numOfRows
,
num
);
i
++
;
i
++
;
}
}
...
@@ -1674,7 +1671,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
...
@@ -1674,7 +1671,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
int32_t
i
=
0
,
j
=
0
,
k
=
0
;
int32_t
i
=
0
,
j
=
0
,
k
=
0
;
while
(
i
<
numOfCols
&&
(
j
<
numOfColsOfRow1
||
k
<
numOfColsOfRow2
))
{
while
(
i
<
numOfCols
&&
(
j
<
numOfColsOfRow1
||
k
<
numOfColsOfRow2
))
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
i
);
int32_t
colIdOfRow1
;
int32_t
colIdOfRow1
;
if
(
j
>=
numOfColsOfRow1
)
{
if
(
j
>=
numOfColsOfRow1
)
{
...
@@ -1805,7 +1802,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
...
@@ -1805,7 +1802,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa
if
(
mergeOption
==
1
)
{
if
(
mergeOption
==
1
)
{
while
(
i
<
numOfCols
)
{
// the remain columns are all null data
while
(
i
<
numOfCols
)
{
// the remain columns are all null data
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
i
);
colDataAppend
(
pColInfo
,
*
curRow
,
NULL
,
true
);
colDataAppend
(
pColInfo
,
*
curRow
,
NULL
,
true
);
++
i
;
++
i
;
}
}
...
@@ -1861,7 +1858,7 @@ static void doCheckGeneratedBlockRange(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -1861,7 +1858,7 @@ static void doCheckGeneratedBlockRange(STsdbReadHandle* pTsdbReadHandle) {
assert
(
cur
->
win
.
skey
>=
pTsdbReadHandle
->
window
.
ekey
&&
cur
->
win
.
ekey
<=
pTsdbReadHandle
->
window
.
skey
);
assert
(
cur
->
win
.
skey
>=
pTsdbReadHandle
->
window
.
ekey
&&
cur
->
win
.
ekey
<=
pTsdbReadHandle
->
window
.
skey
);
}
}
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
0
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
0
);
assert
(
cur
->
win
.
skey
==
((
TSKEY
*
)
pColInfoData
->
pData
)[
0
]
&&
assert
(
cur
->
win
.
skey
==
((
TSKEY
*
)
pColInfoData
->
pData
)[
0
]
&&
cur
->
win
.
ekey
==
((
TSKEY
*
)
pColInfoData
->
pData
)[
cur
->
rows
-
1
]);
cur
->
win
.
ekey
==
((
TSKEY
*
)
pColInfoData
->
pData
)[
cur
->
rows
-
1
]);
}
else
{
}
else
{
...
@@ -2771,7 +2768,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
...
@@ -2771,7 +2768,7 @@ static int tsdbReadRowsFromCache(STableCheckInfo* pCheckInfo, TSKEY maxKey, int
STsdbReadHandle
*
pTsdbReadHandle
)
{
STsdbReadHandle
*
pTsdbReadHandle
)
{
int
numOfRows
=
0
;
int
numOfRows
=
0
;
int
curRows
=
0
;
int
curRows
=
0
;
int32_t
numOfCols
=
(
int32_t
)
taosArrayGetSize
(
pTsdbReadHandle
->
p
Columns
);
int32_t
numOfCols
=
(
int32_t
)
taosArrayGetSize
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
);
STsdbCfg
*
pCfg
=
REPO_CFG
(
pTsdbReadHandle
->
pTsdb
);
STsdbCfg
*
pCfg
=
REPO_CFG
(
pTsdbReadHandle
->
pTsdb
);
win
->
skey
=
TSKEY_INITIAL_VAL
;
win
->
skey
=
TSKEY_INITIAL_VAL
;
...
@@ -2901,7 +2898,7 @@ static bool loadBlockOfActiveTable(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -2901,7 +2898,7 @@ static bool loadBlockOfActiveTable(STsdbReadHandle* pTsdbReadHandle) {
if
(
exists
)
{
if
(
exists
)
{
tsdbRetrieveDataBlock
((
tsdbReaderT
*
)
pTsdbReadHandle
,
NULL
);
tsdbRetrieveDataBlock
((
tsdbReaderT
*
)
pTsdbReadHandle
,
NULL
);
if
(
pTsdbReadHandle
->
currentLoadExternalRows
&&
pTsdbReadHandle
->
window
.
skey
==
pTsdbReadHandle
->
window
.
ekey
)
{
if
(
pTsdbReadHandle
->
currentLoadExternalRows
&&
pTsdbReadHandle
->
window
.
skey
==
pTsdbReadHandle
->
window
.
ekey
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
0
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
0
);
assert
(
*
(
int64_t
*
)
pColInfo
->
pData
==
pTsdbReadHandle
->
window
.
skey
);
assert
(
*
(
int64_t
*
)
pColInfo
->
pData
==
pTsdbReadHandle
->
window
.
skey
);
}
}
...
@@ -3003,7 +3000,7 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -3003,7 +3000,7 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
//
//
// int32_t i = 0, j = 0;
// int32_t i = 0, j = 0;
// while(i < tgNumOfCols && j < numOfCols) {
// while(i < tgNumOfCols && j < numOfCols) {
// pColInfo = taosArrayGet(pTsdbReadHandle->p
Columns
, i);
// pColInfo = taosArrayGet(pTsdbReadHandle->p
ResBlock->pDataBlock
, i);
// if (pTable->lastCols[j].colId < pColInfo->info.colId) {
// if (pTable->lastCols[j].colId < pColInfo->info.colId) {
// j++;
// j++;
// continue;
// continue;
...
@@ -3066,7 +3063,7 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -3066,7 +3063,7 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
// continue;
// continue;
// }
// }
//
//
// pColInfo = taosArrayGet(pTsdbReadHandle->p
Columns
, n);
// pColInfo = taosArrayGet(pTsdbReadHandle->p
ResBlock->pDataBlock
, n);
// pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;;
// pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;;
//
//
// if (pColInfo->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
// if (pColInfo->info.colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
...
@@ -3091,7 +3088,7 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -3091,7 +3088,7 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
//
//
// // leave the real ts column as the last row, because last function only (not stable) use the last row as res
// // leave the real ts column as the last row, because last function only (not stable) use the last row as res
// if (priKey != TSKEY_INITIAL_VAL) {
// if (priKey != TSKEY_INITIAL_VAL) {
// pColInfo = taosArrayGet(pTsdbReadHandle->p
Columns
, priIdx);
// pColInfo = taosArrayGet(pTsdbReadHandle->p
ResBlock->pDataBlock
, priIdx);
// pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;
// pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;
//
//
// *(TSKEY *)pData = priKey;
// *(TSKEY *)pData = priKey;
...
@@ -3101,7 +3098,7 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -3101,7 +3098,7 @@ static bool loadCachedLastRow(STsdbReadHandle* pTsdbReadHandle) {
// continue;
// continue;
// }
// }
//
//
// pColInfo = taosArrayGet(pTsdbReadHandle->p
Columns
, n);
// pColInfo = taosArrayGet(pTsdbReadHandle->p
ResBlock->pDataBlock
, n);
// pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;;
// pData = (char*)pColInfo->pData + numOfRows * pColInfo->info.bytes;;
//
//
// assert (pColInfo->info.colId != PRIMARYKEY_TIMESTAMP_COL_ID);
// assert (pColInfo->info.colId != PRIMARYKEY_TIMESTAMP_COL_ID);
...
@@ -3161,9 +3158,9 @@ static bool loadDataBlockFromTableSeq(STsdbReadHandle* pTsdbReadHandle) {
...
@@ -3161,9 +3158,9 @@ static bool loadDataBlockFromTableSeq(STsdbReadHandle* pTsdbReadHandle) {
bool
tsdbNextDataBlock
(
tsdbReaderT
pHandle
)
{
bool
tsdbNextDataBlock
(
tsdbReaderT
pHandle
)
{
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
pHandle
;
STsdbReadHandle
*
pTsdbReadHandle
=
(
STsdbReadHandle
*
)
pHandle
;
size_t
numOfCols
=
taosArrayGetSize
(
pTsdbReadHandle
->
p
Columns
);
size_t
numOfCols
=
taosArrayGetSize
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
i
);
colInfoDataCleanup
(
pColInfo
,
pTsdbReadHandle
->
outputCapacity
);
colInfoDataCleanup
(
pColInfo
,
pTsdbReadHandle
->
outputCapacity
);
}
}
...
@@ -3250,7 +3247,7 @@ bool tsdbNextDataBlock(tsdbReaderT pHandle) {
...
@@ -3250,7 +3247,7 @@ bool tsdbNextDataBlock(tsdbReaderT pHandle) {
// SArray* row = (type == TSDB_PREV_ROW)? pTsdbReadHandle->prev : pTsdbReadHandle->next;
// SArray* row = (type == TSDB_PREV_ROW)? pTsdbReadHandle->prev : pTsdbReadHandle->next;
//
//
// for (int32_t i = 0; i < numOfCols; ++i) {
// for (int32_t i = 0; i < numOfCols; ++i) {
// SColumnInfoData* pCol = taosArrayGet(pTsdbReadHandle->p
Columns
, i);
// SColumnInfoData* pCol = taosArrayGet(pTsdbReadHandle->p
ResBlock->pDataBlock
, i);
//
//
// SColumnInfoData colInfo = {{0}, 0};
// SColumnInfoData colInfo = {{0}, 0};
// colInfo.info = pCol->info;
// colInfo.info = pCol->info;
...
@@ -3280,7 +3277,7 @@ bool tsdbNextDataBlock(tsdbReaderT pHandle) {
...
@@ -3280,7 +3277,7 @@ bool tsdbNextDataBlock(tsdbReaderT pHandle) {
// }
// }
//
//
// for (int32_t i = 0; i < cond.numOfCols; ++i) {
// for (int32_t i = 0; i < cond.numOfCols; ++i) {
// SColumnInfoData* pColInfoData = taosArrayGet(pTsdbReadHandle->p
Columns
, i);
// SColumnInfoData* pColInfoData = taosArrayGet(pTsdbReadHandle->p
ResBlock->pDataBlock
, i);
// memcpy(&cond.colList[i], &pColInfoData->info, sizeof(SColumnInfo));
// memcpy(&cond.colList[i], &pColInfoData->info, sizeof(SColumnInfo));
// }
// }
//
//
...
@@ -3342,7 +3339,7 @@ bool tsdbGetExternalRow(tsdbReaderT pHandle) {
...
@@ -3342,7 +3339,7 @@ bool tsdbGetExternalRow(tsdbReaderT pHandle) {
int32_t
numOfCols
=
(
int32_t
)
QH_GET_NUM_OF_COLS
(
pTsdbReadHandle
);
int32_t
numOfCols
=
(
int32_t
)
QH_GET_NUM_OF_COLS
(
pTsdbReadHandle
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pTsdbReadHandle
->
p
Columns
,
i
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
first
=
taosArrayGet
(
pTsdbReadHandle
->
prev
,
i
);
SColumnInfoData
*
first
=
taosArrayGet
(
pTsdbReadHandle
->
prev
,
i
);
memcpy
(
pColInfoData
->
pData
,
first
->
pData
,
pColInfoData
->
info
.
bytes
);
memcpy
(
pColInfoData
->
pData
,
first
->
pData
,
pColInfoData
->
info
.
bytes
);
...
@@ -3617,13 +3614,13 @@ SArray* tsdbRetrieveDataBlock(tsdbReaderT* pTsdbReadHandle, SArray* pIdList) {
...
@@ -3617,13 +3614,13 @@ SArray* tsdbRetrieveDataBlock(tsdbReaderT* pTsdbReadHandle, SArray* pIdList) {
*/
*/
STsdbReadHandle
*
pHandle
=
(
STsdbReadHandle
*
)
pTsdbReadHandle
;
STsdbReadHandle
*
pHandle
=
(
STsdbReadHandle
*
)
pTsdbReadHandle
;
if
(
pHandle
->
cur
.
fid
==
INT32_MIN
)
{
if
(
pHandle
->
cur
.
fid
==
INT32_MIN
)
{
return
pHandle
->
p
Columns
;
return
pHandle
->
p
ResBlock
->
pDataBlock
;
}
else
{
}
else
{
STableBlockInfo
*
pBlockInfo
=
&
pHandle
->
pDataBlockInfo
[
pHandle
->
cur
.
slot
];
STableBlockInfo
*
pBlockInfo
=
&
pHandle
->
pDataBlockInfo
[
pHandle
->
cur
.
slot
];
STableCheckInfo
*
pCheckInfo
=
pBlockInfo
->
pTableCheckInfo
;
STableCheckInfo
*
pCheckInfo
=
pBlockInfo
->
pTableCheckInfo
;
if
(
pHandle
->
cur
.
mixBlock
)
{
if
(
pHandle
->
cur
.
mixBlock
)
{
return
pHandle
->
p
Columns
;
return
pHandle
->
p
ResBlock
->
pDataBlock
;
}
else
{
}
else
{
SDataBlockInfo
binfo
=
GET_FILE_DATA_BLOCK_INFO
(
pCheckInfo
,
pBlockInfo
->
compBlock
);
SDataBlockInfo
binfo
=
GET_FILE_DATA_BLOCK_INFO
(
pCheckInfo
,
pBlockInfo
->
compBlock
);
assert
(
pHandle
->
realNumOfRows
<=
binfo
.
rows
);
assert
(
pHandle
->
realNumOfRows
<=
binfo
.
rows
);
...
@@ -3633,7 +3630,7 @@ SArray* tsdbRetrieveDataBlock(tsdbReaderT* pTsdbReadHandle, SArray* pIdList) {
...
@@ -3633,7 +3630,7 @@ SArray* tsdbRetrieveDataBlock(tsdbReaderT* pTsdbReadHandle, SArray* pIdList) {
if
(
pBlockLoadInfo
->
slot
==
pHandle
->
cur
.
slot
&&
pBlockLoadInfo
->
fileGroup
->
fid
==
pHandle
->
cur
.
fid
&&
if
(
pBlockLoadInfo
->
slot
==
pHandle
->
cur
.
slot
&&
pBlockLoadInfo
->
fileGroup
->
fid
==
pHandle
->
cur
.
fid
&&
pBlockLoadInfo
->
uid
==
pCheckInfo
->
tableId
)
{
pBlockLoadInfo
->
uid
==
pCheckInfo
->
tableId
)
{
return
pHandle
->
p
Columns
;
return
pHandle
->
p
ResBlock
->
pDataBlock
;
}
else
{
// only load the file block
}
else
{
// only load the file block
SBlock
*
pBlock
=
pBlockInfo
->
compBlock
;
SBlock
*
pBlock
=
pBlockInfo
->
compBlock
;
if
(
doLoadFileDataBlock
(
pHandle
,
pBlock
,
pCheckInfo
,
pHandle
->
cur
.
slot
)
!=
TSDB_CODE_SUCCESS
)
{
if
(
doLoadFileDataBlock
(
pHandle
,
pBlock
,
pCheckInfo
,
pHandle
->
cur
.
slot
)
!=
TSDB_CODE_SUCCESS
)
{
...
@@ -3641,7 +3638,7 @@ SArray* tsdbRetrieveDataBlock(tsdbReaderT* pTsdbReadHandle, SArray* pIdList) {
...
@@ -3641,7 +3638,7 @@ SArray* tsdbRetrieveDataBlock(tsdbReaderT* pTsdbReadHandle, SArray* pIdList) {
}
}
int32_t
numOfRows
=
doCopyRowsFromFileBlock
(
pHandle
,
pHandle
->
outputCapacity
,
0
,
0
,
pBlock
->
numOfRows
-
1
);
int32_t
numOfRows
=
doCopyRowsFromFileBlock
(
pHandle
,
pHandle
->
outputCapacity
,
0
,
0
,
pBlock
->
numOfRows
-
1
);
return
pHandle
->
p
Columns
;
return
pHandle
->
p
ResBlock
->
pDataBlock
;
}
}
}
}
}
}
...
@@ -3692,7 +3689,7 @@ void tsdbCleanupReadHandle(tsdbReaderT queryHandle) {
...
@@ -3692,7 +3689,7 @@ void tsdbCleanupReadHandle(tsdbReaderT queryHandle) {
return
;
return
;
}
}
pTsdbReadHandle
->
p
Columns
=
doFreeColumnInfoData
(
pTsdbReadHandle
->
pColumns
);
pTsdbReadHandle
->
p
ResBlock
->
pDataBlock
=
doFreeColumnInfoData
(
pTsdbReadHandle
->
pResBlock
->
pDataBlock
);
taosArrayDestroy
(
pTsdbReadHandle
->
suppInfo
.
defaultLoadColumn
);
taosArrayDestroy
(
pTsdbReadHandle
->
suppInfo
.
defaultLoadColumn
);
taosMemoryFreeClear
(
pTsdbReadHandle
->
pDataBlockInfo
);
taosMemoryFreeClear
(
pTsdbReadHandle
->
pDataBlockInfo
);
...
...
source/dnode/vnode/test/tsdbSmaTest.cpp
浏览文件 @
ee821197
...
@@ -435,7 +435,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
...
@@ -435,7 +435,7 @@ TEST(testCase, tSma_Data_Insert_Query_Test) {
SSDataBlock
*
pDataBlock
=
(
SSDataBlock
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pDataBlock
=
(
SSDataBlock
*
)
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
EXPECT_NE
(
pDataBlock
,
nullptr
);
EXPECT_NE
(
pDataBlock
,
nullptr
);
pDataBlock
->
pBlockAgg
=
NULL
;
pDataBlock
->
pBlockAgg
=
NULL
;
pDataBlock
->
info
.
numOfCols
=
tSmaNumOfCols
;
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
=
tSmaNumOfCols
;
pDataBlock
->
info
.
rows
=
tSmaNumOfRows
;
pDataBlock
->
info
.
rows
=
tSmaNumOfRows
;
pDataBlock
->
info
.
groupId
=
tSmaGroupId
+
g
;
pDataBlock
->
info
.
groupId
=
tSmaGroupId
+
g
;
...
...
source/libs/catalog/inc/catalogInt.h
浏览文件 @
ee821197
...
@@ -65,6 +65,7 @@ enum {
...
@@ -65,6 +65,7 @@ enum {
typedef
enum
{
typedef
enum
{
CTG_TASK_GET_QNODE
=
0
,
CTG_TASK_GET_QNODE
=
0
,
CTG_TASK_GET_DNODE
,
CTG_TASK_GET_DB_VGROUP
,
CTG_TASK_GET_DB_VGROUP
,
CTG_TASK_GET_DB_CFG
,
CTG_TASK_GET_DB_CFG
,
CTG_TASK_GET_DB_INFO
,
CTG_TASK_GET_DB_INFO
,
...
@@ -216,6 +217,7 @@ typedef struct SCtgJob {
...
@@ -216,6 +217,7 @@ typedef struct SCtgJob {
int32_t
dbVgNum
;
int32_t
dbVgNum
;
int32_t
udfNum
;
int32_t
udfNum
;
int32_t
qnodeNum
;
int32_t
qnodeNum
;
int32_t
dnodeNum
;
int32_t
dbCfgNum
;
int32_t
dbCfgNum
;
int32_t
indexNum
;
int32_t
indexNum
;
int32_t
userNum
;
int32_t
userNum
;
...
@@ -565,6 +567,7 @@ int32_t ctgGetTbHashVgroupFromCache(SCatalog *pCtg, const SName *pTableName, SVg
...
@@ -565,6 +567,7 @@ int32_t ctgGetTbHashVgroupFromCache(SCatalog *pCtg, const SName *pTableName, SVg
int32_t
ctgProcessRspMsg
(
void
*
out
,
int32_t
reqType
,
char
*
msg
,
int32_t
msgSize
,
int32_t
rspCode
,
char
*
target
);
int32_t
ctgProcessRspMsg
(
void
*
out
,
int32_t
reqType
,
char
*
msg
,
int32_t
msgSize
,
int32_t
rspCode
,
char
*
target
);
int32_t
ctgGetDBVgInfoFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SBuildUseDBInput
*
input
,
SUseDbOutput
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetDBVgInfoFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SBuildUseDBInput
*
input
,
SUseDbOutput
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetQnodeListFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetQnodeListFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetDnodeListFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
**
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetDBCfgFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
dbFName
,
SDbCfgInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetDBCfgFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
dbFName
,
SDbCfgInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetIndexInfoFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
indexName
,
SIndexInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetIndexInfoFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
const
char
*
indexName
,
SIndexInfo
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTbIndexFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SName
*
name
,
STableIndex
*
out
,
SCtgTask
*
pTask
);
int32_t
ctgGetTbIndexFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SName
*
name
,
STableIndex
*
out
,
SCtgTask
*
pTask
);
...
...
source/libs/catalog/src/catalog.c
浏览文件 @
ee821197
...
@@ -1099,8 +1099,19 @@ _return:
...
@@ -1099,8 +1099,19 @@ _return:
CTG_API_LEAVE
(
TSDB_CODE_SUCCESS
);
CTG_API_LEAVE
(
TSDB_CODE_SUCCESS
);
}
}
int32_t
catalogGetDnodeList
(
SCatalog
*
pCatalog
,
SRequestConnInfo
*
pConn
,
SArray
**
pDnodeList
)
{
int32_t
catalogGetDnodeList
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
**
pDnodeList
)
{
return
TSDB_CODE_CTG_INVALID_INPUT
;
CTG_API_ENTER
();
int32_t
code
=
0
;
if
(
NULL
==
pCtg
||
NULL
==
pConn
||
NULL
==
pDnodeList
)
{
CTG_API_LEAVE
(
TSDB_CODE_CTG_INVALID_INPUT
);
}
CTG_ERR_JRET
(
ctgGetDnodeListFromMnode
(
pCtg
,
pConn
,
pDnodeList
,
NULL
));
_return:
CTG_API_LEAVE
(
TSDB_CODE_SUCCESS
);
}
}
int32_t
catalogGetExpiredSTables
(
SCatalog
*
pCtg
,
SSTableVersion
**
stables
,
uint32_t
*
num
)
{
int32_t
catalogGetExpiredSTables
(
SCatalog
*
pCtg
,
SSTableVersion
**
stables
,
uint32_t
*
num
)
{
...
...
source/libs/catalog/src/ctgAsync.c
浏览文件 @
ee821197
...
@@ -168,6 +168,21 @@ int32_t ctgInitGetQnodeTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
...
@@ -168,6 +168,21 @@ int32_t ctgInitGetQnodeTask(SCtgJob *pJob, int32_t taskIdx, void* param) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgInitGetDnodeTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
SCtgTask
task
=
{
0
};
task
.
type
=
CTG_TASK_GET_DNODE
;
task
.
taskId
=
taskIdx
;
task
.
pJob
=
pJob
;
task
.
taskCtx
=
NULL
;
taosArrayPush
(
pJob
->
pTasks
,
&
task
);
qDebug
(
"QID:0x%"
PRIx64
" the %d task type %s initialized"
,
pJob
->
queryId
,
taskIdx
,
ctgTaskTypeStr
(
task
.
type
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgInitGetIndexTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
int32_t
ctgInitGetIndexTask
(
SCtgJob
*
pJob
,
int32_t
taskIdx
,
void
*
param
)
{
char
*
name
=
(
char
*
)
param
;
char
*
name
=
(
char
*
)
param
;
SCtgTask
task
=
{
0
};
SCtgTask
task
=
{
0
};
...
@@ -405,6 +420,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -405,6 +420,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
int32_t
tbHashNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableHash
);
int32_t
tbHashNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableHash
);
int32_t
udfNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUdf
);
int32_t
udfNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUdf
);
int32_t
qnodeNum
=
pReq
->
qNodeRequired
?
1
:
0
;
int32_t
qnodeNum
=
pReq
->
qNodeRequired
?
1
:
0
;
int32_t
dnodeNum
=
pReq
->
dNodeRequired
?
1
:
0
;
int32_t
dbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbCfg
);
int32_t
dbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pDbCfg
);
int32_t
indexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pIndex
);
int32_t
indexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pIndex
);
int32_t
userNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUser
);
int32_t
userNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pUser
);
...
@@ -412,7 +428,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -412,7 +428,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
int32_t
tbIndexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableIndex
);
int32_t
tbIndexNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableIndex
);
int32_t
tbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableCfg
);
int32_t
tbCfgNum
=
(
int32_t
)
taosArrayGetSize
(
pReq
->
pTableCfg
);
*
taskNum
=
tbMetaNum
+
dbVgNum
+
udfNum
+
tbHashNum
+
qnodeNum
+
dbCfgNum
+
indexNum
+
userNum
+
dbInfoNum
+
tbIndexNum
+
tbCfgNum
;
*
taskNum
=
tbMetaNum
+
dbVgNum
+
udfNum
+
tbHashNum
+
qnodeNum
+
d
nodeNum
+
d
bCfgNum
+
indexNum
+
userNum
+
dbInfoNum
+
tbIndexNum
+
tbCfgNum
;
if
(
*
taskNum
<=
0
)
{
if
(
*
taskNum
<=
0
)
{
ctgDebug
(
"Empty input for job, no need to retrieve meta, reqId:0x%"
PRIx64
,
reqId
);
ctgDebug
(
"Empty input for job, no need to retrieve meta, reqId:0x%"
PRIx64
,
reqId
);
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -435,6 +451,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -435,6 +451,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
pJob
->
tbMetaNum
=
tbMetaNum
;
pJob
->
tbMetaNum
=
tbMetaNum
;
pJob
->
tbHashNum
=
tbHashNum
;
pJob
->
tbHashNum
=
tbHashNum
;
pJob
->
qnodeNum
=
qnodeNum
;
pJob
->
qnodeNum
=
qnodeNum
;
pJob
->
dnodeNum
=
dnodeNum
;
pJob
->
dbVgNum
=
dbVgNum
;
pJob
->
dbVgNum
=
dbVgNum
;
pJob
->
udfNum
=
udfNum
;
pJob
->
udfNum
=
udfNum
;
pJob
->
dbCfgNum
=
dbCfgNum
;
pJob
->
dbCfgNum
=
dbCfgNum
;
...
@@ -509,6 +526,10 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
...
@@ -509,6 +526,10 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, uint6
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_QNODE
,
NULL
,
NULL
));
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_QNODE
,
NULL
,
NULL
));
}
}
if
(
dnodeNum
)
{
CTG_ERR_JRET
(
ctgInitTask
(
pJob
,
CTG_TASK_GET_DNODE
,
NULL
,
NULL
));
}
pJob
->
refId
=
taosAddRef
(
gCtgMgmt
.
jobPool
,
pJob
);
pJob
->
refId
=
taosAddRef
(
gCtgMgmt
.
jobPool
,
pJob
);
if
(
pJob
->
refId
<
0
)
{
if
(
pJob
->
refId
<
0
)
{
ctgError
(
"add job to ref failed, error: %s"
,
tstrerror
(
terrno
));
ctgError
(
"add job to ref failed, error: %s"
,
tstrerror
(
terrno
));
...
@@ -631,6 +652,22 @@ int32_t ctgDumpQnodeRes(SCtgTask* pTask) {
...
@@ -631,6 +652,22 @@ int32_t ctgDumpQnodeRes(SCtgTask* pTask) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgDumpDnodeRes
(
SCtgTask
*
pTask
)
{
SCtgJob
*
pJob
=
pTask
->
pJob
;
if
(
NULL
==
pJob
->
jobRes
.
pDnodeList
)
{
pJob
->
jobRes
.
pDnodeList
=
taosArrayInit
(
1
,
sizeof
(
SMetaRes
));
if
(
NULL
==
pJob
->
jobRes
.
pDnodeList
)
{
CTG_ERR_RET
(
TSDB_CODE_OUT_OF_MEMORY
);
}
}
SMetaRes
res
=
{.
code
=
pTask
->
code
,
.
pRes
=
pTask
->
res
};
taosArrayPush
(
pJob
->
jobRes
.
pDnodeList
,
&
res
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgDumpDbCfgRes
(
SCtgTask
*
pTask
)
{
int32_t
ctgDumpDbCfgRes
(
SCtgTask
*
pTask
)
{
SCtgJob
*
pJob
=
pTask
->
pJob
;
SCtgJob
*
pJob
=
pTask
->
pJob
;
if
(
NULL
==
pJob
->
jobRes
.
pDbCfg
)
{
if
(
NULL
==
pJob
->
jobRes
.
pDbCfg
)
{
...
@@ -1036,6 +1073,19 @@ _return:
...
@@ -1036,6 +1073,19 @@ _return:
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
int32_t
ctgHandleGetDnodeRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
&
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
TSWAP
(
pTask
->
res
,
pTask
->
msgCtx
.
out
);
_return:
ctgHandleTaskEnd
(
pTask
,
code
);
CTG_RET
(
code
);
}
int32_t
ctgHandleGetIndexRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
ctgHandleGetIndexRsp
(
SCtgTask
*
pTask
,
int32_t
reqType
,
const
SDataBuf
*
pMsg
,
int32_t
rspCode
)
{
int32_t
code
=
0
;
int32_t
code
=
0
;
CTG_ERR_JRET
(
ctgProcessRspMsg
(
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
CTG_ERR_JRET
(
ctgProcessRspMsg
(
pTask
->
msgCtx
.
out
,
reqType
,
pMsg
->
pData
,
pMsg
->
len
,
rspCode
,
pTask
->
msgCtx
.
target
));
...
@@ -1311,6 +1361,15 @@ int32_t ctgLaunchGetQnodeTask(SCtgTask *pTask) {
...
@@ -1311,6 +1361,15 @@ int32_t ctgLaunchGetQnodeTask(SCtgTask *pTask) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgLaunchGetDnodeTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
CTG_ERR_RET
(
ctgGetDnodeListFromMnode
(
pCtg
,
pConn
,
NULL
,
pTask
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgLaunchGetDbCfgTask
(
SCtgTask
*
pTask
)
{
int32_t
ctgLaunchGetDbCfgTask
(
SCtgTask
*
pTask
)
{
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SCatalog
*
pCtg
=
pTask
->
pJob
->
pCtg
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
SRequestConnInfo
*
pConn
=
&
pTask
->
pJob
->
conn
;
...
@@ -1462,6 +1521,7 @@ int32_t ctgCloneDbVg(SCtgTask* pTask, void** pRes) {
...
@@ -1462,6 +1521,7 @@ int32_t ctgCloneDbVg(SCtgTask* pTask, void** pRes) {
SCtgAsyncFps
gCtgAsyncFps
[]
=
{
SCtgAsyncFps
gCtgAsyncFps
[]
=
{
{
ctgInitGetQnodeTask
,
ctgLaunchGetQnodeTask
,
ctgHandleGetQnodeRsp
,
ctgDumpQnodeRes
,
NULL
,
NULL
},
{
ctgInitGetQnodeTask
,
ctgLaunchGetQnodeTask
,
ctgHandleGetQnodeRsp
,
ctgDumpQnodeRes
,
NULL
,
NULL
},
{
ctgInitGetDnodeTask
,
ctgLaunchGetDnodeTask
,
ctgHandleGetDnodeRsp
,
ctgDumpDnodeRes
,
NULL
,
NULL
},
{
ctgInitGetDbVgTask
,
ctgLaunchGetDbVgTask
,
ctgHandleGetDbVgRsp
,
ctgDumpDbVgRes
,
ctgCompDbVgTasks
,
ctgCloneDbVg
},
{
ctgInitGetDbVgTask
,
ctgLaunchGetDbVgTask
,
ctgHandleGetDbVgRsp
,
ctgDumpDbVgRes
,
ctgCompDbVgTasks
,
ctgCloneDbVg
},
{
ctgInitGetDbCfgTask
,
ctgLaunchGetDbCfgTask
,
ctgHandleGetDbCfgRsp
,
ctgDumpDbCfgRes
,
NULL
,
NULL
},
{
ctgInitGetDbCfgTask
,
ctgLaunchGetDbCfgTask
,
ctgHandleGetDbCfgRsp
,
ctgDumpDbCfgRes
,
NULL
,
NULL
},
{
ctgInitGetDbInfoTask
,
ctgLaunchGetDbInfoTask
,
ctgHandleGetDbInfoRsp
,
ctgDumpDbInfoRes
,
NULL
,
NULL
},
{
ctgInitGetDbInfoTask
,
ctgLaunchGetDbInfoTask
,
ctgHandleGetDbInfoRsp
,
ctgDumpDbInfoRes
,
NULL
,
NULL
},
...
...
source/libs/catalog/src/ctgRemote.c
浏览文件 @
ee821197
...
@@ -40,6 +40,21 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
...
@@ -40,6 +40,21 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize,
qDebug
(
"Got qnode list from mnode, listNum:%d"
,
(
int32_t
)
taosArrayGetSize
(
out
));
qDebug
(
"Got qnode list from mnode, listNum:%d"
,
(
int32_t
)
taosArrayGetSize
(
out
));
break
;
break
;
}
}
case
TDMT_MND_DNODE_LIST
:
{
if
(
TSDB_CODE_SUCCESS
!=
rspCode
)
{
qError
(
"error rsp for dnode list, error:%s"
,
tstrerror
(
rspCode
));
CTG_ERR_RET
(
rspCode
);
}
code
=
queryProcessMsgRsp
[
TMSG_INDEX
(
reqType
)](
out
,
msg
,
msgSize
);
if
(
code
)
{
qError
(
"Process dnode list rsp failed, error:%s"
,
tstrerror
(
rspCode
));
CTG_ERR_RET
(
code
);
}
qDebug
(
"Got dnode list from mnode, listNum:%d"
,
(
int32_t
)
taosArrayGetSize
(
*
(
SArray
**
)
out
));
break
;
}
case
TDMT_MND_USE_DB
:
{
case
TDMT_MND_USE_DB
:
{
if
(
TSDB_CODE_SUCCESS
!=
rspCode
)
{
if
(
TSDB_CODE_SUCCESS
!=
rspCode
)
{
qError
(
"error rsp for use db, error:%s, dbFName:%s"
,
tstrerror
(
rspCode
),
target
);
qError
(
"error rsp for use db, error:%s, dbFName:%s"
,
tstrerror
(
rspCode
),
target
);
...
@@ -309,9 +324,6 @@ _return:
...
@@ -309,9 +324,6 @@ _return:
CTG_RET
(
code
);
CTG_RET
(
code
);
}
}
int32_t
ctgGetQnodeListFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
*
out
,
SCtgTask
*
pTask
)
{
int32_t
ctgGetQnodeListFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
*
out
,
SCtgTask
*
pTask
)
{
char
*
msg
=
NULL
;
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
msgLen
=
0
;
...
@@ -349,6 +361,39 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray
...
@@ -349,6 +361,39 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
ctgGetDnodeListFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SArray
**
out
,
SCtgTask
*
pTask
)
{
char
*
msg
=
NULL
;
int32_t
msgLen
=
0
;
int32_t
reqType
=
TDMT_MND_DNODE_LIST
;
void
*
(
*
mallocFp
)(
int32_t
)
=
pTask
?
taosMemoryMalloc
:
rpcMallocCont
;
ctgDebug
(
"try to get dnode list from mnode, mgmtEpInUse:%d"
,
pConn
->
mgmtEps
.
inUse
);
int32_t
code
=
queryBuildMsg
[
TMSG_INDEX
(
reqType
)](
NULL
,
&
msg
,
0
,
&
msgLen
,
mallocFp
);
if
(
code
)
{
ctgError
(
"Build dnode list msg failed, error:%s"
,
tstrerror
(
code
));
CTG_ERR_RET
(
code
);
}
if
(
pTask
)
{
CTG_ERR_RET
(
ctgUpdateMsgCtx
(
&
pTask
->
msgCtx
,
reqType
,
NULL
,
NULL
));
CTG_RET
(
ctgAsyncSendMsg
(
pCtg
,
pConn
,
pTask
,
reqType
,
msg
,
msgLen
));
}
SRpcMsg
rpcMsg
=
{
.
msgType
=
reqType
,
.
pCont
=
msg
,
.
contLen
=
msgLen
,
};
SRpcMsg
rpcRsp
=
{
0
};
rpcSendRecv
(
pConn
->
pTrans
,
&
pConn
->
mgmtEps
,
&
rpcMsg
,
&
rpcRsp
);
CTG_ERR_RET
(
ctgProcessRspMsg
(
out
,
reqType
,
rpcRsp
.
pCont
,
rpcRsp
.
contLen
,
rpcRsp
.
code
,
NULL
));
return
TSDB_CODE_SUCCESS
;
}
int32_t
ctgGetDBVgInfoFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SBuildUseDBInput
*
input
,
SUseDbOutput
*
out
,
SCtgTask
*
pTask
)
{
int32_t
ctgGetDBVgInfoFromMnode
(
SCatalog
*
pCtg
,
SRequestConnInfo
*
pConn
,
SBuildUseDBInput
*
input
,
SUseDbOutput
*
out
,
SCtgTask
*
pTask
)
{
char
*
msg
=
NULL
;
char
*
msg
=
NULL
;
...
...
source/libs/catalog/src/ctgUtil.c
浏览文件 @
ee821197
...
@@ -23,6 +23,8 @@ char *ctgTaskTypeStr(CTG_TASK_TYPE type) {
...
@@ -23,6 +23,8 @@ char *ctgTaskTypeStr(CTG_TASK_TYPE type) {
switch
(
type
)
{
switch
(
type
)
{
case
CTG_TASK_GET_QNODE
:
case
CTG_TASK_GET_QNODE
:
return
"[get qnode list]"
;
return
"[get qnode list]"
;
case
CTG_TASK_GET_DNODE
:
return
"[get dnode list]"
;
case
CTG_TASK_GET_DB_VGROUP
:
case
CTG_TASK_GET_DB_VGROUP
:
return
"[get db vgroup]"
;
return
"[get db vgroup]"
;
case
CTG_TASK_GET_DB_CFG
:
case
CTG_TASK_GET_DB_CFG
:
...
@@ -349,6 +351,11 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
...
@@ -349,6 +351,11 @@ void ctgFreeTaskRes(CTG_TASK_TYPE type, void **pRes) {
*
pRes
=
NULL
;
*
pRes
=
NULL
;
break
;
break
;
}
}
case
CTG_TASK_GET_DNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_TB_META
:
{
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
taosMemoryFreeClear
(
*
pRes
);
break
;
break
;
...
@@ -413,6 +420,11 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
...
@@ -413,6 +420,11 @@ void ctgFreeSubTaskRes(CTG_TASK_TYPE type, void **pRes) {
*
pRes
=
NULL
;
*
pRes
=
NULL
;
break
;
break
;
}
}
case
CTG_TASK_GET_DNODE
:
{
taosArrayDestroy
((
SArray
*
)
*
pRes
);
*
pRes
=
NULL
;
break
;
}
case
CTG_TASK_GET_TB_META
:
{
case
CTG_TASK_GET_TB_META
:
{
taosMemoryFreeClear
(
*
pRes
);
taosMemoryFreeClear
(
*
pRes
);
break
;
break
;
...
...
source/libs/command/src/command.c
浏览文件 @
ee821197
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "tdatablock.h"
#include "tdatablock.h"
#include "tglobal.h"
#include "tglobal.h"
extern
SConfig
*
tsCfg
;
static
int32_t
getSchemaBytes
(
const
SSchema
*
pSchema
)
{
static
int32_t
getSchemaBytes
(
const
SSchema
*
pSchema
)
{
switch
(
pSchema
->
type
)
{
switch
(
pSchema
->
type
)
{
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_BINARY
:
...
@@ -31,31 +32,19 @@ static int32_t getSchemaBytes(const SSchema* pSchema) {
...
@@ -31,31 +32,19 @@ static int32_t getSchemaBytes(const SSchema* pSchema) {
}
}
static
SSDataBlock
*
buildDescResultDataBlock
()
{
static
SSDataBlock
*
buildDescResultDataBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
createDataBlock
();
pBlock
->
info
.
numOfCols
=
DESCRIBE_RESULT_COLS
;
pBlock
->
info
.
hasVarCol
=
true
;
pBlock
->
pDataBlock
=
taosArrayInit
(
4
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
DESCRIBE_RESULT_FIELD_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
DESCRIBE_RESULT_TYPE_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_INT
;
SColumnInfoData
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
DESCRIBE_RESULT_FIELD_LEN
,
1
)
;
infoData
.
info
.
bytes
=
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
;
blockDataAppendColInfo
(
pBlock
,
&
infoData
)
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
DESCRIBE_RESULT_TYPE_LEN
,
2
);
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_INT
,
tDataTypes
[
TSDB_DATA_TYPE_INT
].
bytes
,
3
);
infoData
.
info
.
bytes
=
DESCRIBE_RESULT_NOTE_LEN
;
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
DESCRIBE_RESULT_NOTE_LEN
,
4
);
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
return
pBlock
;
return
pBlock
;
}
}
...
@@ -126,22 +115,12 @@ static int32_t execResetQueryCache() { return catalogClearCache(); }
...
@@ -126,22 +115,12 @@ static int32_t execResetQueryCache() { return catalogClearCache(); }
static
SSDataBlock
*
buildCreateDBResultDataBlock
()
{
static
SSDataBlock
*
buildCreateDBResultDataBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
createDataBlock
();
pBlock
->
info
.
numOfCols
=
SHOW_CREATE_DB_RESULT_COLS
;
SColumnInfoData
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
SHOW_CREATE_DB_RESULT_COLS
,
1
);
pBlock
->
info
.
hasVarCol
=
true
;
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
pBlock
->
pDataBlock
=
taosArrayInit
(
pBlock
->
info
.
numOfCols
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_CREATE_DB_RESULT_FIELD1_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_CREATE_DB_RESULT_FIELD2_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
SHOW_CREATE_DB_RESULT_FIELD2_LEN
,
2
);
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
return
pBlock
;
return
pBlock
;
}
}
...
@@ -283,21 +262,13 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT
...
@@ -283,21 +262,13 @@ static int32_t execShowCreateDatabase(SShowCreateDatabaseStmt* pStmt, SRetrieveT
}
}
static
SSDataBlock
*
buildCreateTbResultDataBlock
()
{
static
SSDataBlock
*
buildCreateTbResultDataBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
createDataBlock
();
pBlock
->
info
.
numOfCols
=
SHOW_CREATE_TB_RESULT_COLS
;
pBlock
->
info
.
hasVarCol
=
true
;
pBlock
->
pDataBlock
=
taosArrayInit
(
pBlock
->
info
.
numOfCols
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
SHOW_CREATE_TB_RESULT_FIELD1_LEN
,
1
);
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
SColumnInfoData
infoData
=
{
0
};
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
SHOW_CREATE_TB_RESULT_FIELD2_LEN
,
2
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
infoData
.
info
.
bytes
=
SHOW_CREATE_TB_RESULT_FIELD1_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_CREATE_TB_RESULT_FIELD2_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
return
pBlock
;
return
pBlock
;
}
}
...
@@ -551,7 +522,84 @@ static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt, SRetrieveTableR
...
@@ -551,7 +522,84 @@ static int32_t execShowCreateSTable(SShowCreateTableStmt* pStmt, SRetrieveTableR
static
int32_t
execAlterLocal
(
SAlterLocalStmt
*
pStmt
)
{
return
TSDB_CODE_FAILED
;
}
static
int32_t
execAlterLocal
(
SAlterLocalStmt
*
pStmt
)
{
return
TSDB_CODE_FAILED
;
}
static
int32_t
execShowLocalVariables
()
{
return
TSDB_CODE_FAILED
;
}
static
SSDataBlock
*
buildLocalVariablesResultDataBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
pBlock
->
info
.
hasVarCol
=
true
;
pBlock
->
pDataBlock
=
taosArrayInit
(
SHOW_LOCAL_VARIABLES_RESULT_COLS
,
sizeof
(
SColumnInfoData
));
SColumnInfoData
infoData
=
{
0
};
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_LOCAL_VARIABLES_RESULT_FIELD1_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
infoData
.
info
.
bytes
=
SHOW_LOCAL_VARIABLES_RESULT_FIELD2_LEN
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
return
pBlock
;
}
int32_t
setLocalVariablesResultIntoDataBlock
(
SSDataBlock
*
pBlock
)
{
int32_t
numOfCfg
=
taosArrayGetSize
(
tsCfg
->
array
);
int32_t
numOfRows
=
0
;
blockDataEnsureCapacity
(
pBlock
,
numOfCfg
);
for
(
int32_t
i
=
0
,
c
=
0
;
i
<
numOfCfg
;
++
i
,
c
=
0
)
{
SConfigItem
*
pItem
=
taosArrayGet
(
tsCfg
->
array
,
i
);
char
name
[
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
STR_WITH_MAXSIZE_TO_VARSTR
(
name
,
pItem
->
name
,
TSDB_CONFIG_OPTION_LEN
+
VARSTR_HEADER_SIZE
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
name
,
false
);
char
value
[
TSDB_CONFIG_VALUE_LEN
+
VARSTR_HEADER_SIZE
]
=
{
0
};
int32_t
valueLen
=
0
;
cfgDumpItemValue
(
pItem
,
&
value
[
VARSTR_HEADER_SIZE
],
TSDB_CONFIG_VALUE_LEN
,
&
valueLen
);
varDataSetLen
(
value
,
valueLen
);
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
c
++
);
colDataAppend
(
pColInfo
,
i
,
value
,
false
);
numOfRows
++
;
}
pBlock
->
info
.
rows
=
numOfRows
;
return
TSDB_CODE_SUCCESS
;
}
static
int32_t
execShowLocalVariables
(
SRetrieveTableRsp
**
pRsp
)
{
SSDataBlock
*
pBlock
=
buildLocalVariablesResultDataBlock
();
int32_t
code
=
setLocalVariablesResultIntoDataBlock
(
pBlock
);
if
(
code
)
{
return
code
;
}
size_t
rspSize
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
*
pRsp
=
taosMemoryCalloc
(
1
,
rspSize
);
if
(
NULL
==
*
pRsp
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
(
*
pRsp
)
->
useconds
=
0
;
(
*
pRsp
)
->
completed
=
1
;
(
*
pRsp
)
->
precision
=
0
;
(
*
pRsp
)
->
compressed
=
0
;
(
*
pRsp
)
->
compLen
=
0
;
(
*
pRsp
)
->
numOfRows
=
htonl
(
pBlock
->
info
.
rows
);
(
*
pRsp
)
->
numOfCols
=
htonl
(
SHOW_LOCAL_VARIABLES_RESULT_COLS
);
int32_t
len
=
0
;
blockCompressEncode
(
pBlock
,
(
*
pRsp
)
->
data
,
&
len
,
SHOW_LOCAL_VARIABLES_RESULT_COLS
,
false
);
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
blockDataDestroy
(
pBlock
);
return
TSDB_CODE_SUCCESS
;
}
int32_t
qExecCommand
(
SNode
*
pStmt
,
SRetrieveTableRsp
**
pRsp
)
{
int32_t
qExecCommand
(
SNode
*
pStmt
,
SRetrieveTableRsp
**
pRsp
)
{
switch
(
nodeType
(
pStmt
))
{
switch
(
nodeType
(
pStmt
))
{
...
@@ -568,7 +616,7 @@ int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) {
...
@@ -568,7 +616,7 @@ int32_t qExecCommand(SNode* pStmt, SRetrieveTableRsp** pRsp) {
case
QUERY_NODE_ALTER_LOCAL_STMT
:
case
QUERY_NODE_ALTER_LOCAL_STMT
:
return
execAlterLocal
((
SAlterLocalStmt
*
)
pStmt
);
return
execAlterLocal
((
SAlterLocalStmt
*
)
pStmt
);
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
case
QUERY_NODE_SHOW_LOCAL_VARIABLES_STMT
:
return
execShowLocalVariables
();
return
execShowLocalVariables
(
pRsp
);
default:
default:
break
;
break
;
}
}
...
...
source/libs/command/src/explain.c
浏览文件 @
ee821197
...
@@ -1190,17 +1190,12 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) {
...
@@ -1190,17 +1190,12 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) {
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
QRY_ERR_RET
(
TSDB_CODE_QRY_APP_ERROR
);
}
}
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
createDataBlock
();
SColumnInfoData
infoData
=
{
0
};
SColumnInfoData
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_VARCHAR
,
TSDB_EXPLAIN_RESULT_ROW_SIZE
,
1
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_VARCHAR
;
blockDataAppendColInfo
(
pBlock
,
&
infoData
);
infoData
.
info
.
bytes
=
TSDB_EXPLAIN_RESULT_ROW_SIZE
;
blockDataEnsureCapacity
(
pBlock
,
rowNum
);
pBlock
->
pDataBlock
=
taosArrayInit
(
1
,
sizeof
(
SColumnInfoData
));
taosArrayPush
(
pBlock
->
pDataBlock
,
&
infoData
);
SColumnInfoData
*
pInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
SColumnInfoData
*
pInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
pInfoData
->
hasNull
=
false
;
colInfoDataEnsureCapacity
(
pInfoData
,
0
,
rowNum
);
char
buf
[
1024
]
=
{
0
};
char
buf
[
1024
]
=
{
0
};
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
rowNum
;
++
i
)
{
...
@@ -1210,9 +1205,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) {
...
@@ -1210,9 +1205,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) {
colDataAppend
(
pInfoData
,
i
,
buf
,
false
);
colDataAppend
(
pInfoData
,
i
,
buf
,
false
);
}
}
pBlock
->
info
.
numOfCols
=
1
;
pBlock
->
info
.
rows
=
rowNum
;
pBlock
->
info
.
rows
=
rowNum
;
pBlock
->
info
.
hasVarCol
=
true
;
int32_t
rspSize
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
int32_t
rspSize
=
sizeof
(
SRetrieveTableRsp
)
+
blockGetEncodeSize
(
pBlock
);
...
@@ -1226,7 +1219,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) {
...
@@ -1226,7 +1219,7 @@ int32_t qExplainGetRspFromCtx(void *ctx, SRetrieveTableRsp **pRsp) {
rsp
->
numOfRows
=
htonl
(
rowNum
);
rsp
->
numOfRows
=
htonl
(
rowNum
);
int32_t
len
=
0
;
int32_t
len
=
0
;
blockCompressEncode
(
pBlock
,
rsp
->
data
,
&
len
,
pBlock
->
info
.
numOfCols
,
0
);
blockCompressEncode
(
pBlock
,
rsp
->
data
,
&
len
,
taosArrayGetSize
(
pBlock
->
pDataBlock
)
,
0
);
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
ASSERT
(
len
==
rspSize
-
sizeof
(
SRetrieveTableRsp
));
rsp
->
compLen
=
htonl
(
len
);
rsp
->
compLen
=
htonl
(
len
);
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
ee821197
...
@@ -336,11 +336,10 @@ typedef struct SStreamBlockScanInfo {
...
@@ -336,11 +336,10 @@ typedef struct SStreamBlockScanInfo {
int32_t
numOfPseudoExpr
;
int32_t
numOfPseudoExpr
;
int32_t
primaryTsIndex
;
// primary time stamp slot id
int32_t
primaryTsIndex
;
// primary time stamp slot id
void
*
pDataReader
;
SReadHandle
readHandle
;
SReadHandle
readHandle
;
uint64_t
tableUid
;
// queried super table uid
uint64_t
tableUid
;
// queried super table uid
EStreamScanMode
scanMode
;
EStreamScanMode
scanMode
;
SOperatorInfo
*
p
OperatorDumy
;
SOperatorInfo
*
p
SnapshotReadOp
;
SInterval
interval
;
// if the upstream is an interval operator, the interval info is also kept here.
SInterval
interval
;
// if the upstream is an interval operator, the interval info is also kept here.
SArray
*
childIds
;
SArray
*
childIds
;
SessionWindowSupporter
sessionSup
;
SessionWindowSupporter
sessionSup
;
...
...
source/libs/executor/src/dataDeleter.c
浏览文件 @
ee821197
...
@@ -75,7 +75,7 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp
...
@@ -75,7 +75,7 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
SDataCacheEntry
*
pEntry
=
(
SDataCacheEntry
*
)
pBuf
->
pData
;
pEntry
->
compressed
=
0
;
pEntry
->
compressed
=
0
;
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
numOfRows
=
pInput
->
pData
->
info
.
rows
;
pEntry
->
numOfCols
=
pInput
->
pData
->
info
.
numOfCols
;
pEntry
->
numOfCols
=
taosArrayGetSize
(
pInput
->
pData
->
pDataBlock
)
;
pEntry
->
dataLen
=
sizeof
(
SDeleterRes
);
pEntry
->
dataLen
=
sizeof
(
SDeleterRes
);
ASSERT
(
1
==
pEntry
->
numOfRows
);
ASSERT
(
1
==
pEntry
->
numOfRows
);
...
@@ -86,7 +86,7 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp
...
@@ -86,7 +86,7 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp
SColumnInfoData
*
pColRes
=
(
SColumnInfoData
*
)
taosArrayGet
(
pInput
->
pData
->
pDataBlock
,
0
);
SColumnInfoData
*
pColRes
=
(
SColumnInfoData
*
)
taosArrayGet
(
pInput
->
pData
->
pDataBlock
,
0
);
SDeleterRes
*
pRes
=
(
SDeleterRes
*
)
pEntry
->
data
;
SDeleterRes
*
pRes
=
(
SDeleterRes
*
)
pEntry
->
data
;
pRes
->
uid
=
pHandle
->
pDeleter
->
tableI
d
;
pRes
->
suid
=
pHandle
->
pParam
->
sui
d
;
pRes
->
uidList
=
pHandle
->
pParam
->
pUidList
;
pRes
->
uidList
=
pHandle
->
pParam
->
pUidList
;
pRes
->
skey
=
pHandle
->
pDeleter
->
deleteTimeRange
.
skey
;
pRes
->
skey
=
pHandle
->
pDeleter
->
deleteTimeRange
.
skey
;
pRes
->
ekey
=
pHandle
->
pDeleter
->
deleteTimeRange
.
ekey
;
pRes
->
ekey
=
pHandle
->
pDeleter
->
deleteTimeRange
.
ekey
;
...
...
source/libs/executor/src/executil.c
浏览文件 @
ee821197
...
@@ -183,34 +183,24 @@ SArray* createSortInfo(SNodeList* pNodeList) {
...
@@ -183,34 +183,24 @@ SArray* createSortInfo(SNodeList* pNodeList) {
SSDataBlock
*
createResDataBlock
(
SDataBlockDescNode
*
pNode
)
{
SSDataBlock
*
createResDataBlock
(
SDataBlockDescNode
*
pNode
)
{
int32_t
numOfCols
=
LIST_LENGTH
(
pNode
->
pSlots
);
int32_t
numOfCols
=
LIST_LENGTH
(
pNode
->
pSlots
);
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
createDataBlock
();
pBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
pBlock
->
info
.
blockId
=
pNode
->
dataBlockId
;
pBlock
->
info
.
blockId
=
pNode
->
dataBlockId
;
pBlock
->
info
.
rowSize
=
pNode
->
totalRowSize
;
// todo ??
pBlock
->
info
.
type
=
STREAM_INVALID
;
pBlock
->
info
.
type
=
STREAM_INVALID
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
idata
=
{{
0
}};
SSlotDescNode
*
pDescNode
=
(
SSlotDescNode
*
)
nodesListGetNode
(
pNode
->
pSlots
,
i
);
SSlotDescNode
*
pDescNode
=
(
SSlotDescNode
*
)
nodesListGetNode
(
pNode
->
pSlots
,
i
);
// if (!pDescNode->output) { // todo disable it temporarily
// if (!pDescNode->output) { // todo disable it temporarily
// continue;
// continue;
// }
// }
idata
.
info
.
type
=
pDescNode
->
dataType
.
type
;
SColumnInfoData
idata
=
createColumnInfoData
(
pDescNode
->
dataType
.
type
,
pDescNode
->
dataType
.
bytes
,
pDescNode
->
slotId
);
idata
.
info
.
bytes
=
pDescNode
->
dataType
.
bytes
;
idata
.
info
.
scale
=
pDescNode
->
dataType
.
scale
;
idata
.
info
.
scale
=
pDescNode
->
dataType
.
scale
;
idata
.
info
.
slotId
=
pDescNode
->
slotId
;
idata
.
info
.
precision
=
pDescNode
->
dataType
.
precision
;
idata
.
info
.
precision
=
pDescNode
->
dataType
.
precision
;
if
(
IS_VAR_DATA_TYPE
(
idata
.
info
.
type
))
{
blockDataAppendColInfo
(
pBlock
,
&
idata
);
pBlock
->
info
.
hasVarCol
=
true
;
}
}
taosArrayPush
(
pBlock
->
pDataBlock
,
&
idata
);
}
pBlock
->
info
.
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
return
pBlock
;
return
pBlock
;
}
}
...
@@ -300,6 +290,8 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
...
@@ -300,6 +290,8 @@ int32_t getTableList(void* metaHandle, SScanPhysiNode* pScanNode, STableListInfo
uint64_t
tableUid
=
pScanNode
->
uid
;
uint64_t
tableUid
=
pScanNode
->
uid
;
pListInfo
->
suid
=
pScanNode
->
suid
;
SNode
*
pTagCond
=
(
SNode
*
)
pListInfo
->
pTagCond
;
SNode
*
pTagCond
=
(
SNode
*
)
pListInfo
->
pTagCond
;
SNode
*
pTagIndexCond
=
(
SNode
*
)
pListInfo
->
pTagIndexCond
;
SNode
*
pTagIndexCond
=
(
SNode
*
)
pListInfo
->
pTagIndexCond
;
if
(
pScanNode
->
tableType
==
TSDB_SUPER_TABLE
)
{
if
(
pScanNode
->
tableType
==
TSDB_SUPER_TABLE
)
{
...
@@ -696,7 +688,7 @@ void relocateColumnData(SSDataBlock* pBlock, const SArray* pColMatchInfo, SArray
...
@@ -696,7 +688,7 @@ void relocateColumnData(SSDataBlock* pBlock, const SArray* pColMatchInfo, SArray
if
(
p
->
info
.
colId
==
pmInfo
->
colId
)
{
if
(
p
->
info
.
colId
==
pmInfo
->
colId
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
colDataAssign
(
pDst
,
p
,
pBlock
->
info
.
rows
);
colDataAssign
(
pDst
,
p
,
pBlock
->
info
.
rows
,
&
pBlock
->
info
);
i
++
;
i
++
;
j
++
;
j
++
;
}
else
if
(
p
->
info
.
colId
<
pmInfo
->
colId
)
{
}
else
if
(
p
->
info
.
colId
<
pmInfo
->
colId
)
{
...
...
source/libs/executor/src/executor.c
浏览文件 @
ee821197
...
@@ -67,6 +67,9 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -67,6 +67,9 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
taosArrayAddAll
(
p
->
pDataBlock
,
pDataBlock
->
pDataBlock
);
taosArrayAddAll
(
p
->
pDataBlock
,
pDataBlock
->
pDataBlock
);
taosArrayPush
(
pInfo
->
pBlockLists
,
&
p
);
taosArrayPush
(
pInfo
->
pBlockLists
,
&
p
);
}
}
}
else
if
(
type
==
STREAM_DATA_TYPE_FROM_SNAPSHOT
)
{
// do nothing
ASSERT
(
pInfo
->
blockType
==
STREAM_DATA_TYPE_FROM_SNAPSHOT
);
}
else
{
}
else
{
ASSERT
(
0
);
ASSERT
(
0
);
}
}
...
@@ -75,6 +78,14 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
...
@@ -75,6 +78,14 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu
}
}
}
}
int32_t
qStreamScanSnapshot
(
qTaskInfo_t
tinfo
)
{
if
(
tinfo
==
NULL
)
{
return
TSDB_CODE_QRY_APP_ERROR
;
}
SExecTaskInfo
*
pTaskInfo
=
(
SExecTaskInfo
*
)
tinfo
;
return
doSetStreamBlock
(
pTaskInfo
->
pRoot
,
NULL
,
0
,
STREAM_DATA_TYPE_FROM_SNAPSHOT
,
0
,
NULL
);
}
int32_t
qSetStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
input
,
int32_t
type
,
bool
assignUid
)
{
int32_t
qSetStreamInput
(
qTaskInfo_t
tinfo
,
const
void
*
input
,
int32_t
type
,
bool
assignUid
)
{
return
qSetMultiStreamInput
(
tinfo
,
input
,
1
,
type
,
assignUid
);
return
qSetMultiStreamInput
(
tinfo
,
input
,
1
,
type
,
assignUid
);
}
}
...
@@ -106,14 +117,6 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, void* streamReadHandle) {
...
@@ -106,14 +117,6 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, void* streamReadHandle) {
return
NULL
;
return
NULL
;
}
}
// print those info into log
#if 0
pMsg->sId = pMsg->sId;
pMsg->queryId = pMsg->queryId;
pMsg->taskId = pMsg->taskId;
pMsg->contentLen = pMsg->contentLen;
#endif
/*qDebugL("stream task string %s", (const char*)msg);*/
/*qDebugL("stream task string %s", (const char*)msg);*/
struct
SSubplan
*
plan
=
NULL
;
struct
SSubplan
*
plan
=
NULL
;
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
ee821197
...
@@ -356,7 +356,7 @@ void initExecTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pQueryWindow
...
@@ -356,7 +356,7 @@ void initExecTimeWindowInfo(SColumnInfoData* pColData, STimeWindow* pQueryWindow
pColData
->
info
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pColData
->
info
.
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
pColData
->
info
.
bytes
=
sizeof
(
int64_t
);
pColData
->
info
.
bytes
=
sizeof
(
int64_t
);
colInfoDataEnsureCapacity
(
pColData
,
0
,
5
);
colInfoDataEnsureCapacity
(
pColData
,
5
);
colDataAppendInt64
(
pColData
,
0
,
&
pQueryWindow
->
skey
);
colDataAppendInt64
(
pColData
,
0
,
&
pQueryWindow
->
skey
);
colDataAppendInt64
(
pColData
,
1
,
&
pQueryWindow
->
ekey
);
colDataAppendInt64
(
pColData
,
1
,
&
pQueryWindow
->
ekey
);
...
@@ -458,7 +458,7 @@ static int32_t doCreateConstantValColumnInfo(SInputColumnInfoData* pInput, SFunc
...
@@ -458,7 +458,7 @@ static int32_t doCreateConstantValColumnInfo(SInputColumnInfoData* pInput, SFunc
pColInfo
=
pInput
->
pData
[
paramIndex
];
pColInfo
=
pInput
->
pData
[
paramIndex
];
}
}
colInfoDataEnsureCapacity
(
pColInfo
,
0
,
numOfRows
);
colInfoDataEnsureCapacity
(
pColInfo
,
numOfRows
);
int8_t
type
=
pFuncParam
->
param
.
nType
;
int8_t
type
=
pFuncParam
->
param
.
nType
;
if
(
type
==
TSDB_DATA_TYPE_BIGINT
||
type
==
TSDB_DATA_TYPE_UBIGINT
)
{
if
(
type
==
TSDB_DATA_TYPE_BIGINT
||
type
==
TSDB_DATA_TYPE_UBIGINT
)
{
...
@@ -579,7 +579,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
...
@@ -579,7 +579,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
colDataMergeCol
(
pColInfoData
,
pResult
->
info
.
rows
,
&
pResult
->
info
.
capacity
,
pfCtx
->
input
.
pData
[
0
],
colDataMergeCol
(
pColInfoData
,
pResult
->
info
.
rows
,
&
pResult
->
info
.
capacity
,
pfCtx
->
input
.
pData
[
0
],
pfCtx
->
input
.
numOfRows
);
pfCtx
->
input
.
numOfRows
);
}
else
{
}
else
{
colDataAssign
(
pColInfoData
,
pfCtx
->
input
.
pData
[
0
],
pfCtx
->
input
.
numOfRows
);
colDataAssign
(
pColInfoData
,
pfCtx
->
input
.
pData
[
0
],
pfCtx
->
input
.
numOfRows
,
&
pResult
->
info
);
}
}
numOfRows
=
pfCtx
->
input
.
numOfRows
;
numOfRows
=
pfCtx
->
input
.
numOfRows
;
...
@@ -1186,7 +1186,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
...
@@ -1186,7 +1186,7 @@ int32_t loadDataBlockOnDemand(SExecTaskInfo* pTaskInfo, STableScanInfo* pTableSc
// }
// }
// if (pQueryAttr->pFilters != NULL) {
// if (pQueryAttr->pFilters != NULL) {
// filterSetColFieldData(pQueryAttr->pFilters,
pBlock->info.numOfCols
, pBlock->pDataBlock);
// filterSetColFieldData(pQueryAttr->pFilters,
taosArrayGetSize(pBlock->pDataBlock)
, pBlock->pDataBlock);
// }
// }
// if (pQueryAttr->pFilters != NULL || pRuntimeEnv->pTsBuf != NULL) {
// if (pQueryAttr->pFilters != NULL || pRuntimeEnv->pTsBuf != NULL) {
...
@@ -1321,7 +1321,8 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
...
@@ -1321,7 +1321,8 @@ void doFilter(const SNode* pFilterNode, SSDataBlock* pBlock) {
// todo move to the initialization function
// todo move to the initialization function
int32_t
code
=
filterInitFromNode
((
SNode
*
)
pFilterNode
,
&
filter
,
0
);
int32_t
code
=
filterInitFromNode
((
SNode
*
)
pFilterNode
,
&
filter
,
0
);
SFilterColumnParam
param1
=
{.
numOfCols
=
pBlock
->
info
.
numOfCols
,
.
pDataBlock
=
pBlock
->
pDataBlock
};
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
SFilterColumnParam
param1
=
{.
numOfCols
=
numOfCols
,
.
pDataBlock
=
pBlock
->
pDataBlock
};
code
=
filterSetDataFromSlotId
(
filter
,
&
param1
);
code
=
filterSetDataFromSlotId
(
filter
,
&
param1
);
int8_t
*
rowRes
=
NULL
;
int8_t
*
rowRes
=
NULL
;
...
@@ -1343,7 +1344,8 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR
...
@@ -1343,7 +1344,8 @@ void extractQualifiedTupleByFilterResult(SSDataBlock* pBlock, const int8_t* rowR
int32_t
totalRows
=
pBlock
->
info
.
rows
;
int32_t
totalRows
=
pBlock
->
info
.
rows
;
SSDataBlock
*
px
=
createOneDataBlock
(
pBlock
,
true
);
SSDataBlock
*
px
=
createOneDataBlock
(
pBlock
,
true
);
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pSrc
=
taosArrayGet
(
px
->
pDataBlock
,
i
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
px
->
pDataBlock
,
i
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
// it is a reserved column for scalar function, and no data in this column yet.
// it is a reserved column for scalar function, and no data in this column yet.
...
@@ -2045,8 +2047,9 @@ int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLo
...
@@ -2045,8 +2047,9 @@ int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLo
int32_t
compLen
,
int32_t
numOfOutput
,
int64_t
startTs
,
uint64_t
*
total
,
int32_t
compLen
,
int32_t
numOfOutput
,
int64_t
startTs
,
uint64_t
*
total
,
SArray
*
pColList
)
{
SArray
*
pColList
)
{
if
(
pColList
==
NULL
)
{
// data from other sources
if
(
pColList
==
NULL
)
{
// data from other sources
blockDataCleanup
(
pRes
);
// blockDataEnsureCapacity(pRes, numOfRows);
blockCompressDecode
(
pRes
,
numOfOutput
,
numOfRows
,
pData
);
blockCompressDecode
(
pRes
,
numOfOutput
,
numOfRows
,
pData
);
pRes
->
info
.
rows
=
numOfRows
;
}
else
{
// extract data according to pColList
}
else
{
// extract data according to pColList
ASSERT
(
numOfOutput
==
taosArrayGetSize
(
pColList
));
ASSERT
(
numOfOutput
==
taosArrayGetSize
(
pColList
));
char
*
pStart
=
pData
;
char
*
pStart
=
pData
;
...
@@ -2064,32 +2067,19 @@ int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLo
...
@@ -2064,32 +2067,19 @@ int32_t extractDataBlockFromFetchRsp(SSDataBlock* pRes, SLoadRemoteDataInfo* pLo
pStart
+=
sizeof
(
SSysTableSchema
);
pStart
+=
sizeof
(
SSysTableSchema
);
}
}
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pBlock
=
createDataBlock
();
pBlock
->
pDataBlock
=
taosArrayInit
(
numOfCols
,
sizeof
(
SColumnInfoData
));
pBlock
->
info
.
numOfCols
=
numOfCols
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
idata
=
{
0
};
SColumnInfoData
idata
=
createColumnInfoData
(
pSchema
[
i
].
type
,
pSchema
[
i
].
bytes
,
pSchema
[
i
].
colId
);
blockDataAppendColInfo
(
pBlock
,
&
idata
);
idata
.
info
.
type
=
pSchema
[
i
].
type
;
idata
.
info
.
bytes
=
pSchema
[
i
].
bytes
;
idata
.
info
.
colId
=
pSchema
[
i
].
colId
;
idata
.
hasNull
=
true
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
idata
);
if
(
IS_VAR_DATA_TYPE
(
idata
.
info
.
type
))
{
pBlock
->
info
.
hasVarCol
=
true
;
}
}
}
blockCompressDecode
(
pBlock
,
numOfCols
,
numOfRows
,
pStart
);
blockCompressDecode
(
pBlock
,
numOfCols
,
numOfRows
,
pStart
);
blockDataEnsureCapacity
(
pRes
,
numOfRows
);
// data from mnode
// data from mnode
pRes
->
info
.
rows
=
numOfRows
;
pRes
->
info
.
rows
=
numOfRows
;
relocateColumnData
(
pRes
,
pColList
,
pBlock
->
pDataBlock
,
false
);
relocateColumnData
(
pRes
,
pColList
,
pBlock
->
pDataBlock
,
false
);
taosArrayDestroy
(
pBlock
->
pDataBlock
);
blockDataDestroy
(
pBlock
);
taosMemoryFree
(
pBlock
);
// blockDataDestroy(pBlock);
}
}
// todo move this to time window aggregator, since the primary timestamp may not be known by exchange operator.
// todo move this to time window aggregator, since the primary timestamp may not be known by exchange operator.
...
@@ -2420,7 +2410,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
...
@@ -2420,7 +2410,7 @@ SOperatorInfo* createExchangeOperatorInfo(void* pTransporter, SExchangePhysiNode
pOperator
->
blocking
=
false
;
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
exprSupp
.
numOfExprs
=
pInfo
->
pResult
->
info
.
numOfCols
;
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pResult
->
pDataBlock
)
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
fpSet
=
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
NULL
,
pOperator
->
fpSet
=
createOperatorFpSet
(
prepareLoadRemoteData
,
doLoadRemoteData
,
NULL
,
NULL
,
...
@@ -2542,9 +2532,6 @@ static void doMergeImpl(SOperatorInfo* pOperator, int32_t numOfExpr, SSDataBlock
...
@@ -2542,9 +2532,6 @@ static void doMergeImpl(SOperatorInfo* pOperator, int32_t numOfExpr, SSDataBlock
SSortedMergeOperatorInfo
*
pInfo
=
pOperator
->
info
;
SSortedMergeOperatorInfo
*
pInfo
=
pOperator
->
info
;
SqlFunctionCtx
*
pCtx
=
pOperator
->
exprSupp
.
pCtx
;
SqlFunctionCtx
*
pCtx
=
pOperator
->
exprSupp
.
pCtx
;
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
// pCtx[i].size = 1;
}
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
rows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
rows
;
++
i
)
{
if
(
!
pInfo
->
hasGroupVal
)
{
if
(
!
pInfo
->
hasGroupVal
)
{
...
@@ -2653,7 +2640,7 @@ SSDataBlock* getSortedMergeBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo
...
@@ -2653,7 +2640,7 @@ SSDataBlock* getSortedMergeBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
,
&
pDataBlock
->
info
);
}
}
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
...
@@ -3993,8 +3980,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -3993,8 +3980,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
==
type
)
{
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_SCAN
==
type
)
{
STableScanPhysiNode
*
pTableScanNode
=
(
STableScanPhysiNode
*
)
pPhyNode
;
STableScanPhysiNode
*
pTableScanNode
=
(
STableScanPhysiNode
*
)
pPhyNode
;
tsdbReaderT
pDataReader
=
tsdbReaderT
pDataReader
=
doCreateDataReader
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
(
uint64_t
)
queryId
,
taskId
);
doCreateDataReader
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
(
uint64_t
)
queryId
,
taskId
);
if
(
pDataReader
==
NULL
&&
terrno
!=
0
)
{
if
(
pDataReader
==
NULL
&&
terrno
!=
0
)
{
pTaskInfo
->
code
=
terrno
;
pTaskInfo
->
code
=
terrno
;
return
NULL
;
return
NULL
;
...
@@ -4020,16 +4006,20 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4020,16 +4006,20 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
return
pOperator
;
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TABLE_MERGE_SCAN
==
type
)
{
STableMergeScanPhysiNode
*
pTableScanNode
=
(
STableMergeScanPhysiNode
*
)
pPhyNode
;
STableMergeScanPhysiNode
*
pTableScanNode
=
(
STableMergeScanPhysiNode
*
)
pPhyNode
;
createScanTableListInfo
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
queryId
,
taskId
);
createScanTableListInfo
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
queryId
,
taskId
);
extractTableSchemaVersion
(
pHandle
,
pTableScanNode
->
scan
.
uid
,
pTaskInfo
);
extractTableSchemaVersion
(
pHandle
,
pTableScanNode
->
scan
.
uid
,
pTaskInfo
);
SOperatorInfo
*
pOperator
=
createTableMergeScanOperatorInfo
(
pTableScanNode
,
pTableListInfo
,
pHandle
,
pTaskInfo
,
queryId
,
taskId
);
SOperatorInfo
*
pOperator
=
createTableMergeScanOperatorInfo
(
pTableScanNode
,
pTableListInfo
,
pHandle
,
pTaskInfo
,
queryId
,
taskId
);
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
STableScanInfo
*
pScanInfo
=
pOperator
->
info
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
pTaskInfo
->
cost
.
pRecoder
=
&
pScanInfo
->
readRecorder
;
return
pOperator
;
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_EXCHANGE
==
type
)
{
return
createExchangeOperatorInfo
(
pHandle
->
pMsgCb
->
clientRpc
,
(
SExchangePhysiNode
*
)
pPhyNode
,
pTaskInfo
);
return
createExchangeOperatorInfo
(
pHandle
->
pMsgCb
->
clientRpc
,
(
SExchangePhysiNode
*
)
pPhyNode
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN
==
type
)
{
SScanPhysiNode
*
pScanPhyNode
=
(
SScanPhysiNode
*
)
pPhyNode
;
// simple child table.
SScanPhysiNode
*
pScanPhyNode
=
(
SScanPhysiNode
*
)
pPhyNode
;
// simple child table.
STableScanPhysiNode
*
pTableScanNode
=
(
STableScanPhysiNode
*
)
pPhyNode
;
STableScanPhysiNode
*
pTableScanNode
=
(
STableScanPhysiNode
*
)
pPhyNode
;
...
@@ -4041,22 +4031,25 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4041,22 +4031,25 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
tsdbReaderT
pDataReader
=
NULL
;
tsdbReaderT
pDataReader
=
NULL
;
if
(
pHandle
)
{
if
(
pHandle
)
{
if
(
pHandle
->
vnode
)
{
if
(
pHandle
->
initTsdbReader
)
{
// for stram
// for str
e
am
pDataReader
=
ASSERT
(
pHandle
->
vnode
);
doCreateDataReader
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
(
uint64_t
)
queryId
,
taskId
);
pDataReader
=
doCreateDataReader
(
pTableScanNode
,
pHandle
,
pTableListInfo
,
(
uint64_t
)
queryId
,
taskId
);
}
else
{
}
else
{
// for tq
// for tq
ASSERT
(
pHandle
->
meta
);
getTableList
(
pHandle
->
meta
,
pScanPhyNode
,
pTableListInfo
);
getTableList
(
pHandle
->
meta
,
pScanPhyNode
,
pTableListInfo
);
}
}
}
}
#if 0
if (pDataReader == NULL && terrno != 0) {
if (pDataReader == NULL && terrno != 0) {
qDebug("%s pDataReader is NULL", GET_TASKID(pTaskInfo));
qDebug("%s pDataReader is NULL", GET_TASKID(pTaskInfo));
// return NULL;
// return NULL;
} else {
} else {
qDebug("%s pDataReader is not NULL", GET_TASKID(pTaskInfo));
qDebug("%s pDataReader is not NULL", GET_TASKID(pTaskInfo));
}
}
#endif
SArray
*
groupKeys
=
extractPartitionColInfo
(
pTableScanNode
->
pPartitionTags
);
SArray
*
groupKeys
=
extractPartitionColInfo
(
pTableScanNode
->
pPartitionTags
);
int32_t
code
=
generateGroupIdMap
(
pTableListInfo
,
pHandle
,
groupKeys
);
// todo for json
int32_t
code
=
generateGroupIdMap
(
pTableListInfo
,
pHandle
,
groupKeys
);
// todo for json
...
@@ -4069,9 +4062,11 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4069,9 +4062,11 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pDataReader
,
pHandle
,
pTableScanNode
,
pTaskInfo
,
&
twSup
);
SOperatorInfo
*
pOperator
=
createStreamScanOperatorInfo
(
pDataReader
,
pHandle
,
pTableScanNode
,
pTaskInfo
,
&
twSup
);
return
pOperator
;
return
pOperator
;
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_SYSTABLE_SCAN
==
type
)
{
SSystemTableScanPhysiNode
*
pSysScanPhyNode
=
(
SSystemTableScanPhysiNode
*
)
pPhyNode
;
SSystemTableScanPhysiNode
*
pSysScanPhyNode
=
(
SSystemTableScanPhysiNode
*
)
pPhyNode
;
return
createSysTableScanOperatorInfo
(
pHandle
,
pSysScanPhyNode
,
pTaskInfo
);
return
createSysTableScanOperatorInfo
(
pHandle
,
pSysScanPhyNode
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_TAG_SCAN
==
type
)
{
STagScanPhysiNode
*
pScanPhyNode
=
(
STagScanPhysiNode
*
)
pPhyNode
;
STagScanPhysiNode
*
pScanPhyNode
=
(
STagScanPhysiNode
*
)
pPhyNode
;
...
@@ -4082,6 +4077,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
...
@@ -4082,6 +4077,7 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
}
}
return
createTagScanOperatorInfo
(
pHandle
,
pScanPhyNode
,
pTableListInfo
,
pTaskInfo
);
return
createTagScanOperatorInfo
(
pHandle
,
pScanPhyNode
,
pTableListInfo
,
pTaskInfo
);
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN
==
type
)
{
}
else
if
(
QUERY_NODE_PHYSICAL_PLAN_BLOCK_DIST_SCAN
==
type
)
{
SBlockDistScanPhysiNode
*
pBlockNode
=
(
SBlockDistScanPhysiNode
*
)
pPhyNode
;
SBlockDistScanPhysiNode
*
pBlockNode
=
(
SBlockDistScanPhysiNode
*
)
pPhyNode
;
pTableListInfo
->
pTableList
=
taosArrayInit
(
4
,
sizeof
(
STableKeyInfo
));
pTableListInfo
->
pTableList
=
taosArrayInit
(
4
,
sizeof
(
STableKeyInfo
));
...
@@ -4355,7 +4351,7 @@ tsdbReaderT doCreateDataReader(STableScanPhysiNode* pTableScanNode, SReadHandle*
...
@@ -4355,7 +4351,7 @@ tsdbReaderT doCreateDataReader(STableScanPhysiNode* pTableScanNode, SReadHandle*
goto
_error
;
goto
_error
;
}
}
tsdbReaderT
*
pReader
=
tsdbReaderOpen
(
pHandle
->
vnode
,
&
cond
,
pTableListInfo
,
queryId
,
taskId
);
tsdbReaderT
pReader
=
tsdbReaderOpen
(
pHandle
->
vnode
,
&
cond
,
pTableListInfo
,
queryId
,
taskId
);
cleanupQueryTableDataCond
(
&
cond
);
cleanupQueryTableDataCond
(
&
cond
);
return
pReader
;
return
pReader
;
...
@@ -4464,6 +4460,7 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, qTaskInfo_t* pT
...
@@ -4464,6 +4460,7 @@ int32_t createDataSinkParam(SDataSinkNode* pNode, void** pParam, qTaskInfo_t* pT
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
int32_t
tbNum
=
taosArrayGetSize
(
pTask
->
tableqinfoList
.
pTableList
);
int32_t
tbNum
=
taosArrayGetSize
(
pTask
->
tableqinfoList
.
pTableList
);
pDeleterParam
->
suid
=
pTask
->
tableqinfoList
.
suid
;
pDeleterParam
->
pUidList
=
taosArrayInit
(
tbNum
,
sizeof
(
uint64_t
));
pDeleterParam
->
pUidList
=
taosArrayInit
(
tbNum
,
sizeof
(
uint64_t
));
if
(
NULL
==
pDeleterParam
->
pUidList
)
{
if
(
NULL
==
pDeleterParam
->
pUidList
)
{
taosMemoryFree
(
pDeleterParam
);
taosMemoryFree
(
pDeleterParam
);
...
@@ -4498,18 +4495,14 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
...
@@ -4498,18 +4495,14 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead
(
*
pTaskInfo
)
->
sql
=
sql
;
(
*
pTaskInfo
)
->
sql
=
sql
;
(
*
pTaskInfo
)
->
tableqinfoList
.
pTagCond
=
pPlan
->
pTagCond
;
(
*
pTaskInfo
)
->
tableqinfoList
.
pTagCond
=
pPlan
->
pTagCond
;
(
*
pTaskInfo
)
->
tableqinfoList
.
pTagIndexCond
=
pPlan
->
pTagIndexCond
;
(
*
pTaskInfo
)
->
tableqinfoList
.
pTagIndexCond
=
pPlan
->
pTagIndexCond
;
(
*
pTaskInfo
)
->
pRoot
=
createOperatorTree
(
pPlan
->
pNode
,
*
pTaskInfo
,
pHandle
,
queryId
,
taskId
,
(
*
pTaskInfo
)
->
pRoot
=
&
(
*
pTaskInfo
)
->
tableqinfoList
);
createOperatorTree
(
pPlan
->
pNode
,
*
pTaskInfo
,
pHandle
,
queryId
,
taskId
,
&
(
*
pTaskInfo
)
->
tableqinfoList
);
if
(
NULL
==
(
*
pTaskInfo
)
->
pRoot
)
{
if
(
NULL
==
(
*
pTaskInfo
)
->
pRoot
)
{
code
=
(
*
pTaskInfo
)
->
code
;
code
=
(
*
pTaskInfo
)
->
code
;
goto
_complete
;
goto
_complete
;
}
}
if
((
*
pTaskInfo
)
->
pRoot
==
NULL
)
{
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_complete
;
}
return
code
;
return
code
;
_complete:
_complete:
...
...
source/libs/executor/src/groupoperator.c
浏览文件 @
ee821197
...
@@ -559,8 +559,8 @@ uint64_t calcGroupId(char* pData, int32_t len) {
...
@@ -559,8 +559,8 @@ uint64_t calcGroupId(char* pData, int32_t len) {
}
}
int32_t
*
setupColumnOffset
(
const
SSDataBlock
*
pBlock
,
int32_t
rowCapacity
)
{
int32_t
*
setupColumnOffset
(
const
SSDataBlock
*
pBlock
,
int32_t
rowCapacity
)
{
size_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
size_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
int32_t
*
offset
=
taosMemoryCalloc
(
pBlock
->
info
.
numOfCols
,
sizeof
(
int32_t
));
int32_t
*
offset
=
taosMemoryCalloc
(
numOfCols
,
sizeof
(
int32_t
));
offset
[
0
]
=
sizeof
(
int32_t
)
+
sizeof
(
uint64_t
);
// the number of rows in current page, ref to SSDataBlock paged serialization format
offset
[
0
]
=
sizeof
(
int32_t
)
+
sizeof
(
uint64_t
);
// the number of rows in current page, ref to SSDataBlock paged serialization format
...
...
source/libs/executor/src/scanoperator.c
浏览文件 @
ee821197
...
@@ -203,7 +203,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
...
@@ -203,7 +203,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
pCost
->
skipBlocks
+=
1
;
pCost
->
skipBlocks
+=
1
;
// clear all data in pBlock that are set when handing the previous block
// clear all data in pBlock that are set when handing the previous block
for
(
int32_t
i
=
0
;
i
<
pBlockInfo
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
++
i
)
{
SColumnInfoData
*
pcol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pcol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
pcol
->
pData
=
NULL
;
pcol
->
pData
=
NULL
;
}
}
...
@@ -217,7 +217,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
...
@@ -217,7 +217,7 @@ static int32_t loadDataBlock(SOperatorInfo* pOperator, STableScanInfo* pTableSca
tsdbRetrieveDataBlockStatisInfo
(
pTableScanInfo
->
dataReader
,
&
pColAgg
,
&
allColumnsHaveAgg
);
tsdbRetrieveDataBlockStatisInfo
(
pTableScanInfo
->
dataReader
,
&
pColAgg
,
&
allColumnsHaveAgg
);
if
(
allColumnsHaveAgg
==
true
)
{
if
(
allColumnsHaveAgg
==
true
)
{
int32_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
int32_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
// todo create this buffer during creating operator
// todo create this buffer during creating operator
if
(
pBlock
->
pBlockAgg
==
NULL
)
{
if
(
pBlock
->
pBlockAgg
==
NULL
)
{
...
@@ -316,7 +316,7 @@ void addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_
...
@@ -316,7 +316,7 @@ void addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
dstSlotId
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
dstSlotId
);
colInfoDataEnsureCapacity
(
pColInfoData
,
0
,
pBlock
->
info
.
rows
);
colInfoDataEnsureCapacity
(
pColInfoData
,
pBlock
->
info
.
rows
);
colInfoDataCleanup
(
pColInfoData
,
pBlock
->
info
.
rows
);
colInfoDataCleanup
(
pColInfoData
,
pBlock
->
info
.
rows
);
int32_t
functionId
=
pExpr
->
pExpr
->
_function
.
functionId
;
int32_t
functionId
=
pExpr
->
pExpr
->
_function
.
functionId
;
...
@@ -337,7 +337,8 @@ void addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_
...
@@ -337,7 +337,8 @@ void addTagPseudoColumnData(SReadHandle* pHandle, SExprInfo* pPseudoExpr, int32_
}
}
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
rows
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
rows
;
++
i
)
{
colDataAppend
(
pColInfoData
,
i
,
data
,
(
data
==
NULL
)
||
(
pColInfoData
->
info
.
type
==
TSDB_DATA_TYPE_JSON
&&
tTagIsJsonNull
(
data
)));
colDataAppend
(
pColInfoData
,
i
,
data
,
(
data
==
NULL
)
||
(
pColInfoData
->
info
.
type
==
TSDB_DATA_TYPE_JSON
&&
tTagIsJsonNull
(
data
)));
}
}
if
(
data
&&
(
pColInfoData
->
info
.
type
!=
TSDB_DATA_TYPE_JSON
)
&&
p
!=
NULL
&&
if
(
data
&&
(
pColInfoData
->
info
.
type
!=
TSDB_DATA_TYPE_JSON
)
&&
p
!=
NULL
&&
...
@@ -354,10 +355,8 @@ void setTbNameColData(void* pMeta, const SSDataBlock* pBlock, SColumnInfoData* p
...
@@ -354,10 +355,8 @@ void setTbNameColData(void* pMeta, const SSDataBlock* pBlock, SColumnInfoData* p
struct
SScalarFuncExecFuncs
fpSet
=
{
0
};
struct
SScalarFuncExecFuncs
fpSet
=
{
0
};
fmGetScalarFuncExecFuncs
(
functionId
,
&
fpSet
);
fmGetScalarFuncExecFuncs
(
functionId
,
&
fpSet
);
SColumnInfoData
infoData
=
{
0
};
SColumnInfoData
infoData
=
createColumnInfoData
(
TSDB_DATA_TYPE_BIGINT
,
sizeof
(
uint64_t
),
1
);
infoData
.
info
.
type
=
TSDB_DATA_TYPE_BIGINT
;
colInfoDataEnsureCapacity
(
&
infoData
,
1
);
infoData
.
info
.
bytes
=
sizeof
(
uint64_t
);
colInfoDataEnsureCapacity
(
&
infoData
,
0
,
1
);
colDataAppendInt64
(
&
infoData
,
0
,
(
int64_t
*
)
&
pBlock
->
info
.
uid
);
colDataAppendInt64
(
&
infoData
,
0
,
(
int64_t
*
)
&
pBlock
->
info
.
uid
);
SScalarParam
srcParam
=
{.
numOfRows
=
pBlock
->
info
.
rows
,
.
param
=
pMeta
,
.
columnData
=
&
infoData
};
SScalarParam
srcParam
=
{.
numOfRows
=
pBlock
->
info
.
rows
,
.
param
=
pMeta
,
.
columnData
=
&
infoData
};
...
@@ -776,7 +775,7 @@ static bool prepareDataScan(SStreamBlockScanInfo* pInfo) {
...
@@ -776,7 +775,7 @@ static bool prepareDataScan(SStreamBlockScanInfo* pInfo) {
if
(
!
needRead
)
{
if
(
!
needRead
)
{
return
false
;
return
false
;
}
}
STableScanInfo
*
pTableScanInfo
=
pInfo
->
p
OperatorDumy
->
info
;
STableScanInfo
*
pTableScanInfo
=
pInfo
->
p
SnapshotReadOp
->
info
;
pTableScanInfo
->
cond
.
twindows
[
0
]
=
win
;
pTableScanInfo
->
cond
.
twindows
[
0
]
=
win
;
pTableScanInfo
->
curTWinIdx
=
0
;
pTableScanInfo
->
curTWinIdx
=
0
;
tsdbResetReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
tsdbResetReadHandle
(
pTableScanInfo
->
dataReader
,
&
pTableScanInfo
->
cond
,
0
);
...
@@ -785,7 +784,7 @@ static bool prepareDataScan(SStreamBlockScanInfo* pInfo) {
...
@@ -785,7 +784,7 @@ static bool prepareDataScan(SStreamBlockScanInfo* pInfo) {
}
}
static
void
copyOneRow
(
SSDataBlock
*
dest
,
SSDataBlock
*
source
,
int32_t
sourceRowId
)
{
static
void
copyOneRow
(
SSDataBlock
*
dest
,
SSDataBlock
*
source
,
int32_t
sourceRowId
)
{
for
(
int32_t
j
=
0
;
j
<
source
->
info
.
numOfCols
;
j
++
)
{
for
(
int32_t
j
=
0
;
j
<
taosArrayGetSize
(
source
->
pDataBlock
)
;
j
++
)
{
SColumnInfoData
*
pDestCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
dest
->
pDataBlock
,
j
);
SColumnInfoData
*
pDestCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
dest
->
pDataBlock
,
j
);
SColumnInfoData
*
pSourceCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
source
->
pDataBlock
,
j
);
SColumnInfoData
*
pSourceCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
source
->
pDataBlock
,
j
);
if
(
colDataIsNull_s
(
pSourceCol
,
sourceRowId
))
{
if
(
colDataIsNull_s
(
pSourceCol
,
sourceRowId
))
{
...
@@ -821,11 +820,11 @@ static uint64_t getGroupId(SOperatorInfo* pOperator, SSDataBlock* pBlock, int32_
...
@@ -821,11 +820,11 @@ static uint64_t getGroupId(SOperatorInfo* pOperator, SSDataBlock* pBlock, int32_
static
SSDataBlock
*
doDataScan
(
SStreamBlockScanInfo
*
pInfo
)
{
static
SSDataBlock
*
doDataScan
(
SStreamBlockScanInfo
*
pInfo
)
{
while
(
1
)
{
while
(
1
)
{
SSDataBlock
*
pResult
=
NULL
;
SSDataBlock
*
pResult
=
NULL
;
pResult
=
doTableScan
(
pInfo
->
p
OperatorDumy
);
pResult
=
doTableScan
(
pInfo
->
p
SnapshotReadOp
);
if
(
pResult
==
NULL
)
{
if
(
pResult
==
NULL
)
{
if
(
prepareDataScan
(
pInfo
))
{
if
(
prepareDataScan
(
pInfo
))
{
// scan next window data
// scan next window data
pResult
=
doTableScan
(
pInfo
->
p
OperatorDumy
);
pResult
=
doTableScan
(
pInfo
->
p
SnapshotReadOp
);
}
}
}
}
if
(
!
pResult
)
{
if
(
!
pResult
)
{
...
@@ -857,14 +856,13 @@ static void setUpdateData(SStreamBlockScanInfo* pInfo, SSDataBlock* pBlock, SSDa
...
@@ -857,14 +856,13 @@ static void setUpdateData(SStreamBlockScanInfo* pInfo, SSDataBlock* pBlock, SSDa
SColumnInfoData
*
pCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
pUpdateBlock
->
pDataBlock
,
pInfo
->
primaryTsIndex
);
SColumnInfoData
*
pCol
=
(
SColumnInfoData
*
)
taosArrayGet
(
pUpdateBlock
->
pDataBlock
,
pInfo
->
primaryTsIndex
);
ASSERT
(
pCol
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
ASSERT
(
pCol
->
info
.
type
==
TSDB_DATA_TYPE_TIMESTAMP
);
blockDataEnsureCapacity
(
pUpdateBlock
,
size
);
blockDataEnsureCapacity
(
pUpdateBlock
,
size
);
ASSERT
(
pBlock
->
info
.
numOfCols
==
pUpdateBlock
->
info
.
numOfCols
);
int32_t
rowId
=
*
(
int32_t
*
)
taosArrayGet
(
pInfo
->
tsArray
,
pInfo
->
tsArrayIndex
);
int32_t
rowId
=
*
(
int32_t
*
)
taosArrayGet
(
pInfo
->
tsArray
,
pInfo
->
tsArrayIndex
);
pInfo
->
groupId
=
getGroupId
(
pInfo
->
p
OperatorDumy
,
pBlock
,
rowId
);
pInfo
->
groupId
=
getGroupId
(
pInfo
->
p
SnapshotReadOp
,
pBlock
,
rowId
);
int32_t
i
=
0
;
int32_t
i
=
0
;
for
(;
i
<
size
;
i
++
)
{
for
(;
i
<
size
;
i
++
)
{
rowId
=
*
(
int32_t
*
)
taosArrayGet
(
pInfo
->
tsArray
,
i
+
pInfo
->
tsArrayIndex
);
rowId
=
*
(
int32_t
*
)
taosArrayGet
(
pInfo
->
tsArray
,
i
+
pInfo
->
tsArrayIndex
);
uint64_t
id
=
getGroupId
(
pInfo
->
p
OperatorDumy
,
pBlock
,
rowId
);
uint64_t
id
=
getGroupId
(
pInfo
->
p
SnapshotReadOp
,
pBlock
,
rowId
);
if
(
pInfo
->
groupId
!=
id
)
{
if
(
pInfo
->
groupId
!=
id
)
{
break
;
break
;
}
}
...
@@ -928,7 +926,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
...
@@ -928,7 +926,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
SSDataBlock
*
pBlock
=
taosArrayGetP
(
pInfo
->
pBlockLists
,
current
);
SSDataBlock
*
pBlock
=
taosArrayGetP
(
pInfo
->
pBlockLists
,
current
);
blockDataUpdateTsWindow
(
pBlock
,
0
);
blockDataUpdateTsWindow
(
pBlock
,
0
);
return
pBlock
;
return
pBlock
;
}
else
{
}
else
if
(
pInfo
->
blockType
==
STREAM_DATA_TYPE_SUBMIT_BLOCK
)
{
if
(
pInfo
->
scanMode
==
STREAM_SCAN_FROM_RES
)
{
if
(
pInfo
->
scanMode
==
STREAM_SCAN_FROM_RES
)
{
blockDataDestroy
(
pInfo
->
pUpdateRes
);
blockDataDestroy
(
pInfo
->
pUpdateRes
);
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
...
@@ -968,13 +966,13 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
...
@@ -968,13 +966,13 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
blockDataCleanup
(
pInfo
->
pRes
);
blockDataCleanup
(
pInfo
->
pRes
);
while
(
tqNextDataBlock
(
pInfo
->
streamBlockReader
))
{
while
(
tqNextDataBlock
(
pInfo
->
streamBlockReader
))
{
S
Array
*
pCols
=
NULL
;
S
SDataBlock
block
=
{
0
}
;
uint64_t
groupId
=
0
;
uint64_t
groupId
=
0
;
uint64_t
uid
=
0
;
uint64_t
uid
=
0
;
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
int16_t
outputCol
=
0
;
int32_t
code
=
tqRetrieveDataBlock
(
&
pCols
,
pInfo
->
streamBlockReader
,
&
groupId
,
&
uid
,
&
numOfRows
,
&
outputCol
);
// todo refactor
int32_t
code
=
tqRetrieveDataBlock
(
&
block
,
pInfo
->
streamBlockReader
,
&
groupId
,
&
uid
,
&
numOfRows
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
numOfRows
==
0
)
{
if
(
code
!=
TSDB_CODE_SUCCESS
||
numOfRows
==
0
)
{
pTaskInfo
->
code
=
code
;
pTaskInfo
->
code
=
code
;
...
@@ -985,6 +983,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
...
@@ -985,6 +983,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
pInfo
->
pRes
->
info
.
rows
=
numOfRows
;
pInfo
->
pRes
->
info
.
uid
=
uid
;
pInfo
->
pRes
->
info
.
uid
=
uid
;
pInfo
->
pRes
->
info
.
type
=
STREAM_NORMAL
;
pInfo
->
pRes
->
info
.
type
=
STREAM_NORMAL
;
pInfo
->
pRes
->
info
.
capacity
=
numOfRows
;
// for generating rollup SMA result, each time is an independent time serie.
// for generating rollup SMA result, each time is an independent time serie.
// TODO temporarily used, when the statement of "partition by tbname" is ready, remove this
// TODO temporarily used, when the statement of "partition by tbname" is ready, remove this
...
@@ -999,6 +998,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
...
@@ -999,6 +998,7 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
pInfo
->
pRes
->
info
.
groupId
=
*
groupIdPre
;
pInfo
->
pRes
->
info
.
groupId
=
*
groupIdPre
;
}
}
// todo extract method
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
pColMatchInfo
);
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pInfo
->
pColMatchInfo
);
++
i
)
{
SColMatchInfo
*
pColMatchInfo
=
taosArrayGet
(
pInfo
->
pColMatchInfo
,
i
);
SColMatchInfo
*
pColMatchInfo
=
taosArrayGet
(
pInfo
->
pColMatchInfo
,
i
);
if
(
!
pColMatchInfo
->
output
)
{
if
(
!
pColMatchInfo
->
output
)
{
...
@@ -1006,8 +1006,8 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
...
@@ -1006,8 +1006,8 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
}
}
bool
colExists
=
false
;
bool
colExists
=
false
;
for
(
int32_t
j
=
0
;
j
<
taosArrayGetSize
(
pCols
);
++
j
)
{
for
(
int32_t
j
=
0
;
j
<
blockDataGetNumOfCols
(
&
block
);
++
j
)
{
SColumnInfoData
*
pResCol
=
taosArrayGet
(
pCols
,
j
);
SColumnInfoData
*
pResCol
=
bdGetColumnInfoData
(
&
block
,
j
);
if
(
pResCol
->
info
.
colId
==
pColMatchInfo
->
colId
)
{
if
(
pResCol
->
info
.
colId
==
pColMatchInfo
->
colId
)
{
taosArraySet
(
pInfo
->
pRes
->
pDataBlock
,
pColMatchInfo
->
targetSlotId
,
pResCol
);
taosArraySet
(
pInfo
->
pRes
->
pDataBlock
,
pColMatchInfo
->
targetSlotId
,
pResCol
);
colExists
=
true
;
colExists
=
true
;
...
@@ -1018,11 +1018,13 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
...
@@ -1018,11 +1018,13 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
// the required column does not exists in submit block, let's set it to be all null value
// the required column does not exists in submit block, let's set it to be all null value
if
(
!
colExists
)
{
if
(
!
colExists
)
{
SColumnInfoData
*
pDst
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
pColMatchInfo
->
targetSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pInfo
->
pRes
->
pDataBlock
,
pColMatchInfo
->
targetSlotId
);
colInfoDataEnsureCapacity
(
pDst
,
0
,
pBlockInfo
->
rows
);
colDataAppendNNULL
(
pDst
,
0
,
pBlockInfo
->
rows
);
colDataAppendNNULL
(
pDst
,
0
,
pBlockInfo
->
rows
);
}
}
}
}
// TODO refactor @liao
taosArrayDestroy
(
block
.
pDataBlock
);
if
(
pInfo
->
pRes
->
pDataBlock
==
NULL
)
{
if
(
pInfo
->
pRes
->
pDataBlock
==
NULL
)
{
// TODO add log
// TODO add log
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
...
@@ -1062,6 +1064,14 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
...
@@ -1062,6 +1064,14 @@ static SSDataBlock* doStreamBlockScan(SOperatorInfo* pOperator) {
}
}
return
(
pBlockInfo
->
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
return
(
pBlockInfo
->
rows
==
0
)
?
NULL
:
pInfo
->
pRes
;
}
else
if
(
pInfo
->
blockType
==
STREAM_DATA_TYPE_FROM_SNAPSHOT
)
{
SSDataBlock
*
pResult
=
doTableScan
(
pInfo
->
pSnapshotReadOp
);
return
pResult
&&
pResult
->
info
.
rows
>
0
?
pResult
:
NULL
;
}
else
{
ASSERT
(
0
);
return
NULL
;
}
}
}
}
...
@@ -1126,7 +1136,7 @@ SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHan
...
@@ -1126,7 +1136,7 @@ SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHan
}
else
{
}
else
{
pInfo
->
pUpdateInfo
=
NULL
;
pInfo
->
pUpdateInfo
=
NULL
;
}
}
pInfo
->
p
OperatorDumy
=
pTableScanDummy
;
pInfo
->
p
SnapshotReadOp
=
pTableScanDummy
;
pInfo
->
interval
=
pSTInfo
->
interval
;
pInfo
->
interval
=
pSTInfo
->
interval
;
pInfo
->
readHandle
=
*
pHandle
;
pInfo
->
readHandle
=
*
pHandle
;
...
@@ -1153,7 +1163,6 @@ SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHan
...
@@ -1153,7 +1163,6 @@ SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHan
pInfo
->
pRes
=
createResDataBlock
(
pDescNode
);
pInfo
->
pRes
=
createResDataBlock
(
pDescNode
);
pInfo
->
pUpdateRes
=
createResDataBlock
(
pDescNode
);
pInfo
->
pUpdateRes
=
createResDataBlock
(
pDescNode
);
pInfo
->
pCondition
=
pScanPhyNode
->
node
.
pConditions
;
pInfo
->
pCondition
=
pScanPhyNode
->
node
.
pConditions
;
pInfo
->
pDataReader
=
pDataReader
;
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
pInfo
->
scanMode
=
STREAM_SCAN_FROM_READERHANDLE
;
pInfo
->
sessionSup
=
(
SessionWindowSupporter
){.
pStreamAggSup
=
NULL
,
.
gap
=
-
1
};
pInfo
->
sessionSup
=
(
SessionWindowSupporter
){.
pStreamAggSup
=
NULL
,
.
gap
=
-
1
};
pInfo
->
groupId
=
0
;
pInfo
->
groupId
=
0
;
...
@@ -1163,7 +1172,7 @@ SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHan
...
@@ -1163,7 +1172,7 @@ SOperatorInfo* createStreamScanOperatorInfo(void* pDataReader, SReadHandle* pHan
pOperator
->
blocking
=
false
;
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
exprSupp
.
numOfExprs
=
pInfo
->
pRes
->
info
.
numOfCols
;
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pInfo
->
pRes
->
pDataBlock
)
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
fpSet
=
pOperator
->
fpSet
=
...
@@ -1291,7 +1300,7 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
...
@@ -1291,7 +1300,7 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
SColumnInfoData* pSrc = taosArrayGet(pInfo->pRes->pDataBlock, i);
SColumnInfoData* pSrc = taosArrayGet(pInfo->pRes->pDataBlock, i);
if (keep) {
if (keep) {
colDataAssign(pDest, pSrc, pInfo->pRes->info.rows);
colDataAssign(pDest, pSrc, pInfo->pRes->info.rows
, &px->info
);
numOfRow = pInfo->pRes->info.rows;
numOfRow = pInfo->pRes->info.rows;
} else if (NULL != rowRes) {
} else if (NULL != rowRes) {
numOfRow = 0;
numOfRow = 0;
...
@@ -1321,8 +1330,6 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
...
@@ -1321,8 +1330,6 @@ static SSDataBlock* doFilterResult(SSysTableScanInfo* pInfo) {
}
}
static
SSDataBlock
*
buildSysTableMetaBlock
()
{
static
SSDataBlock
*
buildSysTableMetaBlock
()
{
SSDataBlock
*
pBlock
=
taosMemoryCalloc
(
1
,
sizeof
(
SSDataBlock
));
size_t
size
=
0
;
size_t
size
=
0
;
const
SSysTableMeta
*
pMeta
=
NULL
;
const
SSysTableMeta
*
pMeta
=
NULL
;
getInfosDbMeta
(
&
pMeta
,
&
size
);
getInfosDbMeta
(
&
pMeta
,
&
size
);
...
@@ -1335,19 +1342,13 @@ static SSDataBlock* buildSysTableMetaBlock() {
...
@@ -1335,19 +1342,13 @@ static SSDataBlock* buildSysTableMetaBlock() {
}
}
}
}
pBlock
->
pDataBlock
=
taosArrayInit
(
pBlock
->
info
.
numOfCols
,
sizeof
(
SColumnInfoData
));
SSDataBlock
*
pBlock
=
createDataBlock
();
for
(
int32_t
i
=
0
;
i
<
pMeta
[
index
].
colNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
pMeta
[
index
].
colNum
;
++
i
)
{
SColumnInfoData
colInfoData
=
{
0
};
SColumnInfoData
colInfoData
=
colInfoData
.
info
.
colId
=
i
+
1
;
createColumnInfoData
(
pMeta
[
index
].
schema
[
i
].
type
,
pMeta
[
index
].
schema
[
i
].
bytes
,
i
+
1
);
colInfoData
.
info
.
type
=
pMeta
[
index
].
schema
[
i
].
type
;
blockDataAppendColInfo
(
pBlock
,
&
colInfoData
);
colInfoData
.
info
.
bytes
=
pMeta
[
index
].
schema
[
i
].
bytes
;
taosArrayPush
(
pBlock
->
pDataBlock
,
&
colInfoData
);
}
}
pBlock
->
info
.
numOfCols
=
pMeta
[
index
].
colNum
;
pBlock
->
info
.
hasVarCol
=
true
;
return
pBlock
;
return
pBlock
;
}
}
...
@@ -1378,7 +1379,6 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
...
@@ -1378,7 +1379,6 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
}
}
blockDataCleanup
(
pInfo
->
pRes
);
blockDataCleanup
(
pInfo
->
pRes
);
int32_t
numOfRows
=
0
;
int32_t
numOfRows
=
0
;
const
char
*
db
=
NULL
;
const
char
*
db
=
NULL
;
...
@@ -1548,11 +1548,15 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
...
@@ -1548,11 +1548,15 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
return
NULL
;
return
NULL
;
}
}
int32_t
msgType
=
(
strcasecmp
(
name
,
TSDB_INS_TABLE_DNODE_VARIABLES
)
==
0
)
?
TDMT_DND_SYSTABLE_RETRIEVE
:
TDMT_MND_SYSTABLE_RETRIEVE
;
pMsgSendInfo
->
param
=
pOperator
;
pMsgSendInfo
->
param
=
pOperator
;
pMsgSendInfo
->
msgInfo
.
pData
=
buf1
;
pMsgSendInfo
->
msgInfo
.
pData
=
buf1
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
pMsgSendInfo
->
msgInfo
.
len
=
contLen
;
pMsgSendInfo
->
msgType
=
TDMT_MND_SYSTABLE_RETRIEVE
;
pMsgSendInfo
->
msgType
=
msgType
;
pMsgSendInfo
->
fp
=
loadSysTableCallback
;
pMsgSendInfo
->
fp
=
loadSysTableCallback
;
pMsgSendInfo
->
requestId
=
pTaskInfo
->
id
.
queryId
;
int64_t
transporterId
=
0
;
int64_t
transporterId
=
0
;
int32_t
code
=
int32_t
code
=
...
@@ -1570,7 +1574,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
...
@@ -1570,7 +1574,7 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
if
(
pRsp
->
numOfRows
==
0
||
pRsp
->
completed
)
{
if
(
pRsp
->
numOfRows
==
0
||
pRsp
->
completed
)
{
pOperator
->
status
=
OP_EXEC_DONE
;
pOperator
->
status
=
OP_EXEC_DONE
;
qDebug
(
"%s load meta data from mnode completed, rowsOfSource:%d, totalRows:%"
PRIu64
" "
,
GET_TASKID
(
pTaskInfo
),
qDebug
(
"%s load meta data from mnode completed, rowsOfSource:%d, totalRows:%"
PRIu64
,
GET_TASKID
(
pTaskInfo
),
pRsp
->
numOfRows
,
pInfo
->
loadInfo
.
totalRows
);
pRsp
->
numOfRows
,
pInfo
->
loadInfo
.
totalRows
);
if
(
pRsp
->
numOfRows
==
0
)
{
if
(
pRsp
->
numOfRows
==
0
)
{
...
@@ -1587,6 +1591,8 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
...
@@ -1587,6 +1591,8 @@ static SSDataBlock* doSysTableScan(SOperatorInfo* pOperator) {
taosMemoryFree
(
pRsp
);
taosMemoryFree
(
pRsp
);
if
(
pInfo
->
pRes
->
info
.
rows
>
0
)
{
if
(
pInfo
->
pRes
->
info
.
rows
>
0
)
{
return
pInfo
->
pRes
;
return
pInfo
->
pRes
;
}
else
if
(
pOperator
->
status
==
OP_EXEC_DONE
)
{
return
NULL
;
}
}
}
}
}
}
...
@@ -1695,7 +1701,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
...
@@ -1695,7 +1701,7 @@ SOperatorInfo* createSysTableScanOperatorInfo(void* readHandle, SSystemTableScan
pOperator
->
blocking
=
false
;
pOperator
->
blocking
=
false
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
exprSupp
.
numOfExprs
=
pResBlock
->
info
.
numOfCols
;
pOperator
->
exprSupp
.
numOfExprs
=
taosArrayGetSize
(
pResBlock
->
pDataBlock
)
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
pTaskInfo
=
pTaskInfo
;
pOperator
->
fpSet
=
pOperator
->
fpSet
=
...
@@ -1829,7 +1835,8 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
...
@@ -1829,7 +1835,8 @@ static SSDataBlock* doTagScan(SOperatorInfo* pOperator) {
}
else
{
}
else
{
data
=
(
char
*
)
p
;
data
=
(
char
*
)
p
;
}
}
colDataAppend
(
pDst
,
count
,
data
,
(
data
==
NULL
)
||
(
pDst
->
info
.
type
==
TSDB_DATA_TYPE_JSON
&&
tTagIsJsonNull
(
data
)));
colDataAppend
(
pDst
,
count
,
data
,
(
data
==
NULL
)
||
(
pDst
->
info
.
type
==
TSDB_DATA_TYPE_JSON
&&
tTagIsJsonNull
(
data
)));
if
(
pDst
->
info
.
type
!=
TSDB_DATA_TYPE_JSON
&&
p
!=
NULL
&&
IS_VAR_DATA_TYPE
(((
const
STagVal
*
)
p
)
->
type
)
&&
if
(
pDst
->
info
.
type
!=
TSDB_DATA_TYPE_JSON
&&
p
!=
NULL
&&
IS_VAR_DATA_TYPE
(((
const
STagVal
*
)
p
)
->
type
)
&&
data
!=
NULL
)
{
data
!=
NULL
)
{
...
@@ -2032,6 +2039,7 @@ int32_t createMultipleDataReaders(SQueryTableDataCond* pQueryCond, SReadHandle*
...
@@ -2032,6 +2039,7 @@ int32_t createMultipleDataReaders(SQueryTableDataCond* pQueryCond, SReadHandle*
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
// todo refactor
static
int32_t
loadDataBlockFromOneTable
(
SOperatorInfo
*
pOperator
,
STableMergeScanInfo
*
pTableScanInfo
,
static
int32_t
loadDataBlockFromOneTable
(
SOperatorInfo
*
pOperator
,
STableMergeScanInfo
*
pTableScanInfo
,
int32_t
readerIdx
,
SSDataBlock
*
pBlock
,
uint32_t
*
status
)
{
int32_t
readerIdx
,
SSDataBlock
*
pBlock
,
uint32_t
*
status
)
{
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
SExecTaskInfo
*
pTaskInfo
=
pOperator
->
pTaskInfo
;
...
@@ -2062,7 +2070,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
...
@@ -2062,7 +2070,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
pCost
->
skipBlocks
+=
1
;
pCost
->
skipBlocks
+=
1
;
// clear all data in pBlock that are set when handing the previous block
// clear all data in pBlock that are set when handing the previous block
for
(
int32_t
i
=
0
;
i
<
pBlockInfo
->
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
++
i
)
{
SColumnInfoData
*
pcol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pcol
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
pcol
->
pData
=
NULL
;
pcol
->
pData
=
NULL
;
}
}
...
@@ -2077,7 +2085,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
...
@@ -2077,7 +2085,7 @@ static int32_t loadDataBlockFromOneTable(SOperatorInfo* pOperator, STableMergeSc
tsdbRetrieveDataBlockStatisInfo
(
reader
,
&
pColAgg
,
&
allColumnsHaveAgg
);
tsdbRetrieveDataBlockStatisInfo
(
reader
,
&
pColAgg
,
&
allColumnsHaveAgg
);
if
(
allColumnsHaveAgg
==
true
)
{
if
(
allColumnsHaveAgg
==
true
)
{
int32_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
int32_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
// todo create this buffer during creating operator
// todo create this buffer during creating operator
if
(
pBlock
->
pBlockAgg
==
NULL
)
{
if
(
pBlock
->
pBlockAgg
==
NULL
)
{
...
@@ -2172,7 +2180,13 @@ static SSDataBlock* getTableDataBlock(void* param) {
...
@@ -2172,7 +2180,13 @@ static SSDataBlock* getTableDataBlock(void* param) {
continue
;
continue
;
}
}
tsdbRetrieveDataBlockInfo
(
reader
,
&
pBlock
->
info
);
blockDataCleanup
(
pBlock
);
SDataBlockInfo
binfo
=
pBlock
->
info
;
tsdbRetrieveDataBlockInfo
(
reader
,
&
binfo
);
binfo
.
capacity
=
binfo
.
rows
;
blockDataEnsureCapacity
(
pBlock
,
binfo
.
capacity
);
pBlock
->
info
=
binfo
;
uint32_t
status
=
0
;
uint32_t
status
=
0
;
int32_t
code
=
loadDataBlockFromOneTable
(
pOperator
,
pTableScanInfo
,
readerIdx
,
pBlock
,
&
status
);
int32_t
code
=
loadDataBlockFromOneTable
(
pOperator
,
pTableScanInfo
,
readerIdx
,
pBlock
,
&
status
);
...
...
source/libs/executor/src/sortoperator.c
浏览文件 @
ee821197
...
@@ -80,7 +80,7 @@ _error:
...
@@ -80,7 +80,7 @@ _error:
}
}
void
appendOneRowToDataBlock
(
SSDataBlock
*
pBlock
,
STupleHandle
*
pTupleHandle
)
{
void
appendOneRowToDataBlock
(
SSDataBlock
*
pBlock
,
STupleHandle
*
pTupleHandle
)
{
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
bool
isNull
=
tsortIsNullVal
(
pTupleHandle
,
i
);
bool
isNull
=
tsortIsNullVal
(
pTupleHandle
,
i
);
if
(
isNull
)
{
if
(
isNull
)
{
...
@@ -120,6 +120,9 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
...
@@ -120,6 +120,9 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
}
}
if
(
p
->
info
.
rows
>
0
)
{
if
(
p
->
info
.
rows
>
0
)
{
blockDataEnsureCapacity
(
pDataBlock
,
capacity
);
// todo extract function to handle this
int32_t
numOfCols
=
taosArrayGetSize
(
pColMatchInfo
);
int32_t
numOfCols
=
taosArrayGetSize
(
pColMatchInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColMatchInfo
*
pmInfo
=
taosArrayGet
(
pColMatchInfo
,
i
);
SColMatchInfo
*
pmInfo
=
taosArrayGet
(
pColMatchInfo
,
i
);
...
@@ -127,11 +130,10 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
...
@@ -127,11 +130,10 @@ SSDataBlock* getSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlock, i
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
,
&
pDataBlock
->
info
);
}
}
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
capacity
=
p
->
info
.
rows
;
}
}
blockDataDestroy
(
p
);
blockDataDestroy
(
p
);
...
@@ -257,6 +259,7 @@ typedef struct SGroupSortOperatorInfo {
...
@@ -257,6 +259,7 @@ typedef struct SGroupSortOperatorInfo {
SSDataBlock
*
getGroupSortedBlockData
(
SSortHandle
*
pHandle
,
SSDataBlock
*
pDataBlock
,
int32_t
capacity
,
SSDataBlock
*
getGroupSortedBlockData
(
SSortHandle
*
pHandle
,
SSDataBlock
*
pDataBlock
,
int32_t
capacity
,
SArray
*
pColMatchInfo
,
SGroupSortOperatorInfo
*
pInfo
)
{
SArray
*
pColMatchInfo
,
SGroupSortOperatorInfo
*
pInfo
)
{
blockDataCleanup
(
pDataBlock
);
blockDataCleanup
(
pDataBlock
);
blockDataEnsureCapacity
(
pDataBlock
,
capacity
);
SSDataBlock
*
p
=
tsortGetSortedDataBlock
(
pHandle
);
SSDataBlock
*
p
=
tsortGetSortedDataBlock
(
pHandle
);
if
(
p
==
NULL
)
{
if
(
p
==
NULL
)
{
...
@@ -285,7 +288,7 @@ SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo
...
@@ -285,7 +288,7 @@ SSDataBlock* getGroupSortedBlockData(SSortHandle* pHandle, SSDataBlock* pDataBlo
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
,
&
pDataBlock
->
info
);
}
}
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
...
@@ -387,6 +390,10 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
...
@@ -387,6 +390,10 @@ SSDataBlock* doGroupSort(SOperatorInfo* pOperator) {
pInfo
->
hasGroupId
=
true
;
pInfo
->
hasGroupId
=
true
;
pInfo
->
prefetchedSortInput
=
pOperator
->
pDownstream
[
0
]
->
fpSet
.
getNextFn
(
pOperator
->
pDownstream
[
0
]);
pInfo
->
prefetchedSortInput
=
pOperator
->
pDownstream
[
0
]
->
fpSet
.
getNextFn
(
pOperator
->
pDownstream
[
0
]);
if
(
pInfo
->
prefetchedSortInput
==
NULL
)
{
doSetOperatorCompleted
(
pOperator
);
return
NULL
;
}
pInfo
->
currGroupId
=
pInfo
->
prefetchedSortInput
->
info
.
groupId
;
pInfo
->
currGroupId
=
pInfo
->
prefetchedSortInput
->
info
.
groupId
;
pInfo
->
childOpStatus
=
CHILD_OP_NEW_GROUP
;
pInfo
->
childOpStatus
=
CHILD_OP_NEW_GROUP
;
beginSortGroup
(
pOperator
);
beginSortGroup
(
pOperator
);
...
@@ -460,7 +467,7 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort
...
@@ -460,7 +467,7 @@ SOperatorInfo* createGroupSortOperatorInfo(SOperatorInfo* downstream, SGroupSort
pInfo
->
pColMatchInfo
=
pColMatchColInfo
;
pInfo
->
pColMatchInfo
=
pColMatchColInfo
;
pOperator
->
name
=
"GroupSortOperator"
;
pOperator
->
name
=
"GroupSortOperator"
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT
;
pOperator
->
operatorType
=
QUERY_NODE_PHYSICAL_PLAN_GROUP_SORT
;
pOperator
->
blocking
=
tru
e
;
pOperator
->
blocking
=
fals
e
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
status
=
OP_NOT_OPENED
;
pOperator
->
info
=
pInfo
;
pOperator
->
info
=
pInfo
;
pOperator
->
exprSupp
.
pExprInfo
=
pExprInfo
;
pOperator
->
exprSupp
.
pExprInfo
=
pExprInfo
;
...
@@ -564,7 +571,8 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
...
@@ -564,7 +571,8 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
}
}
}
}
if
(
p
->
info
.
rows
>
0
)
{
if
(
p
->
info
.
rows
>
0
)
{
// todo extract method
blockDataEnsureCapacity
(
pDataBlock
,
p
->
info
.
rows
);
int32_t
numOfCols
=
taosArrayGetSize
(
pColMatchInfo
);
int32_t
numOfCols
=
taosArrayGetSize
(
pColMatchInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColMatchInfo
*
pmInfo
=
taosArrayGet
(
pColMatchInfo
,
i
);
SColMatchInfo
*
pmInfo
=
taosArrayGet
(
pColMatchInfo
,
i
);
...
@@ -572,11 +580,10 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
...
@@ -572,11 +580,10 @@ SSDataBlock* getMultiwaySortedBlockData(SSortHandle* pHandle, SSDataBlock* pData
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pSrc
=
taosArrayGet
(
p
->
pDataBlock
,
pmInfo
->
srcSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
SColumnInfoData
*
pDst
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
pmInfo
->
targetSlotId
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
);
colDataAssign
(
pDst
,
pSrc
,
p
->
info
.
rows
,
&
pDataBlock
->
info
);
}
}
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
rows
=
p
->
info
.
rows
;
pDataBlock
->
info
.
capacity
=
p
->
info
.
rows
;
pDataBlock
->
info
.
groupId
=
pInfo
->
groupId
;
pDataBlock
->
info
.
groupId
=
pInfo
->
groupId
;
}
}
...
...
source/libs/executor/src/tfill.c
浏览文件 @
ee821197
...
@@ -50,7 +50,7 @@ static void setTagsValue(SFillInfo* pFillInfo, void** data, int32_t genRows) {
...
@@ -50,7 +50,7 @@ static void setTagsValue(SFillInfo* pFillInfo, void** data, int32_t genRows) {
static
void
setNullRow
(
SSDataBlock
*
pBlock
,
int32_t
numOfCol
,
int32_t
rowIndex
)
{
static
void
setNullRow
(
SSDataBlock
*
pBlock
,
int32_t
numOfCol
,
int32_t
rowIndex
)
{
// the first are always the timestamp column, so start from the second column.
// the first are always the timestamp column, so start from the second column.
for
(
int32_t
i
=
1
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
1
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
p
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
colDataAppendNULL
(
p
,
rowIndex
);
colDataAppendNULL
(
p
,
rowIndex
);
}
}
...
...
source/libs/executor/src/timewindowoperator.c
浏览文件 @
ee821197
...
@@ -1814,7 +1814,7 @@ static int32_t initPrevRowsKeeper(STimeSliceOperatorInfo* pInfo, SSDataBlock* pB
...
@@ -1814,7 +1814,7 @@ static int32_t initPrevRowsKeeper(STimeSliceOperatorInfo* pInfo, SSDataBlock* pB
return
TSDB_CODE_OUT_OF_MEMORY
;
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
int32_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
int32_t
numOfCols
=
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
...
@@ -2231,23 +2231,23 @@ static void clearStreamIntervalOperator(SStreamFinalIntervalOperatorInfo* pInfo)
...
@@ -2231,23 +2231,23 @@ static void clearStreamIntervalOperator(SStreamFinalIntervalOperatorInfo* pInfo)
}
}
static
void
clearUpdateDataBlock
(
SSDataBlock
*
pBlock
)
{
static
void
clearUpdateDataBlock
(
SSDataBlock
*
pBlock
)
{
if
(
pBlock
->
info
.
rows
<=
0
)
{
return
;
}
blockDataCleanup
(
pBlock
);
blockDataCleanup
(
pBlock
);
}
}
void
copyUpdateDataBlock
(
SSDataBlock
*
pDest
,
SSDataBlock
*
pSource
,
int32_t
tsColIndex
)
{
void
copyUpdateDataBlock
(
SSDataBlock
*
pDest
,
SSDataBlock
*
pSource
,
int32_t
tsColIndex
)
{
ASSERT
(
pDest
->
info
.
capacity
>=
pSource
->
info
.
rows
);
// ASSERT(pDest->info.capacity >= pSource->info.rows);
blockDataEnsureCapacity
(
pDest
,
pSource
->
info
.
rows
);
clearUpdateDataBlock
(
pDest
);
clearUpdateDataBlock
(
pDest
);
SColumnInfoData
*
pDestCol
=
taosArrayGet
(
pDest
->
pDataBlock
,
0
);
SColumnInfoData
*
pDestCol
=
taosArrayGet
(
pDest
->
pDataBlock
,
0
);
SColumnInfoData
*
pSourceCol
=
taosArrayGet
(
pSource
->
pDataBlock
,
tsColIndex
);
SColumnInfoData
*
pSourceCol
=
taosArrayGet
(
pSource
->
pDataBlock
,
tsColIndex
);
// copy timestamp column
// copy timestamp column
colDataAssign
(
pDestCol
,
pSourceCol
,
pSource
->
info
.
rows
);
colDataAssign
(
pDestCol
,
pSourceCol
,
pSource
->
info
.
rows
,
&
pDest
->
info
);
for
(
int32_t
i
=
1
;
i
<
pDest
->
info
.
numOfCols
;
i
++
)
{
for
(
int32_t
i
=
1
;
i
<
taosArrayGetSize
(
pDest
->
pDataBlock
)
;
i
++
)
{
SColumnInfoData
*
pCol
=
taosArrayGet
(
pDest
->
pDataBlock
,
i
);
SColumnInfoData
*
pCol
=
taosArrayGet
(
pDest
->
pDataBlock
,
i
);
colDataAppendNNULL
(
pCol
,
0
,
pSource
->
info
.
rows
);
colDataAppendNNULL
(
pCol
,
0
,
pSource
->
info
.
rows
);
}
}
pDest
->
info
.
rows
=
pSource
->
info
.
rows
;
pDest
->
info
.
rows
=
pSource
->
info
.
rows
;
pDest
->
info
.
groupId
=
pSource
->
info
.
groupId
;
pDest
->
info
.
groupId
=
pSource
->
info
.
groupId
;
pDest
->
info
.
type
=
pSource
->
info
.
type
;
pDest
->
info
.
type
=
pSource
->
info
.
type
;
...
@@ -2917,7 +2917,7 @@ void doBuildDeleteDataBlock(SHashObj* pStDeleted, SSDataBlock* pBlock, void** It
...
@@ -2917,7 +2917,7 @@ void doBuildDeleteDataBlock(SHashObj* pStDeleted, SSDataBlock* pBlock, void** It
while
(((
*
Ite
)
=
taosHashIterate
(
pStDeleted
,
*
Ite
))
!=
NULL
)
{
while
(((
*
Ite
)
=
taosHashIterate
(
pStDeleted
,
*
Ite
))
!=
NULL
)
{
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
SColumnInfoData
*
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
0
);
colDataAppend
(
pColInfoData
,
pBlock
->
info
.
rows
,
*
Ite
,
false
);
colDataAppend
(
pColInfoData
,
pBlock
->
info
.
rows
,
*
Ite
,
false
);
for
(
int32_t
i
=
1
;
i
<
pBlock
->
info
.
numOfCols
;
i
++
)
{
for
(
int32_t
i
=
1
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
i
++
)
{
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
pColInfoData
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
colDataAppendNULL
(
pColInfoData
,
pBlock
->
info
.
rows
);
colDataAppendNULL
(
pColInfoData
,
pBlock
->
info
.
rows
);
}
}
...
@@ -4117,6 +4117,8 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprI
...
@@ -4117,6 +4117,8 @@ SOperatorInfo* createMergeIntervalOperatorInfo(SOperatorInfo* downstream, SExprI
goto
_error
;
goto
_error
;
}
}
miaInfo
->
groupIntervalHash
=
taosHashInit
(
128
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_UBIGINT
),
true
,
HASH_NO_LOCK
);
SIntervalAggOperatorInfo
*
iaInfo
=
&
miaInfo
->
intervalAggOperatorInfo
;
SIntervalAggOperatorInfo
*
iaInfo
=
&
miaInfo
->
intervalAggOperatorInfo
;
iaInfo
->
win
=
pTaskInfo
->
window
;
iaInfo
->
win
=
pTaskInfo
->
window
;
...
...
source/libs/executor/src/tsort.c
浏览文件 @
ee821197
...
@@ -147,7 +147,7 @@ static int32_t doAddNewExternalMemSource(SDiskbasedBuf *pBuf, SArray* pAllSource
...
@@ -147,7 +147,7 @@ static int32_t doAddNewExternalMemSource(SDiskbasedBuf *pBuf, SArray* pAllSource
int32_t
rowSize
=
blockDataGetSerialRowSize
(
pSource
->
src
.
pBlock
);
int32_t
rowSize
=
blockDataGetSerialRowSize
(
pSource
->
src
.
pBlock
);
// The value of numOfRows must be greater than 0, which is guaranteed by the previous memory allocation
// The value of numOfRows must be greater than 0, which is guaranteed by the previous memory allocation
int32_t
numOfRows
=
(
getBufPageSize
(
pBuf
)
-
blockDataGetSerialMetaSize
(
pBlock
->
info
.
numOfCols
))
/
rowSize
;
int32_t
numOfRows
=
(
getBufPageSize
(
pBuf
)
-
blockDataGetSerialMetaSize
(
taosArrayGetSize
(
pBlock
->
pDataBlock
)
))
/
rowSize
;
ASSERT
(
numOfRows
>
0
);
ASSERT
(
numOfRows
>
0
);
return
blockDataEnsureCapacity
(
pSource
->
src
.
pBlock
,
numOfRows
);
return
blockDataEnsureCapacity
(
pSource
->
src
.
pBlock
,
numOfRows
);
}
}
...
@@ -178,7 +178,7 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
...
@@ -178,7 +178,7 @@ static int32_t doAddToBuf(SSDataBlock* pDataBlock, SSortHandle* pHandle) {
return
terrno
;
return
terrno
;
}
}
int32_t
size
=
blockDataGetSize
(
p
)
+
sizeof
(
int32_t
)
+
p
->
info
.
numOfCols
*
sizeof
(
int32_t
);
int32_t
size
=
blockDataGetSize
(
p
)
+
sizeof
(
int32_t
)
+
taosArrayGetSize
(
p
->
pDataBlock
)
*
sizeof
(
int32_t
);
assert
(
size
<=
getBufPageSize
(
pHandle
->
pBuf
));
assert
(
size
<=
getBufPageSize
(
pHandle
->
pBuf
));
blockDataToBuf
(
pPage
,
p
);
blockDataToBuf
(
pPage
,
p
);
...
@@ -252,7 +252,7 @@ static int32_t sortComparInit(SMsortComparParam* cmpParam, SArray* pSources, int
...
@@ -252,7 +252,7 @@ static int32_t sortComparInit(SMsortComparParam* cmpParam, SArray* pSources, int
}
}
static
void
appendOneRowToDataBlock
(
SSDataBlock
*
pBlock
,
const
SSDataBlock
*
pSource
,
int32_t
*
rowIndex
)
{
static
void
appendOneRowToDataBlock
(
SSDataBlock
*
pBlock
,
const
SSDataBlock
*
pSource
,
int32_t
*
rowIndex
)
{
for
(
int32_t
i
=
0
;
i
<
pBlock
->
info
.
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
taosArrayGetSize
(
pBlock
->
pDataBlock
)
;
++
i
)
{
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pColInfo
=
taosArrayGet
(
pBlock
->
pDataBlock
,
i
);
SColumnInfoData
*
pSrcColInfo
=
taosArrayGet
(
pSource
->
pDataBlock
,
i
);
SColumnInfoData
*
pSrcColInfo
=
taosArrayGet
(
pSource
->
pDataBlock
,
i
);
...
@@ -500,7 +500,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
...
@@ -500,7 +500,7 @@ static int32_t doInternalMergeSort(SSortHandle* pHandle) {
return
terrno
;
return
terrno
;
}
}
int32_t
size
=
blockDataGetSize
(
pDataBlock
)
+
sizeof
(
int32_t
)
+
pDataBlock
->
info
.
numOfCols
*
sizeof
(
int32_t
);
int32_t
size
=
blockDataGetSize
(
pDataBlock
)
+
sizeof
(
int32_t
)
+
taosArrayGetSize
(
pDataBlock
->
pDataBlock
)
*
sizeof
(
int32_t
);
assert
(
size
<=
getBufPageSize
(
pHandle
->
pBuf
));
assert
(
size
<=
getBufPageSize
(
pHandle
->
pBuf
));
blockDataToBuf
(
pPage
,
pDataBlock
);
blockDataToBuf
(
pPage
,
pDataBlock
);
...
...
source/libs/executor/test/executorTests.cpp
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/executor/test/sortTests.cpp
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/function/inc/taggfunction.h
浏览文件 @
ee821197
...
@@ -28,19 +28,6 @@ extern "C" {
...
@@ -28,19 +28,6 @@ extern "C" {
#include "function.h"
#include "function.h"
#include "tudf.h"
#include "tudf.h"
extern
SAggFunctionInfo
aggFunc
[
35
];
#define FUNCSTATE_SO 0x0u
#define FUNCSTATE_MO 0x1u // dynamic number of output, not multinumber of output e.g., TOP/BOTTOM
#define FUNCSTATE_STREAM 0x2u // function avail for stream
#define FUNCSTATE_STABLE 0x4u // function avail for super table
#define FUNCSTATE_NEED_TS 0x8u // timestamp is required during query processing
#define FUNCSTATE_SELECTIVITY 0x10u // selectivity functions, can exists along with tag columns
#define BASIC_FUNC_SO FUNCSTATE_SO | FUNCSTATE_STREAM | FUNCSTATE_STABLE
#define BASIC_FUNC_MO FUNCSTATE_MO | FUNCSTATE_STREAM | FUNCSTATE_STABLE
#define AVG_FUNCTION_INTER_BUFFER_SIZE 50
#define AVG_FUNCTION_INTER_BUFFER_SIZE 50
#define DATA_SET_FLAG ',' // to denote the output area has data, not null value
#define DATA_SET_FLAG ',' // to denote the output area has data, not null value
...
...
source/libs/function/src/builtins.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/function/src/builtinsimpl.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/function/src/tudf.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/function/src/udfd.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/function/test/runUdf.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/index/test/index_executor_tests.cpp
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/monitor/src/monMain.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/monitor/src/monMsg.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/parser/src/parAstParser.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/parser/src/parTranslater.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/parser/src/parUtil.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/parser/test/mockCatalogService.cpp
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/qcom/src/querymsg.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/qworker/src/qworker.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/scalar/inc/sclInt.h
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/scalar/src/filter.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/scalar/src/scalar.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclfunc.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/scalar/src/sclvector.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/scalar/test/filter/filterTests.cpp
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/scalar/test/scalar/scalarTests.cpp
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/stream/inc/streamInc.h
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/stream/src/streamDispatch.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/stream/src/streamExec.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncEnv.h
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/inc/syncRaftLog.h
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/src/syncAppendEntries.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/src/syncAppendEntriesReply.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/src/syncMain.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftCfg.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/src/syncRaftLog.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/src/syncReplication.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/src/syncSnapshot.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/test/syncRaftLogTest2.cpp
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/sync/test/syncRaftLogTest3.cpp
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/tdb/src/db/tdbBtree.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/transport/src/transCli.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/wal/src/walRead.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/libs/wal/src/walWrite.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/util/src/tconfig.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/util/src/terror.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
source/util/src/tlog.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/pytest/util/cluster.py
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/script/general/parser/udf.sim
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/script/jenkins/basic.txt
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/script/tmp/monitor.sim
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/script/tsim/query/udf.sim
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/script/tsim/show/basic.sim
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/script/tsim/tmq/consume.sh
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/script/tsim/tmq/snapshot.sim
0 → 100644
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/system-test/6-cluster/5dnode3mnodeStop.py
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmq3mnodeSwitch.py
0 → 100644
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqCommon.py
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/system-test/7-tmq/tmqUdf.py
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/system-test/fulltest.sh
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/system-test/simpletest.bat
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/system-test/test.py
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tests/test/c/tmqSim.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
tools/shell/src/shellEngine.c
浏览文件 @
ee821197
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录