Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
599df650
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
599df650
编写于
7月 18, 2020
作者:
dengyihao
提交者:
GitHub
7月 18, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into hotfix/TD-884
上级
3c4e620f
f28c39da
变更
207
展开全部
隐藏空白更改
内联
并排
Showing
207 changed file
with
2585 addition
and
2037 deletion
+2585
-2037
importSampleData/app/main.go
importSampleData/app/main.go
+122
-126
src/client/inc/tscUtil.h
src/client/inc/tscUtil.h
+4
-2
src/client/inc/tsclient.h
src/client/inc/tsclient.h
+4
-4
src/client/src/tscAsync.c
src/client/src/tscAsync.c
+17
-26
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+5
-15
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+26
-18
src/client/src/tscServer.c
src/client/src/tscServer.c
+63
-59
src/client/src/tscSql.c
src/client/src/tscSql.c
+3
-3
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+133
-115
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+3
-4
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+17
-17
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+0
-2
src/common/src/tglobal.c
src/common/src/tglobal.c
+15
-25
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
...or/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
+0
-1
src/cq/src/cqMain.c
src/cq/src/cqMain.c
+3
-3
src/dnode/inc/dnodeMgmt.h
src/dnode/inc/dnodeMgmt.h
+2
-2
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+52
-53
src/dnode/src/dnodePeer.c
src/dnode/src/dnodePeer.c
+12
-12
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+2
-2
src/inc/dnode.h
src/inc/dnode.h
+3
-3
src/inc/taosdef.h
src/inc/taosdef.h
+2
-3
src/inc/taosmsg.h
src/inc/taosmsg.h
+7
-7
src/inc/trpc.h
src/inc/trpc.h
+7
-7
src/inc/tsdb.h
src/inc/tsdb.h
+1
-7
src/kit/taosmigrate/taosmigrate.c
src/kit/taosmigrate/taosmigrate.c
+4
-4
src/kit/taosmigrate/taosmigrate.h
src/kit/taosmigrate/taosmigrate.h
+1
-1
src/kit/taosmigrate/taosmigrateDnodeCfg.c
src/kit/taosmigrate/taosmigrateDnodeCfg.c
+18
-18
src/mnode/inc/mnodeDef.h
src/mnode/inc/mnodeDef.h
+3
-3
src/mnode/inc/mnodeMnode.h
src/mnode/inc/mnodeMnode.h
+3
-3
src/mnode/inc/mnodeVgroup.h
src/mnode/inc/mnodeVgroup.h
+3
-3
src/mnode/src/mnodeBalance.c
src/mnode/src/mnodeBalance.c
+2
-2
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+30
-16
src/mnode/src/mnodeMnode.c
src/mnode/src/mnodeMnode.c
+24
-24
src/mnode/src/mnodePeer.c
src/mnode/src/mnodePeer.c
+7
-7
src/mnode/src/mnodeRead.c
src/mnode/src/mnodeRead.c
+7
-7
src/mnode/src/mnodeSdb.c
src/mnode/src/mnodeSdb.c
+1
-1
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+2
-2
src/mnode/src/mnodeTable.c
src/mnode/src/mnodeTable.c
+14
-14
src/mnode/src/mnodeVgroup.c
src/mnode/src/mnodeVgroup.c
+35
-34
src/mnode/src/mnodeWrite.c
src/mnode/src/mnodeWrite.c
+8
-8
src/plugins/monitor/src/monitorMain.c
src/plugins/monitor/src/monitorMain.c
+4
-0
src/query/inc/qExecutor.h
src/query/inc/qExecutor.h
+1
-2
src/query/inc/qUtil.h
src/query/inc/qUtil.h
+19
-4
src/query/inc/qresultBuf.h
src/query/inc/qresultBuf.h
+13
-17
src/query/inc/tsqlfunction.h
src/query/inc/tsqlfunction.h
+1
-4
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+257
-223
src/query/src/qUtil.c
src/query/src/qUtil.c
+5
-12
src/query/src/qast.c
src/query/src/qast.c
+3
-4
src/query/src/qresultBuf.c
src/query/src/qresultBuf.c
+25
-64
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+30
-30
src/rpc/src/rpcTcp.c
src/rpc/src/rpcTcp.c
+1
-1
src/rpc/test/rclient.c
src/rpc/test/rclient.c
+15
-15
src/rpc/test/rsclient.c
src/rpc/test/rsclient.c
+13
-13
src/rpc/test/rserver.c
src/rpc/test/rserver.c
+1
-1
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+2
-1
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+6
-1
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+1
-1
src/tsdb/src/tsdbRWHelper.c
src/tsdb/src/tsdbRWHelper.c
+20
-9
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+140
-97
src/tsdb/tests/tsdbTests.cpp
src/tsdb/tests/tsdbTests.cpp
+9
-6
src/util/src/tcache.c
src/util/src/tcache.c
+3
-43
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+7
-9
tests/comparisonTest/tdengine/q5.txt
tests/comparisonTest/tdengine/q5.txt
+1
-0
tests/comparisonTest/tdengine/tdengineTest.c
tests/comparisonTest/tdengine/tdengineTest.c
+54
-21
tests/perftest-scripts/tdengineTestQ1Loop.sh
tests/perftest-scripts/tdengineTestQ1Loop.sh
+127
-0
tests/perftest-scripts/tdengineTestQ2Loop.sh
tests/perftest-scripts/tdengineTestQ2Loop.sh
+348
-0
tests/perftest-scripts/tdengineTestQ3Loop.sh
tests/perftest-scripts/tdengineTestQ3Loop.sh
+124
-0
tests/perftest-scripts/tdengineTestQ4Loop.sh
tests/perftest-scripts/tdengineTestQ4Loop.sh
+124
-0
tests/perftest-scripts/tdengineTestQ5Loop.sh
tests/perftest-scripts/tdengineTestQ5Loop.sh
+107
-0
tests/perftest-scripts/tdengineTestWriteLoop.sh
tests/perftest-scripts/tdengineTestWriteLoop.sh
+116
-0
tests/pytest/tag_lite/add.py
tests/pytest/tag_lite/add.py
+2
-0
tests/pytest/util/dnodes-no-random-fail.py
tests/pytest/util/dnodes-no-random-fail.py
+0
-1
tests/pytest/util/dnodes-random-fail.py
tests/pytest/util/dnodes-random-fail.py
+0
-1
tests/pytest/util/dnodes.py
tests/pytest/util/dnodes.py
+0
-1
tests/script/general/alter/cached_schema_after_alter.sim
tests/script/general/alter/cached_schema_after_alter.sim
+2
-2
tests/script/general/db/alter_option.sim
tests/script/general/db/alter_option.sim
+0
-1
tests/script/general/db/basic.sim
tests/script/general/db/basic.sim
+1
-3
tests/script/general/db/delete.sim
tests/script/general/db/delete.sim
+0
-1
tests/script/general/db/delete_reuse1.sim
tests/script/general/db/delete_reuse1.sim
+0
-5
tests/script/general/db/delete_reuse2.sim
tests/script/general/db/delete_reuse2.sim
+0
-5
tests/script/general/db/delete_reusevnode.sim
tests/script/general/db/delete_reusevnode.sim
+0
-7
tests/script/general/db/delete_reusevnode2.sim
tests/script/general/db/delete_reusevnode2.sim
+0
-3
tests/script/general/db/delete_writing1.sim
tests/script/general/db/delete_writing1.sim
+0
-5
tests/script/general/db/delete_writing2.sim
tests/script/general/db/delete_writing2.sim
+0
-1
tests/script/general/db/len.sim
tests/script/general/db/len.sim
+0
-1
tests/script/general/db/repeat.sim
tests/script/general/db/repeat.sim
+0
-1
tests/script/general/db/vnodes.sim
tests/script/general/db/vnodes.sim
+0
-1
tests/script/general/parser/bug.sim
tests/script/general/parser/bug.sim
+0
-1
tests/script/general/parser/first_last_query.sim
tests/script/general/parser/first_last_query.sim
+11
-0
tests/script/general/parser/null_char.sim
tests/script/general/parser/null_char.sim
+15
-0
tests/script/general/parser/select_across_vnodes.sim
tests/script/general/parser/select_across_vnodes.sim
+0
-1
tests/script/general/parser/select_from_cache_disk.sim
tests/script/general/parser/select_from_cache_disk.sim
+0
-1
tests/script/general/parser/slimit.sim
tests/script/general/parser/slimit.sim
+0
-1
tests/script/general/parser/slimit1.sim
tests/script/general/parser/slimit1.sim
+0
-1
tests/script/general/parser/slimit_alter_tags.sim
tests/script/general/parser/slimit_alter_tags.sim
+0
-1
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+3
-5
tests/script/general/parser/timestamp.sim
tests/script/general/parser/timestamp.sim
+0
-1
tests/script/general/parser/union.sim
tests/script/general/parser/union.sim
+82
-78
tests/script/general/stable/disk.sim
tests/script/general/stable/disk.sim
+0
-1
tests/script/general/stable/dnode3.sim
tests/script/general/stable/dnode3.sim
+0
-4
tests/script/general/stable/metrics.sim
tests/script/general/stable/metrics.sim
+0
-1
tests/script/general/stable/refcount.sim
tests/script/general/stable/refcount.sim
+0
-1
tests/script/general/stable/show.sim
tests/script/general/stable/show.sim
+0
-1
tests/script/general/stable/values.sim
tests/script/general/stable/values.sim
+0
-1
tests/script/general/stable/vnode3.sim
tests/script/general/stable/vnode3.sim
+0
-2
tests/script/general/stream/metrics_replica1_vnoden.sim
tests/script/general/stream/metrics_replica1_vnoden.sim
+0
-1
tests/script/general/stream/table_replica1_vnoden.sim
tests/script/general/stream/table_replica1_vnoden.sim
+0
-1
tests/script/general/table/delete_reuse1.sim
tests/script/general/table/delete_reuse1.sim
+0
-5
tests/script/general/table/delete_reuse2.sim
tests/script/general/table/delete_reuse2.sim
+0
-5
tests/script/general/table/delete_writing.sim
tests/script/general/table/delete_writing.sim
+0
-5
tests/script/general/table/limit.sim
tests/script/general/table/limit.sim
+0
-1
tests/script/general/table/vgroup.sim
tests/script/general/table/vgroup.sim
+1
-8
tests/script/sh/clear.sh
tests/script/sh/clear.sh
+0
-1
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+0
-1
tests/script/tmp/http.sim
tests/script/tmp/http.sim
+0
-5
tests/script/tmp/mnodes.sim
tests/script/tmp/mnodes.sim
+0
-4
tests/script/unique/account/authority.sim
tests/script/unique/account/authority.sim
+0
-1
tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim
tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim
...script/unique/arbitrator/dn3_mn1_full_createTableFail.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim
...s/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim
...script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim
...e/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim
tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim
tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim
...t/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim
+6
-13
tests/script/unique/arbitrator/dn3_mn1_replica_change.sim
tests/script/unique/arbitrator/dn3_mn1_replica_change.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim
...ipt/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim
tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim
+5
-10
tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim
tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim
...t/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim
...pt/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim
.../unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim
tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim
...unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim
tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim
+4
-9
tests/script/unique/arbitrator/dn3_mn2_killDnode.sim
tests/script/unique/arbitrator/dn3_mn2_killDnode.sim
+4
-9
tests/script/unique/arbitrator/insert_duplicationTs.sim
tests/script/unique/arbitrator/insert_duplicationTs.sim
+4
-9
tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim
.../unique/arbitrator/offline_replica2_alterTable_online.sim
+4
-9
tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim
...pt/unique/arbitrator/offline_replica2_alterTag_online.sim
+4
-9
tests/script/unique/arbitrator/offline_replica2_createTable_online.sim
...unique/arbitrator/offline_replica2_createTable_online.sim
+4
-9
tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim
...ript/unique/arbitrator/offline_replica2_dropDb_online.sim
+4
-9
tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim
...t/unique/arbitrator/offline_replica2_dropTable_online.sim
+4
-9
tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim
.../unique/arbitrator/offline_replica3_alterTable_online.sim
+4
-9
tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim
...pt/unique/arbitrator/offline_replica3_alterTag_online.sim
+4
-4
tests/script/unique/arbitrator/offline_replica3_createTable_online.sim
...unique/arbitrator/offline_replica3_createTable_online.sim
+4
-9
tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim
...ript/unique/arbitrator/offline_replica3_dropDb_online.sim
+4
-9
tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim
...t/unique/arbitrator/offline_replica3_dropTable_online.sim
+4
-9
tests/script/unique/arbitrator/replica_changeWithArbitrator.sim
...script/unique/arbitrator/replica_changeWithArbitrator.sim
+6
-11
tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim
...script/unique/arbitrator/sync_replica2_alterTable_add.sim
+4
-9
tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim
...cript/unique/arbitrator/sync_replica2_alterTable_drop.sim
+4
-9
tests/script/unique/arbitrator/sync_replica2_dropDb.sim
tests/script/unique/arbitrator/sync_replica2_dropDb.sim
+4
-9
tests/script/unique/arbitrator/sync_replica2_dropTable.sim
tests/script/unique/arbitrator/sync_replica2_dropTable.sim
+4
-9
tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim
...script/unique/arbitrator/sync_replica3_alterTable_add.sim
+4
-9
tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim
...cript/unique/arbitrator/sync_replica3_alterTable_drop.sim
+4
-9
tests/script/unique/arbitrator/sync_replica3_createTable.sim
tests/script/unique/arbitrator/sync_replica3_createTable.sim
+4
-9
tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim
...ator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim
+4
-9
tests/script/unique/arbitrator/sync_replica3_dropDb.sim
tests/script/unique/arbitrator/sync_replica3_dropDb.sim
+4
-9
tests/script/unique/arbitrator/sync_replica3_dropTable.sim
tests/script/unique/arbitrator/sync_replica3_dropTable.sim
+4
-9
tests/script/unique/big/balance.sim
tests/script/unique/big/balance.sim
+0
-5
tests/script/unique/big/maxvnodes.sim
tests/script/unique/big/maxvnodes.sim
+0
-2
tests/script/unique/big/restartSpeed.sim
tests/script/unique/big/restartSpeed.sim
+0
-2
tests/script/unique/cluster/balance1.sim
tests/script/unique/cluster/balance1.sim
+0
-9
tests/script/unique/cluster/balance2.sim
tests/script/unique/cluster/balance2.sim
+0
-9
tests/script/unique/cluster/balance3.sim
tests/script/unique/cluster/balance3.sim
+0
-9
tests/script/unique/cluster/client1_0.sim
tests/script/unique/cluster/client1_0.sim
+0
-5
tests/script/unique/cluster/cluster_main.sim
tests/script/unique/cluster/cluster_main.sim
+5
-11
tests/script/unique/cluster/cluster_main0.sim
tests/script/unique/cluster/cluster_main0.sim
+5
-11
tests/script/unique/cluster/cluster_main1.sim
tests/script/unique/cluster/cluster_main1.sim
+5
-11
tests/script/unique/cluster/cluster_main2.sim
tests/script/unique/cluster/cluster_main2.sim
+5
-11
tests/script/unique/cluster/main1_client1_0.sim
tests/script/unique/cluster/main1_client1_0.sim
+1
-2
tests/script/unique/cluster/main2_client1_0.sim
tests/script/unique/cluster/main2_client1_0.sim
+0
-1
tests/script/unique/db/delete.sim
tests/script/unique/db/delete.sim
+0
-3
tests/script/unique/db/delete_part.sim
tests/script/unique/db/delete_part.sim
+4
-9
tests/script/unique/db/replica_add12.sim
tests/script/unique/db/replica_add12.sim
+0
-5
tests/script/unique/db/replica_add13.sim
tests/script/unique/db/replica_add13.sim
+0
-5
tests/script/unique/db/replica_add23.sim
tests/script/unique/db/replica_add23.sim
+0
-5
tests/script/unique/db/replica_part.sim
tests/script/unique/db/replica_part.sim
+0
-3
tests/script/unique/db/replica_reduce21.sim
tests/script/unique/db/replica_reduce21.sim
+0
-6
tests/script/unique/db/replica_reduce31.sim
tests/script/unique/db/replica_reduce31.sim
+0
-3
tests/script/unique/db/replica_reduce32.sim
tests/script/unique/db/replica_reduce32.sim
+0
-3
tests/script/unique/dnode/alternativeRole.sim
tests/script/unique/dnode/alternativeRole.sim
+3
-3
tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim
tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim
+4
-9
tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim
...s/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim
+4
-9
tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim
...migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim
+4
-9
tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim
tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim
+4
-9
tests/script/unique/stable/balance_replica1.sim
tests/script/unique/stable/balance_replica1.sim
+0
-2
tests/script/unique/stable/dnode2.sim
tests/script/unique/stable/dnode2.sim
+0
-2
tests/script/unique/stable/dnode2_stop.sim
tests/script/unique/stable/dnode2_stop.sim
+0
-2
tests/script/unique/stable/dnode3.sim
tests/script/unique/stable/dnode3.sim
+0
-3
tests/script/unique/stable/replica2_dnode4.sim
tests/script/unique/stable/replica2_dnode4.sim
+0
-4
tests/script/unique/stable/replica2_vnode3.sim
tests/script/unique/stable/replica2_vnode3.sim
+0
-2
tests/script/unique/stable/replica3_dnode6.sim
tests/script/unique/stable/replica3_dnode6.sim
+0
-7
tests/script/unique/stable/replica3_vnode3.sim
tests/script/unique/stable/replica3_vnode3.sim
+0
-4
tests/script/unique/stream/metrics_balance.sim
tests/script/unique/stream/metrics_balance.sim
+0
-2
tests/script/unique/stream/metrics_replica1_dnode2.sim
tests/script/unique/stream/metrics_replica1_dnode2.sim
+0
-2
tests/script/unique/stream/metrics_replica2_dnode2_vnoden.sim
...s/script/unique/stream/metrics_replica2_dnode2_vnoden.sim
+0
-2
tests/script/unique/stream/metrics_replica2_dnode3.sim
tests/script/unique/stream/metrics_replica2_dnode3.sim
+0
-3
tests/script/unique/stream/metrics_replica3_dnode4.sim
tests/script/unique/stream/metrics_replica3_dnode4.sim
+0
-4
tests/script/unique/stream/table_balance.sim
tests/script/unique/stream/table_balance.sim
+0
-4
tests/script/unique/stream/table_move.sim
tests/script/unique/stream/table_move.sim
+0
-10
tests/script/unique/stream/table_replica1_dnode2.sim
tests/script/unique/stream/table_replica1_dnode2.sim
+0
-4
tests/script/unique/stream/table_replica2_dnode2_vnoden.sim
tests/script/unique/stream/table_replica2_dnode2_vnoden.sim
+0
-2
tests/script/unique/stream/table_replica2_dnode3.sim
tests/script/unique/stream/table_replica2_dnode3.sim
+0
-3
tests/script/unique/stream/table_replica3_dnode4.sim
tests/script/unique/stream/table_replica3_dnode4.sim
+0
-4
tests/script/unique/vnode/many.sim
tests/script/unique/vnode/many.sim
+0
-4
tests/script/unique/vnode/replica2_basic2.sim
tests/script/unique/vnode/replica2_basic2.sim
+0
-5
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+13
-3
未找到文件。
importSampleData/app/main.go
浏览文件 @
599df650
...
...
@@ -7,7 +7,6 @@ import (
"encoding/json"
"flag"
"fmt"
"github.com/taosdata/TDengine/importSampleData/import"
"hash/crc32"
"io"
"log"
...
...
@@ -18,88 +17,89 @@ import (
"sync"
"time"
dataimport
"github.com/taosdata/TDengine/importSampleData/import"
_
"github.com/taosdata/driver-go/taosSql"
)
const
(
TIMESTAMP
=
"timestamp"
DATETIME
=
"datetime"
MILLISECOND
=
"millisecond"
DEFAULT_STARTTIME
int64
=
-
1
DEFAULT_INTERVAL
int64
=
1
*
1000
DEFAULT_DELAY
int64
=
-
1
DEFAULT_STATISTIC_TABLE
=
"statistic"
JSON_FORMAT
=
"json"
CSV_FORMAT
=
"csv"
TIMESTAMP
=
"timestamp"
DATETIME
=
"datetime"
MILLISECOND
=
"millisecond"
DEFAULT_STARTTIME
int64
=
-
1
DEFAULT_INTERVAL
int64
=
1
*
1000
DEFAULT_DELAY
int64
=
-
1
DEFAULT_STATISTIC_TABLE
=
"statistic"
JSON_FORMAT
=
"json"
CSV_FORMAT
=
"csv"
SUPERTABLE_PREFIX
=
"s_"
SUBTABLE_PREFIX
=
"t_"
SUBTABLE_PREFIX
=
"t_"
DRIVER_NAME
=
"taosSql"
DRIVER_NAME
=
"taosSql"
STARTTIME_LAYOUT
=
"2006-01-02 15:04:05.000"
INSERT_PREFIX
=
"insert into "
INSERT_PREFIX
=
"insert into "
)
var
(
cfg
string
cases
string
hnum
int
vnum
int
thread
int
batch
int
auto
int
starttimestr
string
interval
int64
host
string
port
int
user
string
password
string
dropdb
int
db
string
dbparam
string
cfg
string
cases
string
hnum
int
vnum
int
thread
int
batch
int
auto
int
starttimestr
string
interval
int64
host
string
port
int
user
string
password
string
dropdb
int
db
string
dbparam
string
dataSourceName
string
startTime
int64
startTime
int64
superTableConfigMap
=
make
(
map
[
string
]
*
superTableConfig
)
subTableMap
=
make
(
map
[
string
]
*
dataRows
)
scaleTableNames
[]
string
superTableConfigMap
=
make
(
map
[
string
]
*
superTableConfig
)
subTableMap
=
make
(
map
[
string
]
*
dataRows
)
scaleTableNames
[]
string
scaleTableMap
=
make
(
map
[
string
]
*
scaleTableInfo
)
successRows
[]
int64
successRows
[]
int64
lastStaticTime
time
.
Time
lastTotalRows
int64
timeTicker
*
time
.
Ticker
delay
int64
// default 10 milliseconds
tick
int64
save
int
saveTable
string
lastTotalRows
int64
timeTicker
*
time
.
Ticker
delay
int64
// default 10 milliseconds
tick
int64
save
int
saveTable
string
)
type
superTableConfig
struct
{
startTime
int64
endTime
int64
cycleTime
int64
startTime
int64
endTime
int64
cycleTime
int64
avgInterval
int64
config
dataimport
.
CaseConfig
config
dataimport
.
CaseConfig
}
type
scaleTableInfo
struct
{
scaleTableName
string
subTableName
string
insertRows
int64
subTableName
string
insertRows
int64
}
type
tableRows
struct
{
tableName
string
// tableName
value
string
// values(...)
tableName
string
// tableName
value
string
// values(...)
}
type
dataRows
struct
{
rows
[]
map
[
string
]
interface
{}
config
dataimport
.
CaseConfig
rows
[]
map
[
string
]
interface
{}
config
dataimport
.
CaseConfig
}
func
(
rows
dataRows
)
Len
()
int
{
...
...
@@ -127,10 +127,10 @@ func init() {
if
db
==
""
{
//db = "go"
db
=
fmt
.
Sprintf
(
"test_%s"
,
time
.
Now
()
.
Format
(
"20060102"
))
db
=
fmt
.
Sprintf
(
"test_%s"
,
time
.
Now
()
.
Format
(
"20060102"
))
}
if
auto
==
1
&&
len
(
starttimestr
)
==
0
{
if
auto
==
1
&&
len
(
starttimestr
)
==
0
{
log
.
Fatalf
(
"startTime must be set when auto is 1, the format is
\"
yyyy-MM-dd HH:mm:ss.SSS
\"
"
)
}
...
...
@@ -141,7 +141,7 @@ func init() {
}
startTime
=
t
.
UnixNano
()
/
1e6
// as millisecond
}
else
{
}
else
{
startTime
=
DEFAULT_STARTTIME
}
...
...
@@ -179,7 +179,7 @@ func main() {
_
,
exists
:=
superTableConfigMap
[
caseConfig
.
Stname
]
if
!
exists
{
superTableConfigMap
[
caseConfig
.
Stname
]
=
&
superTableConfig
{
config
:
caseConfig
}
superTableConfigMap
[
caseConfig
.
Stname
]
=
&
superTableConfig
{
config
:
caseConfig
}
}
else
{
log
.
Fatalf
(
"the stname of case %s already exist.
\n
"
,
caseConfig
.
Stname
)
}
...
...
@@ -201,9 +201,9 @@ func main() {
if
DEFAULT_DELAY
==
delay
{
// default delay
delay
=
caseMinumInterval
/
2
delay
=
caseMinumInterval
/
2
if
delay
<
1
{
delay
=
1
delay
=
1
}
log
.
Printf
(
"actual delay is %d ms."
,
delay
)
}
...
...
@@ -232,7 +232,7 @@ func main() {
filePerThread
:=
subTableNum
/
thread
leftFileNum
:=
subTableNum
%
thread
var
wg
sync
.
WaitGroup
var
wg
sync
.
WaitGroup
start
=
time
.
Now
()
...
...
@@ -255,31 +255,31 @@ func main() {
go
staticSpeed
()
wg
.
Wait
()
usedTime
:=
time
.
Since
(
start
)
usedTime
:=
time
.
Since
(
start
)
total
:=
getTotalRows
(
successRows
)
log
.
Printf
(
"finished insert %d rows, used %d ms, speed %d rows/s"
,
total
,
usedTime
/
1e6
,
total
*
1e9
/
int64
(
usedTime
))
log
.
Printf
(
"finished insert %d rows, used %d ms, speed %d rows/s"
,
total
,
usedTime
/
1e6
,
total
*
1e3
/
usedTime
.
Milliseconds
(
))
if
vnum
==
0
{
// continue waiting for insert data
wait
:=
make
(
chan
string
)
v
:=
<-
wait
wait
:=
make
(
chan
string
)
v
:=
<-
wait
log
.
Printf
(
"program receive %s, exited.
\n
"
,
v
)
}
else
{
}
else
{
timeTicker
.
Stop
()
}
}
func
staticSpeed
(){
func
staticSpeed
()
{
connection
:=
getConnection
()
defer
connection
.
Close
()
if
save
==
1
{
connection
.
Exec
(
"use "
+
db
)
_
,
err
:=
connection
.
Exec
(
"create table if not exists "
+
saveTable
+
"(ts timestamp, speed int)"
)
_
,
err
:=
connection
.
Exec
(
"create table if not exists "
+
saveTable
+
"(ts timestamp, speed int)"
)
if
err
!=
nil
{
log
.
Fatalf
(
"create %s Table error: %s
\n
"
,
saveTable
,
err
)
}
...
...
@@ -287,13 +287,13 @@ func staticSpeed(){
for
{
<-
timeTicker
.
C
currentTime
:=
time
.
Now
()
usedTime
:=
currentTime
.
UnixNano
()
-
lastStaticTime
.
UnixNano
()
total
:=
getTotalRows
(
successRows
)
currentSuccessRows
:=
total
-
lastTotalRows
speed
:=
currentSuccessRows
*
1e9
/
int64
(
usedTime
)
log
.
Printf
(
"insert %d rows, used %d ms, speed %d rows/s"
,
currentSuccessRows
,
usedTime
/
1e6
,
speed
)
...
...
@@ -301,14 +301,14 @@ func staticSpeed(){
insertSql
:=
fmt
.
Sprintf
(
"insert into %s values(%d, %d)"
,
saveTable
,
currentTime
.
UnixNano
()
/
1e6
,
speed
)
connection
.
Exec
(
insertSql
)
}
lastStaticTime
=
currentTime
lastTotalRows
=
total
}
}
func
getTotalRows
(
successRows
[]
int64
)
int64
{
func
getTotalRows
(
successRows
[]
int64
)
int64
{
var
total
int64
=
0
for
j
:=
0
;
j
<
len
(
successRows
);
j
++
{
total
+=
successRows
[
j
]
...
...
@@ -316,18 +316,18 @@ func getTotalRows(successRows []int64) int64{
return
total
}
func
getSuperTableTimeConfig
(
fileRows
dataRows
)
(
start
,
cycleTime
,
avgInterval
int64
){
func
getSuperTableTimeConfig
(
fileRows
dataRows
)
(
start
,
cycleTime
,
avgInterval
int64
)
{
if
auto
==
1
{
// use auto generate data time
start
=
startTime
avgInterval
=
interval
maxTableRows
:=
normalizationDataWithSameInterval
(
fileRows
,
avgInterval
)
cycleTime
=
maxTableRows
*
avgInterval
+
avgInterval
cycleTime
=
maxTableRows
*
avgInterval
+
avgInterval
}
else
{
// use the sample data primary timestamp
sort
.
Sort
(
fileRows
)
// sort the file data by the primarykey
sort
.
Sort
(
fileRows
)
// sort the file data by the primarykey
minTime
:=
getPrimaryKey
(
fileRows
.
rows
[
0
][
fileRows
.
config
.
Timestamp
])
maxTime
:=
getPrimaryKey
(
fileRows
.
rows
[
len
(
fileRows
.
rows
)
-
1
][
fileRows
.
config
.
Timestamp
])
...
...
@@ -340,21 +340,21 @@ func getSuperTableTimeConfig(fileRows dataRows) (start, cycleTime, avgInterval i
if
minTime
==
maxTime
{
avgInterval
=
interval
cycleTime
=
tableNum
*
avgInterval
+
avgInterval
}
else
{
cycleTime
=
tableNum
*
avgInterval
+
avgInterval
}
else
{
avgInterval
=
(
maxTime
-
minTime
)
/
int64
(
len
(
fileRows
.
rows
))
*
tableNum
cycleTime
=
maxTime
-
minTime
+
avgInterval
}
}
return
}
func
createStatisticTable
(){
func
createStatisticTable
()
{
connection
:=
getConnection
()
defer
connection
.
Close
()
_
,
err
:=
connection
.
Exec
(
"create table if not exist "
+
db
+
"."
+
saveTable
+
"(ts timestamp, speed int)"
)
_
,
err
:=
connection
.
Exec
(
"create table if not exist "
+
db
+
"."
+
saveTable
+
"(ts timestamp, speed int)"
)
if
err
!=
nil
{
log
.
Fatalf
(
"createStatisticTable error: %s
\n
"
,
err
)
}
...
...
@@ -379,8 +379,8 @@ func createSubTable(subTableMaps map[string]*dataRows) {
tableName
:=
getScaleSubTableName
(
subTableName
,
i
)
scaleTableMap
[
tableName
]
=
&
scaleTableInfo
{
subTableName
:
subTableName
,
insertRows
:
0
,
subTableName
:
subTableName
,
insertRows
:
0
,
}
scaleTableNames
=
append
(
scaleTableNames
,
tableName
)
...
...
@@ -389,12 +389,12 @@ func createSubTable(subTableMaps map[string]*dataRows) {
buffers
.
WriteString
(
" using "
)
buffers
.
WriteString
(
superTableName
)
buffers
.
WriteString
(
" tags("
)
for
_
,
tag
:=
range
subTableMaps
[
subTableName
]
.
config
.
Tags
{
for
_
,
tag
:=
range
subTableMaps
[
subTableName
]
.
config
.
Tags
{
tagValue
:=
fmt
.
Sprintf
(
"%v"
,
tagValues
[
strings
.
ToLower
(
tag
.
Name
)])
buffers
.
WriteString
(
"'"
+
tagValue
+
"'"
)
buffers
.
WriteString
(
","
)
}
buffers
.
Truncate
(
buffers
.
Len
()
-
1
)
buffers
.
Truncate
(
buffers
.
Len
()
-
1
)
buffers
.
WriteString
(
")"
)
createTableSql
:=
buffers
.
String
()
...
...
@@ -451,14 +451,14 @@ func createSuperTable(superTableConfigMap map[string]*superTableConfig) {
buffer
.
WriteString
(
field
.
Name
+
" "
+
field
.
Type
+
","
)
}
buffer
.
Truncate
(
buffer
.
Len
()
-
1
)
buffer
.
Truncate
(
buffer
.
Len
()
-
1
)
buffer
.
WriteString
(
") tags( "
)
for
_
,
tag
:=
range
superTableConf
.
config
.
Tags
{
buffer
.
WriteString
(
tag
.
Name
+
" "
+
tag
.
Type
+
","
)
}
buffer
.
Truncate
(
buffer
.
Len
()
-
1
)
buffer
.
Truncate
(
buffer
.
Len
()
-
1
)
buffer
.
WriteString
(
")"
)
createSql
:=
buffer
.
String
()
...
...
@@ -475,16 +475,15 @@ func createSuperTable(superTableConfigMap map[string]*superTableConfig) {
func
getScaleSubTableName
(
subTableName
string
,
hnum
int
)
string
{
if
hnum
==
0
{
return
subTableName
return
subTableName
}
return
fmt
.
Sprintf
(
"%s_%d"
,
subTableName
,
hnum
)
return
fmt
.
Sprintf
(
"%s_%d"
,
subTableName
,
hnum
)
}
func
getSuperTableName
(
stname
string
)
string
{
return
SUPERTABLE_PREFIX
+
stname
}
/**
* normalizationData , and return the num of subTables
*/
...
...
@@ -505,12 +504,12 @@ func normalizationData(fileRows dataRows, minTime int64) int64 {
value
,
ok
:=
subTableMap
[
subTableName
]
if
!
ok
{
subTableMap
[
subTableName
]
=
&
dataRows
{
rows
:
[]
map
[
string
]
interface
{}{
row
},
config
:
fileRows
.
config
,
rows
:
[]
map
[
string
]
interface
{}{
row
},
config
:
fileRows
.
config
,
}
tableNum
++
}
else
{
}
else
{
value
.
rows
=
append
(
value
.
rows
,
row
)
}
}
...
...
@@ -518,9 +517,9 @@ func normalizationData(fileRows dataRows, minTime int64) int64 {
}
// return the maximum table rows
func
normalizationDataWithSameInterval
(
fileRows
dataRows
,
avgInterval
int64
)
int64
{
func
normalizationDataWithSameInterval
(
fileRows
dataRows
,
avgInterval
int64
)
int64
{
// subTableMap
currSubTableMap
:=
make
(
map
[
string
]
*
dataRows
)
currSubTableMap
:=
make
(
map
[
string
]
*
dataRows
)
for
_
,
row
:=
range
fileRows
.
rows
{
// get subTableName
tableValue
:=
getSubTableNameValue
(
row
[
fileRows
.
config
.
SubTableName
])
...
...
@@ -534,10 +533,10 @@ func normalizationDataWithSameInterval(fileRows dataRows, avgInterval int64) int
if
!
ok
{
row
[
fileRows
.
config
.
Timestamp
]
=
0
currSubTableMap
[
subTableName
]
=
&
dataRows
{
rows
:
[]
map
[
string
]
interface
{}{
row
},
config
:
fileRows
.
config
,
rows
:
[]
map
[
string
]
interface
{}{
row
},
config
:
fileRows
.
config
,
}
}
else
{
}
else
{
row
[
fileRows
.
config
.
Timestamp
]
=
int64
(
len
(
value
.
rows
))
*
avgInterval
value
.
rows
=
append
(
value
.
rows
,
row
)
}
...
...
@@ -545,7 +544,7 @@ func normalizationDataWithSameInterval(fileRows dataRows, avgInterval int64) int
}
var
maxRows
,
tableRows
int
=
0
,
0
for
tableName
:=
range
currSubTableMap
{
for
tableName
:=
range
currSubTableMap
{
tableRows
=
len
(
currSubTableMap
[
tableName
]
.
rows
)
subTableMap
[
tableName
]
=
currSubTableMap
[
tableName
]
// add to global subTableMap
if
tableRows
>
maxRows
{
...
...
@@ -556,13 +555,11 @@ func normalizationDataWithSameInterval(fileRows dataRows, avgInterval int64) int
return
int64
(
maxRows
)
}
func
getSubTableName
(
subTableValue
string
,
superTableName
string
)
string
{
func
getSubTableName
(
subTableValue
string
,
superTableName
string
)
string
{
return
SUBTABLE_PREFIX
+
subTableValue
+
"_"
+
superTableName
}
func
insertData
(
threadIndex
,
start
,
end
int
,
wg
*
sync
.
WaitGroup
,
successRows
[]
int64
)
{
func
insertData
(
threadIndex
,
start
,
end
int
,
wg
*
sync
.
WaitGroup
,
successRows
[]
int64
)
{
connection
:=
getConnection
()
defer
connection
.
Close
()
defer
wg
.
Done
()
...
...
@@ -591,9 +588,9 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []
var
tableEndTime
int64
if
vnum
==
0
{
// need continue generate data
tableEndTime
=
time
.
Now
()
.
UnixNano
()
/
1e6
}
else
{
tableEndTime
=
tableStartTime
+
superTableConf
.
cycleTime
*
int64
(
vnum
)
-
superTableConf
.
avgInterval
tableEndTime
=
time
.
Now
()
.
UnixNano
()
/
1e6
}
else
{
tableEndTime
=
tableStartTime
+
superTableConf
.
cycleTime
*
int64
(
vnum
)
-
superTableConf
.
avgInterval
}
insertRows
:=
scaleTableMap
[
tableName
]
.
insertRows
...
...
@@ -603,10 +600,10 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []
rowIndex
:=
insertRows
%
subTableRows
currentRow
:=
subTableInfo
.
rows
[
rowIndex
]
currentTime
:=
getPrimaryKey
(
currentRow
[
subTableInfo
.
config
.
Timestamp
])
+
loopNum
*
superTableConf
.
cycleTime
+
tableStartTime
currentTime
:=
getPrimaryKey
(
currentRow
[
subTableInfo
.
config
.
Timestamp
])
+
loopNum
*
superTableConf
.
cycleTime
+
tableStartTime
if
currentTime
<=
tableEndTime
{
// append
if
lastTableName
!=
tableName
{
buffers
.
WriteString
(
tableName
)
buffers
.
WriteString
(
" values"
)
...
...
@@ -616,22 +613,22 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []
buffers
.
WriteString
(
"("
)
buffers
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
currentTime
))
buffers
.
WriteString
(
","
)
// fieldNum := len(subTableInfo.config.Fields)
for
_
,
field
:=
range
subTableInfo
.
config
.
Fields
{
for
_
,
field
:=
range
subTableInfo
.
config
.
Fields
{
buffers
.
WriteString
(
getFieldValue
(
currentRow
[
strings
.
ToLower
(
field
.
Name
)]))
buffers
.
WriteString
(
","
)
// if( i != fieldNum -1){
// }
}
buffers
.
Truncate
(
buffers
.
Len
()
-
1
)
buffers
.
Truncate
(
buffers
.
Len
()
-
1
)
buffers
.
WriteString
(
") "
)
appendRows
++
insertRows
++
if
appendRows
==
batch
{
if
appendRows
==
batch
{
// executebatch
insertSql
:=
buffers
.
String
()
connection
.
Exec
(
"use "
+
db
)
...
...
@@ -645,7 +642,7 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []
lastTableName
=
""
appendRows
=
0
}
}
else
{
}
else
{
// finished insert current table
break
}
...
...
@@ -654,14 +651,14 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []
scaleTableMap
[
tableName
]
.
insertRows
=
insertRows
}
// left := len(rows)
if
appendRows
>
0
{
if
appendRows
>
0
{
// executebatch
insertSql
:=
buffers
.
String
()
connection
.
Exec
(
"use "
+
db
)
affectedRows
:=
executeBatchInsert
(
insertSql
,
connection
)
successRows
[
threadIndex
]
+=
affectedRows
currSuccessRows
+=
affectedRows
...
...
@@ -676,7 +673,7 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []
break
}
if
(
num
==
0
)
{
if
num
==
0
{
wg
.
Done
()
//finished insert history data
num
++
}
...
...
@@ -691,7 +688,7 @@ func insertData(threadIndex, start, end int, wg *sync.WaitGroup, successRows []
}
func
buildSql
(
rows
[]
tableRows
)
string
{
func
buildSql
(
rows
[]
tableRows
)
string
{
var
lastTableName
string
...
...
@@ -709,7 +706,7 @@ func buildSql(rows []tableRows) string{
if
lastTableName
==
row
.
tableName
{
buffers
.
WriteString
(
row
.
value
)
}
else
{
}
else
{
buffers
.
WriteString
(
" "
)
buffers
.
WriteString
(
row
.
tableName
)
buffers
.
WriteString
(
" values"
)
...
...
@@ -722,7 +719,7 @@ func buildSql(rows []tableRows) string{
return
inserSql
}
func
buildRow
(
tableName
string
,
currentTime
int64
,
subTableInfo
*
dataRows
,
currentRow
map
[
string
]
interface
{})
tableRows
{
func
buildRow
(
tableName
string
,
currentTime
int64
,
subTableInfo
*
dataRows
,
currentRow
map
[
string
]
interface
{})
tableRows
{
tableRows
:=
tableRows
{
tableName
:
tableName
}
...
...
@@ -732,12 +729,12 @@ func buildRow(tableName string, currentTime int64, subTableInfo *dataRows, curre
buffers
.
WriteString
(
fmt
.
Sprintf
(
"%v"
,
currentTime
))
buffers
.
WriteString
(
","
)
for
_
,
field
:=
range
subTableInfo
.
config
.
Fields
{
for
_
,
field
:=
range
subTableInfo
.
config
.
Fields
{
buffers
.
WriteString
(
getFieldValue
(
currentRow
[
strings
.
ToLower
(
field
.
Name
)]))
buffers
.
WriteString
(
","
)
}
buffers
.
Truncate
(
buffers
.
Len
()
-
1
)
buffers
.
Truncate
(
buffers
.
Len
()
-
1
)
buffers
.
WriteString
(
")"
)
insertSql
:=
buffers
.
String
()
...
...
@@ -764,7 +761,7 @@ func getFieldValue(fieldValue interface{}) string {
return
fmt
.
Sprintf
(
"'%v'"
,
fieldValue
)
}
func
getConnection
()
*
sql
.
DB
{
func
getConnection
()
*
sql
.
DB
{
db
,
err
:=
sql
.
Open
(
DRIVER_NAME
,
dataSourceName
)
if
err
!=
nil
{
panic
(
err
)
...
...
@@ -772,7 +769,6 @@ func getConnection() *sql.DB{
return
db
}
func
getSubTableNameValue
(
suffix
interface
{})
string
{
return
fmt
.
Sprintf
(
"%v"
,
suffix
)
}
...
...
@@ -950,7 +946,7 @@ func parseMillisecond(str interface{}, layout string) int64 {
log
.
Println
(
err
)
return
-
1
}
return
t
.
UnixNano
()
/
1e6
return
t
.
UnixNano
()
/
1e6
}
// lowerMapKey transfer all the map key to lowercase
...
...
@@ -1009,7 +1005,7 @@ func checkUserCaseConfig(caseName string, caseConfig *dataimport.CaseConfig) {
if
i
<
len
(
caseConfig
.
Fields
)
-
1
{
// delete middle item, a = a[:i+copy(a[i:], a[i+1:])]
caseConfig
.
Fields
=
caseConfig
.
Fields
[
:
i
+
copy
(
caseConfig
.
Fields
[
i
:
],
caseConfig
.
Fields
[
i
+
1
:
])]
}
else
{
}
else
{
// delete the last item
caseConfig
.
Fields
=
caseConfig
.
Fields
[
:
len
(
caseConfig
.
Fields
)
-
1
]
}
...
...
@@ -1057,7 +1053,7 @@ func parseArg() {
flag
.
Parse
()
}
func
printArg
()
{
func
printArg
()
{
fmt
.
Println
(
"used param: "
)
fmt
.
Println
(
"-cfg: "
,
cfg
)
fmt
.
Println
(
"-cases:"
,
cases
)
...
...
src/client/inc/tscUtil.h
浏览文件 @
599df650
...
...
@@ -263,10 +263,12 @@ int16_t tscGetJoinTagColIdByUid(STagCond* pTagCond, uint64_t uid);
void
tscPrintSelectClause
(
SSqlObj
*
pSql
,
int32_t
subClauseIndex
);
bool
hasMoreVnodesToTry
(
SSqlObj
*
pSql
);
bool
hasMoreClauseToTry
(
SSqlObj
*
pSql
);
void
tscTryQueryNextVnode
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
void
tscAsyncQuerySingleRowForNextVnode
(
void
*
param
,
TAOS_RES
*
tres
,
int
numOfRows
);
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
void
(
*
queryFp
)()
);
int
tscSetMgmt
IpLis
tFromCfg
(
const
char
*
first
,
const
char
*
second
);
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
);
int
tscSetMgmt
EpSe
tFromCfg
(
const
char
*
first
,
const
char
*
second
);
void
*
malloc_throw
(
size_t
size
);
void
*
calloc_throw
(
size_t
nmemb
,
size_t
size
);
...
...
src/client/inc/tsclient.h
浏览文件 @
599df650
...
...
@@ -314,7 +314,7 @@ typedef struct SSqlObj {
char
*
sqlstr
;
char
retry
;
char
maxRetry
;
SRpc
IpSet
ipLis
t
;
SRpc
EpSet
epSe
t
;
char
listed
;
tsem_t
rspSem
;
SSqlCmd
cmd
;
...
...
@@ -358,7 +358,7 @@ void tscInitMsgsFp();
int
tsParseSql
(
SSqlObj
*
pSql
,
bool
initial
);
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpc
IpSet
*
pI
pSet
);
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpc
EpSet
*
pE
pSet
);
int
tscProcessSql
(
SSqlObj
*
pSql
);
int
tscRenewTableMeta
(
SSqlObj
*
pSql
,
char
*
tableId
);
...
...
@@ -430,7 +430,6 @@ static FORCE_INLINE void tscGetResultColumnChr(SSqlRes* pRes, SFieldInfo* pField
int32_t
bytes
=
pInfo
->
pSqlExpr
->
resBytes
;
char
*
pData
=
pRes
->
data
+
pInfo
->
pSqlExpr
->
offset
*
pRes
->
numOfRows
+
bytes
*
pRes
->
row
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
||
type
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
realLen
=
varDataLen
(
pData
);
assert
(
realLen
<=
bytes
-
VARSTR_HEADER_SIZE
);
...
...
@@ -465,7 +464,8 @@ extern void * tscQhandle;
extern
int
tscKeepConn
[];
extern
int
tsInsertHeadSize
;
extern
int
tscNumOfThreads
;
extern
SRpcCorIpSet
tscMgmtIpSet
;
extern
SRpcCorEpSet
tscMgmtEpSet
;
extern
int
(
*
tscBuildMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
);
...
...
src/client/src/tscAsync.c
浏览文件 @
599df650
...
...
@@ -169,7 +169,11 @@ static void tscProcessAsyncRetrieveImpl(void *param, TAOS_RES *tres, int numOfRo
pCmd
->
command
=
(
pCmd
->
command
>
TSDB_SQL_MGMT
)
?
TSDB_SQL_RETRIEVE
:
TSDB_SQL_FETCH
;
}
tscProcessSql
(
pSql
);
if
(
pCmd
->
command
==
TSDB_SQL_TABLE_JOIN_RETRIEVE
)
{
tscFetchDatablockFromSubquery
(
pSql
);
}
else
{
tscProcessSql
(
pSql
);
}
}
/*
...
...
@@ -474,33 +478,11 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
// in case of insert, redo parsing the sql string and build new submit data block for two reasons:
// 1. the table Id(tid & uid) may have been update, the submit block needs to be updated accordingly.
// 2. vnode may need the schema information along with submit block to update its local table schema.
if
(
pCmd
->
command
==
TSDB_SQL_INSERT
)
{
tscDebug
(
"%p redo parse sql string to build submit block"
,
pSql
);
pCmd
->
parseFinished
=
false
;
tscResetSqlCmdObj
(
pCmd
);
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
return
;
}
else
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_error
;
}
/*
* Discard previous built submit blocks, and then parse the sql string again and build up all submit blocks,
* and send the required submit block according to index value in supporter to server.
*/
pSql
->
fp
=
pSql
->
fetchFp
;
// restore the fp
tscHandleInsertRetry
(
pSql
);
}
else
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
)
{
// in case of other query type, continue
if
(
pCmd
->
command
==
TSDB_SQL_INSERT
||
pCmd
->
command
==
TSDB_SQL_SELECT
)
{
tscDebug
(
"%p redo parse sql string and proceed"
,
pSql
);
//tscDebug("before %p fp:%p, fetchFp:%p", pSql, pSql->fp, pSql->fetchFp);
pCmd
->
parseFinished
=
false
;
tscResetSqlCmdObj
(
pCmd
);
//tscDebug("after %p fp:%p, fetchFp:%p", pSql, pSql->fp, pSql->fetchFp);
code
=
tsParseSql
(
pSql
,
true
);
if
(
code
==
TSDB_CODE_TSC_ACTION_IN_PROGRESS
)
{
...
...
@@ -509,8 +491,17 @@ void tscTableMetaCallBack(void *param, TAOS_RES *res, int code) {
goto
_error
;
}
tscProcessSql
(
pSql
);
}
else
{
// in all other cases, simple retry
if
(
pCmd
->
command
==
TSDB_SQL_INSERT
)
{
/*
* Discard previous built submit blocks, and then parse the sql string again and build up all submit blocks,
* and send the required submit block according to index value in supporter to server.
*/
pSql
->
fp
=
pSql
->
fetchFp
;
// restore the fp
tscHandleInsertRetry
(
pSql
);
}
else
if
(
pCmd
->
command
==
TSDB_SQL_SELECT
)
{
// in case of other query type, continue
tscProcessSql
(
pSql
);
}
}
else
{
// in all other cases, simple retry
tscProcessSql
(
pSql
);
}
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
599df650
...
...
@@ -1481,7 +1481,7 @@ static bool first_last_function_setup(SQLFunctionCtx *pCtx) {
// todo opt for null block
static
void
first_function
(
SQLFunctionCtx
*
pCtx
)
{
if
(
pCtx
->
order
==
TSDB_ORDER_DESC
)
{
if
(
pCtx
->
order
==
TSDB_ORDER_DESC
||
pCtx
->
preAggVals
.
dataBlockLoaded
==
false
)
{
return
;
}
...
...
@@ -1550,28 +1550,17 @@ static void first_data_assign_impl(SQLFunctionCtx *pCtx, char *pData, int32_t in
* to decide if the value is earlier than current intermediate result
*/
static
void
first_dist_function
(
SQLFunctionCtx
*
pCtx
)
{
assert
(
pCtx
->
size
>
0
);
if
(
pCtx
->
size
==
0
)
{
return
;
}
/*
* do not to check data in the following cases:
* 1. data block that are not loaded
* 2. scan data files in desc order
*/
if
(
pCtx
->
order
==
TSDB_ORDER_DESC
)
{
if
(
pCtx
->
order
==
TSDB_ORDER_DESC
||
pCtx
->
preAggVals
.
dataBlockLoaded
==
false
)
{
return
;
}
int32_t
notNullElems
=
0
;
// data block is discard, not loaded, do not need to check it
if
(
!
pCtx
->
preAggVals
.
dataBlockLoaded
)
{
return
;
}
// find the first not null value
for
(
int32_t
i
=
0
;
i
<
pCtx
->
size
;
++
i
)
{
char
*
data
=
GET_INPUT_CHAR_INDEX
(
pCtx
,
i
);
...
...
@@ -1655,7 +1644,7 @@ static void first_dist_func_second_merge(SQLFunctionCtx *pCtx) {
* least one data in this block that is not null.(TODO opt for this case)
*/
static
void
last_function
(
SQLFunctionCtx
*
pCtx
)
{
if
(
pCtx
->
order
!=
pCtx
->
param
[
0
].
i64Key
)
{
if
(
pCtx
->
order
!=
pCtx
->
param
[
0
].
i64Key
||
pCtx
->
preAggVals
.
dataBlockLoaded
==
false
)
{
return
;
}
...
...
@@ -2303,8 +2292,9 @@ static void top_func_second_merge(SQLFunctionCtx *pCtx) {
// the intermediate result is binary, we only use the output data type
for
(
int32_t
i
=
0
;
i
<
pInput
->
num
;
++
i
)
{
int16_t
type
=
(
pCtx
->
outputType
==
TSDB_DATA_TYPE_FLOAT
)
?
TSDB_DATA_TYPE_DOUBLE
:
pCtx
->
outputType
;
do_top_function_add
(
pOutput
,
pCtx
->
param
[
0
].
i64Key
,
&
pInput
->
res
[
i
]
->
v
.
i64Key
,
pInput
->
res
[
i
]
->
timestamp
,
pCtx
->
outputT
ype
,
&
pCtx
->
tagInfo
,
pInput
->
res
[
i
]
->
pTags
,
pCtx
->
currentStage
);
t
ype
,
&
pCtx
->
tagInfo
,
pInput
->
res
[
i
]
->
pTags
,
pCtx
->
currentStage
);
}
SET_VAL
(
pCtx
,
pInput
->
num
,
pOutput
->
num
);
...
...
src/client/src/tscSQLParser.c
浏览文件 @
599df650
...
...
@@ -485,7 +485,6 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
case
TSDB_SQL_SELECT
:
{
assert
(
pCmd
->
numOfClause
==
1
);
const
char
*
msg1
=
"columns in select clause not identical"
;
for
(
int32_t
i
=
pCmd
->
numOfClause
;
i
<
pInfo
->
subclauseInfo
.
numOfClause
;
++
i
)
{
...
...
@@ -496,16 +495,19 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
}
assert
(
pCmd
->
numOfClause
==
pInfo
->
subclauseInfo
.
numOfClause
);
for
(
int32_t
i
=
0
;
i
<
pInfo
->
subclauseInfo
.
numOfClause
;
++
i
)
{
for
(
int32_t
i
=
pCmd
->
clauseIndex
;
i
<
pInfo
->
subclauseInfo
.
numOfClause
;
++
i
)
{
SQuerySQL
*
pQuerySql
=
pInfo
->
subclauseInfo
.
pClause
[
i
];
tscTrace
(
"%p start to parse %dth subclause, total:%d"
,
pSql
,
i
,
pInfo
->
subclauseInfo
.
numOfClause
);
if
((
code
=
doCheckForQuery
(
pSql
,
pQuerySql
,
i
))
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
tscPrintSelectClause
(
pSql
,
i
);
pCmd
->
clauseIndex
+=
1
;
}
// restore the clause index
pCmd
->
clauseIndex
=
0
;
// set the command/global limit parameters from the first subclause to the sqlcmd object
SQueryInfo
*
pQueryInfo1
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
pCmd
->
command
=
pQueryInfo1
->
command
;
...
...
@@ -1385,6 +1387,11 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum
return
numOfTotalColumns
;
}
static
void
tscInsertPrimaryTSSourceColumn
(
SQueryInfo
*
pQueryInfo
,
SColumnIndex
*
pIndex
)
{
SColumnIndex
tsCol
=
{.
tableIndex
=
pIndex
->
tableIndex
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
tsCol
);
}
int32_t
addProjectionExprAndResultField
(
SSqlCmd
*
pCmd
,
SQueryInfo
*
pQueryInfo
,
tSQLExprItem
*
pItem
)
{
const
char
*
msg0
=
"invalid column name"
;
const
char
*
msg1
=
"tag for normal table query is not allowed"
;
...
...
@@ -1427,6 +1434,8 @@ int32_t addProjectionExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, t
addProjectQueryCol
(
pQueryInfo
,
startPos
,
&
index
,
pItem
);
}
tscInsertPrimaryTSSourceColumn
(
pQueryInfo
,
&
index
);
}
else
{
return
TSDB_CODE_TSC_INVALID_SQL
;
}
...
...
@@ -1499,8 +1508,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
switch
(
optr
)
{
case
TK_COUNT
:
{
if
(
pItem
->
pNode
->
pParam
!=
NULL
&&
pItem
->
pNode
->
pParam
->
nExpr
!=
1
)
{
/* more than one parameter for count() function */
if
(
pItem
->
pNode
->
pParam
!=
NULL
&&
pItem
->
pNode
->
pParam
->
nExpr
!=
1
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg2
);
}
...
...
@@ -1551,11 +1560,12 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
}
else
{
// count(*) is equalled to count(primary_timestamp_key)
index
=
(
SColumnIndex
){
0
,
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
int32_t
size
=
tDataTypeDesc
[
TSDB_DATA_TYPE_BIGINT
].
nSize
;
pExpr
=
tscSqlExprAppend
(
pQueryInfo
,
functionID
,
&
index
,
TSDB_DATA_TYPE_BIGINT
,
size
,
size
,
false
);
}
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
index
.
tableIndex
);
memset
(
pExpr
->
aliasName
,
0
,
tListLen
(
pExpr
->
aliasName
));
getColumnName
(
pItem
,
pExpr
->
aliasName
,
sizeof
(
pExpr
->
aliasName
)
-
1
);
...
...
@@ -1570,9 +1580,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
}
// the time stamp may be always needed
if
(
index
.
tableIndex
>
0
&&
index
.
tableIndex
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
))
{
SColumnIndex
tsCol
=
{.
tableIndex
=
index
.
tableIndex
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
tsCol
);
if
(
index
.
tableIndex
<
tscGetNumOfColumns
(
pTableMetaInfo
->
pTableMeta
))
{
tscInsertPrimaryTSSourceColumn
(
pQueryInfo
,
&
index
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1682,10 +1691,8 @@ int32_t addExprAndResultField(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t col
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
(
ids
.
ids
[
i
]));
}
}
SColumnIndex
tsCol
=
{.
tableIndex
=
index
.
tableIndex
,
.
columnIndex
=
PRIMARYKEY_TIMESTAMP_COL_INDEX
};
tscColumnListInsert
(
pQueryInfo
->
colList
,
&
tsCol
);
tscInsertPrimaryTSSourceColumn
(
pQueryInfo
,
&
index
);
return
TSDB_CODE_SUCCESS
;
}
case
TK_FIRST
:
...
...
@@ -2348,9 +2355,9 @@ bool validateIpAddress(const char* ip, size_t size) {
strncpy
(
tmp
,
ip
,
size
);
in_addr_t
i
pAddr
=
inet_addr
(
tmp
);
in_addr_t
e
pAddr
=
inet_addr
(
tmp
);
return
i
pAddr
!=
INADDR_NONE
;
return
e
pAddr
!=
INADDR_NONE
;
}
int32_t
tscTansformSQLFuncForSTableQuery
(
SQueryInfo
*
pQueryInfo
)
{
...
...
@@ -5862,6 +5869,8 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
pTableMetaInfo
=
tscAddEmptyMetaInfo
(
pQueryInfo
);
}
assert
(
pCmd
->
clauseIndex
==
index
);
// too many result columns not support order by in query
if
(
pQuerySql
->
pSelection
->
nExpr
>
TSDB_MAX_COLUMNS
)
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg8
);
...
...
@@ -5975,12 +5984,11 @@ int32_t doCheckForQuery(SSqlObj* pSql, SQuerySQL* pQuerySql, int32_t index) {
pQueryInfo
->
window
.
ekey
=
pQueryInfo
->
window
.
ekey
/
1000
;
}
}
else
{
// set the time rang
pQueryInfo
->
window
.
skey
=
TSKEY_INITIAL_VAL
;
pQueryInfo
->
window
.
ekey
=
INT64_MAX
;
pQueryInfo
->
window
=
TSWINDOW_INITIALIZER
;
}
// user does not specified the query time window, twa is not allowed in such case.
if
((
pQueryInfo
->
window
.
skey
==
0
||
pQueryInfo
->
window
.
ekey
==
INT64_MAX
||
if
((
pQueryInfo
->
window
.
skey
==
INT64_MIN
||
pQueryInfo
->
window
.
ekey
==
INT64_MAX
||
(
pQueryInfo
->
window
.
ekey
==
INT64_MAX
/
1000
&&
tinfo
.
precision
==
TSDB_TIME_PRECISION_MILLI
))
&&
tscIsTWAQuery
(
pQueryInfo
))
{
return
invalidSqlErrMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg9
);
}
...
...
src/client/src/tscServer.c
浏览文件 @
599df650
...
...
@@ -30,8 +30,8 @@
#define TSC_MGMT_VNODE 999
SRpcCor
IpSet
tscMgmtI
pSet
;
SRpc
IpSet
tscDnodeI
pSet
;
SRpcCor
EpSet
tscMgmtE
pSet
;
SRpc
EpSet
tscDnodeE
pSet
;
int
(
*
tscBuildMsg
[
TSDB_SQL_MAX
])(
SSqlObj
*
pSql
,
SSqlInfo
*
pInfo
)
=
{
0
};
...
...
@@ -45,18 +45,18 @@ void tscSaveSubscriptionProgress(void* sub);
static
int32_t
minMsgSize
()
{
return
tsRpcHeadSize
+
100
;
}
static
void
tscSetDnode
IpLis
t
(
SSqlObj
*
pSql
,
SCMVgroupInfo
*
pVgroupInfo
)
{
SRpc
IpSet
*
pIpList
=
&
pSql
->
ipLis
t
;
p
IpLis
t
->
inUse
=
0
;
static
void
tscSetDnode
EpSe
t
(
SSqlObj
*
pSql
,
SCMVgroupInfo
*
pVgroupInfo
)
{
SRpc
EpSet
*
pEpSet
=
&
pSql
->
epSe
t
;
p
EpSe
t
->
inUse
=
0
;
if
(
pVgroupInfo
==
NULL
)
{
p
IpList
->
numOfI
ps
=
0
;
p
EpSet
->
numOfE
ps
=
0
;
return
;
}
p
IpList
->
numOfIps
=
pVgroupInfo
->
numOfI
ps
;
for
(
int32_t
i
=
0
;
i
<
pVgroupInfo
->
numOf
I
ps
;
++
i
)
{
strcpy
(
p
IpList
->
fqdn
[
i
],
pVgroupInfo
->
i
pAddr
[
i
].
fqdn
);
p
IpList
->
port
[
i
]
=
pVgroupInfo
->
i
pAddr
[
i
].
port
;
p
EpList
->
numOfEps
=
pVgroupInfo
->
numOfE
ps
;
for
(
int32_t
i
=
0
;
i
<
pVgroupInfo
->
numOf
E
ps
;
++
i
)
{
strcpy
(
p
EpList
->
fqdn
[
i
],
pVgroupInfo
->
e
pAddr
[
i
].
fqdn
);
p
EpList
->
port
[
i
]
=
pVgroupInfo
->
e
pAddr
[
i
].
port
;
}
}
void
tscIpSetCopy
(
SRpcIpSet
*
dst
,
SRpcIpSet
*
src
)
{
...
...
@@ -118,21 +118,21 @@ static void tscUpdateVgroupInfo(SSqlObj *pObj, SRpcIpSet *pIpSet) {
taosCorBeginWrite
(
&
pVgroupInfo
->
version
);
//TODO(dengyihao), dont care vgid
pVgroupInfo
->
inUse
=
p
I
pSet
->
inUse
;
pVgroupInfo
->
numOf
Ips
=
pIpSet
->
numOfI
ps
;
for
(
int32_t
i
=
0
;
pVgroupInfo
->
numOf
I
ps
;
i
++
)
{
strncpy
(
pVgroupInfo
->
ipAddr
[
i
].
fqdn
,
pI
pSet
->
fqdn
[
i
],
TSDB_FQDN_LEN
);
pVgroupInfo
->
ipAddr
[
i
].
port
=
pI
pSet
->
port
[
i
];
pVgroupInfo
->
inUse
=
p
E
pSet
->
inUse
;
pVgroupInfo
->
numOf
Eps
=
pEpSet
->
numOfE
ps
;
for
(
int32_t
i
=
0
;
pVgroupInfo
->
numOf
E
ps
;
i
++
)
{
strncpy
(
pVgroupInfo
->
epAddr
[
i
].
fqdn
,
pE
pSet
->
fqdn
[
i
],
TSDB_FQDN_LEN
);
pVgroupInfo
->
epAddr
[
i
].
port
=
pE
pSet
->
port
[
i
];
}
taosCorEndWrite
(
&
pVgroupInfo
->
version
);
}
void
tscPrintMgmt
I
p
()
{
SRpc
I
pSet
dump
;
tscDumpMgmt
I
pSet
(
&
dump
);
if
(
dump
.
numOf
I
ps
<=
0
)
{
tscError
(
"invalid mnode
IP list:%d"
,
dump
.
numOfIp
s
);
void
tscPrintMgmt
E
p
()
{
SRpc
E
pSet
dump
;
tscDumpMgmt
E
pSet
(
&
dump
);
if
(
dump
.
numOf
E
ps
<=
0
)
{
tscError
(
"invalid mnode
EP list:%d"
,
dump
.
numOfEP
s
);
}
else
{
for
(
int
i
=
0
;
i
<
dump
.
numOf
I
ps
;
++
i
)
{
for
(
int
i
=
0
;
i
<
dump
.
numOf
E
ps
;
++
i
)
{
tscDebug
(
"mnode index:%d %s:%d"
,
i
,
dump
.
fqdn
[
i
],
dump
.
port
[
i
]);
}
}
...
...
@@ -148,9 +148,9 @@ void tscPrintMgmtIp() {
UNUSED_FUNC
static
int32_t
tscGetMgmtConnMaxRetryTimes
()
{
int32_t
factor
=
2
;
SRpc
I
pSet
dump
;
tscDumpMgmt
I
pSet
(
&
dump
);
return
dump
.
numOf
I
ps
*
factor
;
SRpc
E
pSet
dump
;
tscDumpMgmt
E
pSet
(
&
dump
);
return
dump
.
numOf
E
ps
*
factor
;
}
void
tscProcessHeartBeatRsp
(
void
*
param
,
TAOS_RES
*
tres
,
int
code
)
{
...
...
@@ -166,10 +166,10 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if
(
code
==
0
)
{
SCMHeartBeatRsp
*
pRsp
=
(
SCMHeartBeatRsp
*
)
pRes
->
pRsp
;
SRpc
IpSet
*
pIpList
=
&
pRsp
->
i
pList
;
if
(
p
IpList
->
numOfI
ps
>
0
)
{
tsc
IpSetHtons
(
pI
pList
);
tscUpdateMgmt
IpList
(
pI
pList
);
SRpc
EpSet
*
pEpList
=
&
pRsp
->
e
pList
;
if
(
p
EpList
->
numOfE
ps
>
0
)
{
tsc
EpSetHtons
(
pE
pList
);
tscUpdateMgmt
EpList
(
pE
pList
);
}
pSql
->
pTscObj
->
connId
=
htonl
(
pRsp
->
connId
);
...
...
@@ -242,7 +242,7 @@ int tscSendMsgToServer(SSqlObj *pSql) {
// set the mgmt ip list
if
(
pSql
->
cmd
.
command
>=
TSDB_SQL_MGMT
)
{
tscDumpMgmt
IpSet
(
&
pSql
->
i
pList
);
tscDumpMgmt
EpSet
(
&
pSql
->
e
pList
);
}
memcpy
(
pMsg
,
pSql
->
cmd
.
payload
,
pSql
->
cmd
.
payloadLen
);
...
...
@@ -260,11 +260,11 @@ int tscSendMsgToServer(SSqlObj *pSql) {
// Otherwise, the pSql object may have been released already during the response function, which is
// processMsgFromServer function. In the meanwhile, the assignment of the rpc context to sql object will absolutely
// cause crash.
rpcSendRequest
(
pObj
->
pDnodeConn
,
&
pSql
->
ipLis
t
,
&
rpcMsg
);
rpcSendRequest
(
pObj
->
pDnodeConn
,
&
pSql
->
epSe
t
,
&
rpcMsg
);
return
TSDB_CODE_SUCCESS
;
}
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpc
IpSet
*
pI
pSet
)
{
void
tscProcessMsgFromServer
(
SRpcMsg
*
rpcMsg
,
SRpc
EpSet
*
pE
pSet
)
{
SSqlObj
*
pSql
=
(
SSqlObj
*
)
rpcMsg
->
ahandle
;
if
(
pSql
==
NULL
||
pSql
->
signature
!=
pSql
)
{
tscError
(
"%p sql is already released"
,
pSql
);
...
...
@@ -293,14 +293,14 @@ void tscProcessMsgFromServer(SRpcMsg *rpcMsg, SRpcIpSet *pIpSet) {
return
;
}
if
(
p
I
pSet
)
{
//SRpc
I
pSet dump;
tsc
IpSetHtons
(
pI
pSet
);
if
(
tsc
IpSetIsEqual
(
&
pSql
->
ipList
,
pI
pSet
))
{
if
(
p
E
pSet
)
{
//SRpc
E
pSet dump;
tsc
EpSetHtons
(
pE
pSet
);
if
(
tsc
EpSetIsEqual
(
&
pSql
->
epList
,
pE
pSet
))
{
if
(
pCmd
->
command
<
TSDB_SQL_MGMT
)
{
tscUpdateVgroupInfo
(
pSql
,
p
I
pSet
);
tscUpdateVgroupInfo
(
pSql
,
p
E
pSet
);
}
else
{
tscUpdateMgmt
IpList
(
pI
pSet
);
tscUpdateMgmt
EpList
(
pE
pSet
);
}
}
}
...
...
@@ -484,8 +484,9 @@ int tscProcessSql(SSqlObj *pSql) {
return
pSql
->
res
.
code
;
}
}
else
if
(
pCmd
->
command
<
TSDB_SQL_LOCAL
)
{
//tscDumpMgmtIpSet(&pSql->ipList);
}
else
{
//pSql->epSet = tscMgmtEpSet;
}
else
{
// local handler
return
(
*
tscProcessMsgRsp
[
pCmd
->
command
])(
pSql
);
}
...
...
@@ -538,7 +539,7 @@ int tscBuildFetchMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SRetrieveTableMsg
*
pRetrieveMsg
=
(
SRetrieveTableMsg
*
)
pSql
->
cmd
.
payload
;
pRetrieveMsg
->
qhandle
=
htobe64
(
pSql
->
res
.
qhandle
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
0
);
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
);
pRetrieveMsg
->
free
=
htons
(
pQueryInfo
->
type
);
// todo valid the vgroupId at the client side
...
...
@@ -588,10 +589,10 @@ int tscBuildSubmitMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
// pSql->cmd.payloadLen is set during copying data into payload
pSql
->
cmd
.
msgType
=
TSDB_MSG_TYPE_SUBMIT
;
tscDump
IpSetFromVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pSql
->
i
pList
);
tscDebug
(
"%p build submit msg, vgId:%d numOfTables:%d numberOf
I
P:%d"
,
pSql
,
vgId
,
pSql
->
cmd
.
numOfTablesInSubmit
,
pSql
->
ipList
.
numOfI
ps
);
tscDump
EpSetFromVgroupInfo
(
&
pTableMeta
->
corVgroupInfo
,
&
pSql
->
e
pList
);
tscDebug
(
"%p build submit msg, vgId:%d numOfTables:%d numberOf
E
P:%d"
,
pSql
,
vgId
,
pSql
->
cmd
.
numOfTablesInSubmit
,
pSql
->
epSet
.
numOfE
ps
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -630,7 +631,8 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
}
else
{
pVgroupInfo
=
&
pTableMeta
->
vgroupInfo
;
}
tscSetDnodeIpList
(
pSql
,
pVgroupInfo
);
tscSetDnodeEpList
(
pSql
,
pVgroupInfo
);
if
(
pVgroupInfo
!=
NULL
)
{
pQueryMsg
->
head
.
vgId
=
htonl
(
pVgroupInfo
->
vgId
);
}
...
...
@@ -642,7 +644,7 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
pQueryMsg
->
numOfTables
=
htonl
(
1
);
// set the number of tables
pMsg
+=
sizeof
(
STableIdInfo
);
}
else
{
// it is a subquery of the super table query, this
I
P info is acquired from vgroupInfo
}
else
{
// it is a subquery of the super table query, this
E
P info is acquired from vgroupInfo
int32_t
index
=
pTableMetaInfo
->
vgroupIndex
;
int32_t
numOfVgroups
=
taosArrayGetSize
(
pTableMetaInfo
->
pVgroupTables
);
assert
(
index
>=
0
&&
index
<
numOfVgroups
);
...
...
@@ -650,9 +652,9 @@ static char *doSerializeTableInfo(SQueryTableMsg* pQueryMsg, SSqlObj *pSql, char
tscDebug
(
"%p query on stable, vgIndex:%d, numOfVgroups:%d"
,
pSql
,
index
,
numOfVgroups
);
SVgroupTableInfo
*
pTableIdList
=
taosArrayGet
(
pTableMetaInfo
->
pVgroupTables
,
index
);
// set the vgroup info
tscSetDnode
I
pList
(
pSql
,
&
pTableIdList
->
vgInfo
);
tscSetDnode
E
pList
(
pSql
,
&
pTableIdList
->
vgInfo
);
pQueryMsg
->
head
.
vgId
=
htonl
(
pTableIdList
->
vgInfo
.
vgId
);
int32_t
numOfTables
=
taosArrayGetSize
(
pTableIdList
->
itemList
);
...
...
@@ -1385,7 +1387,7 @@ int tscBuildUpdateTagMsg(SSqlObj* pSql, SSqlInfo *pInfo) {
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
0
);
STableMetaInfo
*
pTableMetaInfo
=
tscGetMetaInfo
(
pQueryInfo
,
0
);
tscDump
IpSetFromVgroupInfo
(
&
pTableMetaInfo
->
pTableMeta
->
corVgroupInfo
,
&
pSql
->
i
pList
);
tscDump
EpSetFromVgroupInfo
(
&
pTableMetaInfo
->
pTableMeta
->
corVgroupInfo
,
&
pSql
->
e
pList
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1720,8 +1722,8 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
pMetaMsg
->
contLen
=
htons
(
pMetaMsg
->
contLen
);
pMetaMsg
->
numOfColumns
=
htons
(
pMetaMsg
->
numOfColumns
);
if
(
pMetaMsg
->
sid
<
0
||
pMetaMsg
->
vgroup
.
numOf
I
ps
<
0
)
{
tscError
(
"invalid meter vgId:%d, sid%d"
,
pMetaMsg
->
vgroup
.
numOf
I
ps
,
pMetaMsg
->
sid
);
if
(
pMetaMsg
->
sid
<
0
||
pMetaMsg
->
vgroup
.
numOf
E
ps
<
0
)
{
tscError
(
"invalid meter vgId:%d, sid%d"
,
pMetaMsg
->
vgroup
.
numOf
E
ps
,
pMetaMsg
->
sid
);
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
...
...
@@ -1735,8 +1737,8 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) {
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
for
(
int
i
=
0
;
i
<
pMetaMsg
->
vgroup
.
numOf
I
ps
;
++
i
)
{
pMetaMsg
->
vgroup
.
ipAddr
[
i
].
port
=
htons
(
pMetaMsg
->
vgroup
.
i
pAddr
[
i
].
port
);
for
(
int
i
=
0
;
i
<
pMetaMsg
->
vgroup
.
numOf
E
ps
;
++
i
)
{
pMetaMsg
->
vgroup
.
epAddr
[
i
].
port
=
htons
(
pMetaMsg
->
vgroup
.
e
pAddr
[
i
].
port
);
}
SSchema
*
pSchema
=
pMetaMsg
->
schema
;
...
...
@@ -1912,9 +1914,11 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) {
//just init, no need to lock
SCMVgroupInfo
*
pVgroups
=
&
pInfo
->
vgroupList
->
vgroups
[
j
];
pVgroups
->
vgId
=
htonl
(
pVgroups
->
vgId
);
assert
(
pVgroups
->
numOfIps
>=
1
);
for
(
int32_t
k
=
0
;
k
<
pVgroups
->
numOfIps
;
++
k
)
{
pVgroups
->
ipAddr
[
k
].
port
=
htons
(
pVgroups
->
ipAddr
[
k
].
port
);
assert
(
pVgroups
->
numOfEps
>=
1
);
for
(
int32_t
k
=
0
;
k
<
pVgroups
->
numOfEps
;
++
k
)
{
pVgroups
->
epAddr
[
k
].
port
=
htons
(
pVgroups
->
epAddr
[
k
].
port
);
}
pMsg
+=
size
;
...
...
@@ -2007,9 +2011,9 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
assert
(
len
<=
sizeof
(
pObj
->
db
));
tstrncpy
(
pObj
->
db
,
temp
,
sizeof
(
pObj
->
db
));
if
(
pConnect
->
ipList
.
numOfI
ps
>
0
)
{
tsc
IpSetHtons
(
&
pConnect
->
i
pList
);
tscUpdateMgmt
IpList
(
&
pConnect
->
i
pList
);
if
(
pConnect
->
epList
.
numOfE
ps
>
0
)
{
tsc
EpSetHtons
(
&
pConnect
->
e
pList
);
tscUpdateMgmt
EpList
(
&
pConnect
->
e
pList
);
}
strcpy
(
pObj
->
sversion
,
pConnect
->
serverVersion
);
...
...
src/client/src/tscSql.c
浏览文件 @
599df650
...
...
@@ -62,8 +62,8 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
}
if
(
ip
)
{
if
(
tscSetMgmt
I
pListFromCfg
(
ip
,
NULL
)
<
0
)
return
NULL
;
if
(
port
)
tscMgmt
IpSet
.
i
pSet
.
port
[
0
]
=
port
;
if
(
tscSetMgmt
E
pListFromCfg
(
ip
,
NULL
)
<
0
)
return
NULL
;
if
(
port
)
tscMgmt
EpSet
.
e
pSet
.
port
[
0
]
=
port
;
}
void
*
pDnodeConn
=
NULL
;
...
...
@@ -424,7 +424,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
}
// current data set are exhausted, fetch more data from node
if
(
pRes
->
row
>=
pRes
->
numOfRows
&&
(
pRes
->
completed
!=
true
||
hasMoreVnodesToTry
(
pSql
))
&&
if
(
pRes
->
row
>=
pRes
->
numOfRows
&&
(
pRes
->
completed
!=
true
||
hasMoreVnodesToTry
(
pSql
)
||
hasMoreClauseToTry
(
pSql
)
)
&&
(
pCmd
->
command
==
TSDB_SQL_RETRIEVE
||
pCmd
->
command
==
TSDB_SQL_RETRIEVE_LOCALMERGE
||
pCmd
->
command
==
TSDB_SQL_TABLE_JOIN_RETRIEVE
||
...
...
src/client/src/tscSubquery.c
浏览文件 @
599df650
...
...
@@ -458,7 +458,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr
break
;
}
}
assert
(
info
.
vgInfo
.
numOf
I
ps
!=
0
);
assert
(
info
.
vgInfo
.
numOf
E
ps
!=
0
);
vgTables
=
taosArrayInit
(
4
,
sizeof
(
STableIdInfo
));
info
.
itemList
=
vgTables
;
...
...
@@ -848,13 +848,14 @@ static void joinRetrieveFinalResCallback(void* param, TAOS_RES* tres, int numOfR
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
// TODO put to async res?
if
(
taos_errno
(
pSql
)
!=
TSDB_CODE_SUCCESS
)
{
assert
(
numOfRows
==
taos_errno
(
pSql
));
pParentSql
->
res
.
code
=
numOfRows
;
tscError
(
"%p retrieve failed, index:%d, code:%s"
,
pSql
,
pSupporter
->
subqueryIndex
,
tstrerror
(
numOfRows
));
tscQueueAsyncRes
(
pParentSql
);
return
;
}
if
(
numOfRows
>=
0
)
{
...
...
@@ -941,31 +942,22 @@ void tscFetchDatablockFromSubquery(SSqlObj* pSql) {
SSqlRes
*
pRes
=
&
pSub
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSub
->
cmd
,
0
);
// STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
// if (tscNonOrderedProjectionQueryOnSTable(pQueryInfo, 0)) {
// if (pRes->row >= pRes->numOfRows && pTableMetaInfo->vgroupIndex < pTableMetaInfo->vgroupList->numOfVgroups &&
// (!tscHasReachLimitation(pQueryInfo, pRes)) && !pRes->completed) {
// numOfFetch++;
// }
// } else {
if
(
!
tscHasReachLimitation
(
pQueryInfo
,
pRes
))
{
if
(
pRes
->
row
>=
pRes
->
numOfRows
)
{
hasData
=
false
;
if
(
!
pRes
->
completed
)
{
numOfFetch
++
;
}
}
}
else
{
// has reach the limitation, no data anymore
if
(
pRes
->
row
>=
pRes
->
numOfRows
)
{
hasData
=
false
;
break
;
if
(
!
tscHasReachLimitation
(
pQueryInfo
,
pRes
))
{
if
(
pRes
->
row
>=
pRes
->
numOfRows
)
{
hasData
=
false
;
if
(
!
pRes
->
completed
)
{
numOfFetch
++
;
}
}
}
else
{
// has reach the limitation, no data anymore
if
(
pRes
->
row
>=
pRes
->
numOfRows
)
{
hasData
=
false
;
break
;
}
}
//
}
}
// has data remains in client side, and continue to return data to app
if
(
hasData
)
{
...
...
@@ -1026,7 +1018,7 @@ void tscSetupOutputColumnIndex(SSqlObj* pSql) {
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
tscDebug
(
"%p all subquery response, retrieve data
"
,
pSql
);
tscDebug
(
"%p all subquery response, retrieve data
for subclause:%d"
,
pSql
,
pCmd
->
clauseIndex
);
// the column transfer support struct has been built
if
(
pRes
->
pColumnIndex
!=
NULL
)
{
...
...
@@ -1195,8 +1187,11 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
pNew
->
cmd
.
numOfCols
=
0
;
pNewQueryInfo
->
intervalTime
=
0
;
memset
(
&
pNewQueryInfo
->
limit
,
0
,
sizeof
(
SLimitVal
));
pSupporter
->
limit
=
pNewQueryInfo
->
limit
;
pNewQueryInfo
->
limit
.
limit
=
-
1
;
pNewQueryInfo
->
limit
.
offset
=
0
;
// backup the data and clear it in the sqlcmd object
pSupporter
->
groupbyExpr
=
pNewQueryInfo
->
groupbyExpr
;
memset
(
&
pNewQueryInfo
->
groupbyExpr
,
0
,
sizeof
(
SSqlGroupbyExpr
));
...
...
@@ -1307,7 +1302,7 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) {
break
;
}
}
pSql
->
cmd
.
command
=
(
pSql
->
numOfSubs
<=
0
)
?
TSDB_SQL_RETRIEVE_EMPTY_RESULT
:
TSDB_SQL_TABLE_JOIN_RETRIEVE
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1605,8 +1600,8 @@ static void tscAllDataRetrievedFromDnode(SRetrieveSupport *trsupport, SSqlObj* p
// data in from current vnode is stored in cache and disk
uint32_t
numOfRowsFromSubquery
=
trsupport
->
pExtMemBuffer
[
idx
]
->
numOfTotalElems
+
trsupport
->
localBuffer
->
num
;
tscDebug
(
"%p sub:%p all data retrieved from
i
p:%s, vgId:%d, numOfRows:%d, orderOfSub:%d"
,
pParentSql
,
pSql
,
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
].
i
pAddr
[
0
].
fqdn
,
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
].
vgId
,
tscDebug
(
"%p sub:%p all data retrieved from
e
p:%s, vgId:%d, numOfRows:%d, orderOfSub:%d"
,
pParentSql
,
pSql
,
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
].
e
pAddr
[
0
].
fqdn
,
pTableMetaInfo
->
vgroupList
->
vgroups
[
0
].
vgId
,
numOfRowsFromSubquery
,
idx
);
tColModelCompact
(
pDesc
->
pColumnModel
,
trsupport
->
localBuffer
,
pDesc
->
pColumnModel
->
capacity
);
...
...
@@ -1724,8 +1719,8 @@ static void tscRetrieveFromDnodeCallBack(void *param, TAOS_RES *tres, int numOfR
assert
(
pRes
->
numOfRows
==
numOfRows
);
int64_t
num
=
atomic_add_fetch_64
(
&
pState
->
numOfRetrievedRows
,
numOfRows
);
tscDebug
(
"%p sub:%p retrieve numOfRows:%"
PRId64
" totalNumOfRows:%"
PRIu64
" from
i
p:%s, orderOfSub:%d"
,
pParentSql
,
pSql
,
pRes
->
numOfRows
,
pState
->
numOfRetrievedRows
,
pSql
->
ipList
.
fqdn
[
pSql
->
ipLis
t
.
inUse
],
idx
);
tscDebug
(
"%p sub:%p retrieve numOfRows:%"
PRId64
" totalNumOfRows:%"
PRIu64
" from
e
p:%s, orderOfSub:%d"
,
pParentSql
,
pSql
,
pRes
->
numOfRows
,
pState
->
numOfRetrievedRows
,
pSql
->
epSet
.
fqdn
[
pSql
->
epSe
t
.
inUse
],
idx
);
if
(
num
>
tsMaxNumOfOrderedResults
&&
tscIsProjectionQueryOnSTable
(
pQueryInfo
,
0
))
{
tscError
(
"%p sub:%p num of OrderedRes is too many, max allowed:%"
PRId32
" , current:%"
PRId64
,
...
...
@@ -1833,8 +1828,8 @@ void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code) {
return
;
}
tscTrace
(
"%p sub:%p query complete,
i
p:%s, vgId:%d, orderOfSub:%d, retrieve data"
,
trsupport
->
pParentSql
,
pSql
,
pVgroup
->
i
pAddr
[
0
].
fqdn
,
pVgroup
->
vgId
,
trsupport
->
subqueryIndex
);
tscTrace
(
"%p sub:%p query complete,
e
p:%s, vgId:%d, orderOfSub:%d, retrieve data"
,
trsupport
->
pParentSql
,
pSql
,
pVgroup
->
e
pAddr
[
0
].
fqdn
,
pVgroup
->
vgId
,
trsupport
->
subqueryIndex
);
if
(
pSql
->
res
.
qhandle
==
0
)
{
// qhandle is NULL, code is TSDB_CODE_SUCCESS means no results generated from this vnode
tscRetrieveFromDnodeCallBack
(
param
,
pSql
,
0
);
...
...
@@ -1982,88 +1977,119 @@ int32_t tscHandleMultivnodeInsert(SSqlObj *pSql) {
return
TSDB_CODE_TSC_OUT_OF_MEMORY
;
}
static
char
*
getResultBlockPosition
(
SSqlCmd
*
pCmd
,
SSqlRes
*
pRes
,
int32_t
columnIndex
,
int16_t
*
bytes
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
pCmd
,
pCmd
->
clauseIndex
);
SFieldSupInfo
*
pInfo
=
(
SFieldSupInfo
*
)
TARRAY_GET_ELEM
(
pQueryInfo
->
fieldsInfo
.
pSupportInfo
,
columnIndex
);
assert
(
pInfo
->
pSqlExpr
!=
NULL
);
*
bytes
=
pInfo
->
pSqlExpr
->
resBytes
;
char
*
pData
=
pRes
->
data
+
pInfo
->
pSqlExpr
->
offset
*
pRes
->
numOfRows
;
return
pData
;
}
static
void
doBuildResFromSubqueries
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
);
int32_t
numOfRes
=
INT32_MAX
;
for
(
int32_t
i
=
0
;
i
<
pSql
->
numOfSubs
;
++
i
)
{
if
(
pSql
->
pSubs
[
i
]
==
NULL
)
{
continue
;
}
numOfRes
=
MIN
(
numOfRes
,
pSql
->
pSubs
[
i
]
->
res
.
numOfRows
);
}
int32_t
totalSize
=
tscGetResRowLength
(
pQueryInfo
->
exprList
);
pRes
->
pRsp
=
realloc
(
pRes
->
pRsp
,
numOfRes
*
totalSize
);
pRes
->
data
=
pRes
->
pRsp
;
char
*
data
=
pRes
->
data
;
int16_t
bytes
=
0
;
size_t
numOfExprs
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SColumnIndex
*
pIndex
=
&
pRes
->
pColumnIndex
[
i
];
SSqlRes
*
pRes1
=
&
pSql
->
pSubs
[
pIndex
->
tableIndex
]
->
res
;
SSqlCmd
*
pCmd1
=
&
pSql
->
pSubs
[
pIndex
->
tableIndex
]
->
cmd
;
char
*
pData
=
getResultBlockPosition
(
pCmd1
,
pRes1
,
pIndex
->
columnIndex
,
&
bytes
);
memcpy
(
data
,
pData
,
bytes
*
numOfRes
);
data
+=
bytes
*
numOfRes
;
pRes1
->
row
=
numOfRes
;
}
pRes
->
numOfRows
=
numOfRes
;
pRes
->
numOfClauseTotal
+=
numOfRes
;
}
void
tscBuildResFromSubqueries
(
SSqlObj
*
pSql
)
{
SSqlRes
*
pRes
=
&
pSql
->
res
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
if
(
pRes
->
code
!=
TSDB_CODE_SUCCESS
)
{
tscQueueAsyncRes
(
pSql
);
return
;
}
while
(
1
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
);
if
(
pRes
->
tsrow
==
NULL
)
{
SQueryInfo
*
pQueryInfo
=
tscGetQueryInfoDetail
(
&
pSql
->
cmd
,
pSql
->
cmd
.
clauseIndex
);
size_t
numOfExprs
=
tscSqlExprNumOfExprs
(
pQueryInfo
);
if
(
pRes
->
tsrow
==
NULL
)
{
pRes
->
tsrow
=
calloc
(
numOfExprs
,
POINTER_BYTES
);
pRes
->
length
=
calloc
(
numOfExprs
,
sizeof
(
int32_t
));
}
bool
success
=
false
;
int32_t
numOfTableHasRes
=
0
;
for
(
int32_t
i
=
0
;
i
<
pSql
->
numOfSubs
;
++
i
)
{
if
(
pSql
->
pSubs
[
i
]
!=
NULL
)
{
numOfTableHasRes
++
;
}
}
if
(
numOfTableHasRes
>=
2
)
{
// do merge result
success
=
(
doSetResultRowData
(
pSql
->
pSubs
[
0
],
false
)
!=
NULL
)
&&
(
doSetResultRowData
(
pSql
->
pSubs
[
1
],
false
)
!=
NULL
);
}
else
{
// only one subquery
SSqlObj
*
pSub
=
pSql
->
pSubs
[
0
];
if
(
pSub
==
NULL
)
{
pSub
=
pSql
->
pSubs
[
1
];
}
success
=
(
doSetResultRowData
(
pSub
,
false
)
!=
NULL
);
pRes
->
tsrow
=
calloc
(
numOfExprs
,
POINTER_BYTES
);
pRes
->
buffer
=
calloc
(
numOfExprs
,
POINTER_BYTES
);
pRes
->
length
=
calloc
(
numOfExprs
,
sizeof
(
int32_t
));
tscRestoreSQLFuncForSTableQuery
(
pQueryInfo
);
}
while
(
1
)
{
if
(
pRes
->
row
<
pRes
->
numOfRows
)
{
assert
(
0
);
}
if
(
success
)
{
// current row of final output has been built, return to app
for
(
int32_t
i
=
0
;
i
<
numOfExprs
;
++
i
)
{
SColumnIndex
*
pIndex
=
&
pRes
->
pColumnIndex
[
i
];
SSqlRes
*
pRes1
=
&
pSql
->
pSubs
[
pIndex
->
tableIndex
]
->
res
;
pRes
->
tsrow
[
i
]
=
pRes1
->
tsrow
[
pIndex
->
columnIndex
];
pRes
->
length
[
i
]
=
pRes1
->
length
[
pIndex
->
columnIndex
];
}
pRes
->
numOfClauseTotal
++
;
break
;
}
else
{
// continue retrieve data from vnode
if
(
!
tscHasRemainDataInSubqueryResultSet
(
pSql
))
{
tscDebug
(
"%p at least one subquery exhausted, free all other %d subqueries"
,
pSql
,
pSql
->
numOfSubs
-
1
);
SSubqueryState
*
pState
=
NULL
;
// free all sub sqlobj
for
(
int32_t
i
=
0
;
i
<
pSql
->
numOfSubs
;
++
i
)
{
SSqlObj
*
pChildObj
=
pSql
->
pSubs
[
i
];
if
(
pChildObj
==
NULL
)
{
continue
;
}
SJoinSupporter
*
pSupporter
=
(
SJoinSupporter
*
)
pChildObj
->
param
;
pState
=
pSupporter
->
pState
;
tscDestroyJoinSupporter
(
pChildObj
->
param
);
taos_free_result
(
pChildObj
);
}
free
(
pState
);
pRes
->
completed
=
true
;
// set query completed
sem_post
(
&
pSql
->
rspSem
);
return
;
}
tscFetchDatablockFromSubquery
(
pSql
);
if
(
pRes
->
code
!=
TSDB_CODE_SUCCESS
)
{
return
;
}
doBuildResFromSubqueries
(
pSql
);
sem_post
(
&
pSql
->
rspSem
);
return
;
// continue retrieve data from vnode
// if (!tscHasRemainDataInSubqueryResultSet(pSql)) {
// tscDebug("%p at least one subquery exhausted, free all other %d subqueries", pSql, pSql->numOfSubs - 1);
// SSubqueryState* pState = NULL;
//
// // free all sub sqlobj
// for (int32_t i = 0; i < pSql->numOfSubs; ++i) {
// SSqlObj* pChildObj = pSql->pSubs[i];
// if (pChildObj == NULL) {
// continue;
// }
//
// SJoinSupporter* pSupporter = (SJoinSupporter*)pChildObj->param;
// pState = pSupporter->pState;
//
// tscDestroyJoinSupporter(pChildObj->param);
// taos_free_result(pChildObj);
// }
//
// free(pState);
//
// pRes->completed = true; // set query completed
// sem_post(&pSql->rspSem);
// return;
// }
tscFetchDatablockFromSubquery
(
pSql
);
if
(
pRes
->
code
!=
TSDB_CODE_SUCCESS
)
{
return
;
}
}
if
(
pSql
->
res
.
code
==
TSDB_CODE_SUCCESS
)
{
(
*
pSql
->
fp
)(
pSql
->
param
,
pSql
,
0
);
(
*
pSql
->
fp
)(
pSql
->
param
,
pSql
,
pRes
->
numOfRows
);
}
else
{
tscQueueAsyncRes
(
pSql
);
}
...
...
@@ -2117,14 +2143,6 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) {
assert
(
pRes
->
row
>=
0
&&
pRes
->
row
<=
pRes
->
numOfRows
);
if
(
pCmd
->
command
==
TSDB_SQL_TABLE_JOIN_RETRIEVE
)
{
if
(
pRes
->
completed
)
{
tfree
(
pRes
->
tsrow
);
}
return
pRes
->
tsrow
;
}
if
(
pRes
->
row
>=
pRes
->
numOfRows
)
{
// all the results has returned to invoker
tfree
(
pRes
->
tsrow
);
return
pRes
->
tsrow
;
...
...
@@ -2182,7 +2200,7 @@ void **doSetResultRowData(SSqlObj *pSql, bool finalResult) {
return
pRes
->
tsrow
;
}
static
bool
tscHasRemainDataInSubqueryResultSet
(
SSqlObj
*
pSql
)
{
static
UNUSED_FUNC
bool
tscHasRemainDataInSubqueryResultSet
(
SSqlObj
*
pSql
)
{
bool
hasData
=
true
;
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
...
...
src/client/src/tscSystem.c
浏览文件 @
599df650
...
...
@@ -41,8 +41,7 @@ int tscNumOfThreads;
static
pthread_once_t
tscinit
=
PTHREAD_ONCE_INIT
;
void
taosInitNote
(
int
numOfNoteLines
,
int
maxNotes
,
char
*
lable
);
//void tscUpdateIpSet(void *ahandle, SRpcIpSet *pIpSet);
//void tscUpdateEpSet(void *ahandle, SRpcEpSet *pEpSet);
void
tscCheckDiskUsage
(
void
*
UNUSED_PARAM
(
para
),
void
*
UNUSED_PARAM
(
param
))
{
taosGetDisk
();
...
...
@@ -117,8 +116,8 @@ void taos_init_imp() {
taosInitNote
(
tsNumOfLogLines
/
10
,
1
,
(
char
*
)
"tsc_note"
);
}
if
(
tscSetMgmt
IpLis
tFromCfg
(
tsFirst
,
tsSecond
)
<
0
)
{
tscError
(
"failed to init mnode
I
P list"
);
if
(
tscSetMgmt
EpSe
tFromCfg
(
tsFirst
,
tsSecond
)
<
0
)
{
tscError
(
"failed to init mnode
E
P list"
);
return
;
}
...
...
src/client/src/tscUtil.c
浏览文件 @
599df650
...
...
@@ -1994,6 +1994,10 @@ bool hasMoreVnodesToTry(SSqlObj* pSql) {
(
!
tscHasReachLimitation
(
pQueryInfo
,
pRes
))
&&
(
pTableMetaInfo
->
vgroupIndex
<
numOfVgroups
-
1
);
}
bool
hasMoreClauseToTry
(
SSqlObj
*
pSql
)
{
return
pSql
->
cmd
.
clauseIndex
<
pSql
->
cmd
.
numOfClause
-
1
;
}
void
tscTryQueryNextVnode
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
...
...
@@ -2050,7 +2054,7 @@ void tscTryQueryNextVnode(SSqlObj* pSql, __async_cb_func_t fp) {
}
}
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
void
(
*
queryFp
)()
)
{
void
tscTryQueryNextClause
(
SSqlObj
*
pSql
,
__async_cb_func_t
fp
)
{
SSqlCmd
*
pCmd
=
&
pSql
->
cmd
;
SSqlRes
*
pRes
=
&
pSql
->
res
;
...
...
@@ -2070,17 +2074,13 @@ void tscTryQueryNextClause(SSqlObj* pSql, void (*queryFp)()) {
tfree
(
pSql
->
pSubs
);
pSql
->
numOfSubs
=
0
;
if
(
pSql
->
fp
!=
NULL
)
{
pSql
->
fp
=
queryFp
;
assert
(
queryFp
!=
NULL
);
}
pSql
->
fp
=
fp
;
tscDebug
(
"%p try data in the next subclause:%d, total subclause:%d"
,
pSql
,
pCmd
->
clauseIndex
,
pCmd
->
numOfClause
);
if
(
pCmd
->
command
>
TSDB_SQL_LOCAL
)
{
tscProcessLocalCmd
(
pSql
);
}
else
{
tsc
ProcessSql
(
pSql
);
tsc
DoQuery
(
pSql
);
}
}
...
...
@@ -2145,20 +2145,20 @@ char* strdup_throw(const char* str) {
return
p
;
}
int
tscSetMgmt
I
pListFromCfg
(
const
char
*
first
,
const
char
*
second
)
{
int
tscSetMgmt
E
pListFromCfg
(
const
char
*
first
,
const
char
*
second
)
{
// init mgmt ip set
tscMgmt
I
pSet
.
version
=
0
;
SRpc
IpSet
*
mgmtIpSet
=
&
(
tscMgmtIpSet
.
i
pSet
);
mgmt
IpSet
->
numOfI
ps
=
0
;
mgmt
I
pSet
->
inUse
=
0
;
tscMgmt
E
pSet
.
version
=
0
;
SRpc
EpSet
*
mgmtEpSet
=
&
(
tscMgmtEpSet
.
e
pSet
);
mgmt
EpSet
->
numOfE
ps
=
0
;
mgmt
E
pSet
->
inUse
=
0
;
if
(
first
&&
first
[
0
]
!=
0
)
{
if
(
strlen
(
first
)
>=
TSDB_EP_LEN
)
{
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
first
,
mgmt
IpSet
->
fqdn
[
mgmtIpSet
->
numOfIps
],
&
(
mgmtIpSet
->
port
[
mgmtIpSet
->
numOfI
ps
]));
mgmt
IpSet
->
numOfI
ps
++
;
taosGetFqdnPortFromEp
(
first
,
mgmt
EpSet
->
fqdn
[
mgmtEpSet
->
numOfEps
],
&
(
mgmtEpSet
->
port
[
mgmtEpSet
->
numOfE
ps
]));
mgmt
EpSet
->
numOfE
ps
++
;
}
if
(
second
&&
second
[
0
]
!=
0
)
{
...
...
@@ -2166,11 +2166,11 @@ int tscSetMgmtIpListFromCfg(const char *first, const char *second) {
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
-
1
;
}
taosGetFqdnPortFromEp
(
second
,
mgmt
IpSet
->
fqdn
[
mgmtIpSet
->
numOfIps
],
&
(
mgmtIpSet
->
port
[
mgmtIpSet
->
numOfI
ps
]));
mgmt
IpSet
->
numOfI
ps
++
;
taosGetFqdnPortFromEp
(
second
,
mgmt
EpSet
->
fqdn
[
mgmtEpSet
->
numOfEps
],
&
(
mgmtEpSet
->
port
[
mgmtEpSet
->
numOfE
ps
]));
mgmt
EpSet
->
numOfE
ps
++
;
}
if
(
mgmt
IpSet
->
numOfI
ps
==
0
)
{
if
(
mgmt
EpSet
->
numOfE
ps
==
0
)
{
terrno
=
TSDB_CODE_TSC_INVALID_FQDN
;
return
-
1
;
}
...
...
src/common/inc/tglobal.h
浏览文件 @
599df650
...
...
@@ -30,8 +30,6 @@ extern uint16_t tsDnodeShellPort;
extern
uint16_t
tsDnodeDnodePort
;
extern
uint16_t
tsSyncPort
;
extern
int32_t
tsStatusInterval
;
extern
int16_t
tsNumOfVnodesPerCore
;
extern
int16_t
tsNumOfTotalVnodes
;
extern
int32_t
tsNumOfMnodes
;
extern
int32_t
tsEnableVnodeBak
;
...
...
src/common/src/tglobal.c
浏览文件 @
599df650
...
...
@@ -38,12 +38,9 @@ uint16_t tsDnodeShellPort = 6030; // udp[6035-6039] tcp[6035]
uint16_t
tsDnodeDnodePort
=
6035
;
// udp/tcp
uint16_t
tsSyncPort
=
6040
;
int32_t
tsStatusInterval
=
1
;
// second
int16_t
tsNumOfVnodesPerCore
=
32
;
int16_t
tsNumOfTotalVnodes
=
TSDB_INVALID_VNODE_NUM
;
int32_t
tsNumOfMnodes
=
3
;
int32_t
tsEnableVnodeBak
=
1
;
// common
int32_t
tsRpcTimer
=
1000
;
int32_t
tsRpcMaxTime
=
600
;
// seconds;
...
...
@@ -199,6 +196,9 @@ int32_t sDebugFlag = 135;
int32_t
wDebugFlag
=
135
;
int32_t
tsdbDebugFlag
=
131
;
int32_t
(
*
monitorStartSystemFp
)()
=
NULL
;
void
(
*
monitorStopSystemFp
)()
=
NULL
;
static
pthread_once_t
tsInitGlobalCfgOnce
=
PTHREAD_ONCE_INIT
;
void
taosSetAllDebugFlag
()
{
...
...
@@ -248,11 +248,17 @@ bool taosCfgDynamicOptions(char *msg) {
*
((
int32_t
*
)
cfg
->
ptr
)
=
vint
;
if
(
strncasecmp
(
cfg
->
option
,
"monitor"
,
olen
)
==
0
)
{
// if (0 == vint) {
// monitorStartSystem();
// } else {
// monitorStopSystem();
// }
if
(
1
==
vint
)
{
if
(
monitorStartSystemFp
)
{
(
*
monitorStartSystemFp
)();
uInfo
(
"monitor is enabled"
);
}
}
else
{
if
(
monitorStopSystemFp
)
{
(
*
monitorStopSystemFp
)();
uInfo
(
"monitor is disabled"
);
}
}
return
true
;
}
...
...
@@ -393,16 +399,6 @@ static void doInitGlobalConfig() {
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"numOfTotalVnodes"
;
cfg
.
ptr
=
&
tsNumOfTotalVnodes
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT16
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
cfg
.
minValue
=
0
;
cfg
.
maxValue
=
TSDB_MAX_VNODES
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
taosInitConfigOption
(
cfg
);
cfg
.
option
=
"numOfMnodes"
;
cfg
.
ptr
=
&
tsNumOfMnodes
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
...
...
@@ -444,7 +440,7 @@ static void doInitGlobalConfig() {
taosInitConfigOption
(
cfg
);
// 0-any; 1-mnode; 2-vnode
cfg
.
option
=
"
alternativeR
ole"
;
cfg
.
option
=
"
r
ole"
;
cfg
.
ptr
=
&
tsAlternativeRole
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
;
...
...
@@ -1271,12 +1267,6 @@ bool taosCheckGlobalCfg() {
tsNumOfCores
=
1
;
}
if
(
tsNumOfTotalVnodes
==
TSDB_INVALID_VNODE_NUM
)
{
tsNumOfTotalVnodes
=
tsNumOfCores
*
tsNumOfVnodesPerCore
;
tsNumOfTotalVnodes
=
tsNumOfTotalVnodes
>
TSDB_MAX_VNODES
?
TSDB_MAX_VNODES
:
tsNumOfTotalVnodes
;
tsNumOfTotalVnodes
=
tsNumOfTotalVnodes
<
TSDB_MIN_VNODES
?
TSDB_MIN_VNODES
:
tsNumOfTotalVnodes
;
}
// todo refactor
tsVersion
=
0
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/TDNode.java
浏览文件 @
599df650
...
...
@@ -208,7 +208,6 @@ public class TDNode {
setCfgConfig
(
"mnodeEqualVnodeNum"
,
"0"
);
setCfgConfig
(
"walLevel"
,
"1"
);
setCfgConfig
(
"statusInterval"
,
"1"
);
setCfgConfig
(
"numOfTotalVnodes"
,
"64"
);
setCfgConfig
(
"numOfMnodes"
,
"3"
);
setCfgConfig
(
"numOfThreadsPerCore"
,
"2.0"
);
setCfgConfig
(
"monitor"
,
"0"
);
...
...
src/cq/src/cqMain.c
浏览文件 @
599df650
...
...
@@ -103,9 +103,6 @@ void cqClose(void *handle) {
SCqContext
*
pContext
=
handle
;
if
(
handle
==
NULL
)
return
;
taosTmrCleanUp
(
pContext
->
tmrCtrl
);
pContext
->
tmrCtrl
=
NULL
;
// stop all CQs
cqStop
(
pContext
);
...
...
@@ -125,6 +122,9 @@ void cqClose(void *handle) {
pthread_mutex_destroy
(
&
pContext
->
mutex
);
taosTmrCleanUp
(
pContext
->
tmrCtrl
);
pContext
->
tmrCtrl
=
NULL
;
cTrace
(
"vgId:%d, CQ is closed"
,
pContext
->
vgId
);
free
(
pContext
);
}
...
...
src/dnode/inc/dnodeMgmt.h
浏览文件 @
599df650
...
...
@@ -35,8 +35,8 @@ void* dnodeGetVnodeTsdb(void *pVnode);
void
dnodeReleaseVnode
(
void
*
pVnode
);
void
dnodeSendRedirectMsg
(
SRpcMsg
*
rpcMsg
,
bool
forShell
);
void
dnodeGetMnode
IpSetForPeer
(
void
*
i
pSet
);
void
dnodeGetMnode
IpSetForShell
(
void
*
i
pSet
);
void
dnodeGetMnode
EpSetForPeer
(
void
*
e
pSet
);
void
dnodeGetMnode
EpSetForShell
(
void
*
e
pSet
);
#ifdef __cplusplus
}
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
599df650
...
...
@@ -52,7 +52,7 @@ void * tsDnodeTmr = NULL;
static
void
*
tsStatusTimer
=
NULL
;
static
uint32_t
tsRebootTime
;
static
SRpc
IpSet
tsDMnodeI
pSet
=
{
0
};
static
SRpc
EpSet
tsDMnodeE
pSet
=
{
0
};
static
SDMMnodeInfos
tsDMnodeInfos
=
{
0
};
static
SDMDnodeCfg
tsDnodeCfg
=
{
0
};
static
taos_qset
tsMgmtQset
=
NULL
;
...
...
@@ -90,21 +90,21 @@ int32_t dnodeInitMgmt() {
tsRebootTime
=
taosGetTimestampSec
();
if
(
!
dnodeReadMnodeInfos
())
{
memset
(
&
tsDMnode
IpSet
,
0
,
sizeof
(
SRpcI
pSet
));
memset
(
&
tsDMnode
EpSet
,
0
,
sizeof
(
SRpcE
pSet
));
memset
(
&
tsDMnodeInfos
,
0
,
sizeof
(
SDMMnodeInfos
));
tsDMnode
IpSet
.
numOfI
ps
=
1
;
taosGetFqdnPortFromEp
(
tsFirst
,
tsDMnode
IpSet
.
fqdn
[
0
],
&
tsDMnodeI
pSet
.
port
[
0
]);
tsDMnode
EpSet
.
numOfE
ps
=
1
;
taosGetFqdnPortFromEp
(
tsFirst
,
tsDMnode
EpSet
.
fqdn
[
0
],
&
tsDMnodeE
pSet
.
port
[
0
]);
if
(
strcmp
(
tsSecond
,
tsFirst
)
!=
0
)
{
tsDMnode
IpSet
.
numOfI
ps
=
2
;
taosGetFqdnPortFromEp
(
tsSecond
,
tsDMnode
IpSet
.
fqdn
[
1
],
&
tsDMnodeI
pSet
.
port
[
1
]);
tsDMnode
EpSet
.
numOfE
ps
=
2
;
taosGetFqdnPortFromEp
(
tsSecond
,
tsDMnode
EpSet
.
fqdn
[
1
],
&
tsDMnodeE
pSet
.
port
[
1
]);
}
}
else
{
tsDMnode
I
pSet
.
inUse
=
tsDMnodeInfos
.
inUse
;
tsDMnode
IpSet
.
numOfI
ps
=
tsDMnodeInfos
.
nodeNum
;
tsDMnode
E
pSet
.
inUse
=
tsDMnodeInfos
.
inUse
;
tsDMnode
EpSet
.
numOfE
ps
=
tsDMnodeInfos
.
nodeNum
;
for
(
int32_t
i
=
0
;
i
<
tsDMnodeInfos
.
nodeNum
;
i
++
)
{
taosGetFqdnPortFromEp
(
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeEp
,
tsDMnode
IpSet
.
fqdn
[
i
],
&
tsDMnodeI
pSet
.
port
[
i
]);
taosGetFqdnPortFromEp
(
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeEp
,
tsDMnode
EpSet
.
fqdn
[
i
],
&
tsDMnodeE
pSet
.
port
[
i
]);
}
}
...
...
@@ -450,27 +450,27 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
return
taosCfgDynamicOptions
(
pCfg
->
config
);
}
void
dnodeUpdateMnode
IpSetForPeer
(
SRpcIpSet
*
pI
pSet
)
{
dInfo
(
"mnode
IP list for is changed, numOfIps:%d inUse:%d"
,
pIpSet
->
numOfIps
,
pI
pSet
->
inUse
);
for
(
int
i
=
0
;
i
<
p
IpSet
->
numOfI
ps
;
++
i
)
{
p
I
pSet
->
port
[
i
]
-=
TSDB_PORT_DNODEDNODE
;
dInfo
(
"mnode index:%d %s:%u"
,
i
,
p
IpSet
->
fqdn
[
i
],
pI
pSet
->
port
[
i
])
void
dnodeUpdateMnode
EpSetForPeer
(
SRpcEpSet
*
pE
pSet
)
{
dInfo
(
"mnode
EP list for is changed, numOfEps:%d inUse:%d"
,
pEpSet
->
numOfEps
,
pE
pSet
->
inUse
);
for
(
int
i
=
0
;
i
<
p
EpSet
->
numOfE
ps
;
++
i
)
{
p
E
pSet
->
port
[
i
]
-=
TSDB_PORT_DNODEDNODE
;
dInfo
(
"mnode index:%d %s:%u"
,
i
,
p
EpSet
->
fqdn
[
i
],
pE
pSet
->
port
[
i
])
}
tsDMnode
IpSet
=
*
pI
pSet
;
tsDMnode
EpSet
=
*
pE
pSet
;
}
void
dnodeGetMnode
IpSetForPeer
(
void
*
i
pSetRaw
)
{
SRpc
IpSet
*
ipSet
=
i
pSetRaw
;
*
ipSet
=
tsDMnodeI
pSet
;
void
dnodeGetMnode
EpSetForPeer
(
void
*
e
pSetRaw
)
{
SRpc
EpSet
*
epSet
=
e
pSetRaw
;
*
epSet
=
tsDMnodeE
pSet
;
for
(
int
i
=
0
;
i
<
ipSet
->
numOfI
ps
;
++
i
)
i
pSet
->
port
[
i
]
+=
TSDB_PORT_DNODEDNODE
;
for
(
int
i
=
0
;
i
<
epSet
->
numOfE
ps
;
++
i
)
e
pSet
->
port
[
i
]
+=
TSDB_PORT_DNODEDNODE
;
}
void
dnodeGetMnode
IpSetForShell
(
void
*
i
pSetRaw
)
{
SRpc
IpSet
*
ipSet
=
i
pSetRaw
;
*
ipSet
=
tsDMnodeI
pSet
;
void
dnodeGetMnode
EpSetForShell
(
void
*
e
pSetRaw
)
{
SRpc
EpSet
*
epSet
=
e
pSetRaw
;
*
epSet
=
tsDMnodeE
pSet
;
}
static
void
dnodeProcessStatusRsp
(
SRpcMsg
*
pMsg
)
{
...
...
@@ -536,10 +536,10 @@ static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes) {
dInfo
(
"mnode index:%d, %s"
,
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeId
,
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeEp
);
}
tsDMnode
I
pSet
.
inUse
=
tsDMnodeInfos
.
inUse
;
tsDMnode
IpSet
.
numOfI
ps
=
tsDMnodeInfos
.
nodeNum
;
tsDMnode
E
pSet
.
inUse
=
tsDMnodeInfos
.
inUse
;
tsDMnode
EpSet
.
numOfE
ps
=
tsDMnodeInfos
.
nodeNum
;
for
(
int32_t
i
=
0
;
i
<
tsDMnodeInfos
.
nodeNum
;
i
++
)
{
taosGetFqdnPortFromEp
(
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeEp
,
tsDMnode
IpSet
.
fqdn
[
i
],
&
tsDMnodeI
pSet
.
port
[
i
]);
taosGetFqdnPortFromEp
(
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeEp
,
tsDMnode
EpSet
.
fqdn
[
i
],
&
tsDMnodeE
pSet
.
port
[
i
]);
}
dnodeSaveMnodeInfos
();
...
...
@@ -549,10 +549,10 @@ static void dnodeUpdateMnodeInfos(SDMMnodeInfos *pMnodes) {
static
bool
dnodeReadMnodeInfos
()
{
char
ipFile
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
sprintf
(
ipFile
,
"%s/mnode
IpLis
t.json"
,
tsDnodeDir
);
sprintf
(
ipFile
,
"%s/mnode
EpSe
t.json"
,
tsDnodeDir
);
FILE
*
fp
=
fopen
(
ipFile
,
"r"
);
if
(
!
fp
)
{
dDebug
(
"failed to read mnode
IpLis
t.json, file not exist"
);
dDebug
(
"failed to read mnode
EpSe
t.json, file not exist"
);
return
false
;
}
...
...
@@ -563,40 +563,40 @@ static bool dnodeReadMnodeInfos() {
if
(
len
<=
0
)
{
free
(
content
);
fclose
(
fp
);
dError
(
"failed to read mnode
IpLis
t.json, content is null"
);
dError
(
"failed to read mnode
EpSe
t.json, content is null"
);
return
false
;
}
content
[
len
]
=
0
;
cJSON
*
root
=
cJSON_Parse
(
content
);
if
(
root
==
NULL
)
{
dError
(
"failed to read mnode
IpLis
t.json, invalid json format"
);
dError
(
"failed to read mnode
EpSe
t.json, invalid json format"
);
goto
PARSE_OVER
;
}
cJSON
*
inUse
=
cJSON_GetObjectItem
(
root
,
"inUse"
);
if
(
!
inUse
||
inUse
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read mnode
IpLis
t.json, inUse not found"
);
dError
(
"failed to read mnode
EpSe
t.json, inUse not found"
);
goto
PARSE_OVER
;
}
tsDMnodeInfos
.
inUse
=
inUse
->
valueint
;
cJSON
*
nodeNum
=
cJSON_GetObjectItem
(
root
,
"nodeNum"
);
if
(
!
nodeNum
||
nodeNum
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read mnode
IpLis
t.json, nodeNum not found"
);
dError
(
"failed to read mnode
EpSe
t.json, nodeNum not found"
);
goto
PARSE_OVER
;
}
tsDMnodeInfos
.
nodeNum
=
nodeNum
->
valueint
;
cJSON
*
nodeInfos
=
cJSON_GetObjectItem
(
root
,
"nodeInfos"
);
if
(
!
nodeInfos
||
nodeInfos
->
type
!=
cJSON_Array
)
{
dError
(
"failed to read mnode
IpLis
t.json, nodeInfos not found"
);
dError
(
"failed to read mnode
EpSe
t.json, nodeInfos not found"
);
goto
PARSE_OVER
;
}
int
size
=
cJSON_GetArraySize
(
nodeInfos
);
if
(
size
!=
tsDMnodeInfos
.
nodeNum
)
{
dError
(
"failed to read mnode
IpLis
t.json, nodeInfos size not matched"
);
dError
(
"failed to read mnode
EpSe
t.json, nodeInfos size not matched"
);
goto
PARSE_OVER
;
}
...
...
@@ -606,14 +606,14 @@ static bool dnodeReadMnodeInfos() {
cJSON
*
nodeId
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeId"
);
if
(
!
nodeId
||
nodeId
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read mnode
IpLis
t.json, nodeId not found"
);
dError
(
"failed to read mnode
EpSe
t.json, nodeId not found"
);
goto
PARSE_OVER
;
}
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeId
=
nodeId
->
valueint
;
cJSON
*
nodeEp
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeEp"
);
if
(
!
nodeEp
||
nodeEp
->
type
!=
cJSON_String
||
nodeEp
->
valuestring
==
NULL
)
{
dError
(
"failed to read mnode
IpLis
t.json, nodeName not found"
);
dError
(
"failed to read mnode
EpSe
t.json, nodeName not found"
);
goto
PARSE_OVER
;
}
strncpy
(
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeEp
,
nodeEp
->
valuestring
,
TSDB_EP_LEN
);
...
...
@@ -621,7 +621,7 @@ static bool dnodeReadMnodeInfos() {
ret
=
true
;
dInfo
(
"read mnode
iplist successed, numOfI
ps:%d inUse:%d"
,
tsDMnodeInfos
.
nodeNum
,
tsDMnodeInfos
.
inUse
);
dInfo
(
"read mnode
epSet successed, numOfE
ps:%d inUse:%d"
,
tsDMnodeInfos
.
nodeNum
,
tsDMnodeInfos
.
inUse
);
for
(
int32_t
i
=
0
;
i
<
tsDMnodeInfos
.
nodeNum
;
i
++
)
{
dInfo
(
"mnode:%d, %s"
,
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeId
,
tsDMnodeInfos
.
nodeInfos
[
i
].
nodeEp
);
}
...
...
@@ -635,7 +635,7 @@ PARSE_OVER:
static
void
dnodeSaveMnodeInfos
()
{
char
ipFile
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
ipFile
,
"%s/mnode
IpLis
t.json"
,
tsDnodeDir
);
sprintf
(
ipFile
,
"%s/mnode
EpSe
t.json"
,
tsDnodeDir
);
FILE
*
fp
=
fopen
(
ipFile
,
"w"
);
if
(
!
fp
)
return
;
...
...
@@ -663,11 +663,11 @@ static void dnodeSaveMnodeInfos() {
fclose
(
fp
);
free
(
content
);
dInfo
(
"save mnode
iplis
t successed"
);
dInfo
(
"save mnode
epSe
t successed"
);
}
char
*
dnodeGetMnodeMasterEp
()
{
return
tsDMnodeInfos
.
nodeInfos
[
tsDMnode
I
pSet
.
inUse
].
nodeEp
;
return
tsDMnodeInfos
.
nodeInfos
[
tsDMnode
E
pSet
.
inUse
].
nodeEp
;
}
void
*
dnodeGetMnodeInfos
()
{
...
...
@@ -699,7 +699,6 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
pStatus
->
dnodeId
=
htonl
(
tsDnodeCfg
.
dnodeId
);
strcpy
(
pStatus
->
dnodeEp
,
tsLocalEp
);
pStatus
->
lastReboot
=
htonl
(
tsRebootTime
);
pStatus
->
numOfTotalVnodes
=
htons
((
uint16_t
)
tsNumOfTotalVnodes
);
pStatus
->
numOfCores
=
htons
((
uint16_t
)
tsNumOfCores
);
pStatus
->
diskAvailable
=
tsAvailDataDirGB
;
pStatus
->
alternativeRole
=
(
uint8_t
)
tsAlternativeRole
;
...
...
@@ -727,9 +726,9 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
.
msgType
=
TSDB_MSG_TYPE_DM_STATUS
};
SRpc
IpSet
i
pSet
;
dnodeGetMnode
IpSetForPeer
(
&
i
pSet
);
dnodeSendMsgToDnode
(
&
i
pSet
,
&
rpcMsg
);
SRpc
EpSet
e
pSet
;
dnodeGetMnode
EpSetForPeer
(
&
e
pSet
);
dnodeSendMsgToDnode
(
&
e
pSet
,
&
rpcMsg
);
}
static
bool
dnodeReadDnodeCfg
()
{
...
...
@@ -818,20 +817,20 @@ void dnodeSendRedirectMsg(SRpcMsg *rpcMsg, bool forShell) {
SRpcConnInfo
connInfo
=
{
0
};
rpcGetConnInfo
(
rpcMsg
->
handle
,
&
connInfo
);
SRpc
IpSet
i
pSet
=
{
0
};
SRpc
EpSet
e
pSet
=
{
0
};
if
(
forShell
)
{
dnodeGetMnode
IpSetForShell
(
&
i
pSet
);
dnodeGetMnode
EpSetForShell
(
&
e
pSet
);
}
else
{
dnodeGetMnode
IpSetForPeer
(
&
i
pSet
);
dnodeGetMnode
EpSetForPeer
(
&
e
pSet
);
}
dDebug
(
"msg:%s will be redirected, dnodeIp:%s user:%s, numOf
I
ps:%d inUse:%d"
,
taosMsg
[
rpcMsg
->
msgType
],
taosIpStr
(
connInfo
.
clientIp
),
connInfo
.
user
,
ipSet
.
numOfIps
,
i
pSet
.
inUse
);
dDebug
(
"msg:%s will be redirected, dnodeIp:%s user:%s, numOf
E
ps:%d inUse:%d"
,
taosMsg
[
rpcMsg
->
msgType
],
taosIpStr
(
connInfo
.
clientIp
),
connInfo
.
user
,
epSet
.
numOfEps
,
e
pSet
.
inUse
);
for
(
int
i
=
0
;
i
<
ipSet
.
numOfI
ps
;
++
i
)
{
dDebug
(
"mnode index:%d %s:%d"
,
i
,
ipSet
.
fqdn
[
i
],
i
pSet
.
port
[
i
]);
ipSet
.
port
[
i
]
=
htons
(
i
pSet
.
port
[
i
]);
for
(
int
i
=
0
;
i
<
epSet
.
numOfE
ps
;
++
i
)
{
dDebug
(
"mnode index:%d %s:%d"
,
i
,
epSet
.
fqdn
[
i
],
e
pSet
.
port
[
i
]);
epSet
.
port
[
i
]
=
htons
(
e
pSet
.
port
[
i
]);
}
rpcSendRedirectRsp
(
rpcMsg
->
handle
,
&
i
pSet
);
rpcSendRedirectRsp
(
rpcMsg
->
handle
,
&
e
pSet
);
}
src/dnode/src/dnodePeer.c
浏览文件 @
599df650
...
...
@@ -29,11 +29,11 @@
#include "dnodeVWrite.h"
#include "dnodeMPeer.h"
extern
void
dnodeUpdateMnode
IpSetForPeer
(
SRpcIpSet
*
pI
pSet
);
extern
void
dnodeUpdateMnode
EpSetForPeer
(
SRpcEpSet
*
pE
pSet
);
static
void
(
*
dnodeProcessReqMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
);
static
void
dnodeProcessReqMsgFromDnode
(
SRpcMsg
*
pMsg
,
SRpc
I
pSet
*
);
static
void
dnodeProcessReqMsgFromDnode
(
SRpcMsg
*
pMsg
,
SRpc
E
pSet
*
);
static
void
(
*
dnodeProcessRspMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
rpcMsg
);
static
void
dnodeProcessRspFromDnode
(
SRpcMsg
*
pMsg
,
SRpc
IpSet
*
pI
pSet
);
static
void
dnodeProcessRspFromDnode
(
SRpcMsg
*
pMsg
,
SRpc
EpSet
*
pE
pSet
);
static
void
*
tsDnodeServerRpc
=
NULL
;
static
void
*
tsDnodeClientRpc
=
NULL
;
...
...
@@ -83,7 +83,7 @@ void dnodeCleanupServer() {
}
}
static
void
dnodeProcessReqMsgFromDnode
(
SRpcMsg
*
pMsg
,
SRpc
IpSet
*
pI
pSet
)
{
static
void
dnodeProcessReqMsgFromDnode
(
SRpcMsg
*
pMsg
,
SRpc
EpSet
*
pE
pSet
)
{
SRpcMsg
rspMsg
=
{
.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
...
...
@@ -148,9 +148,9 @@ void dnodeCleanupClient() {
}
}
static
void
dnodeProcessRspFromDnode
(
SRpcMsg
*
pMsg
,
SRpc
IpSet
*
pI
pSet
)
{
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_DM_STATUS_RSP
&&
p
I
pSet
)
{
dnodeUpdateMnode
IpSetForPeer
(
pI
pSet
);
static
void
dnodeProcessRspFromDnode
(
SRpcMsg
*
pMsg
,
SRpc
EpSet
*
pE
pSet
)
{
if
(
pMsg
->
msgType
==
TSDB_MSG_TYPE_DM_STATUS_RSP
&&
p
E
pSet
)
{
dnodeUpdateMnode
EpSetForPeer
(
pE
pSet
);
}
if
(
dnodeProcessRspMsgFp
[
pMsg
->
msgType
])
{
...
...
@@ -166,12 +166,12 @@ void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)) {
dnodeProcessRspMsgFp
[
msgType
]
=
fp
;
}
void
dnodeSendMsgToDnode
(
SRpc
IpSet
*
i
pSet
,
SRpcMsg
*
rpcMsg
)
{
rpcSendRequest
(
tsDnodeClientRpc
,
i
pSet
,
rpcMsg
);
void
dnodeSendMsgToDnode
(
SRpc
EpSet
*
e
pSet
,
SRpcMsg
*
rpcMsg
)
{
rpcSendRequest
(
tsDnodeClientRpc
,
e
pSet
,
rpcMsg
);
}
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
)
{
SRpc
IpSet
i
pSet
=
{
0
};
dnodeGetMnode
IpSetForPeer
(
&
i
pSet
);
rpcSendRecv
(
tsDnodeClientRpc
,
&
i
pSet
,
rpcMsg
,
rpcRsp
);
SRpc
EpSet
e
pSet
=
{
0
};
dnodeGetMnode
EpSetForPeer
(
&
e
pSet
);
rpcSendRecv
(
tsDnodeClientRpc
,
&
e
pSet
,
rpcMsg
,
rpcRsp
);
}
src/dnode/src/dnodeShell.c
浏览文件 @
599df650
...
...
@@ -31,7 +31,7 @@
#include "dnodeShell.h"
static
void
(
*
dnodeProcessShellMsgFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
);
static
void
dnodeProcessMsgFromShell
(
SRpcMsg
*
pMsg
,
SRpc
I
pSet
*
);
static
void
dnodeProcessMsgFromShell
(
SRpcMsg
*
pMsg
,
SRpc
E
pSet
*
);
static
int
dnodeRetrieveUserAuthInfo
(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
static
void
*
tsDnodeShellRpc
=
NULL
;
static
int32_t
tsDnodeQueryReqNum
=
0
;
...
...
@@ -108,7 +108,7 @@ void dnodeCleanupShell() {
}
}
void
dnodeProcessMsgFromShell
(
SRpcMsg
*
pMsg
,
SRpc
IpSet
*
pI
pSet
)
{
void
dnodeProcessMsgFromShell
(
SRpcMsg
*
pMsg
,
SRpc
EpSet
*
pE
pSet
)
{
SRpcMsg
rpcMsg
=
{
.
handle
=
pMsg
->
handle
,
.
pCont
=
NULL
,
...
...
src/inc/dnode.h
浏览文件 @
599df650
...
...
@@ -39,13 +39,13 @@ SDnodeStatisInfo dnodeGetStatisInfo();
bool
dnodeIsFirstDeploy
();
char
*
dnodeGetMnodeMasterEp
();
void
dnodeGetMnode
IpSetForPeer
(
void
*
i
pSet
);
void
dnodeGetMnode
IpSetForShell
(
void
*
i
pSet
);
void
dnodeGetMnode
EpSetForPeer
(
void
*
e
pSet
);
void
dnodeGetMnode
EpSetForShell
(
void
*
e
pSet
);
void
*
dnodeGetMnodeInfos
();
int32_t
dnodeGetDnodeId
();
void
dnodeAddClientRspHandle
(
uint8_t
msgType
,
void
(
*
fp
)(
SRpcMsg
*
rpcMsg
));
void
dnodeSendMsgToDnode
(
SRpc
IpSet
*
i
pSet
,
SRpcMsg
*
rpcMsg
);
void
dnodeSendMsgToDnode
(
SRpc
EpSet
*
e
pSet
,
SRpcMsg
*
rpcMsg
);
void
dnodeSendMsgToDnodeRecv
(
SRpcMsg
*
rpcMsg
,
SRpcMsg
*
rpcRsp
);
void
*
dnodeSendCfgTableToRecv
(
int32_t
vgId
,
int32_t
sid
);
...
...
src/inc/taosdef.h
浏览文件 @
599df650
...
...
@@ -274,9 +274,8 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_DEFAULT_PAYLOAD_SIZE 5120 // default payload size, greater than PATH_MAX value
#define TSDB_EXTRA_PAYLOAD_SIZE 128 // extra bytes for auth
#define TSDB_CQ_SQL_SIZE 1024
#define TSDB_MIN_VNODES 64
#define TSDB_MAX_VNODES 2048
#define TSDB_MIN_VNODES 256
#define TSDB_INVALID_VNODE_NUM 0
#define TSDB_DNODE_ROLE_ANY 0
#define TSDB_DNODE_ROLE_MGMT 1
...
...
@@ -293,7 +292,7 @@ void tsDataSwap(void *pLeft, void *pRight, int32_t type, int32_t size);
#define TSDB_MIN_TOTAL_BLOCKS 2
#define TSDB_MAX_TOTAL_BLOCKS 10000
#define TSDB_DEFAULT_TOTAL_BLOCKS
4
#define TSDB_DEFAULT_TOTAL_BLOCKS
6
#define TSDB_MIN_TABLES 4
#define TSDB_MAX_TABLES 10000000
...
...
src/inc/taosmsg.h
浏览文件 @
599df650
...
...
@@ -176,7 +176,7 @@ extern char *taosMsg[];
typedef
struct
{
char
fqdn
[
TSDB_FQDN_LEN
];
uint16_t
port
;
}
S
I
pAddr
;
}
S
E
pAddr
;
typedef
struct
{
int32_t
numOfVnodes
;
...
...
@@ -306,7 +306,7 @@ typedef struct {
int8_t
reserved1
;
int8_t
reserved2
;
int32_t
connId
;
SRpc
IpSet
ipLis
t
;
SRpc
EpSet
epSe
t
;
}
SCMConnectRsp
;
typedef
struct
{
...
...
@@ -581,12 +581,12 @@ typedef struct {
char
dnodeEp
[
TSDB_EP_LEN
];
uint32_t
moduleStatus
;
uint32_t
lastReboot
;
// time stamp for last reboot
uint16_t
numOfTotalVnodes
;
// from config file
uint16_t
reserve1
;
// from config file
uint16_t
openVnodes
;
uint16_t
numOfCores
;
float
diskAvailable
;
// GB
uint8_t
alternativeRole
;
uint8_t
reserve
[
15
];
uint8_t
reserve
2
[
15
];
SClusterCfg
clusterCfg
;
SVnodeLoad
load
[];
}
SDMStatusMsg
;
...
...
@@ -648,8 +648,8 @@ typedef struct SCMSTableVgroupMsg {
typedef
struct
{
int32_t
vgId
;
int8_t
numOf
I
ps
;
S
IpAddr
i
pAddr
[
TSDB_MAX_REPLICA
];
int8_t
numOf
E
ps
;
S
EpAddr
e
pAddr
[
TSDB_MAX_REPLICA
];
}
SCMVgroupInfo
;
typedef
struct
{
...
...
@@ -753,7 +753,7 @@ typedef struct {
uint32_t
onlineDnodes
;
uint32_t
connId
;
int8_t
killConnection
;
SRpc
IpSet
ipLis
t
;
SRpc
EpSet
epSe
t
;
}
SCMHeartBeatRsp
;
typedef
struct
{
...
...
src/inc/trpc.h
浏览文件 @
599df650
...
...
@@ -28,12 +28,12 @@ extern "C" {
extern
int
tsRpcHeadSize
;
typedef
struct
SRpc
I
pSet
{
typedef
struct
SRpc
E
pSet
{
int8_t
inUse
;
int8_t
numOf
I
ps
;
int8_t
numOf
E
ps
;
uint16_t
port
[
TSDB_MAX_REPLICA
];
char
fqdn
[
TSDB_MAX_REPLICA
][
TSDB_FQDN_LEN
];
}
SRpc
I
pSet
;
}
SRpc
E
pSet
;
typedef
struct
SRpcCorIpSet
{
int32_t
version
;
...
...
@@ -72,7 +72,7 @@ typedef struct SRpcInit {
char
*
ckey
;
// ciphering key
// call back to process incoming msg, code shall be ignored by server app
void
(
*
cfp
)(
SRpcMsg
*
,
SRpc
I
pSet
*
);
void
(
*
cfp
)(
SRpcMsg
*
,
SRpc
E
pSet
*
);
// call back to retrieve the client auth info, for server app only
int
(
*
afp
)(
char
*
tableId
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
...
...
@@ -83,11 +83,11 @@ void rpcClose(void *);
void
*
rpcMallocCont
(
int
contLen
);
void
rpcFreeCont
(
void
*
pCont
);
void
*
rpcReallocCont
(
void
*
ptr
,
int
contLen
);
void
rpcSendRequest
(
void
*
thandle
,
const
SRpc
IpSet
*
pI
pSet
,
SRpcMsg
*
pMsg
);
void
rpcSendRequest
(
void
*
thandle
,
const
SRpc
EpSet
*
pE
pSet
,
SRpcMsg
*
pMsg
);
void
rpcSendResponse
(
const
SRpcMsg
*
pMsg
);
void
rpcSendRedirectRsp
(
void
*
pConn
,
const
SRpc
IpSet
*
pI
pSet
);
void
rpcSendRedirectRsp
(
void
*
pConn
,
const
SRpc
EpSet
*
pE
pSet
);
int
rpcGetConnInfo
(
void
*
thandle
,
SRpcConnInfo
*
pInfo
);
void
rpcSendRecv
(
void
*
shandle
,
SRpc
IpSet
*
pI
pSet
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
);
void
rpcSendRecv
(
void
*
shandle
,
SRpc
EpSet
*
pE
pSet
,
SRpcMsg
*
pReq
,
SRpcMsg
*
pRsp
);
int
rpcReportProgress
(
void
*
pConn
,
char
*
pCont
,
int
contLen
);
void
rpcCancelRequest
(
void
*
pContext
);
...
...
src/inc/tsdb.h
浏览文件 @
599df650
...
...
@@ -46,7 +46,6 @@ typedef struct {
int
(
*
eventCallBack
)(
void
*
);
void
*
(
*
cqCreateFunc
)(
void
*
handle
,
uint64_t
uid
,
int
sid
,
char
*
sqlStr
,
STSchema
*
pSchema
);
void
(
*
cqDropFunc
)(
void
*
handle
);
void
*
(
*
configFunc
)(
int32_t
vgId
,
int32_t
sid
);
}
STsdbAppH
;
// --------- TSDB REPOSITORY CONFIGURATION DEFINITION
...
...
@@ -175,11 +174,6 @@ typedef struct {
SHashObj
*
map
;
// speedup acquire the tableQueryInfo from STableId
}
STableGroupInfo
;
typedef
struct
SQueryRowCond
{
int32_t
rel
;
TSKEY
ts
;
}
SQueryRowCond
;
/**
* Get the data block iterator, starting from position according to the query condition
*
...
...
@@ -276,7 +270,7 @@ int32_t tsdbQuerySTableByTagCond(TSDB_REPO_T *tsdb, uint64_t uid, const char *pT
* destory the created table group list, which is generated by tag query
* @param pGroupList
*/
void
tsdbDest
or
yTableGroup
(
STableGroupInfo
*
pGroupList
);
void
tsdbDest
ro
yTableGroup
(
STableGroupInfo
*
pGroupList
);
/**
* create the table group result including only one table, used to handle the normal table query
...
...
src/kit/taosmigrate/taosmigrate.c
浏览文件 @
599df650
...
...
@@ -210,10 +210,10 @@ int32_t main(int32_t argc, char *argv[]) {
(
void
)
snprintf
(
mnodeWal
,
TSDB_FILENAME_LEN
*
2
,
"%s/mnode/wal/wal0"
,
arguments
.
dataDir
);
walModWalFile
(
mnodeWal
);
// 2. modfiy dnode config: mnode
IpLis
t.json
char
dnode
IpLis
t
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
(
void
)
snprintf
(
dnode
IpList
,
TSDB_FILENAME_LEN
*
2
,
"%s/dnode/mnodeIpLis
t.json"
,
arguments
.
dataDir
);
modDnode
IpList
(
dnodeIpLis
t
);
// 2. modfiy dnode config: mnode
EpSe
t.json
char
dnode
EpSe
t
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
(
void
)
snprintf
(
dnode
EpSet
,
TSDB_FILENAME_LEN
*
2
,
"%s/dnode/mnodeEpSe
t.json"
,
arguments
.
dataDir
);
modDnode
EpSet
(
dnodeEpSe
t
);
// 3. modify vnode config: config.json
char
vnodeDir
[
TSDB_FILENAME_LEN
*
2
]
=
{
0
};
...
...
src/kit/taosmigrate/taosmigrate.h
浏览文件 @
599df650
...
...
@@ -71,7 +71,7 @@ int tSystemShell(const char * cmd);
void
taosMvFile
(
char
*
destFile
,
char
*
srcFile
)
;
void
walModWalFile
(
char
*
walfile
);
SdnodeIfo
*
getDnodeInfo
(
int32_t
dnodeId
);
void
modDnode
IpList
(
char
*
dnodeIpLis
t
);
void
modDnode
EpSet
(
char
*
dnodeEpSe
t
);
void
modAllVnode
(
char
*
vnodeDir
);
#endif
src/kit/taosmigrate/taosmigrateDnodeCfg.c
浏览文件 @
599df650
...
...
@@ -23,10 +23,10 @@
static
SDMMnodeInfos
tsDnodeIpInfos
=
{
0
};
static
bool
dnodeReadMnodeInfos
(
char
*
dnode
IpLis
t
)
{
FILE
*
fp
=
fopen
(
dnode
IpLis
t
,
"r"
);
static
bool
dnodeReadMnodeInfos
(
char
*
dnode
EpSe
t
)
{
FILE
*
fp
=
fopen
(
dnode
EpSe
t
,
"r"
);
if
(
!
fp
)
{
printf
(
"failed to read mnode
IpLis
t.json, file not exist
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, file not exist
\n
"
);
return
false
;
}
...
...
@@ -37,40 +37,40 @@ static bool dnodeReadMnodeInfos(char* dnodeIpList) {
if
(
len
<=
0
)
{
free
(
content
);
fclose
(
fp
);
printf
(
"failed to read mnode
IpLis
t.json, content is null
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, content is null
\n
"
);
return
false
;
}
content
[
len
]
=
0
;
cJSON
*
root
=
cJSON_Parse
(
content
);
if
(
root
==
NULL
)
{
printf
(
"failed to read mnode
IpLis
t.json, invalid json format
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, invalid json format
\n
"
);
goto
PARSE_OVER
;
}
cJSON
*
inUse
=
cJSON_GetObjectItem
(
root
,
"inUse"
);
if
(
!
inUse
||
inUse
->
type
!=
cJSON_Number
)
{
printf
(
"failed to read mnode
IpLis
t.json, inUse not found
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, inUse not found
\n
"
);
goto
PARSE_OVER
;
}
tsDnodeIpInfos
.
inUse
=
inUse
->
valueint
;
cJSON
*
nodeNum
=
cJSON_GetObjectItem
(
root
,
"nodeNum"
);
if
(
!
nodeNum
||
nodeNum
->
type
!=
cJSON_Number
)
{
printf
(
"failed to read mnode
IpLis
t.json, nodeNum not found
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, nodeNum not found
\n
"
);
goto
PARSE_OVER
;
}
tsDnodeIpInfos
.
nodeNum
=
nodeNum
->
valueint
;
cJSON
*
nodeInfos
=
cJSON_GetObjectItem
(
root
,
"nodeInfos"
);
if
(
!
nodeInfos
||
nodeInfos
->
type
!=
cJSON_Array
)
{
printf
(
"failed to read mnode
IpLis
t.json, nodeInfos not found
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, nodeInfos not found
\n
"
);
goto
PARSE_OVER
;
}
int
size
=
cJSON_GetArraySize
(
nodeInfos
);
if
(
size
!=
tsDnodeIpInfos
.
nodeNum
)
{
printf
(
"failed to read mnode
IpLis
t.json, nodeInfos size not matched
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, nodeInfos size not matched
\n
"
);
goto
PARSE_OVER
;
}
...
...
@@ -80,14 +80,14 @@ static bool dnodeReadMnodeInfos(char* dnodeIpList) {
cJSON
*
nodeId
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeId"
);
if
(
!
nodeId
||
nodeId
->
type
!=
cJSON_Number
)
{
printf
(
"failed to read mnode
IpLis
t.json, nodeId not found
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, nodeId not found
\n
"
);
goto
PARSE_OVER
;
}
tsDnodeIpInfos
.
nodeInfos
[
i
].
nodeId
=
nodeId
->
valueint
;
cJSON
*
nodeEp
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeEp"
);
if
(
!
nodeEp
||
nodeEp
->
type
!=
cJSON_String
||
nodeEp
->
valuestring
==
NULL
)
{
printf
(
"failed to read mnode
IpLis
t.json, nodeName not found
\n
"
);
printf
(
"failed to read mnode
EpSe
t.json, nodeName not found
\n
"
);
goto
PARSE_OVER
;
}
strncpy
(
tsDnodeIpInfos
.
nodeInfos
[
i
].
nodeEp
,
nodeEp
->
valuestring
,
TSDB_EP_LEN
);
...
...
@@ -102,7 +102,7 @@ static bool dnodeReadMnodeInfos(char* dnodeIpList) {
ret
=
true
;
//printf("read mnode
iplist successed, numOfI
ps:%d inUse:%d\n", tsDnodeIpInfos.nodeNum, tsDnodeIpInfos.inUse);
//printf("read mnode
epSet successed, numOfE
ps:%d inUse:%d\n", tsDnodeIpInfos.nodeNum, tsDnodeIpInfos.inUse);
//for (int32_t i = 0; i < tsDnodeIpInfos.nodeNum; i++) {
// printf("mnode:%d, %s\n", tsDnodeIpInfos.nodeInfos[i].nodeId, tsDnodeIpInfos.nodeInfos[i].nodeEp);
//}
...
...
@@ -115,8 +115,8 @@ PARSE_OVER:
}
static
void
dnodeSaveMnodeInfos
(
char
*
dnode
IpLis
t
)
{
FILE
*
fp
=
fopen
(
dnode
IpLis
t
,
"w"
);
static
void
dnodeSaveMnodeInfos
(
char
*
dnode
EpSe
t
)
{
FILE
*
fp
=
fopen
(
dnode
EpSe
t
,
"w"
);
if
(
!
fp
)
return
;
int32_t
len
=
0
;
...
...
@@ -143,13 +143,13 @@ static void dnodeSaveMnodeInfos(char* dnodeIpList) {
fclose
(
fp
);
free
(
content
);
printf
(
"mod mnode
iplis
t successed
\n
"
);
printf
(
"mod mnode
epSe
t successed
\n
"
);
}
void
modDnode
IpList
(
char
*
dnodeIpLis
t
)
void
modDnode
EpSet
(
char
*
dnodeEpSe
t
)
{
(
void
)
dnodeReadMnodeInfos
(
dnode
IpLis
t
);
dnodeSaveMnodeInfos
(
dnode
IpLis
t
);
(
void
)
dnodeReadMnodeInfos
(
dnode
EpSe
t
);
dnodeSaveMnodeInfos
(
dnode
EpSe
t
);
return
;
}
...
...
src/mnode/inc/mnodeDef.h
浏览文件 @
599df650
...
...
@@ -40,7 +40,7 @@ typedef struct SDnodeObj {
int32_t
dnodeId
;
int32_t
openVnodes
;
int64_t
createdTime
;
int32_t
totalVnodes
;
// from dnode status msg, config information
int32_t
resever0
;
// from dnode status msg, config information
int32_t
customScore
;
// config by user
uint32_t
lastAccess
;
uint16_t
numOfCores
;
// from dnode status msg
...
...
@@ -50,7 +50,7 @@ typedef struct SDnodeObj {
int8_t
alternativeRole
;
// from dnode status msg, 0-any, 1-mgmt, 2-dnode
int8_t
status
;
// set in balance function
int8_t
isMgmt
;
int8_t
reserve
d0
[
14
];
int8_t
reserve
1
[
14
];
int8_t
updateEnd
[
1
];
int32_t
refCount
;
uint32_t
moduleStatus
;
...
...
@@ -61,7 +61,7 @@ typedef struct SDnodeObj {
int16_t
cpuAvgUsage
;
// calc from sys.cpu
int16_t
memoryAvgUsage
;
// calc from sys.mem
int16_t
bandwidthUsage
;
// calc from sys.band
int8_t
reserved
1
[
2
];
int8_t
reserved
2
[
2
];
}
SDnodeObj
;
typedef
struct
SMnodeObj
{
...
...
src/mnode/inc/mnodeMnode.h
浏览文件 @
599df650
...
...
@@ -42,12 +42,12 @@ void mnodeIncMnodeRef(struct SMnodeObj *pMnode);
void
mnodeDecMnodeRef
(
struct
SMnodeObj
*
pMnode
);
char
*
mnodeGetMnodeRoleStr
();
void
mnodeGetMnode
IpSetForPeer
(
SRpcIpSet
*
i
pSet
);
void
mnodeGetMnode
IpSetForShell
(
SRpcIpSet
*
i
pSet
);
void
mnodeGetMnode
EpSetForPeer
(
SRpcEpSet
*
e
pSet
);
void
mnodeGetMnode
EpSetForShell
(
SRpcEpSet
*
e
pSet
);
char
*
mnodeGetMnodeMasterEp
();
void
mnodeGetMnodeInfos
(
void
*
mnodes
);
void
mnodeUpdateMnode
I
pSet
();
void
mnodeUpdateMnode
E
pSet
();
#ifdef __cplusplus
}
...
...
src/mnode/inc/mnodeVgroup.h
浏览文件 @
599df650
...
...
@@ -44,12 +44,12 @@ int32_t mnodeGetAvailableVgroup(struct SMnodeMsg *pMsg, SVgObj **pVgroup, int32_
void
mnodeAddTableIntoVgroup
(
SVgObj
*
pVgroup
,
SChildTableObj
*
pTable
);
void
mnodeRemoveTableFromVgroup
(
SVgObj
*
pVgroup
,
SChildTableObj
*
pTable
);
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpc
IpSet
*
i
pSet
,
void
*
ahandle
);
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpc
EpSet
*
e
pSet
,
void
*
ahandle
);
void
mnodeSendCreateVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
);
void
mnodeSendAlterVgroupMsg
(
SVgObj
*
pVgroup
);
SRpc
IpSet
mnodeGetI
pSetFromVgroup
(
SVgObj
*
pVgroup
);
SRpc
IpSet
mnodeGetI
pSetFromIp
(
char
*
ep
);
SRpc
EpSet
mnodeGetE
pSetFromVgroup
(
SVgObj
*
pVgroup
);
SRpc
EpSet
mnodeGetE
pSetFromIp
(
char
*
ep
);
#ifdef __cplusplus
}
...
...
src/mnode/src/mnodeBalance.c
浏览文件 @
599df650
...
...
@@ -39,11 +39,11 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) {
pIter
=
mnodeGetNextDnode
(
pIter
,
&
pDnode
);
if
(
pDnode
==
NULL
)
break
;
if
(
pDnode
->
totalVnodes
>
0
&&
pDnode
->
openVnodes
<
pDnode
->
totalVnodes
)
{
if
(
pDnode
->
numOfCores
>
0
&&
pDnode
->
openVnodes
<
TSDB_MAX_VNODES
)
{
float
openVnodes
=
pDnode
->
openVnodes
;
if
(
pDnode
->
isMgmt
)
openVnodes
+=
tsMnodeEqualVnodeNum
;
float
usage
=
openVnodes
/
pDnode
->
totalVnod
es
;
float
usage
=
openVnodes
/
pDnode
->
numOfCor
es
;
if
(
usage
<=
vnodeUsage
)
{
pSelDnode
=
pDnode
;
vnodeUsage
=
usage
;
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
599df650
...
...
@@ -289,14 +289,14 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
}
}
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromIp
(
pCmCfgDnode
->
ep
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromIp
(
pCmCfgDnode
->
ep
);
if
(
dnodeId
!=
0
)
{
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
dnodeId
);
if
(
pDnode
==
NULL
)
{
mError
(
"failed to cfg dnode, invalid dnodeId:%d"
,
dnodeId
);
return
TSDB_CODE_MND_DNODE_NOT_EXIST
;
}
ipSet
=
mnodeGetI
pSetFromIp
(
pDnode
->
dnodeEp
);
epSet
=
mnodeGetE
pSetFromIp
(
pDnode
->
dnodeEp
);
mnodeDecDnodeRef
(
pDnode
);
}
...
...
@@ -313,7 +313,7 @@ static int32_t mnodeProcessCfgDnodeMsg(SMnodeMsg *pMsg) {
};
mInfo
(
"dnode:%s, is configured by %s"
,
pCmCfgDnode
->
ep
,
pMsg
->
pUser
->
user
);
dnodeSendMsgToDnode
(
&
i
pSet
,
&
rpcMdCfgDnodeMsg
);
dnodeSendMsgToDnode
(
&
e
pSet
,
&
rpcMdCfgDnodeMsg
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -345,8 +345,7 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pStatus
->
moduleStatus
=
htonl
(
pStatus
->
moduleStatus
);
pStatus
->
lastReboot
=
htonl
(
pStatus
->
lastReboot
);
pStatus
->
numOfCores
=
htons
(
pStatus
->
numOfCores
);
pStatus
->
numOfTotalVnodes
=
htons
(
pStatus
->
numOfTotalVnodes
);
uint32_t
version
=
htonl
(
pStatus
->
version
);
if
(
version
!=
tsVersion
)
{
mError
(
"status msg version:%d not equal with mnode:%d"
,
version
,
tsVersion
);
...
...
@@ -372,7 +371,6 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
pDnode
->
numOfCores
=
pStatus
->
numOfCores
;
pDnode
->
diskAvailable
=
pStatus
->
diskAvailable
;
pDnode
->
alternativeRole
=
pStatus
->
alternativeRole
;
pDnode
->
totalVnodes
=
pStatus
->
numOfTotalVnodes
;
pDnode
->
moduleStatus
=
pStatus
->
moduleStatus
;
if
(
pStatus
->
dnodeId
==
0
)
{
...
...
@@ -401,9 +399,9 @@ static int32_t mnodeProcessDnodeStatusMsg(SMnodeMsg *pMsg) {
SVgObj
*
pVgroup
=
mnodeGetVgroup
(
pVload
->
vgId
);
if
(
pVgroup
==
NULL
)
{
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromIp
(
pDnode
->
dnodeEp
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromIp
(
pDnode
->
dnodeEp
);
mInfo
(
"dnode:%d, vgId:%d not exist in mnode, drop it"
,
pDnode
->
dnodeId
,
pVload
->
vgId
);
mnodeSendDropVnodeMsg
(
pVload
->
vgId
,
&
i
pSet
,
NULL
);
mnodeSendDropVnodeMsg
(
pVload
->
vgId
,
&
e
pSet
,
NULL
);
}
else
{
mnodeUpdateVgroupStatus
(
pVgroup
,
pDnode
,
pVload
);
pAccess
->
vgId
=
htonl
(
pVload
->
vgId
);
...
...
@@ -452,17 +450,29 @@ static int32_t mnodeCreateDnode(char *ep, SMnodeMsg *pMsg) {
return
grantCode
;
}
char
dnodeEp
[
TSDB_EP_LEN
]
=
{
0
};
tstrncpy
(
dnodeEp
,
ep
,
TSDB_EP_LEN
);
strtrim
(
dnodeEp
);
char
*
temp
=
strchr
(
dnodeEp
,
':'
);
if
(
!
temp
)
{
int
len
=
strlen
(
dnodeEp
);
if
(
dnodeEp
[
len
-
1
]
==
';'
)
dnodeEp
[
len
-
1
]
=
0
;
len
=
strlen
(
dnodeEp
);
snprintf
(
dnodeEp
+
len
,
TSDB_EP_LEN
-
len
,
":%d"
,
tsServerPort
);
}
ep
=
dnodeEp
;
SDnodeObj
*
pDnode
=
mnodeGetDnodeByEp
(
ep
);
if
(
pDnode
!=
NULL
)
{
mnodeDecDnodeRef
(
pDnode
);
mError
(
"dnode:%d is alredy exist, %s:%d"
,
pDnode
->
dnodeId
,
pDnode
->
dnodeFqdn
,
pDnode
->
dnodePort
);
mError
(
"dnode:%d is alre
a
dy exist, %s:%d"
,
pDnode
->
dnodeId
,
pDnode
->
dnodeFqdn
,
pDnode
->
dnodePort
);
return
TSDB_CODE_MND_DNODE_ALREADY_EXIST
;
}
pDnode
=
(
SDnodeObj
*
)
calloc
(
1
,
sizeof
(
SDnodeObj
));
pDnode
->
createdTime
=
taosGetTimestampMs
();
pDnode
->
status
=
TAOS_DN_STATUS_OFFLINE
;
pDnode
->
totalVnodes
=
TSDB_INVALID_VNODE_NUM
;
tstrncpy
(
pDnode
->
dnodeEp
,
ep
,
TSDB_EP_LEN
);
taosGetFqdnPortFromEp
(
ep
,
pDnode
->
dnodeFqdn
,
&
pDnode
->
dnodePort
);
...
...
@@ -507,8 +517,12 @@ int32_t mnodeDropDnode(SDnodeObj *pDnode, void *pMsg) {
static
int32_t
mnodeDropDnodeByEp
(
char
*
ep
,
SMnodeMsg
*
pMsg
)
{
SDnodeObj
*
pDnode
=
mnodeGetDnodeByEp
(
ep
);
if
(
pDnode
==
NULL
)
{
mError
(
"dnode:%s, is not exist"
,
ep
);
return
TSDB_CODE_MND_DNODE_NOT_EXIST
;
int32_t
dnodeId
=
(
int32_t
)
strtol
(
ep
,
NULL
,
10
);
pDnode
=
mnodeGetDnode
(
dnodeId
);
if
(
pDnode
==
NULL
)
{
mError
(
"dnode:%s, is not exist"
,
ep
);
return
TSDB_CODE_MND_DNODE_NOT_EXIST
;
}
}
if
(
strcmp
(
pDnode
->
dnodeEp
,
mnodeGetMnodeMasterEp
())
==
0
)
{
...
...
@@ -575,13 +589,13 @@ static int32_t mnodeGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"
open_
vnodes"
);
strcpy
(
pSchema
[
cols
].
name
,
"vnodes"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
2
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_SMALLINT
;
strcpy
(
pSchema
[
cols
].
name
,
"
total_vnod
es"
);
strcpy
(
pSchema
[
cols
].
name
,
"
cor
es"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -593,7 +607,7 @@ static int32_t mnodeGetDnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
pShow
->
bytes
[
cols
]
=
6
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"
alternativeR
ole"
);
strcpy
(
pSchema
[
cols
].
name
,
"
r
ole"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -645,7 +659,7 @@ static int32_t mnodeRetrieveDnodes(SShowObj *pShow, char *data, int32_t rows, vo
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int16_t
*
)
pWrite
=
pDnode
->
totalVnod
es
;
*
(
int16_t
*
)
pWrite
=
pDnode
->
numOfCor
es
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
...
...
src/mnode/src/mnodeMnode.c
浏览文件 @
599df650
...
...
@@ -35,8 +35,8 @@
static
void
*
tsMnodeSdb
=
NULL
;
static
int32_t
tsMnodeUpdateSize
=
0
;
static
SRpc
IpSet
tsMnodeI
pSetForShell
;
static
SRpc
IpSet
tsMnodeI
pSetForPeer
;
static
SRpc
EpSet
tsMnodeE
pSetForShell
;
static
SRpc
EpSet
tsMnodeE
pSetForPeer
;
static
SDMMnodeInfos
tsMnodeInfos
;
static
int32_t
mnodeGetMnodeMeta
(
STableMetaMsg
*
pMeta
,
SShowObj
*
pShow
,
void
*
pConn
);
static
int32_t
mnodeRetrieveMnodes
(
SShowObj
*
pShow
,
char
*
data
,
int32_t
rows
,
void
*
pConn
);
...
...
@@ -123,7 +123,7 @@ static int32_t mnodeMnodeActionRestored() {
sdbFreeIter
(
pIter
);
}
mnodeUpdateMnode
I
pSet
();
mnodeUpdateMnode
E
pSet
();
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -204,13 +204,13 @@ char *mnodeGetMnodeRoleStr(int32_t role) {
}
}
void
mnodeUpdateMnode
I
pSet
()
{
mInfo
(
"update mnodes
ipset, numOfI
ps:%d "
,
mnodeGetMnodesNum
());
void
mnodeUpdateMnode
E
pSet
()
{
mInfo
(
"update mnodes
epSet, numOfE
ps:%d "
,
mnodeGetMnodesNum
());
mnodeMnodeWrLock
();
memset
(
&
tsMnode
IpSetForShell
,
0
,
sizeof
(
SRpcI
pSet
));
memset
(
&
tsMnode
IpSetForPeer
,
0
,
sizeof
(
SRpcI
pSet
));
memset
(
&
tsMnode
EpSetForShell
,
0
,
sizeof
(
SRpcE
pSet
));
memset
(
&
tsMnode
EpSetForPeer
,
0
,
sizeof
(
SRpcE
pSet
));
memset
(
&
tsMnodeInfos
,
0
,
sizeof
(
SDMMnodeInfos
));
int32_t
index
=
0
;
...
...
@@ -222,20 +222,20 @@ void mnodeUpdateMnodeIpSet() {
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pMnode
->
mnodeId
);
if
(
pDnode
!=
NULL
)
{
strcpy
(
tsMnode
I
pSetForShell
.
fqdn
[
index
],
pDnode
->
dnodeFqdn
);
tsMnode
I
pSetForShell
.
port
[
index
]
=
htons
(
pDnode
->
dnodePort
);
mDebug
(
"mnode:%d, for shell fqdn:%s %d"
,
pDnode
->
dnodeId
,
tsMnode
IpSetForShell
.
fqdn
[
index
],
htons
(
tsMnodeI
pSetForShell
.
port
[
index
]));
strcpy
(
tsMnode
E
pSetForShell
.
fqdn
[
index
],
pDnode
->
dnodeFqdn
);
tsMnode
E
pSetForShell
.
port
[
index
]
=
htons
(
pDnode
->
dnodePort
);
mDebug
(
"mnode:%d, for shell fqdn:%s %d"
,
pDnode
->
dnodeId
,
tsMnode
EpSetForShell
.
fqdn
[
index
],
htons
(
tsMnodeE
pSetForShell
.
port
[
index
]));
strcpy
(
tsMnode
I
pSetForPeer
.
fqdn
[
index
],
pDnode
->
dnodeFqdn
);
tsMnode
I
pSetForPeer
.
port
[
index
]
=
htons
(
pDnode
->
dnodePort
+
TSDB_PORT_DNODEDNODE
);
mDebug
(
"mnode:%d, for peer fqdn:%s %d"
,
pDnode
->
dnodeId
,
tsMnode
IpSetForPeer
.
fqdn
[
index
],
htons
(
tsMnodeI
pSetForPeer
.
port
[
index
]));
strcpy
(
tsMnode
E
pSetForPeer
.
fqdn
[
index
],
pDnode
->
dnodeFqdn
);
tsMnode
E
pSetForPeer
.
port
[
index
]
=
htons
(
pDnode
->
dnodePort
+
TSDB_PORT_DNODEDNODE
);
mDebug
(
"mnode:%d, for peer fqdn:%s %d"
,
pDnode
->
dnodeId
,
tsMnode
EpSetForPeer
.
fqdn
[
index
],
htons
(
tsMnodeE
pSetForPeer
.
port
[
index
]));
tsMnodeInfos
.
nodeInfos
[
index
].
nodeId
=
htonl
(
pMnode
->
mnodeId
);
strcpy
(
tsMnodeInfos
.
nodeInfos
[
index
].
nodeEp
,
pDnode
->
dnodeEp
);
if
(
pMnode
->
role
==
TAOS_SYNC_ROLE_MASTER
)
{
tsMnode
I
pSetForShell
.
inUse
=
index
;
tsMnode
I
pSetForPeer
.
inUse
=
index
;
tsMnode
E
pSetForShell
.
inUse
=
index
;
tsMnode
E
pSetForPeer
.
inUse
=
index
;
tsMnodeInfos
.
inUse
=
index
;
}
...
...
@@ -248,23 +248,23 @@ void mnodeUpdateMnodeIpSet() {
}
tsMnodeInfos
.
nodeNum
=
index
;
tsMnode
IpSetForShell
.
numOfI
ps
=
index
;
tsMnode
IpSetForPeer
.
numOfI
ps
=
index
;
tsMnode
EpSetForShell
.
numOfE
ps
=
index
;
tsMnode
EpSetForPeer
.
numOfE
ps
=
index
;
sdbFreeIter
(
pIter
);
mnodeMnodeUnLock
();
}
void
mnodeGetMnode
IpSetForPeer
(
SRpcIpSet
*
i
pSet
)
{
void
mnodeGetMnode
EpSetForPeer
(
SRpcEpSet
*
e
pSet
)
{
mnodeMnodeRdLock
();
*
ipSet
=
tsMnodeI
pSetForPeer
;
*
epSet
=
tsMnodeE
pSetForPeer
;
mnodeMnodeUnLock
();
}
void
mnodeGetMnode
IpSetForShell
(
SRpcIpSet
*
i
pSet
)
{
void
mnodeGetMnode
EpSetForShell
(
SRpcEpSet
*
e
pSet
)
{
mnodeMnodeRdLock
();
*
ipSet
=
tsMnodeI
pSetForShell
;
*
epSet
=
tsMnodeE
pSetForShell
;
mnodeMnodeUnLock
();
}
...
...
@@ -295,7 +295,7 @@ int32_t mnodeAddMnode(int32_t dnodeId) {
code
=
TSDB_CODE_MND_SDB_ERROR
;
}
mnodeUpdateMnode
I
pSet
();
mnodeUpdateMnode
E
pSet
();
return
code
;
}
...
...
@@ -308,7 +308,7 @@ void mnodeDropMnodeLocal(int32_t dnodeId) {
mnodeDecMnodeRef
(
pMnode
);
}
mnodeUpdateMnode
I
pSet
();
mnodeUpdateMnode
E
pSet
();
}
int32_t
mnodeDropMnode
(
int32_t
dnodeId
)
{
...
...
@@ -330,7 +330,7 @@ int32_t mnodeDropMnode(int32_t dnodeId) {
sdbDecRef
(
tsMnodeSdb
,
pMnode
);
mnodeUpdateMnode
I
pSet
();
mnodeUpdateMnode
E
pSet
();
return
code
;
}
...
...
src/mnode/src/mnodePeer.c
浏览文件 @
599df650
...
...
@@ -53,14 +53,14 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg) {
if
(
!
sdbIsMaster
())
{
SMnodeRsp
*
rpcRsp
=
&
pMsg
->
rpcRsp
;
SRpc
IpSet
*
ipSet
=
rpcMallocCont
(
sizeof
(
SRpcI
pSet
));
mnodeGetMnode
IpSetForPeer
(
i
pSet
);
rpcRsp
->
rsp
=
i
pSet
;
rpcRsp
->
len
=
sizeof
(
SRpc
I
pSet
);
SRpc
EpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
SRpcE
pSet
));
mnodeGetMnode
EpSetForPeer
(
e
pSet
);
rpcRsp
->
rsp
=
e
pSet
;
rpcRsp
->
len
=
sizeof
(
SRpc
E
pSet
);
mDebug
(
"%p, msg:%s in mpeer queue, will be redireced inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
i
pSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
ipSet
->
numOfI
ps
;
++
i
)
{
mDebug
(
"mnode index:%d
ip:%s:%d"
,
i
,
ipSet
->
fqdn
[
i
],
htons
(
i
pSet
->
port
[
i
]));
mDebug
(
"%p, msg:%s in mpeer queue, will be redireced inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
e
pSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
->
numOfE
ps
;
++
i
)
{
mDebug
(
"mnode index:%d
ep:%s:%d"
,
i
,
epSet
->
fqdn
[
i
],
htons
(
e
pSet
->
port
[
i
]));
}
return
TSDB_CODE_RPC_REDIRECT
;
...
...
src/mnode/src/mnodeRead.c
浏览文件 @
599df650
...
...
@@ -49,14 +49,14 @@ int32_t mnodeProcessRead(SMnodeMsg *pMsg) {
if
(
!
sdbIsMaster
())
{
SMnodeRsp
*
rpcRsp
=
&
pMsg
->
rpcRsp
;
SRpc
IpSet
*
ipSet
=
rpcMallocCont
(
sizeof
(
SRpcI
pSet
));
mnodeGetMnode
IpSetForShell
(
i
pSet
);
rpcRsp
->
rsp
=
i
pSet
;
rpcRsp
->
len
=
sizeof
(
SRpc
I
pSet
);
SRpc
EpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
SRpcE
pSet
));
mnodeGetMnode
EpSetForShell
(
e
pSet
);
rpcRsp
->
rsp
=
e
pSet
;
rpcRsp
->
len
=
sizeof
(
SRpc
E
pSet
);
mDebug
(
"%p, msg:%s in mread queue, will be redireced, inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
i
pSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
ipSet
->
numOfI
ps
;
++
i
)
{
mDebug
(
"mnode index:%d
ip:%s:%d"
,
i
,
ipSet
->
fqdn
[
i
],
htons
(
i
pSet
->
port
[
i
]));
mDebug
(
"%p, msg:%s in mread queue, will be redireced, inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
e
pSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
->
numOfE
ps
;
++
i
)
{
mDebug
(
"mnode index:%d
ep:%s:%d"
,
i
,
epSet
->
fqdn
[
i
],
htons
(
e
pSet
->
port
[
i
]));
}
return
TSDB_CODE_RPC_REDIRECT
;
...
...
src/mnode/src/mnodeSdb.c
浏览文件 @
599df650
...
...
@@ -219,7 +219,7 @@ void sdbUpdateMnodeRoles() {
}
}
mnodeUpdateMnode
I
pSet
();
mnodeUpdateMnode
E
pSet
();
}
static
uint32_t
sdbGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
uint32_t
eindex
,
int32_t
*
size
,
uint64_t
*
fversion
)
{
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
599df650
...
...
@@ -270,7 +270,7 @@ static int32_t mnodeProcessHeartBeatMsg(SMnodeMsg *pMsg) {
pHBRsp
->
onlineDnodes
=
htonl
(
mnodeGetOnlinDnodesNum
());
pHBRsp
->
totalDnodes
=
htonl
(
mnodeGetDnodesNum
());
mnodeGetMnode
IpSetForShell
(
&
pHBRsp
->
ipLis
t
);
mnodeGetMnode
EpSetForShell
(
&
pHBRsp
->
epSe
t
);
pMsg
->
rpcRsp
.
rsp
=
pHBRsp
;
pMsg
->
rpcRsp
.
len
=
sizeof
(
SCMHeartBeatRsp
);
...
...
@@ -335,7 +335,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
pConnectRsp
->
writeAuth
=
pUser
->
writeAuth
;
pConnectRsp
->
superAuth
=
pUser
->
superAuth
;
mnodeGetMnode
IpSetForShell
(
&
pConnectRsp
->
ipLis
t
);
mnodeGetMnode
EpSetForShell
(
&
pConnectRsp
->
epSe
t
);
connect_over:
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/mnode/src/mnodeTable.c
浏览文件 @
599df650
...
...
@@ -910,9 +910,9 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
mInfo
(
"app:%p:%p, stable:%s, send drop stable msg to vgId:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pStable
->
info
.
tableId
,
pVgroup
->
vgId
);
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromVgroup
(
pVgroup
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromVgroup
(
pVgroup
);
SRpcMsg
rpcMsg
=
{.
pCont
=
pDrop
,
.
contLen
=
sizeof
(
SMDDropSTableMsg
),
.
msgType
=
TSDB_MSG_TYPE_MD_DROP_STABLE
};
dnodeSendMsgToDnode
(
&
i
pSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
&
e
pSet
,
&
rpcMsg
);
mnodeDecVgroupRef
(
pVgroup
);
}
taosHashDestroyIter
(
pIter
);
...
...
@@ -1484,10 +1484,10 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
SDnodeObj
*
pDnode
=
pVgroup
->
vnodeGid
[
vn
].
pDnode
;
if
(
pDnode
==
NULL
)
break
;
tstrncpy
(
pVgroupInfo
->
vgroups
[
vgSize
].
i
pAddr
[
vn
].
fqdn
,
pDnode
->
dnodeFqdn
,
TSDB_FQDN_LEN
);
pVgroupInfo
->
vgroups
[
vgSize
].
i
pAddr
[
vn
].
port
=
htons
(
pDnode
->
dnodePort
);
tstrncpy
(
pVgroupInfo
->
vgroups
[
vgSize
].
e
pAddr
[
vn
].
fqdn
,
pDnode
->
dnodeFqdn
,
TSDB_FQDN_LEN
);
pVgroupInfo
->
vgroups
[
vgSize
].
e
pAddr
[
vn
].
port
=
htons
(
pDnode
->
dnodePort
);
pVgroupInfo
->
vgroups
[
vgSize
].
numOf
I
ps
++
;
pVgroupInfo
->
vgroups
[
vgSize
].
numOf
E
ps
++
;
}
vgSize
++
;
...
...
@@ -1615,7 +1615,7 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
return
terrno
;
}
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromVgroup
(
pMsg
->
pVgroup
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromVgroup
(
pMsg
->
pVgroup
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
pMsg
,
.
pCont
=
pMDCreate
,
...
...
@@ -1624,7 +1624,7 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
.
msgType
=
TSDB_MSG_TYPE_MD_CREATE_TABLE
};
dnodeSendMsgToDnode
(
&
i
pSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
&
e
pSet
,
&
rpcMsg
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
...
...
@@ -1788,7 +1788,7 @@ static int32_t mnodeProcessDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) {
pDrop
->
sid
=
htonl
(
pTable
->
sid
);
pDrop
->
uid
=
htobe64
(
pTable
->
uid
);
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromVgroup
(
pMsg
->
pVgroup
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromVgroup
(
pMsg
->
pVgroup
);
mInfo
(
"app:%p:%p, table:%s, send drop ctable msg, vgId:%d sid:%d uid:%"
PRIu64
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pDrop
->
tableId
,
pTable
->
vgId
,
pTable
->
sid
,
pTable
->
uid
);
...
...
@@ -1803,7 +1803,7 @@ static int32_t mnodeProcessDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) {
if
(
!
needReturn
)
rpcMsg
.
ahandle
=
NULL
;
dnodeSendMsgToDnode
(
&
i
pSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
&
e
pSet
,
&
rpcMsg
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
...
...
@@ -1842,7 +1842,7 @@ static int32_t mnodeAlterNormalTableColumnCb(SMnodeMsg *pMsg, int32_t code) {
}
}
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromVgroup
(
pMsg
->
pVgroup
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromVgroup
(
pMsg
->
pVgroup
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
pMsg
,
.
pCont
=
pMDCreate
,
...
...
@@ -1854,7 +1854,7 @@ static int32_t mnodeAlterNormalTableColumnCb(SMnodeMsg *pMsg, int32_t code) {
mDebug
(
"app:%p:%p, ctable %s, send alter column msg to vgId:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
pTable
->
info
.
tableId
,
pMsg
->
pVgroup
->
vgId
);
dnodeSendMsgToDnode
(
&
i
pSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
&
e
pSet
,
&
rpcMsg
);
return
TSDB_CODE_MND_ACTION_IN_PROGRESS
;
}
...
...
@@ -1996,9 +1996,9 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) {
for
(
int32_t
i
=
0
;
i
<
pMsg
->
pVgroup
->
numOfVnodes
;
++
i
)
{
SDnodeObj
*
pDnode
=
mnodeGetDnode
(
pMsg
->
pVgroup
->
vnodeGid
[
i
].
dnodeId
);
if
(
pDnode
==
NULL
)
break
;
strcpy
(
pMeta
->
vgroup
.
i
pAddr
[
i
].
fqdn
,
pDnode
->
dnodeFqdn
);
pMeta
->
vgroup
.
i
pAddr
[
i
].
port
=
htons
(
pDnode
->
dnodePort
+
TSDB_PORT_DNODESHELL
);
pMeta
->
vgroup
.
numOf
I
ps
++
;
strcpy
(
pMeta
->
vgroup
.
e
pAddr
[
i
].
fqdn
,
pDnode
->
dnodeFqdn
);
pMeta
->
vgroup
.
e
pAddr
[
i
].
port
=
htons
(
pDnode
->
dnodePort
+
TSDB_PORT_DNODESHELL
);
pMeta
->
vgroup
.
numOf
E
ps
++
;
mnodeDecDnodeRef
(
pDnode
);
}
pMeta
->
vgroup
.
vgId
=
htonl
(
pMsg
->
pVgroup
->
vgId
);
...
...
src/mnode/src/mnodeVgroup.c
浏览文件 @
599df650
...
...
@@ -317,9 +317,9 @@ void mnodeUpdateVgroupStatus(SVgObj *pVgroup, SDnodeObj *pDnode, SVnodeLoad *pVl
}
if
(
!
dnodeExist
)
{
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromIp
(
pDnode
->
dnodeEp
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromIp
(
pDnode
->
dnodeEp
);
mError
(
"vgId:%d, dnode:%d not exist in mnode, drop it"
,
pVload
->
vgId
,
pDnode
->
dnodeId
);
mnodeSendDropVnodeMsg
(
pVload
->
vgId
,
&
i
pSet
,
NULL
);
mnodeSendDropVnodeMsg
(
pVload
->
vgId
,
&
e
pSet
,
NULL
);
return
;
}
...
...
@@ -585,9 +585,9 @@ static int32_t mnodeGetVgroupMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *p
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
4
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_
INT
;
strcpy
(
pSchema
[
cols
].
name
,
"
poolSize
"
);
pShow
->
bytes
[
cols
]
=
12
+
VARSTR_HEADER_SIZE
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_
BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"
status
"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
...
...
@@ -688,8 +688,9 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v
*
(
int32_t
*
)
pWrite
=
pVgroup
->
numOfTables
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int32_t
*
)
pWrite
=
taosIdPoolMaxSize
(
pVgroup
->
idPool
);
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
char
*
status
=
vgroupStatus
[
pVgroup
->
status
];
STR_TO_VARSTR
(
pWrite
,
status
);
cols
++
;
int32_t
onlineVnodes
=
0
;
...
...
@@ -808,29 +809,29 @@ static SMDCreateVnodeMsg *mnodeBuildVnodeMsg(SVgObj *pVgroup) {
return
pVnode
;
}
SRpc
IpSet
mnodeGetI
pSetFromVgroup
(
SVgObj
*
pVgroup
)
{
SRpc
IpSet
i
pSet
=
{
.
numOf
I
ps
=
pVgroup
->
numOfVnodes
,
SRpc
EpSet
mnodeGetE
pSetFromVgroup
(
SVgObj
*
pVgroup
)
{
SRpc
EpSet
e
pSet
=
{
.
numOf
E
ps
=
pVgroup
->
numOfVnodes
,
.
inUse
=
0
,
};
for
(
int
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
strcpy
(
i
pSet
.
fqdn
[
i
],
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeFqdn
);
i
pSet
.
port
[
i
]
=
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodePort
+
TSDB_PORT_DNODEDNODE
;
strcpy
(
e
pSet
.
fqdn
[
i
],
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeFqdn
);
e
pSet
.
port
[
i
]
=
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodePort
+
TSDB_PORT_DNODEDNODE
;
}
return
i
pSet
;
return
e
pSet
;
}
SRpc
IpSet
mnodeGetI
pSetFromIp
(
char
*
ep
)
{
SRpc
IpSet
i
pSet
;
SRpc
EpSet
mnodeGetE
pSetFromIp
(
char
*
ep
)
{
SRpc
EpSet
e
pSet
;
ipSet
.
numOfI
ps
=
1
;
i
pSet
.
inUse
=
0
;
taosGetFqdnPortFromEp
(
ep
,
ipSet
.
fqdn
[
0
],
&
i
pSet
.
port
[
0
]);
i
pSet
.
port
[
0
]
+=
TSDB_PORT_DNODEDNODE
;
return
i
pSet
;
epSet
.
numOfE
ps
=
1
;
e
pSet
.
inUse
=
0
;
taosGetFqdnPortFromEp
(
ep
,
epSet
.
fqdn
[
0
],
&
e
pSet
.
port
[
0
]);
e
pSet
.
port
[
0
]
+=
TSDB_PORT_DNODEDNODE
;
return
e
pSet
;
}
static
void
mnodeSendAlterVnodeMsg
(
SVgObj
*
pVgroup
,
SRpc
IpSet
*
i
pSet
)
{
static
void
mnodeSendAlterVnodeMsg
(
SVgObj
*
pVgroup
,
SRpc
EpSet
*
e
pSet
)
{
SMDAlterVnodeMsg
*
pAlter
=
mnodeBuildVnodeMsg
(
pVgroup
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
NULL
,
...
...
@@ -839,21 +840,21 @@ static void mnodeSendAlterVnodeMsg(SVgObj *pVgroup, SRpcIpSet *ipSet) {
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_ALTER_VNODE
};
dnodeSendMsgToDnode
(
i
pSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
e
pSet
,
&
rpcMsg
);
}
void
mnodeSendAlterVgroupMsg
(
SVgObj
*
pVgroup
)
{
mDebug
(
"vgId:%d, send alter all vnodes msg, numOfVnodes:%d db:%s"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
,
pVgroup
->
dbName
);
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mDebug
(
"vgId:%d, index:%d, send alter vnode msg to dnode %s"
,
pVgroup
->
vgId
,
i
,
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mnodeSendAlterVnodeMsg
(
pVgroup
,
&
i
pSet
);
mnodeSendAlterVnodeMsg
(
pVgroup
,
&
e
pSet
);
}
}
static
void
mnodeSendCreateVnodeMsg
(
SVgObj
*
pVgroup
,
SRpc
IpSet
*
i
pSet
,
void
*
ahandle
)
{
static
void
mnodeSendCreateVnodeMsg
(
SVgObj
*
pVgroup
,
SRpc
EpSet
*
e
pSet
,
void
*
ahandle
)
{
SMDCreateVnodeMsg
*
pCreate
=
mnodeBuildVnodeMsg
(
pVgroup
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
ahandle
,
...
...
@@ -862,17 +863,17 @@ static void mnodeSendCreateVnodeMsg(SVgObj *pVgroup, SRpcIpSet *ipSet, void *aha
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_CREATE_VNODE
};
dnodeSendMsgToDnode
(
i
pSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
e
pSet
,
&
rpcMsg
);
}
void
mnodeSendCreateVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
)
{
mDebug
(
"vgId:%d, send create all vnodes msg, numOfVnodes:%d db:%s"
,
pVgroup
->
vgId
,
pVgroup
->
numOfVnodes
,
pVgroup
->
dbName
);
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mDebug
(
"vgId:%d, index:%d, send create vnode msg to dnode %s, ahandle:%p"
,
pVgroup
->
vgId
,
i
,
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
,
ahandle
);
mnodeSendCreateVnodeMsg
(
pVgroup
,
&
i
pSet
,
ahandle
);
mnodeSendCreateVnodeMsg
(
pVgroup
,
&
e
pSet
,
ahandle
);
}
}
...
...
@@ -925,7 +926,7 @@ static SMDDropVnodeMsg *mnodeBuildDropVnodeMsg(int32_t vgId) {
return
pDrop
;
}
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpc
IpSet
*
i
pSet
,
void
*
ahandle
)
{
void
mnodeSendDropVnodeMsg
(
int32_t
vgId
,
SRpc
EpSet
*
e
pSet
,
void
*
ahandle
)
{
SMDDropVnodeMsg
*
pDrop
=
mnodeBuildDropVnodeMsg
(
vgId
);
SRpcMsg
rpcMsg
=
{
.
ahandle
=
ahandle
,
...
...
@@ -934,16 +935,16 @@ void mnodeSendDropVnodeMsg(int32_t vgId, SRpcIpSet *ipSet, void *ahandle) {
.
code
=
0
,
.
msgType
=
TSDB_MSG_TYPE_MD_DROP_VNODE
};
dnodeSendMsgToDnode
(
i
pSet
,
&
rpcMsg
);
dnodeSendMsgToDnode
(
e
pSet
,
&
rpcMsg
);
}
static
void
mnodeSendDropVgroupMsg
(
SVgObj
*
pVgroup
,
void
*
ahandle
)
{
pVgroup
->
status
=
TAOS_VG_STATUS_DROPPING
;
// deleting
mDebug
(
"vgId:%d, send drop all vnodes msg, ahandle:%p"
,
pVgroup
->
vgId
,
ahandle
);
for
(
int32_t
i
=
0
;
i
<
pVgroup
->
numOfVnodes
;
++
i
)
{
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromIp
(
pVgroup
->
vnodeGid
[
i
].
pDnode
->
dnodeEp
);
mDebug
(
"vgId:%d, send drop vnode msg to dnode:%d, ahandle:%p"
,
pVgroup
->
vgId
,
pVgroup
->
vnodeGid
[
i
].
dnodeId
,
ahandle
);
mnodeSendDropVnodeMsg
(
pVgroup
->
vgId
,
&
i
pSet
,
ahandle
);
mnodeSendDropVnodeMsg
(
pVgroup
->
vgId
,
&
e
pSet
,
ahandle
);
}
}
...
...
@@ -997,8 +998,8 @@ static int32_t mnodeProcessVnodeCfgMsg(SMnodeMsg *pMsg) {
}
mDebug
(
"vgId:%d, send create vnode msg to dnode %s for vnode cfg msg"
,
pVgroup
->
vgId
,
pDnode
->
dnodeEp
);
SRpc
IpSet
ipSet
=
mnodeGetI
pSetFromIp
(
pDnode
->
dnodeEp
);
mnodeSendCreateVnodeMsg
(
pVgroup
,
&
i
pSet
,
NULL
);
SRpc
EpSet
epSet
=
mnodeGetE
pSetFromIp
(
pDnode
->
dnodeEp
);
mnodeSendCreateVnodeMsg
(
pVgroup
,
&
e
pSet
,
NULL
);
mnodeDecDnodeRef
(
pDnode
);
mnodeDecVgroupRef
(
pVgroup
);
...
...
src/mnode/src/mnodeWrite.c
浏览文件 @
599df650
...
...
@@ -49,16 +49,16 @@ int32_t mnodeProcessWrite(SMnodeMsg *pMsg) {
if
(
!
sdbIsMaster
())
{
SMnodeRsp
*
rpcRsp
=
&
pMsg
->
rpcRsp
;
SRpc
IpSet
*
ipSet
=
rpcMallocCont
(
sizeof
(
SRpcI
pSet
));
mnodeGetMnode
IpSetForShell
(
i
pSet
);
rpcRsp
->
rsp
=
i
pSet
;
rpcRsp
->
len
=
sizeof
(
SRpc
I
pSet
);
SRpc
EpSet
*
epSet
=
rpcMallocCont
(
sizeof
(
SRpcE
pSet
));
mnodeGetMnode
EpSetForShell
(
e
pSet
);
rpcRsp
->
rsp
=
e
pSet
;
rpcRsp
->
len
=
sizeof
(
SRpc
E
pSet
);
mDebug
(
"app:%p:%p, msg:%s will be redireced inUse:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
taosMsg
[
pMsg
->
rpcMsg
.
msgType
],
i
pSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
ipSet
->
numOfI
ps
;
++
i
)
{
mDebug
(
"app:%p:%p, mnode index:%d
ip:%s:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
i
,
i
pSet
->
fqdn
[
i
],
htons
(
i
pSet
->
port
[
i
]));
e
pSet
->
inUse
);
for
(
int32_t
i
=
0
;
i
<
epSet
->
numOfE
ps
;
++
i
)
{
mDebug
(
"app:%p:%p, mnode index:%d
ep:%s:%d"
,
pMsg
->
rpcMsg
.
ahandle
,
pMsg
,
i
,
e
pSet
->
fqdn
[
i
],
htons
(
e
pSet
->
port
[
i
]));
}
return
TSDB_CODE_RPC_REDIRECT
;
...
...
src/plugins/monitor/src/monitorMain.c
浏览文件 @
599df650
...
...
@@ -76,6 +76,8 @@ static void monitorInitDatabase();
static
void
monitorInitDatabaseCb
(
void
*
param
,
TAOS_RES
*
result
,
int32_t
code
);
static
void
monitorStartTimer
();
static
void
monitorSaveSystemInfo
();
extern
int32_t
(
*
monitorStartSystemFp
)();
extern
void
(
*
monitorStopSystemFp
)();
static
void
monitorCheckDiskUsage
(
void
*
para
,
void
*
unused
)
{
taosGetDisk
();
...
...
@@ -85,6 +87,8 @@ static void monitorCheckDiskUsage(void *para, void *unused) {
int32_t
monitorInitSystem
()
{
taos_init
();
taosTmrReset
(
monitorCheckDiskUsage
,
CHECK_INTERVAL
,
NULL
,
tscTmr
,
&
tsMonitorConn
.
diskTimer
);
monitorStartSystemFp
=
monitorStartSystem
;
monitorStopSystemFp
=
monitorStopSystem
;
return
0
;
}
...
...
src/query/inc/qExecutor.h
浏览文件 @
599df650
...
...
@@ -121,7 +121,6 @@ typedef struct SQueryCostInfo {
uint32_t
loadBlockStatis
;
uint32_t
discardBlocks
;
uint64_t
elapsedTime
;
uint64_t
ioTime
;
uint64_t
computTime
;
}
SQueryCostInfo
;
...
...
@@ -201,7 +200,7 @@ typedef struct SQInfo {
*/
int32_t
tableIndex
;
int32_t
numOfGroupResultPages
;
void
*
pBuf
;
// allocated buffer for STableQueryInfo, sizeof(STableQueryInfo)*numOfTables;
void
*
pBuf
;
// allocated buffer for STableQueryInfo, sizeof(STableQueryInfo)*numOfTables;
}
SQInfo
;
...
...
src/query/inc/qUtil.h
浏览文件 @
599df650
...
...
@@ -23,7 +23,7 @@ void copyTimeWindowResBuf(SQueryRuntimeEnv* pRuntimeEnv, SWindowResult* dst, con
int32_t
initWindowResInfo
(
SWindowResInfo
*
pWindowResInfo
,
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
size
,
int32_t
threshold
,
int16_t
type
);
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
numOfCols
);
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
);
void
resetTimeWindowInfo
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
SWindowResInfo
*
pWindowResInfo
);
void
clearFirstNTimeWindow
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
num
);
...
...
@@ -32,14 +32,29 @@ int32_t numOfClosedTimeWindow(SWindowResInfo* pWindowResInfo);
void
closeTimeWindow
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
);
void
closeAllTimeWindow
(
SWindowResInfo
*
pWindowResInfo
);
void
removeRedundantWindow
(
SWindowResInfo
*
pWindowResInfo
,
TSKEY
lastKey
,
int32_t
order
);
SWindowResult
*
getWindowResult
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
);
static
FORCE_INLINE
SWindowResult
*
getWindowResult
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
)
{
assert
(
pWindowResInfo
!=
NULL
&&
slot
>=
0
&&
slot
<
pWindowResInfo
->
size
);
return
&
pWindowResInfo
->
pResult
[
slot
];
}
#define curTimeWindow(_winres) ((_winres)->curIndex)
#define GET_ROW_PARAM_FOR_MULTIOUTPUT(_q, tbq, sq) (((tbq) && (!sq))? (_q)->pSelectExpr[1].base.arg->argValue.i64:1)
bool
isWindowResClosed
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
);
int32_t
createQueryResultInfo
(
SQuery
*
pQuery
,
SWindowResult
*
pResultRow
,
bool
isSTableQuery
,
SPosInfo
*
posInfo
,
size_t
interBufSize
);
int32_t
createQueryResultInfo
(
SQuery
*
pQuery
,
SWindowResult
*
pResultRow
,
bool
isSTableQuery
,
size_t
interBufSize
);
static
FORCE_INLINE
char
*
getPosInResultPage
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
columnIndex
,
SWindowResult
*
pResult
)
{
assert
(
pResult
!=
NULL
&&
pRuntimeEnv
!=
NULL
);
SQuery
*
pQuery
=
pRuntimeEnv
->
pQuery
;
tFilePage
*
page
=
GET_RES_BUF_PAGE_BY_ID
(
pRuntimeEnv
->
pResultBuf
,
pResult
->
pos
.
pageId
);
int32_t
realRowId
=
pResult
->
pos
.
rowId
*
GET_ROW_PARAM_FOR_MULTIOUTPUT
(
pQuery
,
pRuntimeEnv
->
topBotQuery
,
pRuntimeEnv
->
stableQuery
);
char
*
getPosInResultPage
(
SQueryRuntimeEnv
*
pRuntimeEnv
,
int32_t
columnIndex
,
SWindowResult
*
pResult
);
return
((
char
*
)
page
->
data
)
+
pRuntimeEnv
->
offset
[
columnIndex
]
*
pRuntimeEnv
->
numOfRowsPerPage
+
pQuery
->
pSelectExpr
[
columnIndex
].
bytes
*
realRowId
;
}
__filter_func_t
*
getRangeFilterFuncArray
(
int32_t
type
);
__filter_func_t
*
getValueFilterFuncArray
(
int32_t
type
);
...
...
src/query/inc/qresultBuf.h
浏览文件 @
599df650
...
...
@@ -22,26 +22,22 @@ extern "C" {
#include "os.h"
#include "qextbuffer.h"
#include "hash.h"
typedef
struct
SIDList
{
uint32_t
alloc
;
int32_t
size
;
int32_t
*
pData
;
}
SIDList
;
typedef
struct
SArray
*
SIDList
;
typedef
struct
SDiskbasedResultBuf
{
int32_t
numOfRowsPerPage
;
int32_t
numOfPages
;
int64_t
totalBufSize
;
int32_t
fd
;
// data file fd
int32_t
allocateId
;
// allocated page id
int32_t
incStep
;
// minimum allocated pages
char
*
pBuf
;
// mmap buffer pointer
char
*
path
;
// file path
int32_t
numOfRowsPerPage
;
int32_t
numOfPages
;
int64_t
totalBufSize
;
int32_t
fd
;
// data file fd
int32_t
allocateId
;
// allocated page id
int32_t
incStep
;
// minimum allocated pages
char
*
pBuf
;
// mmap buffer pointer
char
*
path
;
// file path
uint32_t
numOfAllocGroupIds
;
// number of allocated id list
void
*
idsTable
;
// id hash table
SIDList
*
list
;
// for each id, there is a page id list
SHashObj
*
idsTable
;
// id hash table
SIDList
list
;
// for each id, there is a page id list
}
SDiskbasedResultBuf
;
#define DEFAULT_INTERN_BUF_PAGE_SIZE (8192L*5)
...
...
@@ -112,7 +108,7 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf, void* handle);
* @param pList
* @return
*/
int32_t
getLastPageId
(
SIDList
*
pList
);
int32_t
getLastPageId
(
SIDList
pList
);
#ifdef __cplusplus
}
...
...
src/query/inc/tsqlfunction.h
浏览文件 @
599df650
...
...
@@ -132,13 +132,10 @@ typedef struct SQLPreAggVal {
typedef
struct
SInterpInfoDetail
{
TSKEY
ts
;
// interp specified timestamp
int8_t
hasResult
;
int8_t
type
;
int8_t
primaryCol
;
}
SInterpInfoDetail
;
typedef
struct
SInterpInfo
{
SInterpInfoDetail
*
pInterpDetail
;
}
SInterpInfo
;
typedef
struct
SResultInfo
{
int8_t
hasResult
;
// result generated, not NULL value
bool
initialized
;
// output buffer has been initialized
...
...
@@ -146,7 +143,7 @@ typedef struct SResultInfo {
bool
superTableQ
;
// is super table query
int32_t
numOfRes
;
// num of output result in current buffer
int32_t
bufLen
;
// buffer size
void
*
interResultBuf
;
// output result buffer
void
*
interResultBuf
;
// output result buffer
}
SResultInfo
;
struct
SQLFunctionCtx
;
...
...
src/query/src/qExecutor.c
浏览文件 @
599df650
此差异已折叠。
点击以展开。
src/query/src/qUtil.c
浏览文件 @
599df650
...
...
@@ -53,9 +53,9 @@ int32_t initWindowResInfo(SWindowResInfo *pWindowResInfo, SQueryRuntimeEnv *pRun
if
(
pWindowResInfo
->
pResult
==
NULL
)
{
return
TSDB_CODE_QRY_OUT_OF_MEMORY
;
}
for
(
int32_t
i
=
0
;
i
<
pWindowResInfo
->
capacity
;
++
i
)
{
SPosInfo
posInfo
=
{
-
1
,
-
1
};
int32_t
code
=
createQueryResultInfo
(
pRuntimeEnv
->
pQuery
,
&
pWindowResInfo
->
pResult
[
i
],
pRuntimeEnv
->
stableQuery
,
&
posInfo
,
pRuntimeEnv
->
interBufSize
);
int32_t
code
=
createQueryResultInfo
(
pRuntimeEnv
->
pQuery
,
&
pWindowResInfo
->
pResult
[
i
],
pRuntimeEnv
->
stableQuery
,
pRuntimeEnv
->
interBufSize
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -64,16 +64,15 @@ int32_t initWindowResInfo(SWindowResInfo *pWindowResInfo, SQueryRuntimeEnv *pRun
return
TSDB_CODE_SUCCESS
;
}
void
destroyTimeWindowRes
(
SWindowResult
*
pWindowRes
,
int32_t
nOutputCols
)
{
void
destroyTimeWindowRes
(
SWindowResult
*
pWindowRes
)
{
if
(
pWindowRes
==
NULL
)
{
return
;
}
free
(
pWindowRes
->
resultInfo
[
0
].
interResultBuf
);
free
(
pWindowRes
->
resultInfo
);
}
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
numOfCols
)
{
void
cleanupTimeWindowInfo
(
SWindowResInfo
*
pWindowResInfo
)
{
if
(
pWindowResInfo
==
NULL
)
{
return
;
}
...
...
@@ -84,8 +83,7 @@ void cleanupTimeWindowInfo(SWindowResInfo *pWindowResInfo, int32_t numOfCols) {
if
(
pWindowResInfo
->
pResult
!=
NULL
)
{
for
(
int32_t
i
=
0
;
i
<
pWindowResInfo
->
capacity
;
++
i
)
{
SWindowResult
*
pResult
=
&
pWindowResInfo
->
pResult
[
i
];
destroyTimeWindowRes
(
pResult
,
numOfCols
);
destroyTimeWindowRes
(
&
pWindowResInfo
->
pResult
[
i
]);
}
}
...
...
@@ -225,11 +223,6 @@ void removeRedundantWindow(SWindowResInfo *pWindowResInfo, TSKEY lastKey, int32_
}
}
SWindowResult
*
getWindowResult
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
)
{
assert
(
pWindowResInfo
!=
NULL
&&
slot
>=
0
&&
slot
<
pWindowResInfo
->
size
);
return
&
pWindowResInfo
->
pResult
[
slot
];
}
bool
isWindowResClosed
(
SWindowResInfo
*
pWindowResInfo
,
int32_t
slot
)
{
return
(
getWindowResult
(
pWindowResInfo
,
slot
)
->
status
.
closed
==
true
);
}
...
...
src/query/src/qast.c
浏览文件 @
599df650
...
...
@@ -1064,10 +1064,9 @@ tExprNode* exprTreeFromTableName(const char* tbnameCond) {
if
(
*
e
==
TS_PATH_DELIMITER
[
0
])
{
cond
=
e
+
1
;
}
else
if
(
*
e
==
','
)
{
size_t
len
=
e
-
cond
+
VARSTR_HEADER_SIZE
;
char
*
p
=
exception_malloc
(
len
);
varDataSetLen
(
p
,
len
-
VARSTR_HEADER_SIZE
);
memcpy
(
varDataVal
(
p
),
cond
,
len
);
size_t
len
=
e
-
cond
;
char
*
p
=
exception_malloc
(
len
+
VARSTR_HEADER_SIZE
);
STR_WITH_SIZE_TO_VARSTR
(
p
,
cond
,
len
);
cond
+=
len
;
taosArrayPush
(
pVal
->
arr
,
&
p
);
}
...
...
src/query/src/qresultBuf.c
浏览文件 @
599df650
...
...
@@ -2,7 +2,6 @@
#include "hash.h"
#include "qextbuffer.h"
#include "taoserror.h"
#include "tsqlfunction.h"
#include "queryLog.h"
int32_t
createDiskbasedResultBuffer
(
SDiskbasedResultBuf
**
pResultBuf
,
int32_t
size
,
int32_t
rowSize
,
void
*
handle
)
{
...
...
@@ -20,35 +19,31 @@ int32_t createDiskbasedResultBuffer(SDiskbasedResultBuf** pResultBuf, int32_t si
// init id hash table
pResBuf
->
idsTable
=
taosHashInit
(
size
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_INT
),
false
);
pResBuf
->
list
=
calloc
(
size
,
sizeof
(
SIDList
));
pResBuf
->
numOfAllocGroupIds
=
size
;
pResBuf
->
list
=
taosArrayInit
(
size
,
POINTER_BYTES
);
char
path
[
4096
]
=
{
0
};
getTmpfilePath
(
"tsdb_q
_
buf"
,
path
);
getTmpfilePath
(
"tsdb_qbuf"
,
path
);
pResBuf
->
path
=
strdup
(
path
);
pResBuf
->
fd
=
open
(
pResBuf
->
path
,
O_CREAT
|
O_RDWR
,
0666
);
memset
(
path
,
0
,
tListLen
(
path
));
if
(
!
FD_VALID
(
pResBuf
->
fd
))
{
qError
(
"failed to create tmp file: %s on disk. %s"
,
pResBuf
->
path
,
strerror
(
errno
));
return
T
SDB_CODE_QRY_NO_DISKSPACE
;
return
T
AOS_SYSTEM_ERROR
(
errno
)
;
}
int32_t
ret
=
ftruncate
(
pResBuf
->
fd
,
pResBuf
->
numOfPages
*
DEFAULT_INTERN_BUF_PAGE_SIZE
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
qError
(
"failed to create tmp file: %s on disk. %s"
,
pResBuf
->
path
,
strerror
(
errno
));
return
T
SDB_CODE_QRY_NO_DISKSPACE
;
return
T
AOS_SYSTEM_ERROR
(
errno
)
;
}
pResBuf
->
pBuf
=
mmap
(
NULL
,
pResBuf
->
totalBufSize
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
pResBuf
->
fd
,
0
);
if
(
pResBuf
->
pBuf
==
MAP_FAILED
)
{
qError
(
"QInfo:%p failed to map temp file: %s. %s"
,
handle
,
pResBuf
->
path
,
strerror
(
errno
));
return
T
SDB_CODE_QRY_OUT_OF_MEMORY
;
// todo change error code
return
T
AOS_SYSTEM_ERROR
(
errno
);
}
qDebug
(
"QInfo:%p create tmp file for output result
,
%s, %"
PRId64
"bytes"
,
handle
,
pResBuf
->
path
,
qDebug
(
"QInfo:%p create tmp file for output result
:
%s, %"
PRId64
"bytes"
,
handle
,
pResBuf
->
path
,
pResBuf
->
totalBufSize
);
return
TSDB_CODE_SUCCESS
;
...
...
@@ -86,11 +81,11 @@ static int32_t extendDiskFileSize(SDiskbasedResultBuf* pResultBuf, int32_t numOf
return
TSDB_CODE_SUCCESS
;
}
static
bool
noMoreAvailablePages
(
SDiskbasedResultBuf
*
pResultBuf
)
{
static
FORCE_INLINE
bool
noMoreAvailablePages
(
SDiskbasedResultBuf
*
pResultBuf
)
{
return
(
pResultBuf
->
allocateId
==
pResultBuf
->
numOfPages
-
1
);
}
static
int32_t
getGroupIndex
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
)
{
static
FORCE_INLINE
int32_t
getGroupIndex
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
)
{
assert
(
pResultBuf
!=
NULL
);
char
*
p
=
taosHashGet
(
pResultBuf
->
idsTable
,
(
const
char
*
)
&
groupId
,
sizeof
(
int32_t
));
...
...
@@ -99,51 +94,20 @@ static int32_t getGroupIndex(SDiskbasedResultBuf* pResultBuf, int32_t groupId) {
}
int32_t
slot
=
GET_INT32_VAL
(
p
);
assert
(
slot
>=
0
&&
slot
<
pResultBuf
->
numOfAllocGroupIds
);
assert
(
slot
>=
0
&&
slot
<
taosHashGetSize
(
pResultBuf
->
idsTable
)
);
return
slot
;
}
static
int32_t
addNewGroupId
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
)
{
int32_t
num
=
getNumOfResultBufGroupId
(
pResultBuf
);
// the num is the newest allocated group id slot
if
(
pResultBuf
->
numOfAllocGroupIds
<=
num
)
{
size_t
n
=
pResultBuf
->
numOfAllocGroupIds
<<
1u
;
SIDList
*
p
=
(
SIDList
*
)
realloc
(
pResultBuf
->
list
,
sizeof
(
SIDList
)
*
n
);
assert
(
p
!=
NULL
);
memset
(
&
p
[
pResultBuf
->
numOfAllocGroupIds
],
0
,
sizeof
(
SIDList
)
*
pResultBuf
->
numOfAllocGroupIds
);
pResultBuf
->
list
=
p
;
pResultBuf
->
numOfAllocGroupIds
=
n
;
}
taosHashPut
(
pResultBuf
->
idsTable
,
(
const
char
*
)
&
groupId
,
sizeof
(
int32_t
),
&
num
,
sizeof
(
int32_t
));
return
num
;
}
static
int32_t
doRegisterId
(
SIDList
*
pList
,
int32_t
id
)
{
if
(
pList
->
size
>=
pList
->
alloc
)
{
int32_t
s
=
0
;
if
(
pList
->
alloc
==
0
)
{
s
=
4
;
assert
(
pList
->
pData
==
NULL
);
}
else
{
s
=
pList
->
alloc
<<
1u
;
}
int32_t
*
c
=
realloc
(
pList
->
pData
,
s
*
sizeof
(
int32_t
));
assert
(
c
);
memset
(
&
c
[
pList
->
alloc
],
0
,
sizeof
(
int32_t
)
*
pList
->
alloc
);
pList
->
pData
=
c
;
pList
->
alloc
=
s
;
}
SArray
*
pa
=
taosArrayInit
(
1
,
sizeof
(
int32_t
));
taosArrayPush
(
pResultBuf
->
list
,
&
pa
);
pList
->
pData
[
pList
->
size
++
]
=
id
;
return
0
;
assert
(
taosArrayGetSize
(
pResultBuf
->
list
)
==
taosHashGetSize
(
pResultBuf
->
idsTable
))
;
return
num
;
}
static
void
registerPageId
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
,
int32_t
pageId
)
{
...
...
@@ -152,8 +116,8 @@ static void registerPageId(SDiskbasedResultBuf* pResultBuf, int32_t groupId, int
slot
=
addNewGroupId
(
pResultBuf
,
groupId
);
}
SIDList
*
pList
=
&
pResultBuf
->
list
[
slot
]
;
doRegisterId
(
pList
,
pageId
);
SIDList
pList
=
taosArrayGetP
(
pResultBuf
->
list
,
slot
)
;
taosArrayPush
(
pList
,
&
pageId
);
}
tFilePage
*
getNewDataBuf
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
,
int32_t
*
pageId
)
{
...
...
@@ -178,12 +142,11 @@ tFilePage* getNewDataBuf(SDiskbasedResultBuf* pResultBuf, int32_t groupId, int32
int32_t
getNumOfRowsPerPage
(
SDiskbasedResultBuf
*
pResultBuf
)
{
return
pResultBuf
->
numOfRowsPerPage
;
}
SIDList
getDataBufPagesIdList
(
SDiskbasedResultBuf
*
pResultBuf
,
int32_t
groupId
)
{
SIDList
list
=
{
0
};
int32_t
slot
=
getGroupIndex
(
pResultBuf
,
groupId
);
if
(
slot
<
0
)
{
return
list
;
return
taosArrayInit
(
1
,
sizeof
(
int32_t
))
;
}
else
{
return
pResultBuf
->
list
[
slot
]
;
return
taosArrayGetP
(
pResultBuf
->
list
,
slot
)
;
}
}
...
...
@@ -202,22 +165,20 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf, void* handle) {
tfree
(
pResultBuf
->
path
);
for
(
int32_t
i
=
0
;
i
<
pResultBuf
->
numOfAllocGroupIds
;
++
i
)
{
SIDList
*
pList
=
&
pResultBuf
->
list
[
i
];
tfree
(
pList
->
pData
);
size_t
size
=
taosArrayGetSize
(
pResultBuf
->
list
);
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
SArray
*
pa
=
taosArrayGetP
(
pResultBuf
->
list
,
i
);
taosArrayDestroy
(
pa
);
}
t
free
(
pResultBuf
->
list
);
t
aosArrayDestroy
(
pResultBuf
->
list
);
taosHashCleanup
(
pResultBuf
->
idsTable
);
tfree
(
pResultBuf
);
}
int32_t
getLastPageId
(
SIDList
*
pList
)
{
if
(
pList
==
NULL
||
pList
->
size
<=
0
)
{
return
-
1
;
}
return
pList
->
pData
[
pList
->
size
-
1
];
int32_t
getLastPageId
(
SIDList
pList
)
{
size_t
size
=
taosArrayGetSize
(
pList
);
return
*
(
int32_t
*
)
taosArrayGet
(
pList
,
size
-
1
);
}
src/rpc/src/rpcMain.c
浏览文件 @
599df650
...
...
@@ -55,7 +55,7 @@ typedef struct {
char
secret
[
TSDB_KEY_LEN
];
// secret for the link
char
ckey
[
TSDB_KEY_LEN
];
// ciphering key
void
(
*
cfp
)(
SRpcMsg
*
,
SRpc
I
pSet
*
);
void
(
*
cfp
)(
SRpcMsg
*
,
SRpc
E
pSet
*
);
int
(
*
afp
)(
char
*
user
,
char
*
spi
,
char
*
encrypt
,
char
*
secret
,
char
*
ckey
);
int32_t
refCount
;
...
...
@@ -71,7 +71,7 @@ typedef struct {
typedef
struct
{
SRpcInfo
*
pRpc
;
// associated SRpcInfo
SRpc
IpSet
i
pSet
;
// ip list provided by app
SRpc
EpSet
e
pSet
;
// ip list provided by app
void
*
ahandle
;
// handle provided by app
void
*
signature
;
// for validation
struct
SRpcConn
*
pConn
;
// pConn allocated
...
...
@@ -80,12 +80,12 @@ typedef struct {
int32_t
contLen
;
// content length
int32_t
code
;
// error code
int16_t
numOfTry
;
// number of try for different servers
int8_t
oldInUse
;
// server
I
P inUse passed by app
int8_t
oldInUse
;
// server
E
P inUse passed by app
int8_t
redirect
;
// flag to indicate redirect
int8_t
connType
;
// connection type
SRpcMsg
*
pRsp
;
// for synchronous API
tsem_t
*
pSem
;
// for synchronous API
SRpc
I
pSet
*
pSet
;
// for synchronous API
SRpc
E
pSet
*
pSet
;
// for synchronous API
char
msg
[
0
];
// RpcHead starts from here
}
SRpcReqContext
;
...
...
@@ -355,7 +355,7 @@ void *rpcReallocCont(void *ptr, int contLen) {
return
start
+
sizeof
(
SRpcReqContext
)
+
sizeof
(
SRpcHead
);
}
void
rpcSendRequest
(
void
*
shandle
,
const
SRpc
IpSet
*
pI
pSet
,
SRpcMsg
*
pMsg
)
{
void
rpcSendRequest
(
void
*
shandle
,
const
SRpc
EpSet
*
pE
pSet
,
SRpcMsg
*
pMsg
)
{
SRpcInfo
*
pRpc
=
(
SRpcInfo
*
)
shandle
;
SRpcReqContext
*
pContext
;
...
...
@@ -364,11 +364,11 @@ void rpcSendRequest(void *shandle, const SRpcIpSet *pIpSet, SRpcMsg *pMsg) {
pContext
->
ahandle
=
pMsg
->
ahandle
;
pContext
->
signature
=
pContext
;
pContext
->
pRpc
=
(
SRpcInfo
*
)
shandle
;
pContext
->
ipSet
=
*
pI
pSet
;
pContext
->
epSet
=
*
pE
pSet
;
pContext
->
contLen
=
contLen
;
pContext
->
pCont
=
pMsg
->
pCont
;
pContext
->
msgType
=
pMsg
->
msgType
;
pContext
->
oldInUse
=
p
I
pSet
->
inUse
;
pContext
->
oldInUse
=
p
E
pSet
->
inUse
;
pContext
->
connType
=
RPC_CONN_UDPC
;
if
(
contLen
>
tsRpcMaxUdpSize
)
pContext
->
connType
=
RPC_CONN_TCPC
;
...
...
@@ -458,15 +458,15 @@ void rpcSendResponse(const SRpcMsg *pRsp) {
return
;
}
void
rpcSendRedirectRsp
(
void
*
thandle
,
const
SRpc
IpSet
*
pI
pSet
)
{
void
rpcSendRedirectRsp
(
void
*
thandle
,
const
SRpc
EpSet
*
pE
pSet
)
{
SRpcMsg
rpcMsg
;
memset
(
&
rpcMsg
,
0
,
sizeof
(
rpcMsg
));
rpcMsg
.
contLen
=
sizeof
(
SRpc
I
pSet
);
rpcMsg
.
contLen
=
sizeof
(
SRpc
E
pSet
);
rpcMsg
.
pCont
=
rpcMallocCont
(
rpcMsg
.
contLen
);
if
(
rpcMsg
.
pCont
==
NULL
)
return
;
memcpy
(
rpcMsg
.
pCont
,
p
IpSet
,
sizeof
(
SRpcI
pSet
));
memcpy
(
rpcMsg
.
pCont
,
p
EpSet
,
sizeof
(
SRpcE
pSet
));
rpcMsg
.
code
=
TSDB_CODE_RPC_REDIRECT
;
rpcMsg
.
handle
=
thandle
;
...
...
@@ -488,7 +488,7 @@ int rpcGetConnInfo(void *thandle, SRpcConnInfo *pInfo) {
return
0
;
}
void
rpcSendRecv
(
void
*
shandle
,
SRpc
IpSet
*
pI
pSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
void
rpcSendRecv
(
void
*
shandle
,
SRpc
EpSet
*
pE
pSet
,
SRpcMsg
*
pMsg
,
SRpcMsg
*
pRsp
)
{
SRpcReqContext
*
pContext
;
pContext
=
(
SRpcReqContext
*
)
(
pMsg
->
pCont
-
sizeof
(
SRpcHead
)
-
sizeof
(
SRpcReqContext
));
...
...
@@ -498,9 +498,9 @@ void rpcSendRecv(void *shandle, SRpcIpSet *pIpSet, SRpcMsg *pMsg, SRpcMsg *pRsp)
tsem_init
(
&
sem
,
0
,
0
);
pContext
->
pSem
=
&
sem
;
pContext
->
pRsp
=
pRsp
;
pContext
->
pSet
=
p
I
pSet
;
pContext
->
pSet
=
p
E
pSet
;
rpcSendRequest
(
shandle
,
p
I
pSet
,
pMsg
);
rpcSendRequest
(
shandle
,
p
E
pSet
,
pMsg
);
tsem_wait
(
&
sem
);
tsem_destroy
(
&
sem
);
...
...
@@ -755,11 +755,11 @@ static SRpcConn *rpcGetConnObj(SRpcInfo *pRpc, int sid, SRecvInfo *pRecv) {
static
SRpcConn
*
rpcSetupConnToServer
(
SRpcReqContext
*
pContext
)
{
SRpcConn
*
pConn
;
SRpcInfo
*
pRpc
=
pContext
->
pRpc
;
SRpc
IpSet
*
pIpSet
=
&
pContext
->
i
pSet
;
SRpc
EpSet
*
pEpSet
=
&
pContext
->
e
pSet
;
pConn
=
rpcGetConnFromCache
(
pRpc
->
pCache
,
p
IpSet
->
fqdn
[
pIpSet
->
inUse
],
pIpSet
->
port
[
pI
pSet
->
inUse
],
pContext
->
connType
);
pConn
=
rpcGetConnFromCache
(
pRpc
->
pCache
,
p
EpSet
->
fqdn
[
pEpSet
->
inUse
],
pEpSet
->
port
[
pE
pSet
->
inUse
],
pContext
->
connType
);
if
(
pConn
==
NULL
||
pConn
->
user
[
0
]
==
0
)
{
pConn
=
rpcOpenConn
(
pRpc
,
p
IpSet
->
fqdn
[
pIpSet
->
inUse
],
pIpSet
->
port
[
pI
pSet
->
inUse
],
pContext
->
connType
);
pConn
=
rpcOpenConn
(
pRpc
,
p
EpSet
->
fqdn
[
pEpSet
->
inUse
],
pEpSet
->
port
[
pE
pSet
->
inUse
],
pContext
->
connType
);
}
if
(
pConn
)
{
...
...
@@ -1020,16 +1020,16 @@ static void rpcNotifyClient(SRpcReqContext *pContext, SRpcMsg *pMsg) {
pContext
->
pConn
=
NULL
;
if
(
pContext
->
pRsp
)
{
// for synchronous API
memcpy
(
pContext
->
pSet
,
&
pContext
->
ipSet
,
sizeof
(
SRpcI
pSet
));
memcpy
(
pContext
->
pSet
,
&
pContext
->
epSet
,
sizeof
(
SRpcE
pSet
));
memcpy
(
pContext
->
pRsp
,
pMsg
,
sizeof
(
SRpcMsg
));
tsem_post
(
pContext
->
pSem
);
}
else
{
// for asynchronous API
SRpc
IpSet
*
pI
pSet
=
NULL
;
if
(
pContext
->
i
pSet
.
inUse
!=
pContext
->
oldInUse
||
pContext
->
redirect
)
p
IpSet
=
&
pContext
->
i
pSet
;
SRpc
EpSet
*
pE
pSet
=
NULL
;
if
(
pContext
->
e
pSet
.
inUse
!=
pContext
->
oldInUse
||
pContext
->
redirect
)
p
EpSet
=
&
pContext
->
e
pSet
;
(
*
pRpc
->
cfp
)(
pMsg
,
p
I
pSet
);
(
*
pRpc
->
cfp
)(
pMsg
,
p
E
pSet
);
}
// free the request message
...
...
@@ -1070,9 +1070,9 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
pConn
->
pContext
=
NULL
;
pConn
->
pReqMsg
=
NULL
;
// for UDP, port may be changed by server, the port in
i
pSet shall be used for cache
// for UDP, port may be changed by server, the port in
e
pSet shall be used for cache
if
(
pHead
->
code
!=
TSDB_CODE_RPC_TOO_SLOW
)
{
rpcAddConnIntoCache
(
pRpc
->
pCache
,
pConn
,
pConn
->
peerFqdn
,
pContext
->
ipSet
.
port
[
pContext
->
i
pSet
.
inUse
],
pConn
->
connType
);
rpcAddConnIntoCache
(
pRpc
->
pCache
,
pConn
,
pConn
->
peerFqdn
,
pContext
->
epSet
.
port
[
pContext
->
e
pSet
.
inUse
],
pConn
->
connType
);
}
else
{
rpcCloseConn
(
pConn
);
}
...
...
@@ -1087,10 +1087,10 @@ static void rpcProcessIncomingMsg(SRpcConn *pConn, SRpcHead *pHead) {
if
(
pHead
->
code
==
TSDB_CODE_RPC_REDIRECT
)
{
pContext
->
numOfTry
=
0
;
memcpy
(
&
pContext
->
ipSet
,
pHead
->
content
,
sizeof
(
pContext
->
i
pSet
));
tDebug
(
"%s, redirect is received, numOf
Ips:%d"
,
pConn
->
info
,
pContext
->
ipSet
.
numOfI
ps
);
for
(
int
i
=
0
;
i
<
pContext
->
ipSet
.
numOfI
ps
;
++
i
)
pContext
->
ipSet
.
port
[
i
]
=
htons
(
pContext
->
i
pSet
.
port
[
i
]);
memcpy
(
&
pContext
->
epSet
,
pHead
->
content
,
sizeof
(
pContext
->
e
pSet
));
tDebug
(
"%s, redirect is received, numOf
Eps:%d"
,
pConn
->
info
,
pContext
->
epSet
.
numOfE
ps
);
for
(
int
i
=
0
;
i
<
pContext
->
epSet
.
numOfE
ps
;
++
i
)
pContext
->
epSet
.
port
[
i
]
=
htons
(
pContext
->
e
pSet
.
port
[
i
]);
rpcSendReqToServer
(
pRpc
,
pContext
);
rpcFreeCont
(
rpcMsg
.
pCont
);
}
else
if
(
pHead
->
code
==
TSDB_CODE_RPC_NOT_READY
)
{
...
...
@@ -1269,7 +1269,7 @@ static void rpcProcessConnError(void *param, void *id) {
tDebug
(
"%s %p, connection error happens"
,
pRpc
->
label
,
pContext
->
ahandle
);
if
(
pContext
->
numOfTry
>=
pContext
->
ipSet
.
numOfI
ps
)
{
if
(
pContext
->
numOfTry
>=
pContext
->
epSet
.
numOfE
ps
)
{
rpcMsg
.
msgType
=
pContext
->
msgType
+
1
;
rpcMsg
.
ahandle
=
pContext
->
ahandle
;
rpcMsg
.
code
=
pContext
->
code
;
...
...
@@ -1279,8 +1279,8 @@ static void rpcProcessConnError(void *param, void *id) {
rpcNotifyClient
(
pContext
,
&
rpcMsg
);
}
else
{
// move to next IP
pContext
->
i
pSet
.
inUse
++
;
pContext
->
ipSet
.
inUse
=
pContext
->
ipSet
.
inUse
%
pContext
->
ipSet
.
numOfI
ps
;
pContext
->
e
pSet
.
inUse
++
;
pContext
->
epSet
.
inUse
=
pContext
->
epSet
.
inUse
%
pContext
->
epSet
.
numOfE
ps
;
rpcSendReqToServer
(
pRpc
,
pContext
);
}
}
...
...
src/rpc/src/rpcTcp.c
浏览文件 @
599df650
...
...
@@ -374,7 +374,7 @@ int taosSendTcpData(uint32_t ip, uint16_t port, void *data, int len, void *chand
if
(
chandle
==
NULL
)
return
-
1
;
return
(
int
)
send
(
pFdObj
->
fd
,
data
,
(
size_t
)
len
,
0
);
return
taosWriteMsg
(
pFdObj
->
fd
,
data
,
len
);
}
static
void
taosReportBrokenLink
(
SFdObj
*
pFdObj
)
{
...
...
src/rpc/test/rclient.c
浏览文件 @
599df650
...
...
@@ -22,7 +22,7 @@
typedef
struct
{
int
index
;
SRpc
IpSet
i
pSet
;
SRpc
EpSet
e
pSet
;
int
num
;
int
numOfReqs
;
int
msgSize
;
...
...
@@ -32,11 +32,11 @@ typedef struct {
void
*
pRpc
;
}
SInfo
;
static
void
processResponse
(
SRpcMsg
*
pMsg
,
SRpc
IpSet
*
pI
pSet
)
{
static
void
processResponse
(
SRpcMsg
*
pMsg
,
SRpc
EpSet
*
pE
pSet
)
{
SInfo
*
pInfo
=
(
SInfo
*
)
pMsg
->
ahandle
;
tDebug
(
"thread:%d, response is received, type:%d contLen:%d code:0x%x"
,
pInfo
->
index
,
pMsg
->
msgType
,
pMsg
->
contLen
,
pMsg
->
code
);
if
(
p
IpSet
)
pInfo
->
ipSet
=
*
pI
pSet
;
if
(
p
EpSet
)
pInfo
->
epSet
=
*
pE
pSet
;
rpcFreeCont
(
pMsg
->
pCont
);
sem_post
(
&
pInfo
->
rspSem
);
...
...
@@ -57,7 +57,7 @@ static void *sendRequest(void *param) {
rpcMsg
.
ahandle
=
pInfo
;
rpcMsg
.
msgType
=
1
;
tDebug
(
"thread:%d, send request, contLen:%d num:%d"
,
pInfo
->
index
,
pInfo
->
msgSize
,
pInfo
->
num
);
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
i
pSet
,
&
rpcMsg
);
rpcSendRequest
(
pInfo
->
pRpc
,
&
pInfo
->
e
pSet
,
&
rpcMsg
);
if
(
pInfo
->
num
%
20000
==
0
)
tInfo
(
"thread:%d, %d requests have been sent"
,
pInfo
->
index
,
pInfo
->
num
);
sem_wait
(
&
pInfo
->
rspSem
);
...
...
@@ -71,7 +71,7 @@ static void *sendRequest(void *param) {
int
main
(
int
argc
,
char
*
argv
[])
{
SRpcInit
rpcInit
;
SRpc
IpSet
i
pSet
;
SRpc
EpSet
e
pSet
;
int
msgSize
=
128
;
int
numOfReqs
=
0
;
int
appThreads
=
1
;
...
...
@@ -82,12 +82,12 @@ int main(int argc, char *argv[]) {
pthread_attr_t
thattr
;
// server info
ipSet
.
numOfI
ps
=
1
;
i
pSet
.
inUse
=
0
;
i
pSet
.
port
[
0
]
=
7000
;
i
pSet
.
port
[
1
]
=
7000
;
strcpy
(
i
pSet
.
fqdn
[
0
],
serverIp
);
strcpy
(
i
pSet
.
fqdn
[
1
],
"192.168.0.1"
);
epSet
.
numOfE
ps
=
1
;
e
pSet
.
inUse
=
0
;
e
pSet
.
port
[
0
]
=
7000
;
e
pSet
.
port
[
1
]
=
7000
;
strcpy
(
e
pSet
.
fqdn
[
0
],
serverIp
);
strcpy
(
e
pSet
.
fqdn
[
1
],
"192.168.0.1"
);
// client info
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
...
...
@@ -105,9 +105,9 @@ int main(int argc, char *argv[]) {
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
strcmp
(
argv
[
i
],
"-p"
)
==
0
&&
i
<
argc
-
1
)
{
i
pSet
.
port
[
0
]
=
atoi
(
argv
[
++
i
]);
e
pSet
.
port
[
0
]
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-i"
)
==
0
&&
i
<
argc
-
1
)
{
tstrncpy
(
ipSet
.
fqdn
[
0
],
argv
[
++
i
],
sizeof
(
i
pSet
.
fqdn
[
0
]));
tstrncpy
(
epSet
.
fqdn
[
0
],
argv
[
++
i
],
sizeof
(
e
pSet
.
fqdn
[
0
]));
}
else
if
(
strcmp
(
argv
[
i
],
"-t"
)
==
0
&&
i
<
argc
-
1
)
{
rpcInit
.
numOfThreads
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-m"
)
==
0
&&
i
<
argc
-
1
)
{
...
...
@@ -131,7 +131,7 @@ int main(int argc, char *argv[]) {
}
else
{
printf
(
"
\n
usage: %s [options]
\n
"
,
argv
[
0
]);
printf
(
" [-i ip]: first server IP address, default is:%s
\n
"
,
serverIp
);
printf
(
" [-p port]: server port number, default is:%d
\n
"
,
i
pSet
.
port
[
0
]);
printf
(
" [-p port]: server port number, default is:%d
\n
"
,
e
pSet
.
port
[
0
]);
printf
(
" [-t threads]: number of rpc threads, default is:%d
\n
"
,
rpcInit
.
numOfThreads
);
printf
(
" [-s sessions]: number of rpc sessions, default is:%d
\n
"
,
rpcInit
.
sessions
);
printf
(
" [-m msgSize]: message body size, default is:%d
\n
"
,
msgSize
);
...
...
@@ -168,7 +168,7 @@ int main(int argc, char *argv[]) {
for
(
int
i
=
0
;
i
<
appThreads
;
++
i
)
{
pInfo
->
index
=
i
;
pInfo
->
ipSet
=
i
pSet
;
pInfo
->
epSet
=
e
pSet
;
pInfo
->
numOfReqs
=
numOfReqs
;
pInfo
->
msgSize
=
msgSize
;
sem_init
(
&
pInfo
->
rspSem
,
0
,
0
);
...
...
src/rpc/test/rsclient.c
浏览文件 @
599df650
...
...
@@ -23,7 +23,7 @@
typedef
struct
{
int
index
;
SRpc
IpSet
i
pSet
;
SRpc
EpSet
e
pSet
;
int
num
;
int
numOfReqs
;
int
msgSize
;
...
...
@@ -51,7 +51,7 @@ static void *sendRequest(void *param) {
rpcMsg
.
msgType
=
1
;
tDebug
(
"thread:%d, send request, contLen:%d num:%d"
,
pInfo
->
index
,
pInfo
->
msgSize
,
pInfo
->
num
);
rpcSendRecv
(
pInfo
->
pRpc
,
&
pInfo
->
i
pSet
,
&
rpcMsg
,
&
rspMsg
);
rpcSendRecv
(
pInfo
->
pRpc
,
&
pInfo
->
e
pSet
,
&
rpcMsg
,
&
rspMsg
);
// handle response
if
(
rspMsg
.
code
!=
0
)
terror
++
;
...
...
@@ -72,7 +72,7 @@ static void *sendRequest(void *param) {
int
main
(
int
argc
,
char
*
argv
[])
{
SRpcInit
rpcInit
;
SRpc
IpSet
i
pSet
;
SRpc
EpSet
e
pSet
;
int
msgSize
=
128
;
int
numOfReqs
=
0
;
int
appThreads
=
1
;
...
...
@@ -83,12 +83,12 @@ int main(int argc, char *argv[]) {
pthread_attr_t
thattr
;
// server info
ipSet
.
numOfI
ps
=
1
;
i
pSet
.
inUse
=
0
;
i
pSet
.
port
[
0
]
=
7000
;
i
pSet
.
port
[
1
]
=
7000
;
strcpy
(
i
pSet
.
fqdn
[
0
],
serverIp
);
strcpy
(
i
pSet
.
fqdn
[
1
],
"192.168.0.1"
);
epSet
.
numOfE
ps
=
1
;
e
pSet
.
inUse
=
0
;
e
pSet
.
port
[
0
]
=
7000
;
e
pSet
.
port
[
1
]
=
7000
;
strcpy
(
e
pSet
.
fqdn
[
0
],
serverIp
);
strcpy
(
e
pSet
.
fqdn
[
1
],
"192.168.0.1"
);
// client info
memset
(
&
rpcInit
,
0
,
sizeof
(
rpcInit
));
...
...
@@ -106,9 +106,9 @@ int main(int argc, char *argv[]) {
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
if
(
strcmp
(
argv
[
i
],
"-p"
)
==
0
&&
i
<
argc
-
1
)
{
i
pSet
.
port
[
0
]
=
atoi
(
argv
[
++
i
]);
e
pSet
.
port
[
0
]
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-i"
)
==
0
&&
i
<
argc
-
1
)
{
tstrncpy
(
ipSet
.
fqdn
[
0
],
argv
[
++
i
],
sizeof
(
i
pSet
.
fqdn
[
0
]));
tstrncpy
(
epSet
.
fqdn
[
0
],
argv
[
++
i
],
sizeof
(
e
pSet
.
fqdn
[
0
]));
}
else
if
(
strcmp
(
argv
[
i
],
"-t"
)
==
0
&&
i
<
argc
-
1
)
{
rpcInit
.
numOfThreads
=
atoi
(
argv
[
++
i
]);
}
else
if
(
strcmp
(
argv
[
i
],
"-m"
)
==
0
&&
i
<
argc
-
1
)
{
...
...
@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) {
}
else
{
printf
(
"
\n
usage: %s [options]
\n
"
,
argv
[
0
]);
printf
(
" [-i ip]: first server IP address, default is:%s
\n
"
,
serverIp
);
printf
(
" [-p port]: server port number, default is:%d
\n
"
,
i
pSet
.
port
[
0
]);
printf
(
" [-p port]: server port number, default is:%d
\n
"
,
e
pSet
.
port
[
0
]);
printf
(
" [-t threads]: number of rpc threads, default is:%d
\n
"
,
rpcInit
.
numOfThreads
);
printf
(
" [-s sessions]: number of rpc sessions, default is:%d
\n
"
,
rpcInit
.
sessions
);
printf
(
" [-m msgSize]: message body size, default is:%d
\n
"
,
msgSize
);
...
...
@@ -168,7 +168,7 @@ int main(int argc, char *argv[]) {
for
(
int
i
=
0
;
i
<
appThreads
;
++
i
)
{
pInfo
->
index
=
i
;
pInfo
->
ipSet
=
i
pSet
;
pInfo
->
epSet
=
e
pSet
;
pInfo
->
numOfReqs
=
numOfReqs
;
pInfo
->
msgSize
=
msgSize
;
sem_init
(
&
pInfo
->
rspSem
,
0
,
0
);
...
...
src/rpc/test/rserver.c
浏览文件 @
599df650
...
...
@@ -103,7 +103,7 @@ int retrieveAuthInfo(char *meterId, char *spi, char *encrypt, char *secret, char
return
ret
;
}
void
processRequestMsg
(
SRpcMsg
*
pMsg
,
SRpc
IpSet
*
pI
pSet
)
{
void
processRequestMsg
(
SRpcMsg
*
pMsg
,
SRpc
EpSet
*
pE
pSet
)
{
SRpcMsg
*
pTemp
;
pTemp
=
taosAllocateQitem
(
sizeof
(
SRpcMsg
));
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
599df650
...
...
@@ -148,7 +148,7 @@ void tsdbCloseRepo(TSDB_REPO_T *repo, int toCommit) {
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
int
vgId
=
REPO_ID
(
pRepo
);
tsdbStopStream
(
r
epo
);
tsdbStopStream
(
pR
epo
);
if
(
toCommit
)
{
tsdbAsyncCommit
(
pRepo
);
...
...
@@ -1126,6 +1126,7 @@ static void tsdbStartStream(STsdbRepo *pRepo) {
}
}
static
void
tsdbStopStream
(
STsdbRepo
*
pRepo
)
{
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
599df650
...
...
@@ -172,7 +172,7 @@ void *tsdbAllocBytes(STsdbRepo *pRepo, int bytes) {
STsdbBufBlock
*
pBufBlock
=
tsdbGetCurrBufBlock
(
pRepo
);
if
(
pBufBlock
!=
NULL
&&
pBufBlock
->
remain
<
bytes
)
{
if
(
listNEles
(
pRepo
->
mem
->
bufBlockList
)
>=
pCfg
->
totalBlocks
/
2
)
{
// need to commit mem
if
(
listNEles
(
pRepo
->
mem
->
bufBlockList
)
>=
pCfg
->
totalBlocks
/
3
)
{
// need to commit mem
if
(
tsdbAsyncCommit
(
pRepo
)
<
0
)
return
NULL
;
}
else
{
if
(
tsdbLockRepo
(
pRepo
)
<
0
)
return
NULL
;
...
...
@@ -204,6 +204,9 @@ void *tsdbAllocBytes(STsdbRepo *pRepo, int bytes) {
pBufBlock
->
offset
+=
bytes
;
pBufBlock
->
remain
-=
bytes
;
tsdbTrace
(
"vgId:%d allocate %d bytes from buffer block, nBlocks %d offset %d remain %d"
,
REPO_ID
(
pRepo
),
bytes
,
listNEles
(
pRepo
->
mem
->
bufBlockList
),
pBufBlock
->
offset
,
pBufBlock
->
remain
);
return
ptr
;
}
...
...
@@ -324,6 +327,8 @@ static void tsdbFreeBytes(STsdbRepo *pRepo, void *ptr, int bytes) {
pBufBlock
->
offset
-=
bytes
;
pBufBlock
->
remain
+=
bytes
;
ASSERT
(
ptr
==
POINTER_SHIFT
(
pBufBlock
->
data
,
pBufBlock
->
offset
));
tsdbTrace
(
"vgId:%d return %d bytes to buffer block, nBlocks %d offset %d remain %d"
,
REPO_ID
(
pRepo
),
bytes
,
listNEles
(
pRepo
->
mem
->
bufBlockList
),
pBufBlock
->
offset
,
pBufBlock
->
remain
);
}
static
SMemTable
*
tsdbNewMemTable
(
STsdbCfg
*
pCfg
)
{
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
599df650
...
...
@@ -592,7 +592,7 @@ void tsdbUpdateTableSchema(STsdbRepo *pRepo, STable *pTable, STSchema *pSchema,
int
tlen
=
tsdbGetTableEncodeSize
(
TSDB_UPDATE_META
,
pCTable
);
void
*
buf
=
tsdbAllocBytes
(
pRepo
,
tlen
);
ASSERT
(
buf
!=
NULL
);
tsdbInsertTableAct
(
pRepo
,
TSDB_UPDATE_META
,
buf
,
pTable
);
tsdbInsertTableAct
(
pRepo
,
TSDB_UPDATE_META
,
buf
,
p
C
Table
);
}
}
...
...
src/tsdb/src/tsdbRWHelper.c
浏览文件 @
599df650
...
...
@@ -589,20 +589,25 @@ void tsdbGetDataStatis(SRWHelper *pHelper, SDataStatis *pStatis, int numOfCols)
int
tsdbLoadBlockDataCols
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SCompInfo
*
pCompInfo
,
int16_t
*
colIds
,
int
numOfColIds
)
{
ASSERT
(
pCompBlock
->
numOfSubBlocks
>=
1
);
// Must be super block
SCompBlock
*
pTCompBlock
=
pCompBlock
;
int
numOfSubBlocks
=
pCompBlock
->
numOfSubBlocks
;
if
(
numOfSubBlocks
>
1
)
pCompBlock
=
(
SCompBlock
*
)
POINTER_SHIFT
((
pCompInfo
==
NULL
)
?
pHelper
->
pCompInfo
:
pCompInfo
,
pCompBlock
->
offset
);
p
T
CompBlock
=
(
SCompBlock
*
)
POINTER_SHIFT
((
pCompInfo
==
NULL
)
?
pHelper
->
pCompInfo
:
pCompInfo
,
pCompBlock
->
offset
);
tdResetDataCols
(
pHelper
->
pDataCols
[
0
]);
if
(
tsdbLoadBlockDataColsImpl
(
pHelper
,
pCompBlock
,
pHelper
->
pDataCols
[
0
],
colIds
,
numOfColIds
)
<
0
)
goto
_err
;
if
(
tsdbLoadBlockDataColsImpl
(
pHelper
,
p
T
CompBlock
,
pHelper
->
pDataCols
[
0
],
colIds
,
numOfColIds
)
<
0
)
goto
_err
;
for
(
int
i
=
1
;
i
<
numOfSubBlocks
;
i
++
)
{
tdResetDataCols
(
pHelper
->
pDataCols
[
1
]);
pCompBlock
++
;
if
(
tsdbLoadBlockDataColsImpl
(
pHelper
,
pCompBlock
,
pHelper
->
pDataCols
[
1
],
colIds
,
numOfColIds
)
<
0
)
goto
_err
;
p
T
CompBlock
++
;
if
(
tsdbLoadBlockDataColsImpl
(
pHelper
,
p
T
CompBlock
,
pHelper
->
pDataCols
[
1
],
colIds
,
numOfColIds
)
<
0
)
goto
_err
;
if
(
tdMergeDataCols
(
pHelper
->
pDataCols
[
0
],
pHelper
->
pDataCols
[
1
],
pHelper
->
pDataCols
[
1
]
->
numOfRows
)
<
0
)
goto
_err
;
}
ASSERT
(
pHelper
->
pDataCols
[
0
]
->
numOfRows
==
pCompBlock
->
numOfRows
&&
dataColsKeyFirst
(
pHelper
->
pDataCols
[
0
])
==
pCompBlock
->
keyFirst
&&
dataColsKeyLast
(
pHelper
->
pDataCols
[
0
])
==
pCompBlock
->
keyLast
);
return
0
;
_err:
...
...
@@ -610,19 +615,25 @@ _err:
}
int
tsdbLoadBlockData
(
SRWHelper
*
pHelper
,
SCompBlock
*
pCompBlock
,
SCompInfo
*
pCompInfo
)
{
SCompBlock
*
pTCompBlock
=
pCompBlock
;
int
numOfSubBlock
=
pCompBlock
->
numOfSubBlocks
;
if
(
numOfSubBlock
>
1
)
pCompBlock
=
(
SCompBlock
*
)
POINTER_SHIFT
((
pCompInfo
==
NULL
)
?
pHelper
->
pCompInfo
:
pCompInfo
,
pCompBlock
->
offset
);
p
T
CompBlock
=
(
SCompBlock
*
)
POINTER_SHIFT
((
pCompInfo
==
NULL
)
?
pHelper
->
pCompInfo
:
pCompInfo
,
pCompBlock
->
offset
);
tdResetDataCols
(
pHelper
->
pDataCols
[
0
]);
if
(
tsdbLoadBlockDataImpl
(
pHelper
,
pCompBlock
,
pHelper
->
pDataCols
[
0
])
<
0
)
goto
_err
;
if
(
tsdbLoadBlockDataImpl
(
pHelper
,
p
T
CompBlock
,
pHelper
->
pDataCols
[
0
])
<
0
)
goto
_err
;
for
(
int
i
=
1
;
i
<
numOfSubBlock
;
i
++
)
{
tdResetDataCols
(
pHelper
->
pDataCols
[
1
]);
pCompBlock
++
;
if
(
tsdbLoadBlockDataImpl
(
pHelper
,
pCompBlock
,
pHelper
->
pDataCols
[
1
])
<
0
)
goto
_err
;
p
T
CompBlock
++
;
if
(
tsdbLoadBlockDataImpl
(
pHelper
,
p
T
CompBlock
,
pHelper
->
pDataCols
[
1
])
<
0
)
goto
_err
;
if
(
tdMergeDataCols
(
pHelper
->
pDataCols
[
0
],
pHelper
->
pDataCols
[
1
],
pHelper
->
pDataCols
[
1
]
->
numOfRows
)
<
0
)
goto
_err
;
}
ASSERT
(
pHelper
->
pDataCols
[
0
]
->
numOfRows
==
pCompBlock
->
numOfRows
&&
dataColsKeyFirst
(
pHelper
->
pDataCols
[
0
])
==
pCompBlock
->
keyFirst
&&
dataColsKeyLast
(
pHelper
->
pDataCols
[
0
])
==
pCompBlock
->
keyLast
);
return
0
;
_err:
...
...
@@ -1227,7 +1238,6 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
goto
_err
;
}
ASSERT
(
pCompData
->
numOfCols
==
pCompBlock
->
numOfCols
);
int32_t
tsize
=
TSDB_GET_COMPCOL_LEN
(
pCompBlock
->
numOfCols
);
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
pCompData
,
tsize
))
{
...
...
@@ -1236,6 +1246,7 @@ static int tsdbLoadBlockDataImpl(SRWHelper *pHelper, SCompBlock *pCompBlock, SDa
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
goto
_err
;
}
ASSERT
(
pCompData
->
numOfCols
==
pCompBlock
->
numOfCols
);
pDataCols
->
numOfRows
=
pCompBlock
->
numOfRows
;
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
599df650
此差异已折叠。
点击以展开。
src/tsdb/tests/tsdbTests.cpp
浏览文件 @
599df650
...
...
@@ -39,7 +39,9 @@ static int insertData(SInsertInfo *pInfo) {
pBlock
->
uid
=
pInfo
->
uid
;
pBlock
->
tid
=
pInfo
->
tid
;
pBlock
->
sversion
=
pInfo
->
sversion
;
pBlock
->
len
=
0
;
pBlock
->
dataLen
=
0
;
pBlock
->
schemaLen
=
0
;
pBlock
->
numOfRows
=
0
;
for
(
int
i
=
0
;
i
<
pInfo
->
rowsPerSubmit
;
i
++
)
{
// start_time += 1000;
if
(
pInfo
->
isAscend
)
{
...
...
@@ -47,7 +49,7 @@ static int insertData(SInsertInfo *pInfo) {
}
else
{
start_time
-=
pInfo
->
interval
;
}
SDataRow
row
=
(
SDataRow
)(
pBlock
->
data
+
pBlock
->
l
en
);
SDataRow
row
=
(
SDataRow
)(
pBlock
->
data
+
pBlock
->
dataL
en
);
tdInitDataRow
(
row
,
pInfo
->
pSchema
);
for
(
int
j
=
0
;
j
<
schemaNCols
(
pInfo
->
pSchema
);
j
++
)
{
...
...
@@ -59,13 +61,15 @@ static int insertData(SInsertInfo *pInfo) {
tdAppendColVal
(
row
,
(
void
*
)(
&
val
),
pTCol
->
type
,
pTCol
->
bytes
,
pTCol
->
offset
);
}
}
pBlock
->
len
+=
dataRowLen
(
row
);
pBlock
->
dataLen
+=
dataRowLen
(
row
);
pBlock
->
numOfRows
++
;
}
pMsg
->
length
=
pMsg
->
length
+
sizeof
(
SSubmitBlk
)
+
pBlock
->
l
en
;
pMsg
->
length
=
sizeof
(
SSubmitMsg
)
+
sizeof
(
SSubmitBlk
)
+
pBlock
->
dataL
en
;
pMsg
->
numOfBlocks
=
1
;
pBlock
->
len
=
htonl
(
pBlock
->
l
en
);
pBlock
->
dataLen
=
htonl
(
pBlock
->
dataL
en
);
pBlock
->
numOfRows
=
htonl
(
pBlock
->
numOfRows
);
pBlock
->
schemaLen
=
htonl
(
pBlock
->
schemaLen
);
pBlock
->
uid
=
htobe64
(
pBlock
->
uid
);
pBlock
->
tid
=
htonl
(
pBlock
->
tid
);
...
...
@@ -74,7 +78,6 @@ static int insertData(SInsertInfo *pInfo) {
pMsg
->
length
=
htonl
(
pMsg
->
length
);
pMsg
->
numOfBlocks
=
htonl
(
pMsg
->
numOfBlocks
);
pMsg
->
compressed
=
htonl
(
pMsg
->
numOfBlocks
);
if
(
tsdbInsertData
(
pInfo
->
pRepo
,
pMsg
,
NULL
)
<
0
)
{
tfree
(
pMsg
);
...
...
src/util/src/tcache.c
浏览文件 @
599df650
...
...
@@ -225,7 +225,7 @@ static void doCleanupDataCache(SCacheObj *pCacheObj);
* refresh cache to remove data in both hash list and trash, if any nodes' refcount == 0, every pCacheObj->refreshTime
* @param handle Cache object handle
*/
static
void
*
taosCacheTimedRefresh
(
void
*
pCacheObj
);
static
void
*
taosCacheTimedRefresh
(
void
*
handle
);
SCacheObj
*
taosCacheInit
(
int32_t
keyType
,
int64_t
refreshTimeInSeconds
,
bool
extendLifespan
,
__cache_free_fn_t
fn
,
const
char
*
cacheName
)
{
if
(
refreshTimeInSeconds
<=
0
)
{
...
...
@@ -455,51 +455,11 @@ void taosCacheRelease(SCacheObj *pCacheObj, void **data, bool _remove) {
__cache_unlock
(
pCacheObj
);
}
else
{
uDebug
(
"cache:%s, key:%p, %p is released, refcnt:%d"
,
pCacheObj
->
name
,
pNode
->
key
,
pNode
->
data
,
T_REF_VAL_GET
(
pNode
)
-
1
);
__cache_wr_lock
(
pCacheObj
);
// NOTE: once refcount is decrease, pNode may be freed by other thread immediately.
int32_t
ref
=
T_REF_DEC
(
pNode
);
if
(
inTrashCan
&&
(
ref
==
0
))
{
// Remove it if the ref count is 0.
// The ref count does not need to load and check again after lock acquired, since ref count can not be increased when
// the node is in trashcan.
assert
(
pNode
->
pTNodeHeader
->
pData
==
pNode
);
taosRemoveFromTrashCan
(
pCacheObj
,
pNode
->
pTNodeHeader
);
}
__cache_unlock
(
pCacheObj
);
uDebug
(
"cache:%s, key:%p, %p is released, refcnt:%d, in trashcan:%d"
,
pCacheObj
->
name
,
pNode
->
key
,
pNode
->
data
,
ref
,
inTrashCan
);
}
// else {
// if (_remove) { // not in trash can, but need to remove it
// __cache_wr_lock(pCacheObj);
//
// /*
// * If not referenced by other users. Otherwise move this node to trashcan wait for all users
// * releasing this resources.
// *
// * NOTE: previous ref is 0, and current ref is still 0, remove it. If previous is not 0, there is another thread
// * that tries to do the same thing.
// */
// if (ref == 0) {
// if (T_REF_VAL_GET(pNode) == 0) {
// taosCacheReleaseNode(pCacheObj, pNode);
// } else {
// taosCacheMoveToTrash(pCacheObj, pNode);
// }
// } else if (ref > 0) {
// if (!pNode->inTrashCan) {
// assert(pNode->pTNodeHeader == NULL);
// taosCacheMoveToTrash(pCacheObj, pNode);
// }
// }
//
// __cache_unlock(pCacheObj);
// }
// }
}
void
taosCacheEmpty
(
SCacheObj
*
pCacheObj
)
{
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
599df650
...
...
@@ -259,7 +259,6 @@ int32_t vnodeOpen(int32_t vnode, char *rootDir) {
appH
.
cqH
=
pVnode
->
cq
;
appH
.
cqCreateFunc
=
cqCreate
;
appH
.
cqDropFunc
=
cqDrop
;
appH
.
configFunc
=
dnodeSendCfgTableToRecv
;
sprintf
(
temp
,
"%s/tsdb"
,
rootDir
);
pVnode
->
tsdb
=
tsdbOpenRepo
(
temp
,
&
appH
);
if
(
pVnode
->
tsdb
==
NULL
)
{
...
...
@@ -341,6 +340,13 @@ void vnodeRelease(void *pVnodeRaw) {
tsdbCloseRepo
(
pVnode
->
tsdb
,
1
);
pVnode
->
tsdb
=
NULL
;
// stop continuous query
if
(
pVnode
->
cq
)
{
void
*
cq
=
pVnode
->
cq
;
pVnode
->
cq
=
NULL
;
cqClose
(
cq
);
}
if
(
pVnode
->
wal
)
walClose
(
pVnode
->
wal
);
pVnode
->
wal
=
NULL
;
...
...
@@ -512,13 +518,6 @@ static void vnodeCleanUp(SVnodeObj *pVnode) {
syncStop
(
sync
);
}
// stop continuous query
if
(
pVnode
->
cq
)
{
void
*
cq
=
pVnode
->
cq
;
pVnode
->
cq
=
NULL
;
cqClose
(
cq
);
}
vTrace
(
"vgId:%d, vnode will cleanup, refCount:%d"
,
pVnode
->
vgId
,
pVnode
->
refCount
);
// release local resources only after cutting off outside connections
...
...
@@ -588,7 +587,6 @@ static int vnodeResetTsdb(SVnodeObj *pVnode)
appH
.
cqH
=
pVnode
->
cq
;
appH
.
cqCreateFunc
=
cqCreate
;
appH
.
cqDropFunc
=
cqDrop
;
appH
.
configFunc
=
dnodeSendCfgTableToRecv
;
pVnode
->
tsdb
=
tsdbOpenRepo
(
rootDir
,
&
appH
);
pVnode
->
status
=
TAOS_VN_STATUS_READY
;
...
...
tests/comparisonTest/tdengine/q5.txt
0 → 100644
浏览文件 @
599df650
select * from db.devices;
tests/comparisonTest/tdengine/tdengineTest.c
浏览文件 @
599df650
...
...
@@ -13,8 +13,9 @@ typedef struct {
char
sql
[
256
];
char
dataDir
[
256
];
int
filesNum
;
int
writeC
lients
;
int
c
lients
;
int
rowsPerRequest
;
int
write
;
}
ProArgs
;
typedef
struct
{
...
...
@@ -41,7 +42,7 @@ int main(int argc, char *argv[]) {
statis
.
totalRows
=
0
;
parseArg
(
argc
,
argv
);
if
(
arguments
.
write
Clients
>
0
)
{
if
(
arguments
.
write
)
{
writeData
();
}
else
{
readData
();
...
...
@@ -52,7 +53,7 @@ void parseArg(int argc, char *argv[]) {
strcpy
(
arguments
.
sql
,
"./sqlCmd.txt"
);
strcpy
(
arguments
.
dataDir
,
"./testdata"
);
arguments
.
filesNum
=
2
;
arguments
.
writeClients
=
0
;
arguments
.
clients
=
1
;
arguments
.
rowsPerRequest
=
100
;
for
(
int
i
=
1
;
i
<
argc
;
++
i
)
{
...
...
@@ -83,12 +84,12 @@ void parseArg(int argc, char *argv[]) {
exit
(
EXIT_FAILURE
);
}
}
else
if
(
strcmp
(
argv
[
i
],
"-
writeC
lients"
)
==
0
)
{
else
if
(
strcmp
(
argv
[
i
],
"-
c
lients"
)
==
0
)
{
if
(
i
<
argc
-
1
)
{
arguments
.
writeC
lients
=
atoi
(
argv
[
++
i
]);
arguments
.
c
lients
=
atoi
(
argv
[
++
i
]);
}
else
{
fprintf
(
stderr
,
"'-
writeClients' requires a parameter, default:%d
\n
"
,
arguments
.
writeC
lients
);
fprintf
(
stderr
,
"'-
clients' requires a parameter, default:%d
\n
"
,
arguments
.
c
lients
);
exit
(
EXIT_FAILURE
);
}
}
...
...
@@ -101,6 +102,9 @@ void parseArg(int argc, char *argv[]) {
exit
(
EXIT_FAILURE
);
}
}
else
if
(
strcmp
(
argv
[
i
],
"-w"
)
==
0
)
{
arguments
.
write
=
1
;
}
}
}
...
...
@@ -215,7 +219,7 @@ void writeDataImp(void *param) {
void
writeData
()
{
printf
(
"write data
\n
"
);
printf
(
"----
writeClients: %d
\n
"
,
arguments
.
writeC
lients
);
printf
(
"----
clients: %d
\n
"
,
arguments
.
c
lients
);
printf
(
"---- dataDir: %s
\n
"
,
arguments
.
dataDir
);
printf
(
"---- numOfFiles: %d
\n
"
,
arguments
.
filesNum
);
printf
(
"---- rowsPerRequest: %d
\n
"
,
arguments
.
rowsPerRequest
);
...
...
@@ -243,12 +247,12 @@ void writeData() {
int64_t
st
=
getTimeStampMs
();
int
a
=
arguments
.
filesNum
/
arguments
.
writeC
lients
;
int
b
=
arguments
.
filesNum
%
arguments
.
writeC
lients
;
int
a
=
arguments
.
filesNum
/
arguments
.
c
lients
;
int
b
=
arguments
.
filesNum
%
arguments
.
c
lients
;
int
last
=
0
;
ThreadObj
*
threads
=
calloc
((
size_t
)
arguments
.
writeC
lients
,
sizeof
(
ThreadObj
));
for
(
int
i
=
0
;
i
<
arguments
.
writeC
lients
;
++
i
)
{
ThreadObj
*
threads
=
calloc
((
size_t
)
arguments
.
c
lients
,
sizeof
(
ThreadObj
));
for
(
int
i
=
0
;
i
<
arguments
.
c
lients
;
++
i
)
{
ThreadObj
*
pthread
=
threads
+
i
;
pthread_attr_t
thattr
;
pthread
->
threadId
=
i
+
1
;
...
...
@@ -264,7 +268,7 @@ void writeData() {
pthread_create
(
&
pthread
->
pid
,
&
thattr
,
(
void
*
(
*
)(
void
*
))
writeDataImp
,
pthread
);
}
for
(
int
i
=
0
;
i
<
arguments
.
writeC
lients
;
i
++
)
{
for
(
int
i
=
0
;
i
<
arguments
.
c
lients
;
i
++
)
{
pthread_join
(
threads
[
i
].
pid
,
NULL
);
}
...
...
@@ -272,17 +276,15 @@ void writeData() {
float
seconds
=
(
float
)
elapsed
/
1000
;
float
rs
=
(
float
)
statis
.
totalRows
/
seconds
;
free
(
threads
);
printf
(
"---- Spent %f seconds to insert %ld records, speed: %f Rows/Second
\n
"
,
seconds
,
statis
.
totalRows
,
rs
);
}
void
readData
()
{
printf
(
"read data
\n
"
);
printf
(
"---- sql: %s
\n
"
,
arguments
.
sql
);
void
*
taos
=
taos_connect
(
"127.0.0.1"
,
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
taos
==
NULL
)
taos_error
(
taos
);
void
readDataImp
(
void
*
param
)
{
ThreadObj
*
pThread
=
(
ThreadObj
*
)
param
;
printf
(
"Thread %d
\n
"
,
pThread
->
threadId
);
FILE
*
fp
=
fopen
(
arguments
.
sql
,
"r"
);
if
(
fp
==
NULL
)
{
printf
(
"failed to open file %s
\n
"
,
arguments
.
sql
);
...
...
@@ -290,6 +292,10 @@ void readData() {
}
printf
(
"open file %s success
\n
"
,
arguments
.
sql
);
void
*
taos
=
taos_connect
(
"127.0.0.1"
,
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
taos
==
NULL
)
taos_error
(
taos
);
char
*
line
=
NULL
;
size_t
len
=
0
;
while
(
!
feof
(
fp
))
{
...
...
@@ -325,9 +331,36 @@ void readData() {
int64_t
elapsed
=
getTimeStampMs
()
-
st
;
float
seconds
=
(
float
)
elapsed
/
1000
;
printf
(
"---- Spent %f seconds to
query: %s"
,
seconds
,
line
);
printf
(
"---- Spent %f seconds to
retrieve %d records, Thread:%d query: %s
\n
"
,
seconds
,
rows
,
pThread
->
threadId
,
line
);
}
fclose
(
fp
);
}
void
readData
()
{
printf
(
"read data
\n
"
);
printf
(
"---- sql: %s
\n
"
,
arguments
.
sql
);
printf
(
"---- clients: %d
\n
"
,
arguments
.
clients
);
void
*
taos
=
taos_connect
(
"127.0.0.1"
,
"root"
,
"taosdata"
,
NULL
,
0
);
if
(
taos
==
NULL
)
taos_error
(
taos
);
ThreadObj
*
threads
=
calloc
((
size_t
)
arguments
.
clients
,
sizeof
(
ThreadObj
));
for
(
int
i
=
0
;
i
<
arguments
.
clients
;
++
i
)
{
ThreadObj
*
pthread
=
threads
+
i
;
pthread_attr_t
thattr
;
pthread
->
threadId
=
i
+
1
;
pthread_attr_init
(
&
thattr
);
pthread_attr_setdetachstate
(
&
thattr
,
PTHREAD_CREATE_JOINABLE
);
pthread_create
(
&
pthread
->
pid
,
&
thattr
,
(
void
*
(
*
)(
void
*
))
readDataImp
,
pthread
);
}
for
(
int
i
=
0
;
i
<
arguments
.
clients
;
i
++
)
{
pthread_join
(
threads
[
i
].
pid
,
NULL
);
}
free
(
threads
);
}
tests/perftest-scripts/tdengineTestQ1Loop.sh
0 → 100755
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/perftest-scripts/tdengineTestQ2Loop.sh
0 → 100755
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/perftest-scripts/tdengineTestQ3Loop.sh
0 → 100755
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/perftest-scripts/tdengineTestQ4Loop.sh
0 → 100755
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/perftest-scripts/tdengineTestQ5Loop.sh
0 → 100755
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/perftest-scripts/tdengineTestWriteLoop.sh
0 → 100755
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/pytest/tag_lite/add.py
浏览文件 @
599df650
...
...
@@ -100,6 +100,8 @@ class TDTestCase:
# TSIM: sql alter table $mt add tag tgcol4 int
tdLog
.
info
(
'alter table %s add tag tgcol4 int'
%
(
mt
))
tdSql
.
execute
(
'alter table %s add tag tgcol4 int'
%
(
mt
))
tdLog
.
info
(
'select * from %s where tgcol4=6'
%
(
mt
))
tdSql
.
query
(
'select * from %s where tgcol4=6'
%
(
mt
))
# TSIM: sql reset query cache
tdLog
.
info
(
'reset query cache'
)
tdSql
.
execute
(
'reset query cache'
)
...
...
tests/pytest/util/dnodes-no-random-fail.py
浏览文件 @
599df650
...
...
@@ -178,7 +178,6 @@ class TDDnode:
self
.
cfg
(
"walLevel"
,
"2"
)
self
.
cfg
(
"fsync"
,
"1000"
)
self
.
cfg
(
"statusInterval"
,
"1"
)
self
.
cfg
(
"numOfTotalVnodes"
,
"64"
)
self
.
cfg
(
"numOfMnodes"
,
"3"
)
self
.
cfg
(
"numOfThreadsPerCore"
,
"2.0"
)
self
.
cfg
(
"monitor"
,
"0"
)
...
...
tests/pytest/util/dnodes-random-fail.py
浏览文件 @
599df650
...
...
@@ -178,7 +178,6 @@ class TDDnode:
self
.
cfg
(
"walLevel"
,
"2"
)
self
.
cfg
(
"fsync"
,
"1000"
)
self
.
cfg
(
"statusInterval"
,
"1"
)
self
.
cfg
(
"numOfTotalVnodes"
,
"64"
)
self
.
cfg
(
"numOfMnodes"
,
"3"
)
self
.
cfg
(
"numOfThreadsPerCore"
,
"2.0"
)
self
.
cfg
(
"monitor"
,
"0"
)
...
...
tests/pytest/util/dnodes.py
浏览文件 @
599df650
...
...
@@ -180,7 +180,6 @@ class TDDnode:
self
.
cfg
(
"walLevel"
,
"2"
)
self
.
cfg
(
"fsync"
,
"1000"
)
self
.
cfg
(
"statusInterval"
,
"1"
)
self
.
cfg
(
"numOfTotalVnodes"
,
"64"
)
self
.
cfg
(
"numOfMnodes"
,
"3"
)
self
.
cfg
(
"numOfThreadsPerCore"
,
"2.0"
)
self
.
cfg
(
"monitor"
,
"0"
)
...
...
tests/script/general/alter/cached_schema_after_alter.sim
浏览文件 @
599df650
...
...
@@ -68,7 +68,7 @@ endi
if $data01 != 1 then
return -1
endi
if $data02 !=
NULL
then
if $data02 !=
1
then
return -1
endi
...
...
@@ -80,7 +80,7 @@ endi
if $data01 != 1 then
return -1
endi
if $data02 !=
NULL
then
if $data02 !=
1
then
return -1
endi
...
...
tests/script/general/db/alter_option.sim
浏览文件 @
599df650
system sh/stop_dnodes.sh
system sh/deploy.sh -n dnode1 -i 1
system sh/cfg.sh -n dnode1 -c wallevel -v 0
system sh/cfg.sh -n dnode1 -c numOfTotalVnodes -v 4
system sh/cfg.sh -n dnode1 -c maxTablesPerVnode -v 1000
system sh/exec.sh -n dnode1 -s start
...
...
tests/script/general/db/basic.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/delete.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/delete_reuse1.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/delete_reuse2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/delete_reusevnode.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/delete_reusevnode2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/delete_writing1.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/delete_writing2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/len.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/repeat.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/db/vnodes.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/bug.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/first_last_query.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/null_char.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/select_across_vnodes.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/select_from_cache_disk.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/slimit.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/slimit1.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/slimit_alter_tags.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/testSuite.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/timestamp.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/parser/union.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stable/disk.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stable/dnode3.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stable/metrics.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stable/refcount.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stable/show.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stable/values.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stable/vnode3.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stream/metrics_replica1_vnoden.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/stream/table_replica1_vnoden.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/table/delete_reuse1.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/table/delete_reuse2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/table/delete_writing.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/table/limit.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/general/table/vgroup.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/sh/clear.sh
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/sh/deploy.sh
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/tmp/http.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/tmp/mnodes.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/account/authority.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn2_mn1_cache_file_sync.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_full_createTableFail.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_full_dropDnodeFail.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_multiCreateDropTable.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_nw_disable_timeout_autoDropDnode.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_r2_vnode_delDir.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_r3_vnode_delDir.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_replica2_wal1_AddDelDnode.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_replica_change.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_replica_change_dropDnod.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_stopDnode_timeout.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_vnode_change.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_offline.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_vnode_corruptFile_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_vnode_createErrData_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_vnode_delDir.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_vnode_noCorruptFile_offline.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn1_vnode_nomaster.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/dn3_mn2_killDnode.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/insert_duplicationTs.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica2_alterTable_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica2_alterTag_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica2_createTable_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica2_dropDb_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica2_dropTable_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica3_alterTable_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica3_alterTag_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica3_createTable_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica3_dropDb_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/offline_replica3_dropTable_online.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/replica_changeWithArbitrator.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica2_alterTable_add.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica2_alterTable_drop.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica2_dropDb.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica2_dropTable.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica3_alterTable_add.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica3_alterTable_drop.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica3_createTable.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica3_dnodeChang_DropAddAlterTableDropDb.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica3_dropDb.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/arbitrator/sync_replica3_dropTable.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/big/balance.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/big/maxvnodes.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/big/restartSpeed.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/balance1.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/balance2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/balance3.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/client1_0.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/cluster_main.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/cluster_main0.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/cluster_main1.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/cluster_main2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/main1_client1_0.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/cluster/main2_client1_0.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/delete.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/delete_part.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/replica_add12.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/replica_add13.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/replica_add23.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/replica_part.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/replica_reduce21.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/replica_reduce31.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/db/replica_reduce32.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/dnode/alternativeRole.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeDir.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/migrate/mn2_vn2_repl2_rmMnodeVnodeDir_stopAll_starAll.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/migrate/mn2_vn2_repl2_rmVnodeDir.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stable/balance_replica1.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stable/dnode2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stable/dnode2_stop.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stable/dnode3.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stable/replica2_dnode4.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stable/replica2_vnode3.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stable/replica3_dnode6.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stable/replica3_vnode3.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/metrics_balance.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/metrics_replica1_dnode2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/metrics_replica2_dnode2_vnoden.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/metrics_replica2_dnode3.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/metrics_replica3_dnode4.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/table_balance.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/table_move.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/table_replica1_dnode2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/table_replica2_dnode2_vnoden.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/table_replica2_dnode3.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/stream/table_replica3_dnode4.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/vnode/many.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/script/unique/vnode/replica2_basic2.sim
浏览文件 @
599df650
此差异已折叠。
点击以展开。
tests/tsim/src/simExe.c
浏览文件 @
599df650
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录