Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
84c3955a
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看板
未验证
提交
84c3955a
编写于
4月 20, 2020
作者:
S
slguan
提交者:
GitHub
4月 20, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1670 from taosdata/feature/mpeer
Feature/mpeer
上级
7043cfb6
be8ea454
变更
46
显示空白变更内容
内联
并排
Showing
46 changed file
with
552 addition
and
482 deletion
+552
-482
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+1
-0
src/common/inc/tulog.h
src/common/inc/tulog.h
+5
-0
src/common/src/tglobal.c
src/common/src/tglobal.c
+2
-1
src/dnode/src/dnodeMClient.c
src/dnode/src/dnodeMClient.c
+146
-92
src/inc/dnode.h
src/inc/dnode.h
+1
-1
src/inc/taosmsg.h
src/inc/taosmsg.h
+23
-24
src/inc/tsync.h
src/inc/tsync.h
+1
-1
src/mnode/inc/mgmtMnode.h
src/mnode/inc/mgmtMnode.h
+1
-1
src/mnode/src/mgmtDnode.c
src/mnode/src/mgmtDnode.c
+11
-12
src/mnode/src/mgmtMnode.c
src/mnode/src/mgmtMnode.c
+12
-11
src/mnode/src/mgmtSdb.c
src/mnode/src/mgmtSdb.c
+18
-14
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+1
-0
tests/script/general/account/testSuite.sim
tests/script/general/account/testSuite.sim
+5
-5
tests/script/general/agg/testSuite.sim
tests/script/general/agg/testSuite.sim
+2
-2
tests/script/general/alter/testSuite.sim
tests/script/general/alter/testSuite.sim
+7
-7
tests/script/general/cache/testSuite.sim
tests/script/general/cache/testSuite.sim
+5
-5
tests/script/general/compress/testSuite.sim
tests/script/general/compress/testSuite.sim
+4
-4
tests/script/general/compute/testSuite.sim
tests/script/general/compute/testSuite.sim
+16
-16
tests/script/general/field/testSuite.sim
tests/script/general/field/testSuite.sim
+14
-14
tests/script/general/http/testSuite.sim
tests/script/general/http/testSuite.sim
+7
-7
tests/script/general/import/testSuite.sim
tests/script/general/import/testSuite.sim
+4
-4
tests/script/general/metrics/testSuite.sim
tests/script/general/metrics/testSuite.sim
+4
-4
tests/script/general/parser/testSuite.sim
tests/script/general/parser/testSuite.sim
+49
-49
tests/script/general/stream/testSuite.sim
tests/script/general/stream/testSuite.sim
+12
-12
tests/script/general/tag/testSuite.sim
tests/script/general/tag/testSuite.sim
+25
-25
tests/script/general/vector/testSuite.sim
tests/script/general/vector/testSuite.sim
+11
-11
tests/script/sh/deploy.sh
tests/script/sh/deploy.sh
+1
-1
tests/script/unique/account/testSuite.sim
tests/script/unique/account/testSuite.sim
+9
-9
tests/script/unique/big/testSuite.sim
tests/script/unique/big/testSuite.sim
+3
-3
tests/script/unique/cluster/testSuite.sim
tests/script/unique/cluster/testSuite.sim
+5
-5
tests/script/unique/column/testSuite.sim
tests/script/unique/column/testSuite.sim
+1
-1
tests/script/unique/db/testSuite.sim
tests/script/unique/db/testSuite.sim
+10
-10
tests/script/unique/dnode/testSuite.sim
tests/script/unique/dnode/testSuite.sim
+9
-9
tests/script/unique/http/testSuite.sim
tests/script/unique/http/testSuite.sim
+1
-1
tests/script/unique/import/testSuite.sim
tests/script/unique/import/testSuite.sim
+2
-2
tests/script/unique/metrics/testSuite.sim
tests/script/unique/metrics/testSuite.sim
+4
-4
tests/script/unique/mnode/mgmt22.sim
tests/script/unique/mnode/mgmt22.sim
+5
-5
tests/script/unique/mnode/testSuite.sim
tests/script/unique/mnode/testSuite.sim
+12
-12
tests/script/unique/stream/testSuite.sim
tests/script/unique/stream/testSuite.sim
+15
-15
tests/script/unique/table/testSuite.sim
tests/script/unique/table/testSuite.sim
+1
-1
tests/script/unique/vnode/testSuite.sim
tests/script/unique/vnode/testSuite.sim
+7
-7
tests/script/uniqueSuite.sim
tests/script/uniqueSuite.sim
+5
-0
tests/test/c/importOneRow.c
tests/test/c/importOneRow.c
+3
-3
tests/test/c/importPerTabe.c
tests/test/c/importPerTabe.c
+24
-24
tests/test/c/insertPerRow.c
tests/test/c/insertPerRow.c
+24
-24
tests/test/c/insertPerTable.c
tests/test/c/insertPerTable.c
+24
-24
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
84c3955a
...
@@ -59,6 +59,7 @@ extern uint16_t tsMnodeDnodePort;
...
@@ -59,6 +59,7 @@ extern uint16_t tsMnodeDnodePort;
extern
uint16_t
tsMnodeShellPort
;
extern
uint16_t
tsMnodeShellPort
;
extern
uint16_t
tsDnodeShellPort
;
extern
uint16_t
tsDnodeShellPort
;
extern
uint16_t
tsDnodeMnodePort
;
extern
uint16_t
tsDnodeMnodePort
;
extern
uint16_t
tsSyncPort
;
extern
int
tsStatusInterval
;
extern
int
tsStatusInterval
;
extern
int
tsShellActivityTimer
;
extern
int
tsShellActivityTimer
;
...
...
src/common/inc/tulog.h
浏览文件 @
84c3955a
...
@@ -44,6 +44,11 @@ extern int32_t tscEmbedded;
...
@@ -44,6 +44,11 @@ extern int32_t tscEmbedded;
#define uPrint(...) \
#define uPrint(...) \
{ taosPrintLog("UTL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }
{ taosPrintLog("UTL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }
#define pError(...) \
{ taosPrintLog("ERROR APP ", 255, __VA_ARGS__); }
#define pPrint(...) \
{ taosPrintLog("APP ", 255, __VA_ARGS__); }
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
src/common/src/tglobal.c
浏览文件 @
84c3955a
...
@@ -65,7 +65,8 @@ char tsSecondIp[TSDB_IPv4ADDR_LEN] = {0};
...
@@ -65,7 +65,8 @@ char tsSecondIp[TSDB_IPv4ADDR_LEN] = {0};
uint16_t
tsMnodeShellPort
=
6030
;
// udp[6030-6034] tcp[6030]
uint16_t
tsMnodeShellPort
=
6030
;
// udp[6030-6034] tcp[6030]
uint16_t
tsDnodeShellPort
=
6035
;
// udp[6035-6039] tcp[6035]
uint16_t
tsDnodeShellPort
=
6035
;
// udp[6035-6039] tcp[6035]
uint16_t
tsMnodeDnodePort
=
6040
;
// udp/tcp
uint16_t
tsMnodeDnodePort
=
6040
;
// udp/tcp
uint16_t
tsDnodeMnodePort
=
6041
;
// udp/tcp
uint16_t
tsDnodeMnodePort
=
6045
;
// udp/tcp
uint16_t
tsSyncPort
=
6050
;
int32_t
tsStatusInterval
=
1
;
// second
int32_t
tsStatusInterval
=
1
;
// second
int32_t
tsShellActivityTimer
=
3
;
// second
int32_t
tsShellActivityTimer
=
3
;
// second
...
...
src/dnode/src/dnodeMClient.c
浏览文件 @
84c3955a
...
@@ -34,26 +34,28 @@
...
@@ -34,26 +34,28 @@
#define MPEER_CONTENT_LEN 2000
#define MPEER_CONTENT_LEN 2000
static
bool
dnodeReadMnodeIpList
();
static
void
dnodeUpdateMnodeInfos
(
SDMMnodeInfos
*
pMnodes
);
static
void
dnodeSaveMnodeIpList
();
static
bool
dnodeReadMnodeInfos
();
static
void
dnodeReadDnodeInfo
();
static
void
dnodeSaveMnodeInfos
();
static
void
dnodeUpdateDnodeInfo
(
int32_t
dnodeId
);
static
void
dnodeUpdateDnodeCfg
(
SDMDnodeCfg
*
pCfg
);
static
bool
dnodeReadDnodeCfg
();
static
void
dnodeSaveDnodeCfg
();
static
void
dnodeProcessRspFromMnode
(
SRpcMsg
*
pMsg
);
static
void
dnodeProcessRspFromMnode
(
SRpcMsg
*
pMsg
);
static
void
dnodeProcessStatusRsp
(
SRpcMsg
*
pMsg
);
static
void
dnodeProcessStatusRsp
(
SRpcMsg
*
pMsg
);
static
void
dnodeSendStatusMsg
(
void
*
handle
,
void
*
tmrId
);
static
void
dnodeSendStatusMsg
(
void
*
handle
,
void
*
tmrId
);
static
void
(
*
tsDnodeProcessMgmtRspFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
);
static
void
(
*
tsDnodeProcessMgmtRspFp
[
TSDB_MSG_TYPE_MAX
])(
SRpcMsg
*
);
static
void
*
tsDnodeMClientRpc
=
NULL
;
static
void
*
tsDnodeMClientRpc
=
NULL
;
static
SRpcIpSet
tsMnodeIpList
=
{
0
};
static
SDMNodeInfos
tsMnodeInfos
=
{
0
};
static
void
*
tsDnodeTmr
=
NULL
;
static
void
*
tsDnodeTmr
=
NULL
;
static
void
*
tsStatusTimer
=
NULL
;
static
void
*
tsStatusTimer
=
NULL
;
static
uint32_t
tsRebootTime
;
static
uint32_t
tsRebootTime
;
static
int32_t
tsDnodeId
=
0
;
static
char
tsDnodeName
[
TSDB_NODE_NAME_LEN
];
static
SRpcIpSet
tsMnodeIpSet
=
{
0
};
static
SDMMnodeInfos
tsMnodeInfos
=
{
0
};
static
SDMDnodeCfg
tsDnodeCfg
=
{
0
};
int32_t
dnodeInitMClient
()
{
int32_t
dnodeInitMClient
()
{
dnodeReadDnode
Info
();
dnodeReadDnode
Cfg
();
tsRebootTime
=
taosGetTimestampSec
();
tsRebootTime
=
taosGetTimestampSec
();
tsDnodeTmr
=
taosTmrInit
(
100
,
200
,
60000
,
"DND-DM"
);
tsDnodeTmr
=
taosTmrInit
(
100
,
200
,
60000
,
"DND-DM"
);
...
@@ -62,22 +64,22 @@ int32_t dnodeInitMClient() {
...
@@ -62,22 +64,22 @@ int32_t dnodeInitMClient() {
return
-
1
;
return
-
1
;
}
}
if
(
!
dnodeReadMnodeI
pList
())
{
if
(
!
dnodeReadMnodeI
nfos
())
{
memset
(
&
tsMnodeIp
Lis
t
,
0
,
sizeof
(
SRpcIpSet
));
memset
(
&
tsMnodeIp
Se
t
,
0
,
sizeof
(
SRpcIpSet
));
memset
(
&
tsMnodeInfos
,
0
,
sizeof
(
SDM
N
odeInfos
));
memset
(
&
tsMnodeInfos
,
0
,
sizeof
(
SDM
Mn
odeInfos
));
tsMnodeIp
Lis
t
.
port
=
tsMnodeDnodePort
;
tsMnodeIp
Se
t
.
port
=
tsMnodeDnodePort
;
tsMnodeIp
Lis
t
.
numOfIps
=
1
;
tsMnodeIp
Se
t
.
numOfIps
=
1
;
tsMnodeIp
Lis
t
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
tsMnodeIp
Se
t
.
ip
[
0
]
=
inet_addr
(
tsMasterIp
);
if
(
strcmp
(
tsSecondIp
,
tsMasterIp
)
!=
0
)
{
if
(
strcmp
(
tsSecondIp
,
tsMasterIp
)
!=
0
)
{
tsMnodeIp
Lis
t
.
numOfIps
=
2
;
tsMnodeIp
Se
t
.
numOfIps
=
2
;
tsMnodeIp
Lis
t
.
ip
[
1
]
=
inet_addr
(
tsSecondIp
);
tsMnodeIp
Se
t
.
ip
[
1
]
=
inet_addr
(
tsSecondIp
);
}
}
}
else
{
}
else
{
tsMnodeIp
Lis
t
.
inUse
=
tsMnodeInfos
.
inUse
;
tsMnodeIp
Se
t
.
inUse
=
tsMnodeInfos
.
inUse
;
tsMnodeIp
Lis
t
.
numOfIps
=
tsMnodeInfos
.
nodeNum
;
tsMnodeIp
Se
t
.
numOfIps
=
tsMnodeInfos
.
nodeNum
;
tsMnodeIp
Lis
t
.
port
=
tsMnodeInfos
.
nodeInfos
[
0
].
nodePort
;
tsMnodeIp
Se
t
.
port
=
tsMnodeInfos
.
nodeInfos
[
0
].
nodePort
;
for
(
int32_t
i
=
0
;
i
<
tsMnodeInfos
.
nodeNum
;
i
++
)
{
for
(
int32_t
i
=
0
;
i
<
tsMnodeInfos
.
nodeNum
;
i
++
)
{
tsMnodeIp
Lis
t
.
ip
[
i
]
=
tsMnodeInfos
.
nodeInfos
[
i
].
nodeIp
;
tsMnodeIp
Se
t
.
ip
[
i
]
=
tsMnodeInfos
.
nodeInfos
[
i
].
nodeIp
;
}
}
}
}
...
@@ -144,58 +146,68 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
...
@@ -144,58 +146,68 @@ static void dnodeProcessStatusRsp(SRpcMsg *pMsg) {
}
}
SDMStatusRsp
*
pStatusRsp
=
pMsg
->
pCont
;
SDMStatusRsp
*
pStatusRsp
=
pMsg
->
pCont
;
SDM
NodeInfos
*
m
nodes
=
&
pStatusRsp
->
mnodes
;
SDM
MnodeInfos
*
pM
nodes
=
&
pStatusRsp
->
mnodes
;
if
(
m
nodes
->
nodeNum
<=
0
)
{
if
(
pM
nodes
->
nodeNum
<=
0
)
{
dError
(
"status msg is invalid, num of ips is %d"
,
m
nodes
->
nodeNum
);
dError
(
"status msg is invalid, num of ips is %d"
,
pM
nodes
->
nodeNum
);
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
return
;
return
;
}
}
SDnodeState
*
pState
=
&
pStatusRsp
->
dnodeState
;
SDMDnodeCfg
*
pCfg
=
&
pStatusRsp
->
dnodeCfg
;
pState
->
numOfVnodes
=
htonl
(
pState
->
numOfVnodes
);
pCfg
->
numOfVnodes
=
htonl
(
pCfg
->
numOfVnodes
);
pState
->
moduleStatus
=
htonl
(
pState
->
moduleStatus
);
pCfg
->
moduleStatus
=
htonl
(
pCfg
->
moduleStatus
);
pState
->
createdTime
=
htonl
(
pState
->
createdTime
);
pCfg
->
dnodeId
=
htonl
(
pCfg
->
dnodeId
);
pState
->
dnodeId
=
htonl
(
pState
->
dnodeId
);
for
(
int32_t
i
=
0
;
i
<
pMnodes
->
nodeNum
;
++
i
)
{
dnodeProcessModuleStatus
(
pState
->
moduleStatus
);
SDMMnodeInfo
*
pMnodeInfo
=
&
pMnodes
->
nodeInfos
[
i
];
dnodeUpdateDnodeInfo
(
pState
->
dnodeId
);
pMnodeInfo
->
nodeId
=
htonl
(
pMnodeInfo
->
nodeId
);
pMnodeInfo
->
nodeIp
=
htonl
(
pMnodeInfo
->
nodeIp
);
SRpcIpSet
mgmtIpSet
=
{
0
};
pMnodeInfo
->
nodePort
=
htons
(
pMnodeInfo
->
nodePort
);
mgmtIpSet
.
inUse
=
mnodes
->
inUse
;
pMnodeInfo
->
syncPort
=
htons
(
pMnodeInfo
->
syncPort
);
mgmtIpSet
.
numOfIps
=
mnodes
->
nodeNum
;
mgmtIpSet
.
port
=
htons
(
mnodes
->
nodeInfos
[
0
].
nodePort
);
for
(
int32_t
i
=
0
;
i
<
mnodes
->
nodeNum
;
i
++
)
{
mgmtIpSet
.
ip
[
i
]
=
htonl
(
mnodes
->
nodeInfos
[
i
].
nodeIp
);
}
if
(
memcmp
(
&
mgmtIpSet
,
&
tsMnodeIpList
,
sizeof
(
SRpcIpSet
))
!=
0
||
tsMnodeInfos
.
nodeNum
==
0
)
{
memcpy
(
&
tsMnodeIpList
,
&
mgmtIpSet
,
sizeof
(
SRpcIpSet
));
tsMnodeInfos
.
inUse
=
mnodes
->
inUse
;
tsMnodeInfos
.
nodeNum
=
mnodes
->
nodeNum
;
dPrint
(
"mnode ip list is changed, numOfIps:%d inUse:%d"
,
tsMnodeInfos
.
nodeNum
,
tsMnodeInfos
.
inUse
);
for
(
int32_t
i
=
0
;
i
<
mnodes
->
nodeNum
;
i
++
)
{
tsMnodeInfos
.
nodeInfos
[
i
].
nodeId
=
htonl
(
mnodes
->
nodeInfos
[
i
].
nodeId
);
tsMnodeInfos
.
nodeInfos
[
i
].
nodeIp
=
htonl
(
mnodes
->
nodeInfos
[
i
].
nodeIp
);
tsMnodeInfos
.
nodeInfos
[
i
].
nodePort
=
htons
(
mnodes
->
nodeInfos
[
i
].
nodePort
);
strcpy
(
tsMnodeInfos
.
nodeInfos
[
i
].
nodeName
,
mnodes
->
nodeInfos
[
i
].
nodeName
);
dPrint
(
"mnode:%d, ip:%s:%u name:%s"
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodeId
,
taosIpStr
(
tsMnodeInfos
.
nodeInfos
[
i
].
nodeIp
),
tsMnodeInfos
.
nodeInfos
[
i
].
nodePort
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodeName
);
}
}
dnodeSaveMnodeIpList
();
sdbUpdateSync
();
SDMVgroupAccess
*
pVgAcccess
=
pStatusRsp
->
vgAccess
;
for
(
int32_t
i
=
0
;
i
<
pCfg
->
numOfVnodes
;
++
i
)
{
pVgAcccess
[
i
].
vgId
=
htonl
(
pVgAcccess
[
i
].
vgId
);
}
}
dnodeProcessModuleStatus
(
pCfg
->
moduleStatus
);
dnodeUpdateDnodeCfg
(
pCfg
);
dnodeUpdateMnodeInfos
(
pMnodes
);
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
taosTmrReset
(
dnodeSendStatusMsg
,
tsStatusInterval
*
1000
,
NULL
,
tsDnodeTmr
,
&
tsStatusTimer
);
}
}
static
void
dnodeUpdateMnodeInfos
(
SDMMnodeInfos
*
pMnodes
)
{
bool
mnodesChanged
=
(
memcmp
(
&
tsMnodeInfos
,
pMnodes
,
sizeof
(
SDMMnodeInfos
))
!=
0
);
bool
mnodesNotInit
=
(
tsMnodeInfos
.
nodeNum
==
0
);
if
(
!
(
mnodesChanged
||
mnodesNotInit
))
return
;
memcpy
(
&
tsMnodeInfos
,
pMnodes
,
sizeof
(
SDMMnodeInfos
));
tsMnodeIpSet
.
inUse
=
tsMnodeInfos
.
inUse
;
tsMnodeIpSet
.
numOfIps
=
tsMnodeInfos
.
nodeNum
;
tsMnodeIpSet
.
port
=
tsMnodeInfos
.
nodeInfos
[
0
].
nodePort
;
for
(
int32_t
i
=
0
;
i
<
tsMnodeInfos
.
nodeNum
;
i
++
)
{
tsMnodeIpSet
.
ip
[
i
]
=
tsMnodeInfos
.
nodeInfos
[
i
].
nodeIp
;
}
dPrint
(
"mnodes is changed, nodeNum:%d inUse:%d"
,
tsMnodeInfos
.
nodeNum
,
tsMnodeInfos
.
inUse
);
for
(
int32_t
i
=
0
;
i
<
tsMnodeInfos
.
nodeNum
;
i
++
)
{
dPrint
(
"mnode:%d, ip:%s:%u name:%s"
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodeId
,
taosIpStr
(
tsMnodeInfos
.
nodeInfos
[
i
].
nodeIp
),
tsMnodeInfos
.
nodeInfos
[
i
].
nodePort
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodeName
);
}
dnodeSaveMnodeInfos
();
sdbUpdateSync
();
}
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
)
{
void
dnodeSendMsgToMnode
(
SRpcMsg
*
rpcMsg
)
{
if
(
tsDnodeMClientRpc
)
{
if
(
tsDnodeMClientRpc
)
{
rpcSendRequest
(
tsDnodeMClientRpc
,
&
tsMnodeIp
Lis
t
,
rpcMsg
);
rpcSendRequest
(
tsDnodeMClientRpc
,
&
tsMnodeIp
Se
t
,
rpcMsg
);
}
}
}
}
static
bool
dnodeReadMnodeI
pList
()
{
static
bool
dnodeReadMnodeI
nfos
()
{
char
ipFile
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
ipFile
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
ipFile
,
"%s/mgmtIpList.json"
,
tsDnodeDir
);
sprintf
(
ipFile
,
"%s/mgmtIpList.json"
,
tsDnodeDir
);
FILE
*
fp
=
fopen
(
ipFile
,
"r"
);
FILE
*
fp
=
fopen
(
ipFile
,
"r"
);
...
@@ -272,6 +284,13 @@ static bool dnodeReadMnodeIpList() {
...
@@ -272,6 +284,13 @@ static bool dnodeReadMnodeIpList() {
}
}
tsMnodeInfos
.
nodeInfos
[
i
].
nodePort
=
(
uint16_t
)
nodePort
->
valueint
;
tsMnodeInfos
.
nodeInfos
[
i
].
nodePort
=
(
uint16_t
)
nodePort
->
valueint
;
cJSON
*
syncPort
=
cJSON_GetObjectItem
(
nodeInfo
,
"syncPort"
);
if
(
!
syncPort
||
syncPort
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read mnode mgmtIpList.json, syncPort not found"
);
goto
PARSE_OVER
;
}
tsMnodeInfos
.
nodeInfos
[
i
].
syncPort
=
(
uint16_t
)
syncPort
->
valueint
;
cJSON
*
nodeName
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeName"
);
cJSON
*
nodeName
=
cJSON_GetObjectItem
(
nodeInfo
,
"nodeName"
);
if
(
!
nodeIp
||
nodeName
->
type
!=
cJSON_String
||
nodeName
->
valuestring
==
NULL
)
{
if
(
!
nodeIp
||
nodeName
->
type
!=
cJSON_String
||
nodeName
->
valuestring
==
NULL
)
{
dError
(
"failed to read mnode mgmtIpList.json, nodeName not found"
);
dError
(
"failed to read mnode mgmtIpList.json, nodeName not found"
);
...
@@ -296,7 +315,7 @@ PARSE_OVER:
...
@@ -296,7 +315,7 @@ PARSE_OVER:
return
ret
;
return
ret
;
}
}
static
void
dnodeSaveMnodeI
pList
()
{
static
void
dnodeSaveMnodeI
nfos
()
{
char
ipFile
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
ipFile
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
ipFile
,
"%s/mgmtIpList.json"
,
tsDnodeDir
);
sprintf
(
ipFile
,
"%s/mgmtIpList.json"
,
tsDnodeDir
);
FILE
*
fp
=
fopen
(
ipFile
,
"w"
);
FILE
*
fp
=
fopen
(
ipFile
,
"w"
);
...
@@ -314,6 +333,7 @@ static void dnodeSaveMnodeIpList() {
...
@@ -314,6 +333,7 @@ static void dnodeSaveMnodeIpList() {
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeId
\"
: %d,
\n
"
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeId
\"
: %d,
\n
"
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeIp
\"
:
\"
%s
\"
,
\n
"
,
taosIpStr
(
tsMnodeInfos
.
nodeInfos
[
i
].
nodeIp
));
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeIp
\"
:
\"
%s
\"
,
\n
"
,
taosIpStr
(
tsMnodeInfos
.
nodeInfos
[
i
].
nodeIp
));
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodePort
\"
: %u,
\n
"
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodePort
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodePort
\"
: %u,
\n
"
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodePort
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
syncPort
\"
: %u,
\n
"
,
tsMnodeInfos
.
nodeInfos
[
i
].
syncPort
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeName
\"
:
\"
%s
\"\n
"
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodeName
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
nodeName
\"
:
\"
%s
\"\n
"
,
tsMnodeInfos
.
nodeInfos
[
i
].
nodeName
);
if
(
i
<
tsMnodeInfos
.
nodeNum
-
1
)
{
if
(
i
<
tsMnodeInfos
.
nodeNum
-
1
)
{
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" },{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
" },{
\n
"
);
...
@@ -331,10 +351,10 @@ static void dnodeSaveMnodeIpList() {
...
@@ -331,10 +351,10 @@ static void dnodeSaveMnodeIpList() {
}
}
uint32_t
dnodeGetMnodeMasteIp
()
{
uint32_t
dnodeGetMnodeMasteIp
()
{
return
tsMnodeIp
List
.
ip
[
tsMnodeIpLis
t
.
inUse
];
return
tsMnodeIp
Set
.
ip
[
tsMnodeIpSe
t
.
inUse
];
}
}
void
*
dnodeGetMnode
List
()
{
void
*
dnodeGetMnode
Infos
()
{
return
&
tsMnodeInfos
;
return
&
tsMnodeInfos
;
}
}
...
@@ -358,9 +378,9 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
...
@@ -358,9 +378,9 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
return
;
return
;
}
}
strcpy
(
pStatus
->
dnodeName
,
tsDnodeName
);
//
strcpy(pStatus->dnodeName, tsDnodeName);
pStatus
->
version
=
htonl
(
tsVersion
);
pStatus
->
version
=
htonl
(
tsVersion
);
pStatus
->
dnodeId
=
htonl
(
tsDnodeId
);
pStatus
->
dnodeId
=
htonl
(
tsDnode
Cfg
.
dnode
Id
);
pStatus
->
privateIp
=
htonl
(
inet_addr
(
tsPrivateIp
));
pStatus
->
privateIp
=
htonl
(
inet_addr
(
tsPrivateIp
));
pStatus
->
publicIp
=
htonl
(
inet_addr
(
tsPublicIp
));
pStatus
->
publicIp
=
htonl
(
inet_addr
(
tsPublicIp
));
pStatus
->
lastReboot
=
htonl
(
tsRebootTime
);
pStatus
->
lastReboot
=
htonl
(
tsRebootTime
);
...
@@ -382,47 +402,81 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
...
@@ -382,47 +402,81 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
dnodeSendMsgToMnode
(
&
rpcMsg
);
dnodeSendMsgToMnode
(
&
rpcMsg
);
}
}
static
void
dnodeReadDnodeInfo
()
{
static
bool
dnodeReadDnodeCfg
()
{
char
dnode
Id
File
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
dnode
Cfg
File
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
dnode
IdFile
,
"%s/dnodeId
"
,
tsDnodeDir
);
sprintf
(
dnode
CfgFile
,
"%s/dnodeCfg.json
"
,
tsDnodeDir
);
FILE
*
fp
=
fopen
(
dnodeIdFile
,
"r"
);
FILE
*
fp
=
fopen
(
dnodeCfgFile
,
"r"
);
if
(
!
fp
)
return
;
if
(
!
fp
)
{
dTrace
(
"failed to read dnodeCfg.json, file not exist"
);
return
false
;
}
char
option
[
32
]
=
{
0
};
bool
ret
=
false
;
int32_t
value
=
0
;
int
maxLen
=
100
;
int32_t
num
=
0
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
int
len
=
fread
(
content
,
1
,
maxLen
,
fp
);
if
(
len
<=
0
)
{
free
(
content
);
fclose
(
fp
);
dError
(
"failed to read dnodeCfg.json, content is null"
);
return
false
;
}
num
=
fscanf
(
fp
,
"%s %d"
,
option
,
&
value
);
cJSON
*
root
=
cJSON_Parse
(
content
);
if
(
num
!=
2
)
return
;
if
(
root
==
NULL
)
{
if
(
strcmp
(
option
,
"dnodeId"
)
!=
0
)
return
;
dError
(
"failed to read dnodeCfg.json, invalid json format"
);
tsDnodeId
=
value
;;
goto
PARSE_CFG_OVER
;
}
cJSON
*
dnodeId
=
cJSON_GetObjectItem
(
root
,
"dnodeId"
);
if
(
!
dnodeId
||
dnodeId
->
type
!=
cJSON_Number
)
{
dError
(
"failed to read dnodeCfg.json, dnodeId not found"
);
goto
PARSE_CFG_OVER
;
}
tsDnodeCfg
.
dnodeId
=
dnodeId
->
valueint
;
ret
=
true
;
dPrint
(
"read numOfVnodes successed, dnodeId:%d"
,
tsDnodeCfg
.
dnodeId
);
PARSE_CFG_OVER:
free
(
content
);
cJSON_Delete
(
root
);
fclose
(
fp
);
fclose
(
fp
);
dPrint
(
"read dnodeId:%d successed"
,
tsDnodeId
)
;
return
ret
;
}
}
static
void
dnodeSaveDnode
Info
()
{
static
void
dnodeSaveDnode
Cfg
()
{
char
dnode
Id
File
[
TSDB_FILENAME_LEN
]
=
{
0
};
char
dnode
Cfg
File
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
dnode
IdFile
,
"%s/dnodeId
"
,
tsDnodeDir
);
sprintf
(
dnode
CfgFile
,
"%s/dnodeCfg.json
"
,
tsDnodeDir
);
FILE
*
fp
=
fopen
(
dnode
Id
File
,
"w"
);
FILE
*
fp
=
fopen
(
dnode
Cfg
File
,
"w"
);
if
(
!
fp
)
return
;
if
(
!
fp
)
return
;
fprintf
(
fp
,
"dnodeId %d
\n
"
,
tsDnodeId
);
int32_t
len
=
0
;
int32_t
maxLen
=
100
;
char
*
content
=
calloc
(
1
,
maxLen
+
1
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"{
\n
"
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"
\"
dnodeId
\"
: %d
\n
"
,
tsDnodeCfg
.
dnodeId
);
len
+=
snprintf
(
content
+
len
,
maxLen
-
len
,
"}
\n
"
);
fwrite
(
content
,
1
,
len
,
fp
);
fclose
(
fp
);
fclose
(
fp
);
free
(
content
);
dPrint
(
"save dnodeId successed"
);
dPrint
(
"save dnodeId successed"
);
}
}
void
dnodeUpdateDnode
Info
(
int32_t
dnodeId
)
{
void
dnodeUpdateDnode
Cfg
(
SDMDnodeCfg
*
pCfg
)
{
if
(
tsDnodeId
==
0
)
{
if
(
tsDnode
Cfg
.
dnode
Id
==
0
)
{
dPrint
(
"dnodeId is set to %d"
,
dnodeId
);
dPrint
(
"dnodeId is set to %d"
,
pCfg
->
dnodeId
);
tsDnode
Id
=
dnodeId
;
tsDnode
Cfg
.
dnodeId
=
pCfg
->
dnodeId
;
dnodeSaveDnode
Info
();
dnodeSaveDnode
Cfg
();
}
}
}
}
int32_t
dnodeGetDnodeId
()
{
int32_t
dnodeGetDnodeId
()
{
return
tsDnodeId
;
return
tsDnode
Cfg
.
dnode
Id
;
}
}
\ No newline at end of file
src/inc/dnode.h
浏览文件 @
84c3955a
...
@@ -43,7 +43,7 @@ void dnodeSendRpcWriteRsp(void *pVnode, void *param, int32_t code);
...
@@ -43,7 +43,7 @@ void dnodeSendRpcWriteRsp(void *pVnode, void *param, int32_t code);
bool
dnodeIsFirstDeploy
();
bool
dnodeIsFirstDeploy
();
uint32_t
dnodeGetMnodeMasteIp
();
uint32_t
dnodeGetMnodeMasteIp
();
void
*
dnodeGetMnode
List
();
void
*
dnodeGetMnode
Infos
();
int32_t
dnodeGetDnodeId
();
int32_t
dnodeGetDnodeId
();
#ifdef __cplusplus
#ifdef __cplusplus
...
...
src/inc/taosmsg.h
浏览文件 @
84c3955a
...
@@ -521,12 +521,6 @@ typedef struct {
...
@@ -521,12 +521,6 @@ typedef struct {
uint8_t
reserved
[
5
];
uint8_t
reserved
[
5
];
}
SVnodeLoad
;
}
SVnodeLoad
;
typedef
struct
{
uint32_t
vnode
;
uint8_t
accessState
;
uint8_t
reserved
[
3
];
}
SVnodeAccess
;
/*
/*
* NOTE: sizeof(SVnodeCfg) < TSDB_FILE_HEADER_LEN / 4
* NOTE: sizeof(SVnodeCfg) < TSDB_FILE_HEADER_LEN / 4
*/
*/
...
@@ -571,12 +565,30 @@ typedef struct {
...
@@ -571,12 +565,30 @@ typedef struct {
char
reserved
[
64
];
char
reserved
[
64
];
}
SVnodeStatisticInfo
;
}
SVnodeStatisticInfo
;
typedef
struct
{
int32_t
vgId
;
int8_t
accessState
;
}
SDMVgroupAccess
;
typedef
struct
{
typedef
struct
{
int32_t
dnodeId
;
int32_t
dnodeId
;
uint32_t
moduleStatus
;
uint32_t
moduleStatus
;
uint32_t
createdTime
;
uint32_t
numOfVnodes
;
uint32_t
numOfVnodes
;
}
SDnodeState
;
}
SDMDnodeCfg
;
typedef
struct
{
int32_t
nodeId
;
uint32_t
nodeIp
;
uint16_t
nodePort
;
uint16_t
syncPort
;
char
nodeName
[
TSDB_NODE_NAME_LEN
+
1
];
}
SDMMnodeInfo
;
typedef
struct
{
int8_t
inUse
;
int8_t
nodeNum
;
SDMMnodeInfo
nodeInfos
[
TSDB_MAX_MPEERS
];
}
SDMMnodeInfos
;
typedef
struct
{
typedef
struct
{
uint32_t
version
;
uint32_t
version
;
...
@@ -596,22 +608,9 @@ typedef struct {
...
@@ -596,22 +608,9 @@ typedef struct {
}
SDMStatusMsg
;
}
SDMStatusMsg
;
typedef
struct
{
typedef
struct
{
int32_t
nodeId
;
SDMMnodeInfos
mnodes
;
uint32_t
nodeIp
;
SDMDnodeCfg
dnodeCfg
;
uint16_t
nodePort
;
SDMVgroupAccess
vgAccess
[];
char
nodeName
[
TSDB_NODE_NAME_LEN
+
1
];
}
SDMNodeInfo
;
typedef
struct
{
int8_t
inUse
;
int8_t
nodeNum
;
SDMNodeInfo
nodeInfos
[
TSDB_MAX_MPEERS
];
}
SDMNodeInfos
;
typedef
struct
{
SDMNodeInfos
mnodes
;
SDnodeState
dnodeState
;
SVnodeAccess
vnodeAccess
[];
}
SDMStatusRsp
;
}
SDMStatusRsp
;
typedef
struct
{
typedef
struct
{
...
...
src/inc/tsync.h
浏览文件 @
84c3955a
...
@@ -104,10 +104,10 @@ extern char *syncRole[];
...
@@ -104,10 +104,10 @@ extern char *syncRole[];
extern
int
tsMaxSyncNum
;
extern
int
tsMaxSyncNum
;
extern
int
tsSyncTcpThreads
;
extern
int
tsSyncTcpThreads
;
extern
int
tsMaxWatchFiles
;
extern
int
tsMaxWatchFiles
;
extern
short
tsSyncPort
;
extern
int
tsSyncTimer
;
extern
int
tsSyncTimer
;
extern
int
tsMaxFwdInfo
;
extern
int
tsMaxFwdInfo
;
extern
int
sDebugFlag
;
extern
int
sDebugFlag
;
extern
uint16_t
tsSyncPort
;
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/mnode/inc/mgmtMnode.h
浏览文件 @
84c3955a
...
@@ -41,7 +41,7 @@ void mgmtReleaseMnode(struct SMnodeObj *pMnode);
...
@@ -41,7 +41,7 @@ void mgmtReleaseMnode(struct SMnodeObj *pMnode);
char
*
mgmtGetMnodeRoleStr
();
char
*
mgmtGetMnodeRoleStr
();
void
mgmtGetMnodeIpList
(
SRpcIpSet
*
ipSet
,
bool
usePublicIp
);
void
mgmtGetMnodeIpList
(
SRpcIpSet
*
ipSet
,
bool
usePublicIp
);
void
mgmtGetMnode
List
(
void
*
mnodes
);
void
mgmtGetMnode
Infos
(
void
*
mnodes
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
src/mnode/src/mgmtDnode.c
浏览文件 @
84c3955a
...
@@ -68,7 +68,7 @@ static int32_t mgmtDnodeActionInsert(SSdbOper *pOper) {
...
@@ -68,7 +68,7 @@ static int32_t mgmtDnodeActionInsert(SSdbOper *pOper) {
pDnode
->
mnodeDnodePort
=
tsMnodeDnodePort
;
pDnode
->
mnodeDnodePort
=
tsMnodeDnodePort
;
pDnode
->
dnodeShellPort
=
tsDnodeShellPort
;
pDnode
->
dnodeShellPort
=
tsDnodeShellPort
;
pDnode
->
dnodeMnodePort
=
tsDnodeMnodePort
;
pDnode
->
dnodeMnodePort
=
tsDnodeMnodePort
;
pDnode
->
syncPort
=
0
;
pDnode
->
syncPort
=
tsSyncPort
;
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
...
@@ -346,19 +346,18 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
...
@@ -346,19 +346,18 @@ void mgmtProcessDnodeStatusMsg(SRpcMsg *rpcMsg) {
mgmtReleaseDnode
(
pDnode
);
mgmtReleaseDnode
(
pDnode
);
int32_t
contLen
=
sizeof
(
SDMStatusRsp
)
+
TSDB_MAX_VNODES
*
sizeof
(
S
Vnode
Access
);
int32_t
contLen
=
sizeof
(
SDMStatusRsp
)
+
TSDB_MAX_VNODES
*
sizeof
(
S
DMVgroup
Access
);
SDMStatusRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
SDMStatusRsp
*
pRsp
=
rpcMallocCont
(
contLen
);
if
(
pRsp
==
NULL
)
{
if
(
pRsp
==
NULL
)
{
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_SERV_OUT_OF_MEMORY
);
mgmtSendSimpleResp
(
rpcMsg
->
handle
,
TSDB_CODE_SERV_OUT_OF_MEMORY
);
return
;
return
;
}
}
mgmtGetMnode
List
(
&
pRsp
->
mnodes
);
mgmtGetMnode
Infos
(
&
pRsp
->
mnodes
);
pRsp
->
dnodeState
.
dnodeId
=
htonl
(
pDnode
->
dnodeId
);
pRsp
->
dnodeCfg
.
dnodeId
=
htonl
(
pDnode
->
dnodeId
);
pRsp
->
dnodeState
.
moduleStatus
=
htonl
((
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeCfg
.
moduleStatus
=
htonl
((
int32_t
)
pDnode
->
isMgmt
);
pRsp
->
dnodeState
.
createdTime
=
htonl
(
pDnode
->
createdTime
/
1000
);
pRsp
->
dnodeCfg
.
numOfVnodes
=
0
;
pRsp
->
dnodeState
.
numOfVnodes
=
0
;
contLen
=
sizeof
(
SDMStatusRsp
);
contLen
=
sizeof
(
SDMStatusRsp
);
...
...
src/mnode/src/mgmtMnode.c
浏览文件 @
84c3955a
...
@@ -195,8 +195,8 @@ void mgmtGetMnodeIpList(SRpcIpSet *ipSet, bool usePublicIp) {
...
@@ -195,8 +195,8 @@ void mgmtGetMnodeIpList(SRpcIpSet *ipSet, bool usePublicIp) {
}
}
}
}
void
mgmtGetMnode
List
(
void
*
param
)
{
void
mgmtGetMnode
Infos
(
void
*
param
)
{
SDM
N
odeInfos
*
mnodes
=
param
;
SDM
Mn
odeInfos
*
mnodes
=
param
;
mnodes
->
inUse
=
0
;
mnodes
->
inUse
=
0
;
int32_t
index
=
0
;
int32_t
index
=
0
;
...
@@ -209,6 +209,7 @@ void mgmtGetMnodeList(void *param) {
...
@@ -209,6 +209,7 @@ void mgmtGetMnodeList(void *param) {
mnodes
->
nodeInfos
[
index
].
nodeId
=
htonl
(
pMnode
->
mnodeId
);
mnodes
->
nodeInfos
[
index
].
nodeId
=
htonl
(
pMnode
->
mnodeId
);
mnodes
->
nodeInfos
[
index
].
nodeIp
=
htonl
(
pMnode
->
pDnode
->
privateIp
);
mnodes
->
nodeInfos
[
index
].
nodeIp
=
htonl
(
pMnode
->
pDnode
->
privateIp
);
mnodes
->
nodeInfos
[
index
].
nodePort
=
htons
(
pMnode
->
pDnode
->
mnodeDnodePort
);
mnodes
->
nodeInfos
[
index
].
nodePort
=
htons
(
pMnode
->
pDnode
->
mnodeDnodePort
);
mnodes
->
nodeInfos
[
index
].
syncPort
=
htons
(
pMnode
->
pDnode
->
syncPort
);
strcpy
(
mnodes
->
nodeInfos
[
index
].
nodeName
,
pMnode
->
pDnode
->
dnodeName
);
strcpy
(
mnodes
->
nodeInfos
[
index
].
nodeName
,
pMnode
->
pDnode
->
dnodeName
);
if
(
pMnode
->
role
==
TAOS_SYNC_ROLE_MASTER
)
{
if
(
pMnode
->
role
==
TAOS_SYNC_ROLE_MASTER
)
{
mnodes
->
inUse
=
index
;
mnodes
->
inUse
=
index
;
...
@@ -290,18 +291,18 @@ static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
...
@@ -290,18 +291,18 @@ static int32_t mgmtGetMnodeMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pCo
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create time"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pShow
->
bytes
[
cols
]
=
10
;
pShow
->
bytes
[
cols
]
=
10
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_BINARY
;
strcpy
(
pSchema
[
cols
].
name
,
"role"
);
strcpy
(
pSchema
[
cols
].
name
,
"role"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
cols
++
;
pShow
->
bytes
[
cols
]
=
8
;
pSchema
[
cols
].
type
=
TSDB_DATA_TYPE_TIMESTAMP
;
strcpy
(
pSchema
[
cols
].
name
,
"create time"
);
pSchema
[
cols
].
bytes
=
htons
(
pShow
->
bytes
[
cols
]);
cols
++
;
pMeta
->
numOfColumns
=
htons
(
cols
);
pMeta
->
numOfColumns
=
htons
(
cols
);
pShow
->
numOfColumns
=
cols
;
pShow
->
numOfColumns
=
cols
;
...
@@ -346,11 +347,11 @@ static int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, voi
...
@@ -346,11 +347,11 @@ static int32_t mgmtRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, voi
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
*
(
int64_t
*
)
pWrite
=
pMnode
->
createdTime
;
strcpy
(
pWrite
,
mgmtGetMnodeRoleStr
(
pMnode
->
role
))
;
cols
++
;
cols
++
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
pWrite
=
data
+
pShow
->
offset
[
cols
]
*
rows
+
pShow
->
bytes
[
cols
]
*
numOfRows
;
strcpy
(
pWrite
,
mgmtGetMnodeRoleStr
(
pMnode
->
role
))
;
*
(
int64_t
*
)
pWrite
=
pMnode
->
createdTime
;
cols
++
;
cols
++
;
numOfRows
++
;
numOfRows
++
;
...
...
src/mnode/src/mgmtSdb.c
浏览文件 @
84c3955a
...
@@ -146,7 +146,7 @@ static int32_t sdbInitWal() {
...
@@ -146,7 +146,7 @@ static int32_t sdbInitWal() {
}
}
sdbTrace
(
"open sdb wal for restore"
);
sdbTrace
(
"open sdb wal for restore"
);
walRestore
(
tsSdbObj
.
wal
,
&
tsSdbObj
,
sdbWrite
);
walRestore
(
tsSdbObj
.
wal
,
NULL
,
sdbWrite
);
return
0
;
return
0
;
}
}
...
@@ -174,12 +174,12 @@ void sdbUpdateMnodeRoles() {
...
@@ -174,12 +174,12 @@ void sdbUpdateMnodeRoles() {
SNodesRole
roles
=
{
0
};
SNodesRole
roles
=
{
0
};
syncGetNodesRole
(
tsSdbObj
.
sync
,
&
roles
);
syncGetNodesRole
(
tsSdbObj
.
sync
,
&
roles
);
m
Print
(
"update mnodes:%d sync roles"
,
tsSdbObj
.
cfg
.
replica
);
sdb
Print
(
"update mnodes:%d sync roles"
,
tsSdbObj
.
cfg
.
replica
);
for
(
int32_t
i
=
0
;
i
<
tsSdbObj
.
cfg
.
replica
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
tsSdbObj
.
cfg
.
replica
;
++
i
)
{
SMnodeObj
*
pMnode
=
mgmtGetMnode
(
roles
.
nodeId
[
i
]);
SMnodeObj
*
pMnode
=
mgmtGetMnode
(
roles
.
nodeId
[
i
]);
if
(
pMnode
!=
NULL
)
{
if
(
pMnode
!=
NULL
)
{
pMnode
->
role
=
roles
.
role
[
i
];
pMnode
->
role
=
roles
.
role
[
i
];
m
Print
(
"mnode:%d, role:%s"
,
pMnode
->
mnodeId
,
mgmtGetMnodeRoleStr
(
pMnode
->
role
));
sdb
Print
(
"mnode:%d, role:%s"
,
pMnode
->
mnodeId
,
mgmtGetMnodeRoleStr
(
pMnode
->
role
));
mgmtReleaseMnode
(
pMnode
);
mgmtReleaseMnode
(
pMnode
);
}
}
}
}
...
@@ -196,7 +196,7 @@ static int sdbGetWalInfo(void *ahandle, char *name, uint32_t *index) {
...
@@ -196,7 +196,7 @@ static int sdbGetWalInfo(void *ahandle, char *name, uint32_t *index) {
}
}
static
void
sdbNotifyRole
(
void
*
ahandle
,
int8_t
role
)
{
static
void
sdbNotifyRole
(
void
*
ahandle
,
int8_t
role
)
{
m
Print
(
"mnode role changed from %s to %s"
,
mgmtGetMnodeRoleStr
(
tsSdbObj
.
role
),
mgmtGetMnodeRoleStr
(
role
));
sdb
Print
(
"mnode role changed from %s to %s"
,
mgmtGetMnodeRoleStr
(
tsSdbObj
.
role
),
mgmtGetMnodeRoleStr
(
role
));
if
(
role
==
TAOS_SYNC_ROLE_MASTER
&&
tsSdbObj
.
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
if
(
role
==
TAOS_SYNC_ROLE_MASTER
&&
tsSdbObj
.
role
!=
TAOS_SYNC_ROLE_MASTER
)
{
balanceReset
();
balanceReset
();
...
@@ -208,8 +208,8 @@ static void sdbNotifyRole(void *ahandle, int8_t role) {
...
@@ -208,8 +208,8 @@ static void sdbNotifyRole(void *ahandle, int8_t role) {
static
void
sdbConfirmForward
(
void
*
ahandle
,
void
*
param
,
int32_t
code
)
{
static
void
sdbConfirmForward
(
void
*
ahandle
,
void
*
param
,
int32_t
code
)
{
tsSdbObj
.
code
=
code
;
tsSdbObj
.
code
=
code
;
sdbTrace
(
"sdb forward request confirmed, result:%s"
,
tstrerror
(
code
));
sem_post
(
&
tsSdbObj
.
sem
);
sem_post
(
&
tsSdbObj
.
sem
);
mPrint
(
"sdb forward request confirmed, result:%s"
,
tstrerror
(
code
));
}
}
static
int32_t
sdbForwardToPeer
(
void
*
pHead
)
{
static
int32_t
sdbForwardToPeer
(
void
*
pHead
)
{
...
@@ -227,9 +227,9 @@ void sdbUpdateSync() {
...
@@ -227,9 +227,9 @@ void sdbUpdateSync() {
SSyncCfg
syncCfg
=
{
0
};
SSyncCfg
syncCfg
=
{
0
};
int32_t
index
=
0
;
int32_t
index
=
0
;
SDM
NodeInfos
*
mnodes
=
dnodeGetMnodeList
();
SDM
MnodeInfos
*
mnodes
=
dnodeGetMnodeInfos
();
for
(
int32_t
i
=
0
;
i
<
mnodes
->
nodeNum
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
mnodes
->
nodeNum
;
++
i
)
{
SDM
N
odeInfo
*
node
=
&
mnodes
->
nodeInfos
[
i
];
SDM
Mn
odeInfo
*
node
=
&
mnodes
->
nodeInfos
[
i
];
syncCfg
.
nodeInfo
[
i
].
nodeId
=
node
->
nodeId
;
syncCfg
.
nodeInfo
[
i
].
nodeId
=
node
->
nodeId
;
syncCfg
.
nodeInfo
[
i
].
nodeIp
=
node
->
nodeIp
;
syncCfg
.
nodeInfo
[
i
].
nodeIp
=
node
->
nodeIp
;
strcpy
(
syncCfg
.
nodeInfo
[
i
].
name
,
node
->
nodeName
);
strcpy
(
syncCfg
.
nodeInfo
[
i
].
name
,
node
->
nodeName
);
...
@@ -271,9 +271,9 @@ void sdbUpdateSync() {
...
@@ -271,9 +271,9 @@ void sdbUpdateSync() {
if
(
!
hasThisDnode
)
return
;
if
(
!
hasThisDnode
)
return
;
if
(
memcmp
(
&
syncCfg
,
&
tsSdbObj
.
cfg
,
sizeof
(
SSyncCfg
))
==
0
)
return
;
if
(
memcmp
(
&
syncCfg
,
&
tsSdbObj
.
cfg
,
sizeof
(
SSyncCfg
))
==
0
)
return
;
m
Print
(
"work as mnode, replica:%d arbitratorIp:%s"
,
syncCfg
.
replica
,
taosIpStr
(
syncCfg
.
arbitratorIp
));
sdb
Print
(
"work as mnode, replica:%d arbitratorIp:%s"
,
syncCfg
.
replica
,
taosIpStr
(
syncCfg
.
arbitratorIp
));
for
(
int32_t
i
=
0
;
i
<
syncCfg
.
replica
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
syncCfg
.
replica
;
++
i
)
{
m
Print
(
"mnode:%d, ip:%s name:%s"
,
syncCfg
.
nodeInfo
[
i
].
nodeId
,
taosIpStr
(
syncCfg
.
nodeInfo
[
i
].
nodeIp
),
sdb
Print
(
"mnode:%d, ip:%s name:%s"
,
syncCfg
.
nodeInfo
[
i
].
nodeId
,
taosIpStr
(
syncCfg
.
nodeInfo
[
i
].
nodeIp
),
syncCfg
.
nodeInfo
[
i
].
name
);
syncCfg
.
nodeInfo
[
i
].
name
);
}
}
...
@@ -476,9 +476,13 @@ static int sdbWrite(void *param, void *data, int type) {
...
@@ -476,9 +476,13 @@ static int sdbWrite(void *param, void *data, int type) {
pthread_mutex_unlock
(
&
tsSdbObj
.
mutex
);
pthread_mutex_unlock
(
&
tsSdbObj
.
mutex
);
// from app, oper is created
// from app, oper is created
if
(
param
==
NULL
)
return
code
;
if
(
param
!=
NULL
)
return
code
;
// from wal or forward msg, should create oper
if
(
tsSdbObj
.
sync
!=
NULL
)
{
syncConfirmForward
(
tsSdbObj
.
sync
,
pHead
->
version
,
code
);
}
// from wal, should create oper
if
(
action
==
SDB_ACTION_INSERT
)
{
if
(
action
==
SDB_ACTION_INSERT
)
{
SSdbOper
oper
=
{.
rowSize
=
pHead
->
len
,
.
rowData
=
pHead
->
cont
,
.
table
=
pTable
};
SSdbOper
oper
=
{.
rowSize
=
pHead
->
len
,
.
rowData
=
pHead
->
cont
,
.
table
=
pTable
};
code
=
(
*
pTable
->
decodeFp
)(
&
oper
);
code
=
(
*
pTable
->
decodeFp
)(
&
oper
);
...
@@ -529,7 +533,7 @@ int32_t sdbInsertRow(SSdbOper *pOper) {
...
@@ -529,7 +533,7 @@ int32_t sdbInsertRow(SSdbOper *pOper) {
(
*
pTable
->
encodeFp
)(
pOper
);
(
*
pTable
->
encodeFp
)(
pOper
);
pHead
->
len
=
pOper
->
rowSize
;
pHead
->
len
=
pOper
->
rowSize
;
int32_t
code
=
sdbWrite
(
NULL
,
pHead
,
pHead
->
msgType
);
int32_t
code
=
sdbWrite
(
pOper
,
pHead
,
pHead
->
msgType
);
taosFreeQitem
(
pHead
);
taosFreeQitem
(
pHead
);
if
(
code
<
0
)
return
code
;
if
(
code
<
0
)
return
code
;
}
}
...
@@ -571,7 +575,7 @@ int32_t sdbDeleteRow(SSdbOper *pOper) {
...
@@ -571,7 +575,7 @@ int32_t sdbDeleteRow(SSdbOper *pOper) {
pHead
->
msgType
=
pTable
->
tableId
*
10
+
SDB_ACTION_DELETE
;
pHead
->
msgType
=
pTable
->
tableId
*
10
+
SDB_ACTION_DELETE
;
memcpy
(
pHead
->
cont
,
pOper
->
pObj
,
rowSize
);
memcpy
(
pHead
->
cont
,
pOper
->
pObj
,
rowSize
);
int32_t
code
=
sdbWrite
(
NULL
,
pHead
,
pHead
->
msgType
);
int32_t
code
=
sdbWrite
(
pOper
,
pHead
,
pHead
->
msgType
);
taosFreeQitem
(
pHead
);
taosFreeQitem
(
pHead
);
if
(
code
<
0
)
return
code
;
if
(
code
<
0
)
return
code
;
}
}
...
@@ -602,7 +606,7 @@ int32_t sdbUpdateRow(SSdbOper *pOper) {
...
@@ -602,7 +606,7 @@ int32_t sdbUpdateRow(SSdbOper *pOper) {
(
*
pTable
->
encodeFp
)(
pOper
);
(
*
pTable
->
encodeFp
)(
pOper
);
pHead
->
len
=
pOper
->
rowSize
;
pHead
->
len
=
pOper
->
rowSize
;
int32_t
code
=
sdbWrite
(
NULL
,
pHead
,
pHead
->
msgType
);
int32_t
code
=
sdbWrite
(
pOper
,
pHead
,
pHead
->
msgType
);
taosFreeQitem
(
pHead
);
taosFreeQitem
(
pHead
);
if
(
code
<
0
)
return
code
;
if
(
code
<
0
)
return
code
;
}
}
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
84c3955a
...
@@ -49,6 +49,7 @@ int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle) { return
...
@@ -49,6 +49,7 @@ int syncForwardToPeer(tsync_h shandle, void *pHead, void *mhandle) { return
void
syncStop
(
tsync_h
shandle
)
{}
void
syncStop
(
tsync_h
shandle
)
{}
int
syncReconfig
(
tsync_h
shandle
,
const
SSyncCfg
*
cfg
)
{
return
0
;
}
int
syncReconfig
(
tsync_h
shandle
,
const
SSyncCfg
*
cfg
)
{
return
0
;
}
int
syncGetNodesRole
(
tsync_h
shandle
,
SNodesRole
*
cfg
)
{
return
0
;
}
int
syncGetNodesRole
(
tsync_h
shandle
,
SNodesRole
*
cfg
)
{
return
0
;
}
void
syncConfirmForward
(
tsync_h
shandle
,
uint64_t
version
,
int32_t
code
)
{}
#endif
#endif
static
void
vnodeInit
()
{
static
void
vnodeInit
()
{
...
...
tests/script/general/account/testSuite.sim
浏览文件 @
84c3955a
run lite/account/pass_alter.sim
run general/account/pass_alter.sim
run lite/account/pass_len.sim
run general/account/pass_len.sim
run lite/account/user_create.sim
run general/account/user_create.sim
run lite/account/user_len.sim
run general/account/user_len.sim
run lite/account/monitor.sim
run general/account/monitor.sim
\ No newline at end of file
\ No newline at end of file
tests/script/general/agg/testSuite.sim
浏览文件 @
84c3955a
run lite/agg/fill.sim
run general/agg/fill.sim
run lite/agg/stream.sim
run general/agg/stream.sim
\ No newline at end of file
\ No newline at end of file
tests/script/general/alter/testSuite.sim
浏览文件 @
84c3955a
run lite/alter/count.sim
run general/alter/count.sim
run lite/alter/cached_schema_after_alter.sim
run general/alter/cached_schema_after_alter.sim
run lite/alter/import.sim
run general/alter/import.sim
run lite/alter/insert1.sim
run general/alter/insert1.sim
run lite/alter/insert2.sim
run general/alter/insert2.sim
run lite/alter/metrics.sim
run general/alter/metrics.sim
run lite/alter/table.sim
run general/alter/table.sim
\ No newline at end of file
\ No newline at end of file
tests/script/general/cache/testSuite.sim
浏览文件 @
84c3955a
run
lite
/cache/restart_table.sim
run
general
/cache/restart_table.sim
run
lite
/cache/restart_metrics.sim
run
general
/cache/restart_metrics.sim
run
lite
/cache/restart_stream.sim
run
general
/cache/restart_stream.sim
run
lite
/cache/new_metrics.sim
run
general
/cache/new_metrics.sim
run
lite
/cache/new_stream.sim
run
general
/cache/new_stream.sim
tests/script/general/compress/testSuite.sim
浏览文件 @
84c3955a
run
lite
/compress/compress.sim
run
general
/compress/compress.sim
run
lite
/compress/uncompress.sim
run
general
/compress/uncompress.sim
run
lite
/compress/commitlog.sim
run
general
/compress/commitlog.sim
run
lite
/compress/compress2.sim
run
general
/compress/compress2.sim
tests/script/general/compute/testSuite.sim
浏览文件 @
84c3955a
run
lite
/compute/count.sim
run
general
/compute/count.sim
run
lite
/compute/avg.sim
run
general
/compute/avg.sim
run
lite
/compute/sum.sim
run
general
/compute/sum.sim
run
lite
/compute/min.sim
run
general
/compute/min.sim
run
lite
/compute/max.sim
run
general
/compute/max.sim
run
lite
/compute/first.sim
run
general
/compute/first.sim
run
lite
/compute/last.sim
run
general
/compute/last.sim
run
lite
/compute/stddev.sim
run
general
/compute/stddev.sim
run
lite
/compute/leastsquare.sim
run
general
/compute/leastsquare.sim
run
lite
/compute/top.sim
run
general
/compute/top.sim
run
lite
/compute/bottom.sim
run
general
/compute/bottom.sim
run
lite
/compute/percentile.sim
run
general
/compute/percentile.sim
run
lite
/compute/diff.sim
run
general
/compute/diff.sim
run
lite
/compute/interval.sim
run
general
/compute/interval.sim
run
lite
/compute/null.sim
run
general
/compute/null.sim
run
lite
/compute/diff2.sim
run
general
/compute/diff2.sim
tests/script/general/field/testSuite.sim
浏览文件 @
84c3955a
run lite/field/single.sim
run general/field/single.sim
run lite/field/bool.sim
run general/field/bool.sim
run lite/field/smallint.sim
run general/field/smallint.sim
run lite/field/tinyint.sim
run general/field/tinyint.sim
run lite/field/int.sim
run general/field/int.sim
run lite/field/bigint.sim
run general/field/bigint.sim
run lite/field/float.sim
run general/field/float.sim
run lite/field/double.sim
run general/field/double.sim
run lite/field/binary.sim
run general/field/binary.sim
run lite/field/2.sim
run general/field/2.sim
run lite/field/3.sim
run general/field/3.sim
run lite/field/4.sim
run general/field/4.sim
run lite/field/5.sim
run general/field/5.sim
run lite/field/6.sim
run general/field/6.sim
\ No newline at end of file
\ No newline at end of file
tests/script/general/http/testSuite.sim
浏览文件 @
84c3955a
run
lite
/http/grafana.sim
run
general
/http/grafana.sim
run
lite
/http/restful.sim
run
general
/http/restful.sim
run
lite
/http/restful_full.sim
run
general
/http/restful_full.sim
run
lite
/http/telegraf.sim
run
general
/http/telegraf.sim
run
lite
/http/prepare.sim
run
general
/http/prepare.sim
run
lite
/http/grafana_bug.sim
run
general
/http/grafana_bug.sim
#run
lite
/http/opentsdb.sim
#run
general
/http/opentsdb.sim
tests/script/general/import/testSuite.sim
浏览文件 @
84c3955a
run
lite
/import/basic.sim
run
general
/import/basic.sim
#run
lite
/import/commit.sim
#run
general
/import/commit.sim
run
lite
/import/large.sim
run
general
/import/large.sim
run
lite
/import/replica1.sim
run
general
/import/replica1.sim
tests/script/general/metrics/testSuite.sim
浏览文件 @
84c3955a
run
lite
/metrics/disk.sim
run
general
/metrics/disk.sim
run
lite
/metrics/metrics.sim
run
general
/metrics/metrics.sim
run
lite
/metrics/values.sim
run
general
/metrics/values.sim
run
lite
/metrics/vnode3.sim
run
general
/metrics/vnode3.sim
tests/script/general/parser/testSuite.sim
浏览文件 @
84c3955a
run
lite
/parser/alter.sim
run
general
/parser/alter.sim
sleep 2000
sleep 2000
run
lite
/parser/alter1.sim
run
general
/parser/alter1.sim
sleep 2000
sleep 2000
run
lite
/parser/alter_stable.sim
run
general
/parser/alter_stable.sim
sleep 2000
sleep 2000
run
lite
/parser/auto_create_tb.sim
run
general
/parser/auto_create_tb.sim
sleep 2000
sleep 2000
run
lite
/parser/auto_create_tb_drop_tb.sim
run
general
/parser/auto_create_tb_drop_tb.sim
sleep 2000
sleep 2000
run
lite
/parser/col_arithmetic_operation.sim
run
general
/parser/col_arithmetic_operation.sim
sleep 2000
sleep 2000
run
lite
/parser/columnValue.sim
run
general
/parser/columnValue.sim
sleep 2000
sleep 2000
run
lite
/parser/commit.sim
run
general
/parser/commit.sim
run
lite
/parser/create_db.sim
run
general
/parser/create_db.sim
sleep 2000
sleep 2000
run
lite
/parser/create_mt.sim
run
general
/parser/create_mt.sim
sleep 2000
sleep 2000
run
lite
/parser/create_tb.sim
run
general
/parser/create_tb.sim
sleep 2000
sleep 2000
run
lite
/parser/dbtbnameValidate.sim
run
general
/parser/dbtbnameValidate.sim
sleep 2000
sleep 2000
run
lite
/parser/fill.sim
run
general
/parser/fill.sim
sleep 2000
sleep 2000
run
lite
/parser/fill_stb.sim
run
general
/parser/fill_stb.sim
sleep 2000
sleep 2000
run
lite
/parser/first_last.sim
run
general
/parser/first_last.sim
sleep 2000
sleep 2000
run
lite
/parser/import_commit1.sim
run
general
/parser/import_commit1.sim
sleep 2000
sleep 2000
run
lite
/parser/import_commit2.sim
run
general
/parser/import_commit2.sim
sleep 2000
sleep 2000
run
lite
/parser/import_commit3.sim
run
general
/parser/import_commit3.sim
sleep 2000
sleep 2000
run
lite
/parser/import_file.sim
run
general
/parser/import_file.sim
sleep 2000
sleep 2000
run
lite
/parser/insert_tb.sim
run
general
/parser/insert_tb.sim
sleep 2000
sleep 2000
run
lite
/parser/tags_dynamically_specifiy.sim
run
general
/parser/tags_dynamically_specifiy.sim
sleep 2000
sleep 2000
run
lite
/parser/interp.sim
run
general
/parser/interp.sim
run
lite
/parser/lastrow.sim
run
general
/parser/lastrow.sim
sleep 2000
sleep 2000
run
lite
/parser/limit.sim
run
general
/parser/limit.sim
sleep 2000
sleep 2000
run
lite
/parser/limit1.sim
run
general
/parser/limit1.sim
sleep 2000
sleep 2000
run
lite
/parser/limit1_tblocks100.sim
run
general
/parser/limit1_tblocks100.sim
sleep 2000
sleep 2000
run
lite
/parser/limit2.sim
run
general
/parser/limit2.sim
sleep 2000
sleep 2000
run
lite
/parser/mixed_blocks.sim
run
general
/parser/mixed_blocks.sim
sleep 2000
sleep 2000
run
lite
/parser/nchar.sim
run
general
/parser/nchar.sim
sleep 2000
sleep 2000
run
lite
/parser/null_char.sim
run
general
/parser/null_char.sim
sleep 2000
sleep 2000
run
lite
/parser/selectResNum.sim
run
general
/parser/selectResNum.sim
sleep 2000
sleep 2000
run
lite
/parser/select_across_vnodes.sim
run
general
/parser/select_across_vnodes.sim
sleep 2000
sleep 2000
run
lite
/parser/select_from_cache_disk.sim
run
general
/parser/select_from_cache_disk.sim
sleep 2000
sleep 2000
run
lite
/parser/set_tag_vals.sim
run
general
/parser/set_tag_vals.sim
sleep 2000
sleep 2000
run
lite
/parser/single_row_in_tb.sim
run
general
/parser/single_row_in_tb.sim
sleep 2000
sleep 2000
run
lite
/parser/slimit.sim
run
general
/parser/slimit.sim
sleep 2000
sleep 2000
run
lite
/parser/slimit1.sim
run
general
/parser/slimit1.sim
sleep 2000
sleep 2000
run
lite
/parser/slimit_alter_tags.sim
run
general
/parser/slimit_alter_tags.sim
sleep 2000
sleep 2000
run
lite
/parser/stream_on_sys.sim
run
general
/parser/stream_on_sys.sim
sleep 2000
sleep 2000
run
lite
/parser/stream.sim
run
general
/parser/stream.sim
sleep 2000
sleep 2000
run
lite
/parser/tbnameIn.sim
run
general
/parser/tbnameIn.sim
sleep 2000
sleep 2000
run
lite
/parser/where.sim
run
general
/parser/where.sim
sleep 2000
sleep 2000
#run
lite
/parser/repeatAlter.sim
#run
general
/parser/repeatAlter.sim
sleep 2000
sleep 2000
#run
lite
/parser/repeatStream.sim
#run
general
/parser/repeatStream.sim
sleep 2000
sleep 2000
run
lite
/parser/join.sim
run
general
/parser/join.sim
run
lite
/parser/join_multivnode.sim
run
general
/parser/join_multivnode.sim
run
lite
/parser/projection_limit_offset.sim
run
general
/parser/projection_limit_offset.sim
sleep 2000
sleep 2000
run
lite
/parser/select_with_tags.sim
run
general
/parser/select_with_tags.sim
run
lite
/parser/groupby.sim
run
general
/parser/groupby.sim
tests/script/general/stream/testSuite.sim
浏览文件 @
84c3955a
run lite/stream/stream_1.sim
run general/stream/stream_1.sim
run lite/stream/stream_2.sim
run general/stream/stream_2.sim
run lite/stream/stream_3.sim
run general/stream/stream_3.sim
run lite/stream/stream_restart.sim
run general/stream/stream_restart.sim
run lite/stream/table_1.sim
run general/stream/table_1.sim
run lite/stream/metrics_1.sim
run general/stream/metrics_1.sim
run lite/stream/table_n.sim
run general/stream/table_n.sim
run lite/stream/metrics_n.sim
run general/stream/metrics_n.sim
run lite/stream/table_del.sim
run general/stream/table_del.sim
run lite/stream/metrics_del.sim
run general/stream/metrics_del.sim
run lite/stream/table_replica1_vnoden.sim
run general/stream/table_replica1_vnoden.sim
run lite/stream/metrics_replica1_vnoden.sim
run general/stream/metrics_replica1_vnoden.sim
\ No newline at end of file
\ No newline at end of file
tests/script/general/tag/testSuite.sim
浏览文件 @
84c3955a
run lite/tag/filter.sim
run general/tag/filter.sim
run lite/tag/column.sim
run general/tag/column.sim
run lite/tag/bool.sim
run general/tag/bool.sim
run lite/tag/smallint.sim
run general/tag/smallint.sim
run lite/tag/tinyint.sim
run general/tag/tinyint.sim
run lite/tag/int.sim
run general/tag/int.sim
run lite/tag/bigint.sim
run general/tag/bigint.sim
run lite/tag/float.sim
run general/tag/float.sim
run lite/tag/double.sim
run general/tag/double.sim
run lite/tag/binary.sim
run general/tag/binary.sim
run lite/tag/bool_int.sim
run general/tag/bool_int.sim
run lite/tag/bool_binary.sim
run general/tag/bool_binary.sim
run lite/tag/int_float.sim
run general/tag/int_float.sim
run lite/tag/int_binary.sim
run general/tag/int_binary.sim
run lite/tag/binary_binary.sim
run general/tag/binary_binary.sim
run lite/tag/3.sim
run general/tag/3.sim
run lite/tag/4.sim
run general/tag/4.sim
run lite/tag/5.sim
run general/tag/5.sim
run lite/tag/6.sim
run general/tag/6.sim
run lite/tag/create.sim
run general/tag/create.sim
run lite/tag/delete.sim
run general/tag/delete.sim
run lite/tag/change.sim
run general/tag/change.sim
run lite/tag/set.sim
run general/tag/set.sim
run lite/tag/add.sim
run general/tag/add.sim
run lite/tag/commit.sim
run general/tag/commit.sim
\ No newline at end of file
\ No newline at end of file
tests/script/general/vector/testSuite.sim
浏览文件 @
84c3955a
run
lite
/vector/single.sim
run
general
/vector/single.sim
run
lite
/vector/multi.sim
run
general
/vector/multi.sim
run
lite
/vector/table_query.sim
run
general
/vector/table_query.sim
run
lite
/vector/table_time.sim
run
general
/vector/table_time.sim
run
lite
/vector/table_field.sim
run
general
/vector/table_field.sim
run
lite
/vector/table_mix.sim
run
general
/vector/table_mix.sim
run
lite
/vector/metrics_query.sim
run
general
/vector/metrics_query.sim
run
lite
/vector/metrics_tag.sim
run
general
/vector/metrics_tag.sim
run
lite
/vector/metrics_time.sim
run
general
/vector/metrics_time.sim
run
lite
/vector/metrics_field.sim
run
general
/vector/metrics_field.sim
run
lite
/vector/metrics_mix.sim
run
general
/vector/metrics_mix.sim
tests/script/sh/deploy.sh
浏览文件 @
84c3955a
...
@@ -93,7 +93,7 @@ echo "privateIp $NODE_IP" >> $TAOS_CFG
...
@@ -93,7 +93,7 @@ echo "privateIp $NODE_IP" >> $TAOS_CFG
echo
"dDebugFlag 199"
>>
$TAOS_CFG
echo
"dDebugFlag 199"
>>
$TAOS_CFG
echo
"mDebugFlag 199"
>>
$TAOS_CFG
echo
"mDebugFlag 199"
>>
$TAOS_CFG
echo
"sdbDebugFlag 199"
>>
$TAOS_CFG
echo
"sdbDebugFlag 199"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
5
"
>>
$TAOS_CFG
echo
"rpcDebugFlag 13
1
"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"tmrDebugFlag 131"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
echo
"cDebugFlag 135"
>>
$TAOS_CFG
echo
"httpDebugFlag 131"
>>
$TAOS_CFG
echo
"httpDebugFlag 131"
>>
$TAOS_CFG
...
...
tests/script/unique/account/testSuite.sim
浏览文件 @
84c3955a
run
cluster
/account/account_create.sim
run
unique
/account/account_create.sim
run
cluster
/account/account_len.sim
run
unique
/account/account_len.sim
run
cluster
/account/pass_alter.sim
run
unique
/account/pass_alter.sim
run
cluster
/account/pass_len.sim
run
unique
/account/pass_len.sim
run
cluster
/account/authority.sim
run
unique
/account/authority.sim
run
cluster
/account/account_delete.sim
run
unique
/account/account_delete.sim
run
cluster
/account/user_create.sim
run
unique
/account/user_create.sim
run
cluster
/account/user_len.sim
run
unique
/account/user_len.sim
run
cluster
/account/monitor.sim
run
unique
/account/monitor.sim
tests/script/unique/big/testSuite.sim
浏览文件 @
84c3955a
#run
cluster
/big/balance.sim
#run
unique
/big/balance.sim
#run
cluster
/big/maxvnodes.sim
#run
unique
/big/maxvnodes.sim
run
cluster
/big/tcp.sim
run
unique
/big/tcp.sim
tests/script/unique/cluster/testSuite.sim
浏览文件 @
84c3955a
run cluster/cluster/balance1.sim
run unique/unique/balance1.sim
run cluster/cluster/balance2.sim
run unique/unique/balance2.sim
run cluster/cluster/balance3.sim
run unique/unique/balance3.sim
run cluster/cluster/balance1_bug.sim
run unique/unique/balance1_bug.sim
run cluster/cluster/balance1_single.sim
run unique/unique/balance1_single.sim
\ No newline at end of file
\ No newline at end of file
tests/script/unique/column/testSuite.sim
浏览文件 @
84c3955a
run
cluster
/column/replica3.sim
run
unique
/column/replica3.sim
tests/script/unique/db/testSuite.sim
浏览文件 @
84c3955a
#run
cluster
/db/commit.sim
#run
unique
/db/commit.sim
run
cluster
/db/delete.sim
run
unique
/db/delete.sim
run
cluster
/db/replica_add12.sim
run
unique
/db/replica_add12.sim
run
cluster
/db/replica_add13.sim
run
unique
/db/replica_add13.sim
run
cluster
/db/replica_add23.sim
run
unique
/db/replica_add23.sim
run
cluster
/db/replica_reduce21.sim
run
unique
/db/replica_reduce21.sim
run
cluster
/db/replica_reduce32.sim
run
unique
/db/replica_reduce32.sim
run
cluster
/db/replica_reduce31.sim
run
unique
/db/replica_reduce31.sim
run
cluster
/db/replica_part.sim
run
unique
/db/replica_part.sim
run
cluster
/db/delete_part.sim
run
unique
/db/delete_part.sim
tests/script/unique/dnode/testSuite.sim
浏览文件 @
84c3955a
run
cluster
/dnode/balance1.sim
run
unique
/dnode/balance1.sim
run
cluster
/dnode/balance2.sim
run
unique
/dnode/balance2.sim
run
cluster
/dnode/balance3.sim
run
unique
/dnode/balance3.sim
run
cluster
/dnode/balancex.sim
run
unique
/dnode/balancex.sim
run
cluster
/dnode/offline1.sim
run
unique
/dnode/offline1.sim
run
cluster
/dnode/offline2.sim
run
unique
/dnode/offline2.sim
run
cluster
/dnode/remove1.sim
run
unique
/dnode/remove1.sim
run
cluster
/dnode/remove2.sim
run
unique
/dnode/remove2.sim
run
cluster
/dnode/vnode_clean.sim
run
unique
/dnode/vnode_clean.sim
...
...
tests/script/unique/http/testSuite.sim
浏览文件 @
84c3955a
run cluster/http/admin.sim
run unique/http/admin.sim
\ No newline at end of file
\ No newline at end of file
tests/script/unique/import/testSuite.sim
浏览文件 @
84c3955a
run cluster/import/replica2.sim
run unique/import/replica2.sim
run cluster/import/replica3.sim
run unique/import/replica3.sim
\ No newline at end of file
\ No newline at end of file
tests/script/unique/metrics/testSuite.sim
浏览文件 @
84c3955a
run cluster/metrics/disk.sim
run unique/metrics/disk.sim
run cluster/metrics/metrics.sim
run unique/metrics/metrics.sim
run cluster/metrics/values.sim
run unique/metrics/values.sim
run cluster/metrics/vnode3.sim
run unique/metrics/vnode3.sim
\ No newline at end of file
\ No newline at end of file
tests/script/unique/mnode/mgmt22.sim
浏览文件 @
84c3955a
...
@@ -17,7 +17,7 @@ system sh/cfg.sh -n dnode2 -c secondIp -v 192.168.0.2
...
@@ -17,7 +17,7 @@ system sh/cfg.sh -n dnode2 -c secondIp -v 192.168.0.2
system sh/cfg.sh -n dnode3 -c secondIp -v 192.168.0.2
system sh/cfg.sh -n dnode3 -c secondIp -v 192.168.0.2
print ============== step1
print ============== step1
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sleep 3000
sleep 3000
sql connect
sql connect
...
@@ -29,7 +29,7 @@ if $data3_192.168.0.1 != master then
...
@@ -29,7 +29,7 @@ if $data3_192.168.0.1 != master then
endi
endi
print ============== step2
print ============== step2
system sh/exec.sh -n dnode2 -s start
system sh/exec
_up
.sh -n dnode2 -s start
sql create dnode 192.168.0.2
sql create dnode 192.168.0.2
$x = 0
$x = 0
...
@@ -57,7 +57,7 @@ sql drop dnode 192.168.0.1 -x error1
...
@@ -57,7 +57,7 @@ sql drop dnode 192.168.0.1 -x error1
error1:
error1:
print ============== step4
print ============== step4
system sh/exec.sh -n dnode1 -s stop
system sh/exec
_up
.sh -n dnode1 -s stop
sleep 8000
sleep 8000
$x = 0
$x = 0
...
@@ -105,7 +105,7 @@ system sh/deploy.sh -n dnode1 -m 192.168.0.2 -i 192.168.0.1
...
@@ -105,7 +105,7 @@ system sh/deploy.sh -n dnode1 -m 192.168.0.2 -i 192.168.0.1
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2
system sh/cfg.sh -n dnode1 -c numOfMPeers -v 2
system sh/cfg.sh -n dnode1 -c secondIp -v 192.168.0.1
system sh/cfg.sh -n dnode1 -c secondIp -v 192.168.0.1
system sh/exec.sh -n dnode1 -s start
system sh/exec
_up
.sh -n dnode1 -s start
sql create dnode 192.168.0.1
sql create dnode 192.168.0.1
sleep 5000
sleep 5000
...
@@ -128,7 +128,7 @@ if $data3_192.168.0.2 != master then
...
@@ -128,7 +128,7 @@ if $data3_192.168.0.2 != master then
endi
endi
print ============== step7
print ============== step7
system sh/exec.sh -n dnode3 -s start
system sh/exec
_up
.sh -n dnode3 -s start
sql create dnode 192.168.0.3
sql create dnode 192.168.0.3
sleep 5000
sleep 5000
...
...
tests/script/unique/mnode/testSuite.sim
浏览文件 @
84c3955a
run
cluster
/mnode/mgmt22.sim
run
unique
/mnode/mgmt22.sim
run
cluster
/mnode/mgmt23.sim
run
unique
/mnode/mgmt23.sim
run
cluster
/mnode/mgmt24.sim
run
unique
/mnode/mgmt24.sim
run
cluster
/mnode/mgmt25.sim
run
unique
/mnode/mgmt25.sim
run
cluster
/mnode/mgmt26.sim
run
unique
/mnode/mgmt26.sim
run
cluster
/mnode/mgmt33.sim
run
unique
/mnode/mgmt33.sim
run
cluster
/mnode/mgmt34.sim
run
unique
/mnode/mgmt34.sim
run
cluster
/mnode/mgmtr1.sim
run
unique
/mnode/mgmtr1.sim
run
cluster
/mnode/mgmtr2.sim
run
unique
/mnode/mgmtr2.sim
run
cluster
/mnode/drop.sim
run
unique
/mnode/drop.sim
run
cluster
/mnode/reuse.sim
run
unique
/mnode/reuse.sim
run
cluster
/mnode/secondIp.sim
run
unique
/mnode/secondIp.sim
tests/script/unique/stream/testSuite.sim
浏览文件 @
84c3955a
run cluster/stream/table_replica1_dnode2.sim
run unique/stream/table_replica1_dnode2.sim
run cluster/stream/metrics_replica1_dnode2.sim
run unique/stream/metrics_replica1_dnode2.sim
run cluster/stream/table_replica2_dnode2.sim
run unique/stream/table_replica2_dnode2.sim
run cluster/stream/metrics_replica2_dnode2.sim
run unique/stream/metrics_replica2_dnode2.sim
run cluster/stream/table_replica2_dnode2_vnoden.sim
run unique/stream/table_replica2_dnode2_vnoden.sim
run cluster/stream/metrics_replica2_dnode2_vnoden.sim
run unique/stream/metrics_replica2_dnode2_vnoden.sim
run cluster/stream/table_replica2_dnode3.sim
run unique/stream/table_replica2_dnode3.sim
run cluster/stream/metrics_replica2_dnode3.sim
run unique/stream/metrics_replica2_dnode3.sim
run cluster/stream/table_replica3_dnode4.sim
run unique/stream/table_replica3_dnode4.sim
run cluster/stream/metrics_replica3_dnode4.sim
run unique/stream/metrics_replica3_dnode4.sim
run cluster/stream/table_vnode_stop.sim
run unique/stream/table_vnode_stop.sim
run cluster/stream/metrics_vnode_stop.sim
run unique/stream/metrics_vnode_stop.sim
#run cluster/stream/table_balance.sim
#run unique/stream/table_balance.sim
#run cluster/stream/metrics_balance.sim
#run unique/stream/metrics_balance.sim
#run cluster/stream/table_move.sim
#run unique/stream/table_move.sim
\ No newline at end of file
\ No newline at end of file
tests/script/unique/table/testSuite.sim
浏览文件 @
84c3955a
run
cluster
/table/delete_part.sim
run
unique
/table/delete_part.sim
tests/script/unique/vnode/testSuite.sim
浏览文件 @
84c3955a
run
cluster
/vnode/replica2_basic2.sim
run
unique
/vnode/replica2_basic2.sim
run
cluster
/vnode/replica2_basic.sim
run
unique
/vnode/replica2_basic.sim
run
cluster
/vnode/replica2_repeat.sim
run
unique
/vnode/replica2_repeat.sim
run
cluster
/vnode/replica3_basic.sim
run
unique
/vnode/replica3_basic.sim
run
cluster
/vnode/replica3_repeat.sim
run
unique
/vnode/replica3_repeat.sim
run
cluster
/vnode/commit.sim
run
unique
/vnode/commit.sim
run
cluster
/vnode/many.sim
run
unique
/vnode/many.sim
tests/script/uniqueSuite.sim
0 → 100644
浏览文件 @
84c3955a
#################################
run unique/mnode/testSuite.sim
##################################
tests/test/c/importOneRow.c
浏览文件 @
84c3955a
...
@@ -66,9 +66,9 @@ void shellParseArgument(int argc, char *argv[]) {
...
@@ -66,9 +66,9 @@ void shellParseArgument(int argc, char *argv[]) {
}
}
}
}
u
Print
(
"%s rowNum:%d %s"
,
GREEN
,
rowNum
,
NC
);
p
Print
(
"%s rowNum:%d %s"
,
GREEN
,
rowNum
,
NC
);
u
Print
(
"%s threadNum:%d %s"
,
GREEN
,
threadNum
,
NC
);
p
Print
(
"%s threadNum:%d %s"
,
GREEN
,
threadNum
,
NC
);
u
Print
(
"%s replica:%d %s"
,
GREEN
,
replica
,
NC
);
p
Print
(
"%s replica:%d %s"
,
GREEN
,
replica
,
NC
);
}
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
...
...
tests/test/c/importPerTabe.c
浏览文件 @
84c3955a
...
@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
...
@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
}
}
void
createDbAndTable
()
{
void
createDbAndTable
()
{
u
Print
(
"start to create table"
);
p
Print
(
"start to create table"
);
TAOS
*
con
;
TAOS
*
con
;
struct
timeval
systemTime
;
struct
timeval
systemTime
;
...
@@ -70,19 +70,19 @@ void createDbAndTable() {
...
@@ -70,19 +70,19 @@ void createDbAndTable() {
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
if
(
con
==
NULL
)
{
if
(
con
==
NULL
)
{
u
Error
(
"failed to connect to DB, reason:%s"
,
taos_errstr
(
con
));
p
Error
(
"failed to connect to DB, reason:%s"
,
taos_errstr
(
con
));
exit
(
1
);
exit
(
1
);
}
}
sprintf
(
qstr
,
"create database if not exists %s cache %d tables %d"
,
dbName
,
cache
,
tables
);
sprintf
(
qstr
,
"create database if not exists %s cache %d tables %d"
,
dbName
,
cache
,
tables
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create database:%s, code:%d reason:%s"
,
dbName
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to create database:%s, code:%d reason:%s"
,
dbName
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
sprintf
(
qstr
,
"use %s"
,
dbName
);
sprintf
(
qstr
,
"use %s"
,
dbName
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to use db, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to use db, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
...
@@ -98,14 +98,14 @@ void createDbAndTable() {
...
@@ -98,14 +98,14 @@ void createDbAndTable() {
sprintf
(
qstr
+
len
,
") tags(t int)"
);
sprintf
(
qstr
+
len
,
") tags(t int)"
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create stable, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to create stable, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
for
(
int64_t
t
=
0
;
t
<
totalTables
;
++
t
)
{
for
(
int64_t
t
=
0
;
t
<
totalTables
;
++
t
)
{
sprintf
(
qstr
,
"create table if not exists %s%ld using %s tags(%ld)"
,
stableName
,
t
,
stableName
,
t
);
sprintf
(
qstr
,
"create table if not exists %s%ld using %s tags(%ld)"
,
stableName
,
t
,
stableName
,
t
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
p
Error
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -118,7 +118,7 @@ void createDbAndTable() {
...
@@ -118,7 +118,7 @@ void createDbAndTable() {
sprintf
(
qstr
+
len
,
")"
);
sprintf
(
qstr
+
len
,
")"
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create table %s%ld, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
p
Error
(
"failed to create table %s%ld, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -126,7 +126,7 @@ void createDbAndTable() {
...
@@ -126,7 +126,7 @@ void createDbAndTable() {
gettimeofday
(
&
systemTime
,
NULL
);
gettimeofday
(
&
systemTime
,
NULL
);
et
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
et
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
u
Print
(
"%.1f seconds to create %ld tables"
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
);
p
Print
(
"%.1f seconds to create %ld tables"
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
);
}
}
void
insertData
()
{
void
insertData
()
{
...
@@ -136,7 +136,7 @@ void insertData() {
...
@@ -136,7 +136,7 @@ void insertData() {
gettimeofday
(
&
systemTime
,
NULL
);
gettimeofday
(
&
systemTime
,
NULL
);
st
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
st
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
u
Print
(
"%d threads are spawned to import data"
,
numOfThreads
);
p
Print
(
"%d threads are spawned to import data"
,
numOfThreads
);
pthread_attr_t
thattr
;
pthread_attr_t
thattr
;
pthread_attr_init
(
&
thattr
);
pthread_attr_init
(
&
thattr
);
...
@@ -170,12 +170,12 @@ void insertData() {
...
@@ -170,12 +170,12 @@ void insertData() {
double
speedOfRows
=
totalRows
/
seconds
;
double
speedOfRows
=
totalRows
/
seconds
;
double
speedOfPoints
=
totalPoints
/
seconds
;
double
speedOfPoints
=
totalPoints
/
seconds
;
u
Print
(
p
Print
(
"%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf "
"%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf "
"PointsPerSecond:%.1lf%s"
,
"PointsPerSecond:%.1lf%s"
,
GREEN
,
numOfThreads
,
seconds
,
totalTables
,
totalRows
,
totalPoints
,
speedOfRows
,
speedOfPoints
,
NC
);
GREEN
,
numOfThreads
,
seconds
,
totalTables
,
totalRows
,
totalPoints
,
speedOfRows
,
speedOfPoints
,
NC
);
u
Print
(
"threads exit"
);
p
Print
(
"threads exit"
);
pthread_attr_destroy
(
&
thattr
);
pthread_attr_destroy
(
&
thattr
);
free
(
pInfo
);
free
(
pInfo
);
...
@@ -189,11 +189,11 @@ void *syncTest(void *param) {
...
@@ -189,11 +189,11 @@ void *syncTest(void *param) {
char
qstr
[
65000
];
char
qstr
[
65000
];
int
maxBytes
=
60000
;
int
maxBytes
=
60000
;
u
Print
(
"thread:%d, start to run"
,
pInfo
->
threadIndex
);
p
Print
(
"thread:%d, start to run"
,
pInfo
->
threadIndex
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
if
(
con
==
NULL
)
{
if
(
con
==
NULL
)
{
u
Error
(
"index:%d, failed to connect to DB, reason:%s"
,
pInfo
->
threadIndex
,
taos_errstr
(
con
));
p
Error
(
"index:%d, failed to connect to DB, reason:%s"
,
pInfo
->
threadIndex
,
taos_errstr
(
con
));
exit
(
1
);
exit
(
1
);
}
}
...
@@ -221,7 +221,7 @@ void *syncTest(void *param) {
...
@@ -221,7 +221,7 @@ void *syncTest(void *param) {
len
+=
sprintf
(
sql
+
len
,
")"
);
len
+=
sprintf
(
sql
+
len
,
")"
);
if
(
len
>
maxBytes
)
{
if
(
len
>
maxBytes
)
{
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"thread:%d, failed to import table:%s%ld row:%ld, reason:%s"
,
pInfo
->
threadIndex
,
pInfo
->
stableName
,
p
Error
(
"thread:%d, failed to import table:%s%ld row:%ld, reason:%s"
,
pInfo
->
threadIndex
,
pInfo
->
stableName
,
table
,
row
,
taos_errstr
(
con
));
table
,
row
,
taos_errstr
(
con
));
}
}
...
@@ -245,7 +245,7 @@ void *syncTest(void *param) {
...
@@ -245,7 +245,7 @@ void *syncTest(void *param) {
int64_t
totalTables
=
pInfo
->
tableEndIndex
-
pInfo
->
tableBeginIndex
;
int64_t
totalTables
=
pInfo
->
tableEndIndex
-
pInfo
->
tableBeginIndex
;
int64_t
totalRows
=
totalTables
*
pInfo
->
rowsPerTable
;
int64_t
totalRows
=
totalTables
*
pInfo
->
rowsPerTable
;
int64_t
totalPoints
=
totalRows
*
pInfo
->
pointsPerTable
;
int64_t
totalPoints
=
totalRows
*
pInfo
->
pointsPerTable
;
u
Print
(
"thread:%d, import finished, use %.2f seconds, tables:%ld rows:%ld points:%ld"
,
pInfo
->
threadIndex
,
p
Print
(
"thread:%d, import finished, use %.2f seconds, tables:%ld rows:%ld points:%ld"
,
pInfo
->
threadIndex
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
,
totalRows
,
totalPoints
);
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
,
totalRows
,
totalPoints
);
return
NULL
;
return
NULL
;
...
@@ -310,13 +310,13 @@ void shellParseArgument(int argc, char *argv[]) {
...
@@ -310,13 +310,13 @@ void shellParseArgument(int argc, char *argv[]) {
}
}
}
}
u
Print
(
"%srowsPerTable:%"
PRId64
"%s"
,
GREEN
,
rowsPerTable
,
NC
);
p
Print
(
"%srowsPerTable:%"
PRId64
"%s"
,
GREEN
,
rowsPerTable
,
NC
);
u
Print
(
"%spointsPerTable:%"
PRId64
"%s"
,
GREEN
,
pointsPerTable
,
NC
);
p
Print
(
"%spointsPerTable:%"
PRId64
"%s"
,
GREEN
,
pointsPerTable
,
NC
);
u
Print
(
"%snumOfThreads:%"
PRId64
"%s"
,
GREEN
,
numOfThreads
,
NC
);
p
Print
(
"%snumOfThreads:%"
PRId64
"%s"
,
GREEN
,
numOfThreads
,
NC
);
u
Print
(
"%snumOfTablesPerThread:%"
PRId64
"%s"
,
GREEN
,
numOfTablesPerThread
,
NC
);
p
Print
(
"%snumOfTablesPerThread:%"
PRId64
"%s"
,
GREEN
,
numOfTablesPerThread
,
NC
);
u
Print
(
"%scache:%"
PRId64
"%s"
,
GREEN
,
cache
,
NC
);
p
Print
(
"%scache:%"
PRId64
"%s"
,
GREEN
,
cache
,
NC
);
u
Print
(
"%stables:%"
PRId64
"%s"
,
GREEN
,
tables
,
NC
);
p
Print
(
"%stables:%"
PRId64
"%s"
,
GREEN
,
tables
,
NC
);
u
Print
(
"%sdbName:%s%s"
,
GREEN
,
dbName
,
NC
);
p
Print
(
"%sdbName:%s%s"
,
GREEN
,
dbName
,
NC
);
u
Print
(
"%stableName:%s%s"
,
GREEN
,
stableName
,
NC
);
p
Print
(
"%stableName:%s%s"
,
GREEN
,
stableName
,
NC
);
u
Print
(
"%sstart to run%s"
,
GREEN
,
NC
);
p
Print
(
"%sstart to run%s"
,
GREEN
,
NC
);
}
}
tests/test/c/insertPerRow.c
浏览文件 @
84c3955a
...
@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
...
@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
}
}
void
createDbAndTable
()
{
void
createDbAndTable
()
{
u
Print
(
"start to create table"
);
p
Print
(
"start to create table"
);
TAOS
*
con
;
TAOS
*
con
;
struct
timeval
systemTime
;
struct
timeval
systemTime
;
...
@@ -70,19 +70,19 @@ void createDbAndTable() {
...
@@ -70,19 +70,19 @@ void createDbAndTable() {
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
if
(
con
==
NULL
)
{
if
(
con
==
NULL
)
{
u
Error
(
"failed to connect to DB, reason:%s"
,
taos_errstr
(
con
));
p
Error
(
"failed to connect to DB, reason:%s"
,
taos_errstr
(
con
));
exit
(
1
);
exit
(
1
);
}
}
sprintf
(
qstr
,
"create database if not exists %s cache %d tables %d"
,
dbName
,
cache
,
tables
);
sprintf
(
qstr
,
"create database if not exists %s cache %d tables %d"
,
dbName
,
cache
,
tables
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create database:%s, code:%d reason:%s"
,
dbName
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to create database:%s, code:%d reason:%s"
,
dbName
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
sprintf
(
qstr
,
"use %s"
,
dbName
);
sprintf
(
qstr
,
"use %s"
,
dbName
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to use db, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to use db, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
...
@@ -98,14 +98,14 @@ void createDbAndTable() {
...
@@ -98,14 +98,14 @@ void createDbAndTable() {
sprintf
(
qstr
+
len
,
") tags(t int)"
);
sprintf
(
qstr
+
len
,
") tags(t int)"
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create stable, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to create stable, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
for
(
int64_t
t
=
0
;
t
<
totalTables
;
++
t
)
{
for
(
int64_t
t
=
0
;
t
<
totalTables
;
++
t
)
{
sprintf
(
qstr
,
"create table if not exists %s%ld using %s tags(%ld)"
,
stableName
,
t
,
stableName
,
t
);
sprintf
(
qstr
,
"create table if not exists %s%ld using %s tags(%ld)"
,
stableName
,
t
,
stableName
,
t
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
p
Error
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -118,7 +118,7 @@ void createDbAndTable() {
...
@@ -118,7 +118,7 @@ void createDbAndTable() {
sprintf
(
qstr
+
len
,
")"
);
sprintf
(
qstr
+
len
,
")"
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create table %s%ld, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
p
Error
(
"failed to create table %s%ld, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -126,7 +126,7 @@ void createDbAndTable() {
...
@@ -126,7 +126,7 @@ void createDbAndTable() {
gettimeofday
(
&
systemTime
,
NULL
);
gettimeofday
(
&
systemTime
,
NULL
);
et
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
et
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
u
Print
(
"%.1f seconds to create %ld tables"
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
);
p
Print
(
"%.1f seconds to create %ld tables"
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
);
}
}
void
insertData
()
{
void
insertData
()
{
...
@@ -136,7 +136,7 @@ void insertData() {
...
@@ -136,7 +136,7 @@ void insertData() {
gettimeofday
(
&
systemTime
,
NULL
);
gettimeofday
(
&
systemTime
,
NULL
);
st
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
st
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
u
Print
(
"%d threads are spawned to insert data"
,
numOfThreads
);
p
Print
(
"%d threads are spawned to insert data"
,
numOfThreads
);
pthread_attr_t
thattr
;
pthread_attr_t
thattr
;
pthread_attr_init
(
&
thattr
);
pthread_attr_init
(
&
thattr
);
...
@@ -170,12 +170,12 @@ void insertData() {
...
@@ -170,12 +170,12 @@ void insertData() {
double
speedOfRows
=
totalRows
/
seconds
;
double
speedOfRows
=
totalRows
/
seconds
;
double
speedOfPoints
=
totalPoints
/
seconds
;
double
speedOfPoints
=
totalPoints
/
seconds
;
u
Print
(
p
Print
(
"%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf "
"%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf "
"PointsPerSecond:%.1lf%s"
,
"PointsPerSecond:%.1lf%s"
,
GREEN
,
numOfThreads
,
seconds
,
totalTables
,
totalRows
,
totalPoints
,
speedOfRows
,
speedOfPoints
,
NC
);
GREEN
,
numOfThreads
,
seconds
,
totalTables
,
totalRows
,
totalPoints
,
speedOfRows
,
speedOfPoints
,
NC
);
u
Print
(
"threads exit"
);
p
Print
(
"threads exit"
);
pthread_attr_destroy
(
&
thattr
);
pthread_attr_destroy
(
&
thattr
);
free
(
pInfo
);
free
(
pInfo
);
...
@@ -189,11 +189,11 @@ void *syncTest(void *param) {
...
@@ -189,11 +189,11 @@ void *syncTest(void *param) {
char
qstr
[
65000
];
char
qstr
[
65000
];
int
maxBytes
=
60000
;
int
maxBytes
=
60000
;
u
Print
(
"thread:%d, start to run"
,
pInfo
->
threadIndex
);
p
Print
(
"thread:%d, start to run"
,
pInfo
->
threadIndex
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
if
(
con
==
NULL
)
{
if
(
con
==
NULL
)
{
u
Error
(
"index:%d, failed to connect to DB, reason:%s"
,
pInfo
->
threadIndex
,
taos_errstr
(
con
));
p
Error
(
"index:%d, failed to connect to DB, reason:%s"
,
pInfo
->
threadIndex
,
taos_errstr
(
con
));
exit
(
1
);
exit
(
1
);
}
}
...
@@ -221,7 +221,7 @@ void *syncTest(void *param) {
...
@@ -221,7 +221,7 @@ void *syncTest(void *param) {
len
+=
sprintf
(
sql
+
len
,
")"
);
len
+=
sprintf
(
sql
+
len
,
")"
);
if
(
len
>
maxBytes
)
{
if
(
len
>
maxBytes
)
{
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"thread:%d, failed to insert table:%s%ld row:%ld, reason:%s"
,
pInfo
->
threadIndex
,
pInfo
->
stableName
,
p
Error
(
"thread:%d, failed to insert table:%s%ld row:%ld, reason:%s"
,
pInfo
->
threadIndex
,
pInfo
->
stableName
,
table
,
row
,
taos_errstr
(
con
));
table
,
row
,
taos_errstr
(
con
));
}
}
...
@@ -240,7 +240,7 @@ void *syncTest(void *param) {
...
@@ -240,7 +240,7 @@ void *syncTest(void *param) {
int64_t
totalTables
=
pInfo
->
tableEndIndex
-
pInfo
->
tableBeginIndex
;
int64_t
totalTables
=
pInfo
->
tableEndIndex
-
pInfo
->
tableBeginIndex
;
int64_t
totalRows
=
totalTables
*
pInfo
->
rowsPerTable
;
int64_t
totalRows
=
totalTables
*
pInfo
->
rowsPerTable
;
int64_t
totalPoints
=
totalRows
*
pInfo
->
pointsPerTable
;
int64_t
totalPoints
=
totalRows
*
pInfo
->
pointsPerTable
;
u
Print
(
"thread:%d, insert finished, use %.2f seconds, tables:%ld rows:%ld points:%ld"
,
pInfo
->
threadIndex
,
p
Print
(
"thread:%d, insert finished, use %.2f seconds, tables:%ld rows:%ld points:%ld"
,
pInfo
->
threadIndex
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
,
totalRows
,
totalPoints
);
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
,
totalRows
,
totalPoints
);
return
NULL
;
return
NULL
;
...
@@ -305,13 +305,13 @@ void shellParseArgument(int argc, char *argv[]) {
...
@@ -305,13 +305,13 @@ void shellParseArgument(int argc, char *argv[]) {
}
}
}
}
u
Print
(
"%srowsPerTable:%"
PRId64
"%s"
,
GREEN
,
rowsPerTable
,
NC
);
p
Print
(
"%srowsPerTable:%"
PRId64
"%s"
,
GREEN
,
rowsPerTable
,
NC
);
u
Print
(
"%spointsPerTable:%"
PRId64
"%s"
,
GREEN
,
pointsPerTable
,
NC
);
p
Print
(
"%spointsPerTable:%"
PRId64
"%s"
,
GREEN
,
pointsPerTable
,
NC
);
u
Print
(
"%snumOfThreads:%"
PRId64
"%s"
,
GREEN
,
numOfThreads
,
NC
);
p
Print
(
"%snumOfThreads:%"
PRId64
"%s"
,
GREEN
,
numOfThreads
,
NC
);
u
Print
(
"%snumOfTablesPerThread:%"
PRId64
"%s"
,
GREEN
,
numOfTablesPerThread
,
NC
);
p
Print
(
"%snumOfTablesPerThread:%"
PRId64
"%s"
,
GREEN
,
numOfTablesPerThread
,
NC
);
u
Print
(
"%scache:%"
PRId64
"%s"
,
GREEN
,
cache
,
NC
);
p
Print
(
"%scache:%"
PRId64
"%s"
,
GREEN
,
cache
,
NC
);
u
Print
(
"%stables:%"
PRId64
"%s"
,
GREEN
,
tables
,
NC
);
p
Print
(
"%stables:%"
PRId64
"%s"
,
GREEN
,
tables
,
NC
);
u
Print
(
"%sdbName:%s%s"
,
GREEN
,
dbName
,
NC
);
p
Print
(
"%sdbName:%s%s"
,
GREEN
,
dbName
,
NC
);
u
Print
(
"%stableName:%s%s"
,
GREEN
,
stableName
,
NC
);
p
Print
(
"%stableName:%s%s"
,
GREEN
,
stableName
,
NC
);
u
Print
(
"%sstart to run%s"
,
GREEN
,
NC
);
p
Print
(
"%sstart to run%s"
,
GREEN
,
NC
);
}
}
tests/test/c/insertPerTable.c
浏览文件 @
84c3955a
...
@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
...
@@ -61,7 +61,7 @@ int main(int argc, char *argv[]) {
}
}
void
createDbAndTable
()
{
void
createDbAndTable
()
{
u
Print
(
"start to create table"
);
p
Print
(
"start to create table"
);
TAOS
*
con
;
TAOS
*
con
;
struct
timeval
systemTime
;
struct
timeval
systemTime
;
...
@@ -70,19 +70,19 @@ void createDbAndTable() {
...
@@ -70,19 +70,19 @@ void createDbAndTable() {
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
if
(
con
==
NULL
)
{
if
(
con
==
NULL
)
{
u
Error
(
"failed to connect to DB, reason:%s"
,
taos_errstr
(
con
));
p
Error
(
"failed to connect to DB, reason:%s"
,
taos_errstr
(
con
));
exit
(
1
);
exit
(
1
);
}
}
sprintf
(
qstr
,
"create database if not exists %s cache %d tables %d"
,
dbName
,
cache
,
tables
);
sprintf
(
qstr
,
"create database if not exists %s cache %d tables %d"
,
dbName
,
cache
,
tables
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create database:%s, code:%d reason:%s"
,
dbName
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to create database:%s, code:%d reason:%s"
,
dbName
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
sprintf
(
qstr
,
"use %s"
,
dbName
);
sprintf
(
qstr
,
"use %s"
,
dbName
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to use db, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to use db, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
...
@@ -98,14 +98,14 @@ void createDbAndTable() {
...
@@ -98,14 +98,14 @@ void createDbAndTable() {
sprintf
(
qstr
+
len
,
") tags(t int)"
);
sprintf
(
qstr
+
len
,
") tags(t int)"
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create stable, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
p
Error
(
"failed to create stable, code:%d reason:%s"
,
taos_errno
(
con
),
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
for
(
int64_t
t
=
0
;
t
<
totalTables
;
++
t
)
{
for
(
int64_t
t
=
0
;
t
<
totalTables
;
++
t
)
{
sprintf
(
qstr
,
"create table if not exists %s%ld using %s tags(%ld)"
,
stableName
,
t
,
stableName
,
t
);
sprintf
(
qstr
,
"create table if not exists %s%ld using %s tags(%ld)"
,
stableName
,
t
,
stableName
,
t
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
p
Error
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -118,7 +118,7 @@ void createDbAndTable() {
...
@@ -118,7 +118,7 @@ void createDbAndTable() {
sprintf
(
qstr
+
len
,
")"
);
sprintf
(
qstr
+
len
,
")"
);
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"failed to create table %s%ld, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
p
Error
(
"failed to create table %s%ld, reason:%s"
,
stableName
,
t
,
taos_errstr
(
con
));
exit
(
0
);
exit
(
0
);
}
}
}
}
...
@@ -126,7 +126,7 @@ void createDbAndTable() {
...
@@ -126,7 +126,7 @@ void createDbAndTable() {
gettimeofday
(
&
systemTime
,
NULL
);
gettimeofday
(
&
systemTime
,
NULL
);
et
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
et
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
u
Print
(
"%.1f seconds to create %ld tables"
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
);
p
Print
(
"%.1f seconds to create %ld tables"
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
);
}
}
void
insertData
()
{
void
insertData
()
{
...
@@ -136,7 +136,7 @@ void insertData() {
...
@@ -136,7 +136,7 @@ void insertData() {
gettimeofday
(
&
systemTime
,
NULL
);
gettimeofday
(
&
systemTime
,
NULL
);
st
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
st
=
systemTime
.
tv_sec
*
1000000
+
systemTime
.
tv_usec
;
u
Print
(
"%d threads are spawned to insert data"
,
numOfThreads
);
p
Print
(
"%d threads are spawned to insert data"
,
numOfThreads
);
pthread_attr_t
thattr
;
pthread_attr_t
thattr
;
pthread_attr_init
(
&
thattr
);
pthread_attr_init
(
&
thattr
);
...
@@ -170,12 +170,12 @@ void insertData() {
...
@@ -170,12 +170,12 @@ void insertData() {
double
speedOfRows
=
totalRows
/
seconds
;
double
speedOfRows
=
totalRows
/
seconds
;
double
speedOfPoints
=
totalPoints
/
seconds
;
double
speedOfPoints
=
totalPoints
/
seconds
;
u
Print
(
p
Print
(
"%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf "
"%sall threads:%ld finished, use %.1lf seconds, tables:%.ld rows:%ld points:%ld, speed RowsPerSecond:%.1lf "
"PointsPerSecond:%.1lf%s"
,
"PointsPerSecond:%.1lf%s"
,
GREEN
,
numOfThreads
,
seconds
,
totalTables
,
totalRows
,
totalPoints
,
speedOfRows
,
speedOfPoints
,
NC
);
GREEN
,
numOfThreads
,
seconds
,
totalTables
,
totalRows
,
totalPoints
,
speedOfRows
,
speedOfPoints
,
NC
);
u
Print
(
"threads exit"
);
p
Print
(
"threads exit"
);
pthread_attr_destroy
(
&
thattr
);
pthread_attr_destroy
(
&
thattr
);
free
(
pInfo
);
free
(
pInfo
);
...
@@ -189,11 +189,11 @@ void *syncTest(void *param) {
...
@@ -189,11 +189,11 @@ void *syncTest(void *param) {
char
qstr
[
65000
];
char
qstr
[
65000
];
int
maxBytes
=
60000
;
int
maxBytes
=
60000
;
u
Print
(
"thread:%d, start to run"
,
pInfo
->
threadIndex
);
p
Print
(
"thread:%d, start to run"
,
pInfo
->
threadIndex
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
con
=
taos_connect
(
tsMasterIp
,
tsDefaultUser
,
tsDefaultPass
,
NULL
,
0
);
if
(
con
==
NULL
)
{
if
(
con
==
NULL
)
{
u
Error
(
"index:%d, failed to connect to DB, reason:%s"
,
pInfo
->
threadIndex
,
taos_errstr
(
con
));
p
Error
(
"index:%d, failed to connect to DB, reason:%s"
,
pInfo
->
threadIndex
,
taos_errstr
(
con
));
exit
(
1
);
exit
(
1
);
}
}
...
@@ -221,7 +221,7 @@ void *syncTest(void *param) {
...
@@ -221,7 +221,7 @@ void *syncTest(void *param) {
len
+=
sprintf
(
sql
+
len
,
")"
);
len
+=
sprintf
(
sql
+
len
,
")"
);
if
(
len
>
maxBytes
)
{
if
(
len
>
maxBytes
)
{
if
(
taos_query
(
con
,
qstr
))
{
if
(
taos_query
(
con
,
qstr
))
{
u
Error
(
"thread:%d, failed to insert table:%s%ld row:%ld, reason:%s"
,
pInfo
->
threadIndex
,
pInfo
->
stableName
,
p
Error
(
"thread:%d, failed to insert table:%s%ld row:%ld, reason:%s"
,
pInfo
->
threadIndex
,
pInfo
->
stableName
,
table
,
row
,
taos_errstr
(
con
));
table
,
row
,
taos_errstr
(
con
));
}
}
...
@@ -245,7 +245,7 @@ void *syncTest(void *param) {
...
@@ -245,7 +245,7 @@ void *syncTest(void *param) {
int64_t
totalTables
=
pInfo
->
tableEndIndex
-
pInfo
->
tableBeginIndex
;
int64_t
totalTables
=
pInfo
->
tableEndIndex
-
pInfo
->
tableBeginIndex
;
int64_t
totalRows
=
totalTables
*
pInfo
->
rowsPerTable
;
int64_t
totalRows
=
totalTables
*
pInfo
->
rowsPerTable
;
int64_t
totalPoints
=
totalRows
*
pInfo
->
pointsPerTable
;
int64_t
totalPoints
=
totalRows
*
pInfo
->
pointsPerTable
;
u
Print
(
"thread:%d, insert finished, use %.2f seconds, tables:%ld rows:%ld points:%ld"
,
pInfo
->
threadIndex
,
p
Print
(
"thread:%d, insert finished, use %.2f seconds, tables:%ld rows:%ld points:%ld"
,
pInfo
->
threadIndex
,
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
,
totalRows
,
totalPoints
);
(
et
-
st
)
/
1000
.
0
/
1000
.
0
,
totalTables
,
totalRows
,
totalPoints
);
return
NULL
;
return
NULL
;
...
@@ -310,13 +310,13 @@ void shellParseArgument(int argc, char *argv[]) {
...
@@ -310,13 +310,13 @@ void shellParseArgument(int argc, char *argv[]) {
}
}
}
}
u
Print
(
"%srowsPerTable:%"
PRId64
"%s"
,
GREEN
,
rowsPerTable
,
NC
);
p
Print
(
"%srowsPerTable:%"
PRId64
"%s"
,
GREEN
,
rowsPerTable
,
NC
);
u
Print
(
"%spointsPerTable:%"
PRId64
"%s"
,
GREEN
,
pointsPerTable
,
NC
);
p
Print
(
"%spointsPerTable:%"
PRId64
"%s"
,
GREEN
,
pointsPerTable
,
NC
);
u
Print
(
"%snumOfThreads:%"
PRId64
"%s"
,
GREEN
,
numOfThreads
,
NC
);
p
Print
(
"%snumOfThreads:%"
PRId64
"%s"
,
GREEN
,
numOfThreads
,
NC
);
u
Print
(
"%snumOfTablesPerThread:%"
PRId64
"%s"
,
GREEN
,
numOfTablesPerThread
,
NC
);
p
Print
(
"%snumOfTablesPerThread:%"
PRId64
"%s"
,
GREEN
,
numOfTablesPerThread
,
NC
);
u
Print
(
"%scache:%"
PRId64
"%s"
,
GREEN
,
cache
,
NC
);
p
Print
(
"%scache:%"
PRId64
"%s"
,
GREEN
,
cache
,
NC
);
u
Print
(
"%stables:%"
PRId64
"%s"
,
GREEN
,
tables
,
NC
);
p
Print
(
"%stables:%"
PRId64
"%s"
,
GREEN
,
tables
,
NC
);
u
Print
(
"%sdbName:%s%s"
,
GREEN
,
dbName
,
NC
);
p
Print
(
"%sdbName:%s%s"
,
GREEN
,
dbName
,
NC
);
u
Print
(
"%stableName:%s%s"
,
GREEN
,
stableName
,
NC
);
p
Print
(
"%stableName:%s%s"
,
GREEN
,
stableName
,
NC
);
u
Print
(
"%sstart to run%s"
,
GREEN
,
NC
);
p
Print
(
"%sstart to run%s"
,
GREEN
,
NC
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录