Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
916a9f68
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
916a9f68
编写于
12月 09, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
12月 09, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4490 from taosdata/feature/wal
Feature/wal
上级
a023da48
1c1dac72
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
134 addition
and
126 deletion
+134
-126
src/kit/shell/src/shellWindows.c
src/kit/shell/src/shellWindows.c
+22
-0
src/util/src/tnettest.c
src/util/src/tnettest.c
+109
-123
src/util/src/tnote.c
src/util/src/tnote.c
+1
-1
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+2
-2
未找到文件。
src/kit/shell/src/shellWindows.c
浏览文件 @
916a9f68
...
@@ -45,6 +45,10 @@ void printHelp() {
...
@@ -45,6 +45,10 @@ void printHelp() {
printf
(
"%s%s%s
\n
"
,
indent
,
indent
,
"Database to use when connecting to the server."
);
printf
(
"%s%s%s
\n
"
,
indent
,
indent
,
"Database to use when connecting to the server."
);
printf
(
"%s%s
\n
"
,
indent
,
"-t"
);
printf
(
"%s%s
\n
"
,
indent
,
"-t"
);
printf
(
"%s%s%s
\n
"
,
indent
,
indent
,
"Time zone of the shell, default is local."
);
printf
(
"%s%s%s
\n
"
,
indent
,
indent
,
"Time zone of the shell, default is local."
);
printf
(
"%s%s
\n
"
,
indent
,
"-n"
);
printf
(
"%s%s%s
\n
"
,
indent
,
indent
,
"Net role when network connectivity test, default is startup, options: client|server|rpc|startup."
);
printf
(
"%s%s
\n
"
,
indent
,
"-l"
);
printf
(
"%s%s%s
\n
"
,
indent
,
indent
,
"Packet length used for net test, default is 1000 bytes."
);
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
...
@@ -137,6 +141,24 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
...
@@ -137,6 +141,24 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
}
}
// For time zone
else
if
(
strcmp
(
argv
[
i
],
"-n"
)
==
0
)
{
if
(
i
<
argc
-
1
)
{
arguments
->
netTestRole
=
argv
[
++
i
];
}
else
{
fprintf
(
stderr
,
"option -n requires an argument
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
// For time zone
else
if
(
strcmp
(
argv
[
i
],
"-l"
)
==
0
)
{
if
(
i
<
argc
-
1
)
{
arguments
->
pktLen
=
atoi
(
argv
[
++
i
]);
}
else
{
fprintf
(
stderr
,
"option -l requires an argument
\n
"
);
exit
(
EXIT_FAILURE
);
}
}
// For temperory command TODO
// For temperory command TODO
else
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
)
{
else
if
(
strcmp
(
argv
[
i
],
"--help"
)
==
0
)
{
printHelp
();
printHelp
();
...
...
src/util/src/tnettest.c
浏览文件 @
916a9f68
...
@@ -43,12 +43,13 @@ static void *taosNetBindUdpPort(void *sarg) {
...
@@ -43,12 +43,13 @@ static void *taosNetBindUdpPort(void *sarg) {
char
buffer
[
BUFFER_SIZE
];
char
buffer
[
BUFFER_SIZE
];
int32_t
iDataNum
;
int32_t
iDataNum
;
socklen_t
sin_size
;
socklen_t
sin_size
;
int32_t
bufSize
=
1024000
;
struct
sockaddr_in
server_addr
;
struct
sockaddr_in
server_addr
;
struct
sockaddr_in
clientAddr
;
struct
sockaddr_in
clientAddr
;
if
((
serverSocket
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
))
<
0
)
{
if
((
serverSocket
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
))
<
0
)
{
uError
(
"failed to create
udp
socket since %s"
,
strerror
(
errno
));
uError
(
"failed to create
UDP
socket since %s"
,
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
...
@@ -58,11 +59,23 @@ static void *taosNetBindUdpPort(void *sarg) {
...
@@ -58,11 +59,23 @@ static void *taosNetBindUdpPort(void *sarg) {
server_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
server_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
bind
(
serverSocket
,
(
struct
sockaddr
*
)
&
server_addr
,
sizeof
(
server_addr
))
<
0
)
{
if
(
bind
(
serverSocket
,
(
struct
sockaddr
*
)
&
server_addr
,
sizeof
(
server_addr
))
<
0
)
{
uError
(
"failed to bind
udp
port:%d since %s"
,
port
,
strerror
(
errno
));
uError
(
"failed to bind
UDP
port:%d since %s"
,
port
,
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
uInfo
(
"udp server at port:%d is listening"
,
port
);
if
(
taosSetSockOpt
(
serverSocket
,
SOL_SOCKET
,
SO_SNDBUF
,
(
void
*
)
&
bufSize
,
sizeof
(
bufSize
))
!=
0
)
{
uError
(
"failed to set the send buffer size for UDP socket
\n
"
);
taosCloseSocket
(
serverSocket
);
return
NULL
;
}
if
(
taosSetSockOpt
(
serverSocket
,
SOL_SOCKET
,
SO_RCVBUF
,
(
void
*
)
&
bufSize
,
sizeof
(
bufSize
))
!=
0
)
{
uError
(
"failed to set the receive buffer size for UDP socket
\n
"
);
taosCloseSocket
(
serverSocket
);
return
NULL
;
}
uInfo
(
"UDP server at port:%d is listening"
,
port
);
while
(
1
)
{
while
(
1
)
{
memset
(
buffer
,
0
,
BUFFER_SIZE
);
memset
(
buffer
,
0
,
BUFFER_SIZE
);
...
@@ -74,10 +87,13 @@ static void *taosNetBindUdpPort(void *sarg) {
...
@@ -74,10 +87,13 @@ static void *taosNetBindUdpPort(void *sarg) {
continue
;
continue
;
}
}
uInfo
(
"UDP: recv:%d bytes from %s at %d"
,
iDataNum
,
taosInetNtoa
(
clientAddr
.
sin_addr
),
port
);
if
(
iDataNum
>
0
)
{
if
(
iDataNum
>
0
)
{
uInfo
(
"UDP: recv:%d bytes from %s:%d"
,
iDataNum
,
taosInetNtoa
(
clientAddr
.
sin_addr
),
port
);
iDataNum
=
taosSendto
(
serverSocket
,
buffer
,
iDataNum
,
0
,
(
struct
sockaddr
*
)
&
clientAddr
,
(
int32_t
)
sin_size
);
sendto
(
serverSocket
,
buffer
,
iDataNum
,
0
,
(
struct
sockaddr
*
)
&
clientAddr
,
(
int32_t
)
sin_size
);
}
}
uInfo
(
"UDP: send:%d bytes to %s at %d"
,
iDataNum
,
taosInetNtoa
(
clientAddr
.
sin_addr
),
port
);
}
}
taosCloseSocket
(
serverSocket
);
taosCloseSocket
(
serverSocket
);
...
@@ -94,10 +110,9 @@ static void *taosNetBindTcpPort(void *sarg) {
...
@@ -94,10 +110,9 @@ static void *taosNetBindTcpPort(void *sarg) {
int32_t
addr_len
=
sizeof
(
clientAddr
);
int32_t
addr_len
=
sizeof
(
clientAddr
);
SOCKET
client
;
SOCKET
client
;
char
buffer
[
BUFFER_SIZE
];
char
buffer
[
BUFFER_SIZE
];
int32_t
iDataNum
=
0
;
if
((
serverSocket
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
))
<
0
)
{
if
((
serverSocket
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
))
<
0
)
{
uError
(
"failed to create
tcp
socket since %s"
,
strerror
(
errno
));
uError
(
"failed to create
TCP
socket since %s"
,
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
...
@@ -106,130 +121,103 @@ static void *taosNetBindTcpPort(void *sarg) {
...
@@ -106,130 +121,103 @@ static void *taosNetBindTcpPort(void *sarg) {
server_addr
.
sin_port
=
htons
(
port
);
server_addr
.
sin_port
=
htons
(
port
);
server_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
server_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
int32_t
reuse
=
1
;
if
(
taosSetSockOpt
(
serverSocket
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
void
*
)
&
reuse
,
sizeof
(
reuse
))
<
0
)
{
uError
(
"setsockopt SO_REUSEADDR failed: %d (%s)"
,
errno
,
strerror
(
errno
));
taosCloseSocket
(
serverSocket
);
return
NULL
;
}
if
(
bind
(
serverSocket
,
(
struct
sockaddr
*
)
&
server_addr
,
sizeof
(
server_addr
))
<
0
)
{
if
(
bind
(
serverSocket
,
(
struct
sockaddr
*
)
&
server_addr
,
sizeof
(
server_addr
))
<
0
)
{
uError
(
"failed to bind
tcp
port:%d since %s"
,
port
,
strerror
(
errno
));
uError
(
"failed to bind
TCP
port:%d since %s"
,
port
,
strerror
(
errno
));
return
NULL
;
return
NULL
;
}
}
if
(
listen
(
serverSocket
,
5
)
<
0
)
{
uError
(
"failed to listen tcp port:%d since %s"
,
port
,
strerror
(
errno
));
if
(
taosKeepTcpAlive
(
serverSocket
)
<
0
)
{
uError
(
"failed to set tcp server keep-alive option since %s"
,
strerror
(
errno
));
taosCloseSocket
(
serverSocket
);
return
NULL
;
return
NULL
;
}
}
uInfo
(
"tcp server at port:%d is listening"
,
port
);
if
(
listen
(
serverSocket
,
10
)
<
0
)
{
uError
(
"failed to listen TCP port:%d since %s"
,
port
,
strerror
(
errno
));
return
NULL
;
}
uInfo
(
"TCP server at port:%d is listening"
,
port
);
while
(
1
)
{
while
(
1
)
{
client
=
accept
(
serverSocket
,
(
struct
sockaddr
*
)
&
clientAddr
,
(
socklen_t
*
)
&
addr_len
);
client
=
accept
(
serverSocket
,
(
struct
sockaddr
*
)
&
clientAddr
,
(
socklen_t
*
)
&
addr_len
);
if
(
client
<
0
)
{
if
(
client
<
0
)
{
uDebug
(
"
failed to accept from tcp
port:%d since %s"
,
port
,
strerror
(
errno
));
uDebug
(
"
TCP: failed to accept at
port:%d since %s"
,
port
,
strerror
(
errno
));
continue
;
continue
;
}
}
iDataNum
=
0
;
int32_t
ret
=
taosReadMsg
(
client
,
buffer
,
pinfo
->
pktLen
);
memset
(
buffer
,
0
,
BUFFER_SIZE
);
if
(
ret
<
0
||
ret
!=
pinfo
->
pktLen
)
{
int32_t
nleft
,
nread
;
uError
(
"TCP: failed to read %d bytes at port:%d since %s"
,
pinfo
->
pktLen
,
port
,
strerror
(
errno
));
char
*
ptr
=
buffer
;
taosCloseSocket
(
serverSocket
);
nleft
=
pinfo
->
pktLen
;
return
NULL
;
while
(
nleft
>
0
)
{
nread
=
recv
(
client
,
ptr
,
BUFFER_SIZE
,
0
);
if
(
nread
==
0
)
{
break
;
}
else
if
(
nread
<
0
)
{
if
(
errno
==
EINTR
)
{
continue
;
}
else
{
uError
(
"failed to perform recv func at %d since %s"
,
port
,
strerror
(
errno
));
taosCloseSocket
(
serverSocket
);
return
NULL
;
}
}
else
{
nleft
-=
nread
;
ptr
+=
nread
;
iDataNum
+=
nread
;
}
}
}
if
(
iDataNum
>
0
)
{
uInfo
(
"TCP: read:%d bytes from %s at %d"
,
pinfo
->
pktLen
,
taosInetNtoa
(
clientAddr
.
sin_addr
),
port
);
uInfo
(
"TCP: recv:%d bytes from %s:%d"
,
iDataNum
,
taosInetNtoa
(
clientAddr
.
sin_addr
),
port
);
send
(
client
,
buffer
,
iDataNum
,
0
);
ret
=
taosWriteMsg
(
client
,
buffer
,
pinfo
->
pktLen
);
if
(
ret
<
0
)
{
uError
(
"TCP: failed to write %d bytes at %d since %s"
,
pinfo
->
pktLen
,
port
,
strerror
(
errno
));
taosCloseSocket
(
serverSocket
);
return
NULL
;
}
}
uInfo
(
"TCP: write:%d bytes to %s at %d"
,
pinfo
->
pktLen
,
taosInetNtoa
(
clientAddr
.
sin_addr
),
port
);
}
}
taosCloseSocket
(
serverSocket
);
taosCloseSocket
(
serverSocket
);
return
NULL
;
return
NULL
;
}
}
static
int32_t
taosNetCheckTcpPort
(
STestInfo
*
info
)
{
static
int32_t
taosNetCheckTcpPort
(
STestInfo
*
info
)
{
SOCKET
clientSocket
;
SOCKET
clientSocket
;
char
sendbuf
[
BUFFER_SIZE
];
char
buffer
[
BUFFER_SIZE
]
=
{
0
};
char
recvbuf
[
BUFFER_SIZE
];
int32_t
iDataNum
=
0
;
struct
sockaddr_in
serverAddr
;
if
((
clientSocket
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
<
0
)
{
if
((
clientSocket
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
<
0
)
{
uError
(
"failed to create
tcp
client socket since %s"
,
strerror
(
errno
));
uError
(
"failed to create
TCP
client socket since %s"
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
// set send and recv overtime
int32_t
reuse
=
1
;
struct
timeval
timeout
;
if
(
taosSetSockOpt
(
clientSocket
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
void
*
)
&
reuse
,
sizeof
(
reuse
))
<
0
)
{
timeout
.
tv_sec
=
2
;
// s
uError
(
"setsockopt SO_REUSEADDR failed: %d (%s)"
,
errno
,
strerror
(
errno
));
timeout
.
tv_usec
=
0
;
// us
taosCloseSocket
(
clientSocket
);
if
(
setsockopt
(
clientSocket
,
SOL_SOCKET
,
SO_SNDTIMEO
,
(
char
*
)
&
timeout
,
sizeof
(
struct
timeval
))
==
-
1
)
{
return
-
1
;
uError
(
"failed to setsockopt send timer since %s"
,
strerror
(
errno
));
}
if
(
setsockopt
(
clientSocket
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
char
*
)
&
timeout
,
sizeof
(
struct
timeval
))
==
-
1
)
{
uError
(
"failed to setsockopt recv timer since %s"
,
strerror
(
errno
));
}
}
struct
sockaddr_in
serverAddr
;
memset
((
char
*
)
&
serverAddr
,
0
,
sizeof
(
serverAddr
));
serverAddr
.
sin_family
=
AF_INET
;
serverAddr
.
sin_family
=
AF_INET
;
serverAddr
.
sin_port
=
htons
(
info
->
port
);
serverAddr
.
sin_port
=
(
uint16_t
)
htons
((
uint16_t
)
info
->
port
);
serverAddr
.
sin_addr
.
s_addr
=
info
->
hostIp
;
serverAddr
.
sin_addr
.
s_addr
=
info
->
hostIp
;
if
(
connect
(
clientSocket
,
(
struct
sockaddr
*
)
&
serverAddr
,
sizeof
(
serverAddr
))
<
0
)
{
if
(
connect
(
clientSocket
,
(
struct
sockaddr
*
)
&
serverAddr
,
sizeof
(
serverAddr
))
<
0
)
{
uError
(
"
failed to connect port:%d since %s"
,
info
->
port
,
strerror
(
errno
));
uError
(
"
TCP: failed to connect port %s:%d since %s"
,
taosIpStr
(
info
->
hostIp
)
,
info
->
port
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
memset
(
sendbuf
,
0
,
BUFFER_SIZE
);
taosKeepTcpAlive
(
clientSocket
);
memset
(
recvbuf
,
0
,
BUFFER_SIZE
);
struct
in_addr
ipStr
;
memcpy
(
&
ipStr
,
&
info
->
hostIp
,
4
);
sprintf
(
sendbuf
,
"client send tcp pkg to %s:%d, content: 1122334455"
,
taosInetNtoa
(
ipStr
),
info
->
port
);
sprintf
(
sendbuf
+
info
->
pktLen
-
16
,
"1122334455667788"
);
send
(
clientSocket
,
sendbuf
,
info
->
pktLen
,
0
);
memset
(
recvbuf
,
0
,
BUFFER_SIZE
);
sprintf
(
buffer
,
"client send TCP pkg to %s:%d, content: 1122334455"
,
taosIpStr
(
info
->
hostIp
),
info
->
port
);
int32_t
nleft
,
nread
;
sprintf
(
buffer
+
info
->
pktLen
-
16
,
"1122334455667788"
);
char
*
ptr
=
recvbuf
;
nleft
=
info
->
pktLen
;
while
(
nleft
>
0
)
{
int32_t
ret
=
taosWriteMsg
(
clientSocket
,
buffer
,
info
->
pktLen
);
nread
=
recv
(
clientSocket
,
ptr
,
BUFFER_SIZE
,
0
);;
if
(
ret
<
0
)
{
uError
(
"TCP: failed to write msg to %s:%d since %s"
,
taosIpStr
(
info
->
hostIp
),
info
->
port
,
strerror
(
errno
));
if
(
nread
==
0
)
{
return
-
1
;
break
;
}
else
if
(
nread
<
0
)
{
if
(
errno
==
EINTR
)
{
continue
;
}
else
{
uError
(
"faild to recv pkg from TCP port:%d since %s"
,
info
->
port
,
strerror
(
errno
));
taosCloseSocket
(
clientSocket
);
return
-
1
;
}
}
else
{
nleft
-=
nread
;
ptr
+=
nread
;
iDataNum
+=
nread
;
}
}
}
if
(
iDataNum
<
info
->
pktLen
)
{
ret
=
taosReadMsg
(
clientSocket
,
buffer
,
info
->
pktLen
);
uError
(
"TCP: received ack:%d bytes, less than send:%d bytes from port:%d"
,
iDataNum
,
info
->
pktLen
,
info
->
port
);
if
(
ret
<
0
)
{
uError
(
"TCP: failed to read msg from %s:%d since %s"
,
taosIpStr
(
info
->
hostIp
),
info
->
port
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -239,9 +227,9 @@ static int32_t taosNetCheckTcpPort(STestInfo *info) {
...
@@ -239,9 +227,9 @@ static int32_t taosNetCheckTcpPort(STestInfo *info) {
static
int32_t
taosNetCheckUdpPort
(
STestInfo
*
info
)
{
static
int32_t
taosNetCheckUdpPort
(
STestInfo
*
info
)
{
SOCKET
clientSocket
;
SOCKET
clientSocket
;
char
sendbuf
[
BUFFER_SIZE
];
char
buffer
[
BUFFER_SIZE
]
=
{
0
};
char
recvbuf
[
BUFFER_SIZE
];
int32_t
iDataNum
=
0
;
int32_t
iDataNum
=
0
;
int32_t
bufSize
=
1024000
;
struct
sockaddr_in
serverAddr
;
struct
sockaddr_in
serverAddr
;
...
@@ -250,41 +238,39 @@ static int32_t taosNetCheckUdpPort(STestInfo *info) {
...
@@ -250,41 +238,39 @@ static int32_t taosNetCheckUdpPort(STestInfo *info) {
return
-
1
;
return
-
1
;
}
}
// set overtime
if
(
taosSetSockOpt
(
clientSocket
,
SOL_SOCKET
,
SO_SNDBUF
,
(
void
*
)
&
bufSize
,
sizeof
(
bufSize
))
!=
0
)
{
struct
timeval
timeout
;
uError
(
"failed to set the send buffer size for UDP socket
\n
"
);
timeout
.
tv_sec
=
2
;
// s
return
-
1
;
timeout
.
tv_usec
=
0
;
// us
if
(
setsockopt
(
clientSocket
,
SOL_SOCKET
,
SO_SNDTIMEO
,
(
char
*
)
&
timeout
,
sizeof
(
struct
timeval
))
==
-
1
)
{
uError
(
"failed to setsockopt send timer since %s"
,
strerror
(
errno
));
}
}
if
(
setsockopt
(
clientSocket
,
SOL_SOCKET
,
SO_RCVTIMEO
,
(
char
*
)
&
timeout
,
sizeof
(
struct
timeval
))
==
-
1
)
{
uError
(
"failed to setsockopt recv timer since %s"
,
strerror
(
errno
));
if
(
taosSetSockOpt
(
clientSocket
,
SOL_SOCKET
,
SO_RCVBUF
,
(
void
*
)
&
bufSize
,
sizeof
(
bufSize
))
!=
0
)
{
uError
(
"failed to set the receive buffer size for UDP socket
\n
"
);
return
-
1
;
}
}
serverAddr
.
sin_family
=
AF_INET
;
serverAddr
.
sin_family
=
AF_INET
;
serverAddr
.
sin_port
=
htons
(
info
->
port
);
serverAddr
.
sin_port
=
htons
(
info
->
port
);
serverAddr
.
sin_addr
.
s_addr
=
info
->
hostIp
;
serverAddr
.
sin_addr
.
s_addr
=
info
->
hostIp
;
memset
(
sendbuf
,
0
,
BUFFER_SIZE
);
memset
(
recvbuf
,
0
,
BUFFER_SIZE
);
struct
in_addr
ipStr
;
struct
in_addr
ipStr
;
memcpy
(
&
ipStr
,
&
info
->
hostIp
,
4
);
memcpy
(
&
ipStr
,
&
info
->
hostIp
,
4
);
sprintf
(
sendbuf
,
"client send udp pkg to %s:%d, content: 1122334455"
,
taosInetNtoa
(
ipStr
),
info
->
port
);
sprintf
(
buffer
,
"client send udp pkg to %s:%d, content: 1122334455"
,
taosInetNtoa
(
ipStr
),
info
->
port
);
sprintf
(
sendbuf
+
info
->
pktLen
-
16
,
"1122334455667788"
);
sprintf
(
buffer
+
info
->
pktLen
-
16
,
"1122334455667788"
);
socklen_t
sin_size
=
sizeof
(
*
(
struct
sockaddr
*
)
&
serverAddr
);
socklen_t
sin_size
=
sizeof
(
*
(
struct
sockaddr
*
)
&
serverAddr
);
i
nt32_t
code
=
sendto
(
clientSocket
,
sendbuf
,
info
->
pktLen
,
0
,
(
struct
sockaddr
*
)
&
serverAddr
,
(
int32_t
)
sin_size
);
i
DataNum
=
taosSendto
(
clientSocket
,
buffer
,
info
->
pktLen
,
0
,
(
struct
sockaddr
*
)
&
serverAddr
,
(
int32_t
)
sin_size
);
if
(
code
<
0
)
{
if
(
iDataNum
<
0
||
iDataNum
!=
info
->
pktLen
)
{
uError
(
"failed to perform sendto func since %s"
,
strerror
(
errno
));
uError
(
"
UDP:
failed to perform sendto func since %s"
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
iDataNum
=
recvfrom
(
clientSocket
,
recvbuf
,
BUFFER_SIZE
,
0
,
(
struct
sockaddr
*
)
&
serverAddr
,
&
sin_size
);
memset
(
buffer
,
0
,
BUFFER_SIZE
);
sin_size
=
sizeof
(
*
(
struct
sockaddr
*
)
&
serverAddr
);
iDataNum
=
recvfrom
(
clientSocket
,
buffer
,
BUFFER_SIZE
,
0
,
(
struct
sockaddr
*
)
&
serverAddr
,
&
sin_size
);
if
(
iDataNum
<
info
->
pktLen
)
{
if
(
iDataNum
<
0
||
iDataNum
!=
info
->
pktLen
)
{
uError
(
"UDP: received ack:%d bytes
, less than send:%d bytes from port:%d"
,
iDataNum
,
info
->
pktLen
,
info
->
port
);
uError
(
"UDP: received ack:%d bytes
(expect:%d) from port:%d since %s"
,
iDataNum
,
info
->
pktLen
,
info
->
port
,
strerror
(
errno
)
);
return
-
1
;
return
-
1
;
}
}
...
@@ -304,19 +290,18 @@ static void taosNetCheckPort(uint32_t hostIp, int32_t startPort, int32_t endPort
...
@@ -304,19 +290,18 @@ static void taosNetCheckPort(uint32_t hostIp, int32_t startPort, int32_t endPort
info
.
port
=
port
;
info
.
port
=
port
;
ret
=
taosNetCheckTcpPort
(
&
info
);
ret
=
taosNetCheckTcpPort
(
&
info
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
uError
(
"failed to test
tcp
port:%d"
,
port
);
uError
(
"failed to test
TCP
port:%d"
,
port
);
}
else
{
}
else
{
uInfo
(
"successed to test
tcp
port:%d"
,
port
);
uInfo
(
"successed to test
TCP
port:%d"
,
port
);
}
}
ret
=
taosNetCheckUdpPort
(
&
info
);
ret
=
taosNetCheckUdpPort
(
&
info
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
uError
(
"failed to test
udp
port:%d"
,
port
);
uError
(
"failed to test
UDP
port:%d"
,
port
);
}
else
{
}
else
{
uInfo
(
"successed to test
udp
port:%d"
,
port
);
uInfo
(
"successed to test
UDP
port:%d"
,
port
);
}
}
}
}
return
;
}
}
void
*
taosNetInitRpc
(
char
*
secretEncrypt
,
char
spi
)
{
void
*
taosNetInitRpc
(
char
*
secretEncrypt
,
char
spi
)
{
...
@@ -440,9 +425,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
...
@@ -440,9 +425,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
int32_t
ret
=
taosNetCheckRpc
(
host
,
port
,
sendpkgLen
,
spi
,
NULL
);
int32_t
ret
=
taosNetCheckRpc
(
host
,
port
,
sendpkgLen
,
spi
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
uError
(
"failed to test
tcp
port:%d"
,
port
);
uError
(
"failed to test
TCP
port:%d"
,
port
);
}
else
{
}
else
{
uInfo
(
"successed to test
tcp
port:%d"
,
port
);
uInfo
(
"successed to test
TCP
port:%d"
,
port
);
}
}
if
(
pkgLen
>=
tsRpcMaxUdpSize
)
{
if
(
pkgLen
>=
tsRpcMaxUdpSize
)
{
...
@@ -453,9 +438,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
...
@@ -453,9 +438,9 @@ static void taosNetTestRpc(char *host, int32_t startPort, int32_t pkgLen) {
ret
=
taosNetCheckRpc
(
host
,
port
,
pkgLen
,
spi
,
NULL
);
ret
=
taosNetCheckRpc
(
host
,
port
,
pkgLen
,
spi
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
uError
(
"failed to test
udp
port:%d"
,
port
);
uError
(
"failed to test
UDP
port:%d"
,
port
);
}
else
{
}
else
{
uInfo
(
"successed to test
udp
port:%d"
,
port
);
uInfo
(
"successed to test
UDP
port:%d"
,
port
);
}
}
}
}
}
}
...
@@ -492,14 +477,15 @@ static void taosNetTestServer(char *host, int32_t startPort, int32_t pkgLen) {
...
@@ -492,14 +477,15 @@ static void taosNetTestServer(char *host, int32_t startPort, int32_t pkgLen) {
tcpInfo
->
pktLen
=
pkgLen
;
tcpInfo
->
pktLen
=
pkgLen
;
if
(
pthread_create
(
pids
+
i
,
NULL
,
taosNetBindTcpPort
,
tcpInfo
)
!=
0
)
{
if
(
pthread_create
(
pids
+
i
,
NULL
,
taosNetBindTcpPort
,
tcpInfo
)
!=
0
)
{
uInfo
(
"failed to create
tcp
test thread, %s:%d"
,
tcpInfo
->
hostFqdn
,
tcpInfo
->
port
);
uInfo
(
"failed to create
TCP
test thread, %s:%d"
,
tcpInfo
->
hostFqdn
,
tcpInfo
->
port
);
exit
(
-
1
);
exit
(
-
1
);
}
}
STestInfo
*
udpInfo
=
uinfos
+
i
;
STestInfo
*
udpInfo
=
uinfos
+
i
;
udpInfo
->
port
=
(
uint16_t
)(
port
+
i
);
udpInfo
->
port
=
port
+
i
;
tcpInfo
->
pktLen
=
pkgLen
;
if
(
pthread_create
(
pids
+
num
+
i
,
NULL
,
taosNetBindUdpPort
,
udpInfo
)
!=
0
)
{
if
(
pthread_create
(
pids
+
num
+
i
,
NULL
,
taosNetBindUdpPort
,
udpInfo
)
!=
0
)
{
uInfo
(
"failed to create
udp
test thread, %s:%d"
,
tcpInfo
->
hostFqdn
,
tcpInfo
->
port
);
uInfo
(
"failed to create
UDP
test thread, %s:%d"
,
tcpInfo
->
hostFqdn
,
tcpInfo
->
port
);
exit
(
-
1
);
exit
(
-
1
);
}
}
}
}
...
...
src/util/src/tnote.c
浏览文件 @
916a9f68
...
@@ -228,7 +228,7 @@ static int32_t taosOpenNoteWithMaxLines(char *fn, int32_t maxLines, int32_t maxN
...
@@ -228,7 +228,7 @@ static int32_t taosOpenNoteWithMaxLines(char *fn, int32_t maxLines, int32_t maxN
}
}
void
taosNotePrintBuffer
(
SNoteObj
*
pNote
,
char
*
buffer
,
int32_t
len
)
{
void
taosNotePrintBuffer
(
SNoteObj
*
pNote
,
char
*
buffer
,
int32_t
len
)
{
if
(
pNote
->
fd
<
0
)
return
;
if
(
pNote
->
fd
<
=
0
)
return
;
taosWrite
(
pNote
->
fd
,
buffer
,
len
);
taosWrite
(
pNote
->
fd
,
buffer
,
len
);
if
(
pNote
->
maxLines
>
0
)
{
if
(
pNote
->
maxLines
>
0
)
{
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
916a9f68
...
@@ -441,7 +441,6 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) {
...
@@ -441,7 +441,6 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) {
if
(
status
==
TSDB_STATUS_COMMIT_START
)
{
if
(
status
==
TSDB_STATUS_COMMIT_START
)
{
pVnode
->
isCommiting
=
1
;
pVnode
->
isCommiting
=
1
;
pVnode
->
fversion
=
pVnode
->
version
;
vDebug
(
"vgId:%d, start commit, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
vDebug
(
"vgId:%d, start commit, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
if
(
!
vnodeInInitStatus
(
pVnode
))
{
if
(
!
vnodeInInitStatus
(
pVnode
))
{
return
walRenew
(
pVnode
->
wal
);
return
walRenew
(
pVnode
->
wal
);
...
@@ -450,9 +449,10 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) {
...
@@ -450,9 +449,10 @@ static int32_t vnodeProcessTsdbStatus(void *arg, int32_t status, int32_t eno) {
}
}
if
(
status
==
TSDB_STATUS_COMMIT_OVER
)
{
if
(
status
==
TSDB_STATUS_COMMIT_OVER
)
{
vDebug
(
"vgId:%d, commit over, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
pVnode
->
isCommiting
=
0
;
pVnode
->
isCommiting
=
0
;
pVnode
->
isFull
=
0
;
pVnode
->
isFull
=
0
;
pVnode
->
fversion
=
pVnode
->
version
;
vDebug
(
"vgId:%d, commit over, fver:%"
PRIu64
" vver:%"
PRIu64
,
pVnode
->
vgId
,
pVnode
->
fversion
,
pVnode
->
version
);
if
(
!
vnodeInInitStatus
(
pVnode
))
{
if
(
!
vnodeInInitStatus
(
pVnode
))
{
walRemoveOneOldFile
(
pVnode
->
wal
);
walRemoveOneOldFile
(
pVnode
->
wal
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录