Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3d1a0e0e
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3d1a0e0e
编写于
2月 04, 2021
作者:
D
dapan1121
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into hotfix/TD-2926
上级
a8701889
4e2e7596
变更
24
显示空白变更内容
内联
并排
Showing
24 changed file
with
373 addition
and
167 deletion
+373
-167
Jenkinsfile
Jenkinsfile
+32
-14
deps/rmonotonic/src/monotonic.c
deps/rmonotonic/src/monotonic.c
+2
-2
src/dnode/src/dnodeShell.c
src/dnode/src/dnodeShell.c
+12
-12
src/dnode/src/dnodeStep.c
src/dnode/src/dnodeStep.c
+2
-2
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+1
-1
src/dnode/src/dnodeVWrite.c
src/dnode/src/dnodeVWrite.c
+1
-1
src/mnode/src/mnodeDb.c
src/mnode/src/mnodeDb.c
+1
-1
src/os/inc/osDarwin.h
src/os/inc/osDarwin.h
+2
-1
src/os/src/darwin/darwinEnv.c
src/os/src/darwin/darwinEnv.c
+16
-4
src/os/src/darwin/darwinFile.c
src/os/src/darwin/darwinFile.c
+36
-58
src/os/src/darwin/darwinSemphone.c
src/os/src/darwin/darwinSemphone.c
+40
-0
src/os/src/darwin/darwinSysInfo.c
src/os/src/darwin/darwinSysInfo.c
+129
-21
src/os/src/detail/osSemphone.c
src/os/src/detail/osSemphone.c
+1
-1
src/plugins/http/src/httpSystem.c
src/plugins/http/src/httpSystem.c
+5
-0
src/rpc/src/rpcTcp.c
src/rpc/src/rpcTcp.c
+46
-41
src/sync/src/syncTcp.c
src/sync/src/syncTcp.c
+5
-0
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+4
-1
src/tsdb/src/tsdbSync.c
src/tsdb/src/tsdbSync.c
+1
-1
src/util/src/tsocket.c
src/util/src/tsocket.c
+14
-1
tests/examples/C#/taosdemo/taosdemo.cs
tests/examples/C#/taosdemo/taosdemo.cs
+1
-0
tests/examples/c/epoll.c
tests/examples/c/epoll.c
+4
-1
tests/pytest/pytest_3.sh
tests/pytest/pytest_3.sh
+1
-0
tests/pytest/query/queryGroupbySort.py
tests/pytest/query/queryGroupbySort.py
+4
-0
tests/pytest/tools/taosdemoTest2.py
tests/pytest/tools/taosdemoTest2.py
+13
-4
未找到文件。
Jenkinsfile
浏览文件 @
3d1a0e0e
...
...
@@ -31,6 +31,7 @@ def abort_previous(){
if
(
buildNumber
>
1
)
milestone
(
buildNumber
-
1
)
milestone
(
buildNumber
)
}
def
kipstage
=
0
def
pre_test
(){
catchError
(
buildResult:
'SUCCESS'
,
stageResult:
'FAILURE'
)
{
sh
'''
...
...
@@ -72,12 +73,29 @@ pipeline {
}
stages
{
stage
(
'pre_build'
){
agent
{
label
'master'
}
steps
{
sh
'''
cd ${WORKSPACE}
git checkout develop
git pull
git fetch origin +refs/pull/${CHANGE_ID}/merge
git checkout -qf FETCH_HEAD
'''
script
{
skipstage
=
sh
(
script:
"git --no-pager diff --name-only FETCH_HEAD develop|grep -v -E '.*md|//src//connector|Jenkinsfile|test-all.sh' || echo 1 "
,
returnStdout:
true
)
}
}
}
stage
(
'Parallel test stage'
)
{
//only build pr
when
{
changeRequest
()
expression
{
skipstage
==
0
}
}
parallel
{
stage
(
'python_1_s1'
)
{
...
...
@@ -127,7 +145,7 @@ pipeline {
stage
(
'test_b1_s2'
)
{
agent
{
label
'b1'
}
steps
{
timeout
(
time:
90
,
unit:
'MINUTES'
){
timeout
(
time:
45
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
cd ${WKC}/tests
...
...
@@ -244,8 +262,8 @@ pipeline {
success
{
emailext
(
subject:
"PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
,
body:
'''
<!DOCTYPE html>
subject:
"PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'
SUCCESS
"
,
body:
"""
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
...
...
@@ -261,29 +279,29 @@ pipeline {
<td>
<ul>
<div style="font-size:18px">
<li>构建名称>>分支:${
PROJECT
_NAME}</li>
<li>构建名称>>分支:${
env.BRANCH
_NAME}</li>
<li>构建结果:<span style="color:green"> Successful </span></li>
<li>构建编号:${BUILD_NUMBER}</li>
<li>触发用户:${
CAUSE
}</li>
<li>触发用户:${
env.CHANGE_AUTHOR
}</li>
<li>提交信息:${CHANGE_TITLE}</li>
<li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
<li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
<li>变更集:${JELLY_SCRIPT}</li>
</div>
</ul>
</td>
</tr>
</table></font>
</body>
</html>
'''
,
</html>
"""
,
to:
"${env.CHANGE_AUTHOR_EMAIL}"
,
from:
"support@taosdata.com"
)
}
failure
{
emailext
(
subject:
"PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'"
,
body:
'''
<!DOCTYPE html>
subject:
"PR-result: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'
FAIL
"
,
body:
"""
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
...
...
@@ -299,21 +317,21 @@ pipeline {
<td>
<ul>
<div style="font-size:18px">
<li>构建名称>>分支:${
PROJECT
_NAME}</li>
<li>构建名称>>分支:${
env.BRANCH
_NAME}</li>
<li>构建结果:<span style="color:green"> Successful </span></li>
<li>构建编号:${BUILD_NUMBER}</li>
<li>触发用户:${
CAUSE
}</li>
<li>触发用户:${
env.CHANGE_AUTHOR
}</li>
<li>提交信息:${CHANGE_TITLE}</li>
<li>构建地址:<a href=${BUILD_URL}>${BUILD_URL}</a></li>
<li>构建日志:<a href=${BUILD_URL}console>${BUILD_URL}console</a></li>
<li>变更集:${JELLY_SCRIPT}</li>
</div>
</ul>
</td>
</tr>
</table></font>
</body>
</html>
'''
,
</html>
"""
,
to:
"${env.CHANGE_AUTHOR_EMAIL}"
,
from:
"support@taosdata.com"
)
...
...
deps/rmonotonic/src/monotonic.c
浏览文件 @
3d1a0e0e
...
...
@@ -84,11 +84,11 @@ static void monotonicInit_x86linux() {
regfree
(
&
constTscRegex
);
if
(
mono_ticksPerMicrosecond
==
0
)
{
fprintf
(
stderr
,
"monotonic: x86 linux, unable to determine clock rate"
);
//
fprintf(stderr, "monotonic: x86 linux, unable to determine clock rate");
return
;
}
if
(
!
constantTsc
)
{
fprintf
(
stderr
,
"monotonic: x86 linux, 'constant_tsc' flag not present"
);
//
fprintf(stderr, "monotonic: x86 linux, 'constant_tsc' flag not present");
return
;
}
...
...
src/dnode/src/dnodeShell.c
浏览文件 @
3d1a0e0e
src/dnode/src/dnodeStep.c
浏览文件 @
3d1a0e0e
src/dnode/src/dnodeSystem.c
浏览文件 @
3d1a0e0e
src/dnode/src/dnodeVWrite.c
浏览文件 @
3d1a0e0e
...
...
@@ -53,7 +53,7 @@ void dnodeCleanupVWrite() {
for
(
int32_t
i
=
0
;
i
<
tsVWriteWP
.
max
;
++
i
)
{
SVWriteWorker
*
pWorker
=
tsVWriteWP
.
worker
+
i
;
if
(
taosCheckPthreadValid
(
pWorker
->
thread
))
{
taosQsetThreadResume
(
pWorker
->
qset
);
if
(
pWorker
->
qset
)
taosQsetThreadResume
(
pWorker
->
qset
);
}
}
...
...
src/mnode/src/mnodeDb.c
浏览文件 @
3d1a0e0e
...
...
@@ -679,7 +679,7 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
pShow
->
pIter
=
mnodeGetNextDb
(
pShow
->
pIter
,
&
pDb
);
if
(
pDb
==
NULL
)
break
;
if
(
pDb
->
pAcct
!=
pUser
->
pAcct
)
{
if
(
pDb
->
pAcct
!=
pUser
->
pAcct
||
pDb
->
status
!=
TSDB_DB_STATUS_READY
)
{
mnodeDecDbRef
(
pDb
);
continue
;
}
...
...
src/os/inc/osDarwin.h
浏览文件 @
3d1a0e0e
...
...
@@ -85,6 +85,7 @@ extern "C" {
#define TAOS_OS_FUNC_STRING_STR2INT64
#define TAOS_OS_FUNC_SYSINFO
#define TAOS_OS_FUNC_TIMER
#define TAOS_OS_FUNC_SEMPHONE_PTHREAD
// specific
#define htobe64 htonll
...
...
src/os/src/darwin/darwinEnv.c
浏览文件 @
3d1a0e0e
...
...
@@ -17,17 +17,29 @@
#include "os.h"
#include "tglobal.h"
static
const
char
*
expand_like_shell
(
const
char
*
path
)
{
static
__thread
char
buf
[
TSDB_FILENAME_LEN
];
buf
[
0
]
=
'\0'
;
wordexp_t
we
;
if
(
wordexp
(
path
,
&
we
,
0
))
return
"/tmp/taosd"
;
if
(
sizeof
(
buf
)
<=
snprintf
(
buf
,
sizeof
(
buf
),
"%s"
,
we
.
we_wordv
[
0
]))
return
"/tmp/taosd"
;
wordfree
(
&
we
);
return
buf
;
}
void
osInit
()
{
if
(
configDir
[
0
]
==
0
)
{
strcpy
(
configDir
,
"~/TDengine/cfg"
);
strcpy
(
configDir
,
expand_like_shell
(
"~/TDengine/cfg"
)
);
}
strcpy
(
tsVnodeDir
,
""
);
strcpy
(
tsDnodeDir
,
""
);
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
tsDataDir
,
"~/TDengine/data"
);
strcpy
(
tsLogDir
,
"~/TDengine/log"
);
strcpy
(
tsScriptDir
,
"~/TDengine/cfg"
);
strcpy
(
tsDataDir
,
expand_like_shell
(
"~/TDengine/data"
));
strcpy
(
tsLogDir
,
expand_like_shell
(
"~/TDengine/log"
));
strcpy
(
tsScriptDir
,
expand_like_shell
(
"~/TDengine/cfg"
));
strcpy
(
tsOsName
,
"Darwin"
);
}
src/os/src/darwin/darwinFile.c
浏览文件 @
3d1a0e0e
...
...
@@ -17,71 +17,49 @@
#include "os.h"
#include "tulog.h"
#define _SEND_FILE_STEP_ 1000
int64_t
taosFSendFile
(
FILE
*
out_file
,
FILE
*
in_file
,
int64_t
*
offset
,
int64_t
count
)
{
fseek
(
in_file
,
(
int32_t
)(
*
offset
),
0
);
int
writeLen
=
0
;
uint8_t
buffer
[
_SEND_FILE_STEP_
]
=
{
0
};
for
(
int
len
=
0
;
len
<
(
count
-
_SEND_FILE_STEP_
);
len
+=
_SEND_FILE_STEP_
)
{
size_t
rlen
=
fread
(
buffer
,
1
,
_SEND_FILE_STEP_
,
in_file
);
if
(
rlen
<=
0
)
{
return
writeLen
;
}
else
if
(
rlen
<
_SEND_FILE_STEP_
)
{
fwrite
(
buffer
,
1
,
rlen
,
out_file
);
return
(
int
)(
writeLen
+
rlen
);
}
else
{
fwrite
(
buffer
,
1
,
_SEND_FILE_STEP_
,
in_file
);
writeLen
+=
_SEND_FILE_STEP_
;
int
r
=
0
;
if
(
offset
)
{
r
=
fseek
(
in_file
,
*
offset
,
SEEK_SET
);
if
(
r
==-
1
)
return
-
1
;
}
off_t
len
=
count
;
while
(
len
>
0
)
{
char
buf
[
1024
*
16
];
off_t
n
=
sizeof
(
buf
);
if
(
len
<
n
)
n
=
len
;
size_t
m
=
fread
(
buf
,
1
,
n
,
in_file
);
if
(
m
<
n
)
{
int
e
=
ferror
(
in_file
);
if
(
e
)
return
-
1
;
}
int
remain
=
count
-
writeLen
;
if
(
remain
>
0
)
{
size_t
rlen
=
fread
(
buffer
,
1
,
remain
,
in_file
);
if
(
rlen
<=
0
)
{
return
writeLen
;
}
else
{
fwrite
(
buffer
,
1
,
remain
,
out_file
);
writeLen
+=
remain
;
if
(
m
==
0
)
break
;
if
(
m
!=
fwrite
(
buf
,
1
,
m
,
out_file
))
{
return
-
1
;
}
len
-=
m
;
}
return
writeLen
;
return
count
-
len
;
}
int64_t
taosSendFile
(
SOCKET
dfd
,
int32_t
sfd
,
int64_t
*
offset
,
int64_t
count
)
{
lseek
(
sfd
,
(
int32_t
)(
*
offset
),
0
);
int64_t
writeLen
=
0
;
uint8_t
buffer
[
_SEND_FILE_STEP_
]
=
{
0
};
for
(
int64_t
len
=
0
;
len
<
(
count
-
_SEND_FILE_STEP_
);
len
+=
_SEND_FILE_STEP_
)
{
int32_t
rlen
=
(
int32_t
)
read
(
sfd
,
buffer
,
_SEND_FILE_STEP_
);
if
(
rlen
<=
0
)
{
return
writeLen
;
}
else
if
(
rlen
<
_SEND_FILE_STEP_
)
{
taosWriteSocket
(
dfd
,
buffer
,
rlen
);
return
(
int64_t
)(
writeLen
+
rlen
);
}
else
{
taosWriteSocket
(
dfd
,
buffer
,
_SEND_FILE_STEP_
);
writeLen
+=
_SEND_FILE_STEP_
;
int
r
=
0
;
if
(
offset
)
{
r
=
lseek
(
sfd
,
*
offset
,
SEEK_SET
);
if
(
r
==-
1
)
return
-
1
;
}
off_t
len
=
count
;
while
(
len
>
0
)
{
char
buf
[
1024
*
16
];
off_t
n
=
sizeof
(
buf
);
if
(
len
<
n
)
n
=
len
;
size_t
m
=
read
(
sfd
,
buf
,
n
);
if
(
m
==-
1
)
return
-
1
;
if
(
m
==
0
)
break
;
size_t
l
=
write
(
dfd
,
buf
,
m
);
if
(
l
==-
1
)
return
-
1
;
len
-=
l
;
}
int64_t
remain
=
count
-
writeLen
;
if
(
remain
>
0
)
{
int32_t
rlen
=
read
(
sfd
,
buffer
,
(
int32_t
)
remain
);
if
(
rlen
<=
0
)
{
return
writeLen
;
}
else
{
taosWriteSocket
(
sfd
,
buffer
,
(
int32_t
)
remain
);
writeLen
+=
remain
;
}
}
return
writeLen
;
return
count
-
len
;
}
src/os/src/darwin/darwinSemphone.c
浏览文件 @
3d1a0e0e
...
...
@@ -21,6 +21,8 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include <libproc.h>
// #define SEM_USE_PTHREAD
// #define SEM_USE_POSIX
#define SEM_USE_SEM
...
...
@@ -279,3 +281,41 @@ int tsem_destroy(tsem_t *sem) {
return
0
;
}
bool
taosCheckPthreadValid
(
pthread_t
thread
)
{
uint64_t
id
=
0
;
int
r
=
pthread_threadid_np
(
thread
,
&
id
);
return
r
?
false
:
true
;
}
int64_t
taosGetSelfPthreadId
()
{
return
(
int64_t
)
pthread_self
();
}
int64_t
taosGetPthreadId
(
pthread_t
thread
)
{
return
(
int64_t
)
thread
;
}
void
taosResetPthread
(
pthread_t
*
thread
)
{
*
thread
=
NULL
;
}
bool
taosComparePthread
(
pthread_t
first
,
pthread_t
second
)
{
return
pthread_equal
(
first
,
second
)
?
true
:
false
;
}
int32_t
taosGetPId
()
{
return
(
int32_t
)
getpid
();
}
int32_t
taosGetCurrentAPPName
(
char
*
name
,
int32_t
*
len
)
{
char
buf
[
PATH_MAX
+
1
];
buf
[
0
]
=
'\0'
;
proc_name
(
getpid
(),
buf
,
sizeof
(
buf
)
-
1
);
buf
[
PATH_MAX
]
=
'\0'
;
size_t
n
=
strlen
(
buf
);
if
(
len
)
*
len
=
n
;
if
(
name
)
strcpy
(
name
,
buf
);
return
0
;
}
src/os/src/darwin/darwinSysInfo.c
浏览文件 @
3d1a0e0e
...
...
@@ -24,42 +24,134 @@
static
void
taosGetSystemTimezone
()
{
// get and set default timezone
SGlobalCfg
*
cfg_timezone
=
taosGetConfigOption
(
"timezone"
);
if
(
cfg_timezone
&&
cfg_timezone
->
cfgStatus
<
TAOS_CFG_CSTATUS_DEFAULT
)
{
char
*
tz
=
getenv
(
"TZ"
);
if
(
tz
==
NULL
||
strlen
(
tz
)
==
0
)
{
strcpy
(
tsTimezone
,
"not configured"
);
if
(
cfg_timezone
==
NULL
)
return
;
if
(
cfg_timezone
->
cfgStatus
>=
TAOS_CFG_CSTATUS_DEFAULT
)
{
return
;
}
/* load time zone string from /etc/localtime */
char
buf
[
4096
];
char
*
tz
=
NULL
;
{
int
n
=
readlink
(
"/etc/localtime"
,
buf
,
sizeof
(
buf
));
if
(
n
<
0
)
{
uError
(
"read /etc/localtime error, reason:%s"
,
strerror
(
errno
));
return
;
}
buf
[
n
]
=
'\0'
;
for
(
int
i
=
n
-
1
;
i
>=
0
;
--
i
)
{
if
(
buf
[
i
]
==
'/'
)
{
if
(
tz
)
{
tz
=
buf
+
i
+
1
;
break
;
}
tz
=
buf
+
i
+
1
;
}
else
{
strcpy
(
tsTimezone
,
tz
);
}
cfg_timezone
->
cfgStatus
=
TAOS_CFG_CSTATUS_DEFAULT
;
uInfo
(
"timezone not configured, use default"
);
if
(
!
tz
||
0
==
strchr
(
tz
,
'/'
))
{
uError
(
"parsing /etc/localtime failed"
);
return
;
}
setenv
(
"TZ"
,
tz
,
1
);
tzset
();
}
/*
* NOTE: do not remove it.
* Enforce set the correct daylight saving time(DST) flag according
* to current time
*/
time_t
tx1
=
time
(
NULL
);
struct
tm
tm1
;
localtime_r
(
&
tx1
,
&
tm1
);
/*
* format example:
*
* Asia/Shanghai (CST, +0800)
* Europe/London (BST, +0100)
*/
snprintf
(
tsTimezone
,
TSDB_TIMEZONE_LEN
,
"%s (%s, %+03ld00)"
,
tz
,
tm1
.
tm_isdst
?
tzname
[
daylight
]
:
tzname
[
0
],
-
timezone
/
3600
);
// cfg_timezone->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
uWarn
(
"timezone not configured, set to system default:%s"
,
tsTimezone
);
}
static
void
taosGetSystemLocale
()
{
// get and set default locale
/*
* originally from src/os/src/detail/osSysinfo.c
* POSIX format locale string:
* (Language Strings)_(Country/Region Strings).(code_page)
*
* example: en_US.UTF-8, zh_CN.GB18030, zh_CN.UTF-8,
*
* if user does not specify the locale in taos.cfg the program use default LC_CTYPE as system locale.
*
* In case of some CentOS systems, their default locale is "en_US.utf8", which is not valid code_page
* for libiconv that is employed to convert string in this system. This program will automatically use
* UTF-8 instead as the charset.
*
* In case of windows client, the locale string is not valid POSIX format, user needs to set the
* correct code_page for libiconv. Usually, the code_page of windows system with simple chinese is
* CP936, CP437 for English charset.
*
*/
static
void
taosGetSystemLocale
()
{
// get and set default locale
char
sep
=
'.'
;
char
*
locale
=
NULL
;
SGlobalCfg
*
cfg_locale
=
taosGetConfigOption
(
"locale"
);
if
(
cfg_locale
&&
cfg_locale
->
cfgStatus
<
TAOS_CFG_CSTATUS_DEFAULT
)
{
char
*
locale
=
setlocale
(
LC_CTYPE
,
"chs"
);
if
(
locale
!=
NULL
)
{
locale
=
setlocale
(
LC_CTYPE
,
""
);
if
(
locale
==
NULL
)
{
uError
(
"can't get locale from system, set it to en_US.UTF-8 since error:%d:%s"
,
errno
,
strerror
(
errno
));
strcpy
(
tsLocale
,
"en_US.UTF-8"
);
}
else
{
tstrncpy
(
tsLocale
,
locale
,
TSDB_LOCALE_LEN
);
cfg_locale
->
cfgStatus
=
TAOS_CFG_CSTATUS_DEFAULT
;
uInfo
(
"locale not configured, set to default:%s"
,
tsLocale
);
uWarn
(
"locale not configured, set to system default:%s"
,
tsLocale
);
}
}
/* if user does not specify the charset, extract it from locale */
SGlobalCfg
*
cfg_charset
=
taosGetConfigOption
(
"charset"
);
if
(
cfg_charset
&&
cfg_charset
->
cfgStatus
<
TAOS_CFG_CSTATUS_DEFAULT
)
{
strcpy
(
tsCharset
,
"cp936"
);
cfg_charset
->
cfgStatus
=
TAOS_CFG_CSTATUS_DEFAULT
;
uInfo
(
"charset not configured, set to default:%s"
,
tsCharset
);
char
*
str
=
strrchr
(
tsLocale
,
sep
);
if
(
str
!=
NULL
)
{
str
++
;
char
*
revisedCharset
=
taosCharsetReplace
(
str
);
tstrncpy
(
tsCharset
,
revisedCharset
,
TSDB_LOCALE_LEN
);
free
(
revisedCharset
);
uWarn
(
"charset not configured, set to system default:%s"
,
tsCharset
);
}
else
{
strcpy
(
tsCharset
,
"UTF-8"
);
uWarn
(
"can't get locale and charset from system, set it to UTF-8"
);
}
}
}
void
taosPrintOsInfo
()
{}
void
taosPrintOsInfo
()
{
uInfo
(
" os pageSize: %"
PRId64
"(KB)"
,
tsPageSize
/
1024
);
// uInfo(" os openMax: %" PRId64, tsOpenMax);
// uInfo(" os streamMax: %" PRId64, tsStreamMax);
uInfo
(
" os numOfCores: %d"
,
tsNumOfCores
);
uInfo
(
" os totalDisk: %f(GB)"
,
tsTotalDataDirGB
);
uInfo
(
" os totalMemory: %d(MB)"
,
tsTotalMemoryMB
);
struct
utsname
buf
;
if
(
uname
(
&
buf
))
{
uInfo
(
" can't fetch os info"
);
return
;
}
uInfo
(
" os sysname: %s"
,
buf
.
sysname
);
uInfo
(
" os nodename: %s"
,
buf
.
nodename
);
uInfo
(
" os release: %s"
,
buf
.
release
);
uInfo
(
" os version: %s"
,
buf
.
version
);
uInfo
(
" os machine: %s"
,
buf
.
machine
);
uInfo
(
"=================================="
);
}
void
taosKillSystem
()
{
uError
(
"function taosKillSystem, exit!"
);
...
...
@@ -67,6 +159,22 @@ void taosKillSystem() {
}
void
taosGetSystemInfo
()
{
// taosGetProcInfos();
tsNumOfCores
=
sysconf
(
_SC_NPROCESSORS_ONLN
);
long
physical_pages
=
sysconf
(
_SC_PHYS_PAGES
);
long
page_size
=
sysconf
(
_SC_PAGESIZE
);
tsTotalMemoryMB
=
physical_pages
*
page_size
/
(
1024
*
1024
);
tsPageSize
=
page_size
;
// float tmp1, tmp2;
// taosGetSysMemory(&tmp1);
// taosGetProcMemory(&tmp2);
// taosGetDisk();
// taosGetBandSpeed(&tmp1);
// taosGetCpuUsage(&tmp1, &tmp2);
// taosGetProcIO(&tmp1, &tmp2);
taosGetSystemTimezone
();
taosGetSystemLocale
();
}
...
...
@@ -121,7 +229,6 @@ int32_t taosGetDiskSize(char *dataDir, SysDiskSize *diskSize) {
char
cmdline
[
1024
];
char
*
taosGetCmdlineByPID
(
int
pid
)
{
errno
=
0
;
if
(
proc_pidpath
(
pid
,
cmdline
,
sizeof
(
cmdline
))
<=
0
)
{
...
...
@@ -136,6 +243,7 @@ bool taosGetSystemUid(char *uid) {
uuid_t
uuid
=
{
0
};
uuid_generate
(
uuid
);
// it's caller's responsibility to make enough space for `uid`, that's 36-char + 1-null
uuid_unparse
(
uuid
,
uid
);
uuid_unparse
_lower
(
uuid
,
uid
);
return
true
;
}
src/os/src/detail/osSemphone.c
浏览文件 @
3d1a0e0e
src/plugins/http/src/httpSystem.c
浏览文件 @
3d1a0e0e
...
...
@@ -92,6 +92,11 @@ void httpStopSystem() {
tsHttpServer
.
stop
=
1
;
#ifdef WINDOWS
closesocket
(
tsHttpServer
.
fd
);
#elif __APPLE__
if
(
tsHttpServer
.
fd
!=-
1
)
{
close
(
tsHttpServer
.
fd
);
tsHttpServer
.
fd
=
-
1
;
}
#else
shutdown
(
tsHttpServer
.
fd
,
SHUT_RD
);
#endif
...
...
src/rpc/src/rpcTcp.c
浏览文件 @
3d1a0e0e
...
...
@@ -197,6 +197,11 @@ void taosStopTcpServer(void *handle) {
if
(
pServerObj
->
fd
>=
0
)
{
#ifdef WINDOWS
closesocket
(
pServerObj
->
fd
);
#elif defined(__APPLE__)
if
(
pServerObj
->
fd
!=-
1
)
{
close
(
pServerObj
->
fd
);
pServerObj
->
fd
=
-
1
;
}
#else
shutdown
(
pServerObj
->
fd
,
SHUT_RD
);
#endif
...
...
src/sync/src/syncTcp.c
浏览文件 @
3d1a0e0e
...
...
@@ -103,6 +103,11 @@ void syncCloseTcpThreadPool(void *param) {
#ifdef WINDOWS
closesocket
(
pPool
->
acceptFd
);
#elif defined(__APPLE__)
if
(
pPool
->
acceptFd
!=-
1
)
{
close
(
pPool
->
acceptFd
);
pPool
->
acceptFd
=
-
1
;
}
#else
shutdown
(
pPool
->
acceptFd
,
SHUT_RD
);
#endif
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
3d1a0e0e
...
...
@@ -1180,9 +1180,12 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity,
char
*
pData
=
NULL
;
// the schema version info is embeded in SDataRow
int32_t
numOfRowCols
=
schemaNCols
(
pSchema
)
;
int32_t
numOfRowCols
=
0
;
if
(
pSchema
==
NULL
)
{
pSchema
=
tsdbGetTableSchemaByVersion
(
pTable
,
dataRowVersion
(
row
));
numOfRowCols
=
schemaNCols
(
pSchema
);
}
else
{
numOfRowCols
=
schemaNCols
(
pSchema
);
}
int32_t
i
=
0
,
j
=
0
;
...
...
src/tsdb/src/tsdbSync.c
浏览文件 @
3d1a0e0e
...
...
@@ -549,7 +549,7 @@ static int32_t tsdbSyncSendDFileSet(SSyncH *pSynch, SDFileSet *pSet) {
bool
toSend
=
false
;
if
(
tsdbSendDFileSetInfo
(
pSynch
,
pSet
)
<
0
)
{
tsdbError
(
"vgId:%d, failed to send fileset:%d info since %s"
,
REPO_ID
(
pRepo
),
pSet
->
fid
,
tstrerror
(
terrno
));
tsdbError
(
"vgId:%d, failed to send fileset:%d info since %s"
,
REPO_ID
(
pRepo
),
pSet
?
pSet
->
fid
:
-
1
,
tstrerror
(
terrno
));
return
-
1
;
}
...
...
src/util/src/tsocket.c
浏览文件 @
3d1a0e0e
...
...
@@ -32,14 +32,27 @@ int32_t taosGetFqdn(char *fqdn) {
struct
addrinfo
hints
=
{
0
};
struct
addrinfo
*
result
=
NULL
;
#ifdef __APPLE__
// on macosx, hostname -f has the form of xxx.local
// which will block getaddrinfo for a few seconds if AI_CANONNAME is set
// thus, we choose AF_INET (ipv4 for the moment) to make getaddrinfo return
// immediately
hints
.
ai_family
=
AF_INET
;
#else // __APPLE__
hints
.
ai_flags
=
AI_CANONNAME
;
#endif // __APPLE__
int32_t
ret
=
getaddrinfo
(
hostname
,
NULL
,
&
hints
,
&
result
);
if
(
!
result
)
{
uError
(
"failed to get fqdn, code:%d, reason:%s"
,
ret
,
gai_strerror
(
ret
));
return
-
1
;
}
#ifdef __APPLE__
// refer to comments above
strcpy
(
fqdn
,
hostname
);
#else // __APPLE__
strcpy
(
fqdn
,
result
->
ai_canonname
);
#endif // __APPLE__
freeaddrinfo
(
result
);
return
0
;
}
...
...
tests/examples/C#/taosdemo/taosdemo.cs
浏览文件 @
3d1a0e0e
...
...
@@ -650,6 +650,7 @@ namespace TDengineDriver
tester
.
CloseConnection
();
Console
.
WriteLine
(
"End."
);
CleanAndExitProgram
(
0
);
}
public
class
InsertDataThread
...
...
tests/examples/c/epoll.c
浏览文件 @
3d1a0e0e
...
...
@@ -38,6 +38,8 @@
#include <string.h>
#include <arpa/inet.h>
#include <libgen.h>
#include <locale.h>
#include <netdb.h>
#define D(fmt, ...) fprintf(stderr, "%s[%d]%s(): " fmt "\n", basename(__FILE__), __LINE__, __func__, ##__VA_ARGS__)
#define A(statement, fmt, ...) do { \
...
...
@@ -56,6 +58,8 @@
##__VA_ARGS__); \
} while (0)
#include "os.h"
typedef
struct
ep_s
ep_t
;
struct
ep_s
{
int
ep
;
...
...
@@ -214,7 +218,6 @@ static void* routine(void* arg) {
A
(
0
==
pthread_mutex_lock
(
&
ep
->
lock
),
""
);
ep
->
wakenup
=
0
;
A
(
0
==
pthread_mutex_unlock
(
&
ep
->
lock
),
""
);
D
(
"........"
);
continue
;
}
A
(
ev
->
data
.
ptr
,
"internal logic error"
);
...
...
tests/pytest/pytest_3.sh
浏览文件 @
3d1a0e0e
...
...
@@ -89,6 +89,7 @@ python3 ./test.py -f functions/function_sum.py -r 1
python3 ./test.py
-f
functions/function_top.py
-r
1
python3 ./test.py
-f
functions/function_twa.py
-r
1
python3 ./test.py
-f
functions/function_twa_test2.py
python3 ./test.py
-f
functions/function_stddev_td2555.py
python3 queryCount.py
python3 ./test.py
-f
query/queryGroupbyWithInterval.py
python3 client/twoClients.py
...
...
tests/pytest/query/queryGroupbySort.py
浏览文件 @
3d1a0e0e
...
...
@@ -46,6 +46,10 @@ class TDTestCase:
tdSql
.
checkData
(
1
,
0
,
"2018-10-03 14:38:15"
)
tdSql
.
checkData
(
2
,
0
,
"2018-10-03 14:38:16"
)
tdSql
.
error
(
"SELECT SUM(current) as s, AVG(voltage) FROM meters WHERE groupId > 1 INTERVAL(1s) GROUP BY location order by s ASC"
)
tdSql
.
error
(
"SELECT SUM(current) as s, AVG(voltage) FROM meters WHERE groupId > 1 INTERVAL(1s) GROUP BY location order by s DESC"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
...
...
tests/pytest/tools/taosdemoTest2.py
浏览文件 @
3d1a0e0e
...
...
@@ -33,13 +33,23 @@ class TDTestCase:
if
(
threadID
==
0
):
os
.
system
(
"yes | taosdemo -t %d -n %d -x"
%
(
self
.
numberOfTables
,
self
.
numberOfRecords
))
if
(
threadID
==
1
):
time
.
sleep
(
2
)
print
(
"use test"
)
tdSql
.
execute
(
"use test"
)
# check if all the tables have heen created
while
True
:
tdSql
.
query
(
"show tables"
)
rows
=
tdSql
.
queryRows
print
(
"number of tables: %d"
%
rows
)
if
(
rows
==
self
.
numberOfTables
):
break
time
.
sleep
(
1
)
# check if there are any records in the last created table
while
True
:
print
(
"query started"
)
tdSql
.
query
(
"select * from test.t9"
)
rows
=
tdSql
.
queryRows
print
(
"
rows
%d"
%
rows
)
print
(
"
number of records:
%d"
%
rows
)
if
(
rows
>
0
):
break
time
.
sleep
(
1
)
...
...
@@ -55,7 +65,6 @@ class TDTestCase:
t2
=
threading
.
Thread
(
target
=
self
.
insertDataAndAlterTable
,
args
=
(
1
,
))
t1
.
start
()
time
.
sleep
(
2
)
t2
.
start
()
t1
.
join
()
t2
.
join
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录