Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
哥们要飞
TDengine
提交
310ac98e
T
TDengine
项目概览
哥们要飞
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
310ac98e
编写于
8月 23, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
8月 23, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3192 from taosdata/fmaster/lihui
[TD-1048]
上级
9ee4ce0c
c984139c
变更
16
显示空白变更内容
内联
并排
Showing
16 changed file
with
303 addition
and
40 deletion
+303
-40
cmake/define.inc
cmake/define.inc
+5
-0
cmake/platform.inc
cmake/platform.inc
+18
-0
packaging/deb/tarbitratord
packaging/deb/tarbitratord
+4
-4
packaging/release.sh
packaging/release.sh
+7
-14
packaging/rpm/tarbitratord
packaging/rpm/tarbitratord
+2
-2
packaging/tools/install.sh
packaging/tools/install.sh
+24
-7
packaging/tools/remove.sh
packaging/tools/remove.sh
+25
-7
packaging/tools/remove_client.sh
packaging/tools/remove_client.sh
+1
-1
src/client/src/tscFunctionImpl.c
src/client/src/tscFunctionImpl.c
+6
-3
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+2
-0
src/dnode/src/dnodeMgmt.c
src/dnode/src/dnodeMgmt.c
+3
-0
src/inc/taosmsg.h
src/inc/taosmsg.h
+1
-0
src/mnode/src/mnodeDnode.c
src/mnode/src/mnodeDnode.c
+7
-2
src/os/inc/os.h
src/os/inc/os.h
+4
-0
src/os/inc/osNingsi.h
src/os/inc/osNingsi.h
+138
-0
src/os/src/linux/ningsi.c
src/os/src/linux/ningsi.c
+56
-0
未找到文件。
cmake/define.inc
浏览文件 @
310ac98e
...
...
@@ -78,6 +78,11 @@ IF (TD_LINUX)
ADD_DEFINITIONS
(
-
D_TD_LINUX
)
ADD_DEFINITIONS
(
-
D_REENTRANT
-
D__USE_POSIX
-
D_LIBC_REENTRANT
)
IF
(
TD_NINGSI_60
)
ADD_DEFINITIONS
(
-
D_TD_NINGSI_60_
)
MESSAGE
(
STATUS
"set ningsi macro to true"
)
ENDIF
()
SET
(
DEBUG_FLAGS
"-O0 -DDEBUG"
)
SET
(
RELEASE_FLAGS
"-O0"
)
...
...
cmake/platform.inc
浏览文件 @
310ac98e
...
...
@@ -22,6 +22,9 @@ SET(TD_LINUX FALSE)
SET
(
TD_MIPS_64
FALSE
)
SET
(
TD_MIPS_32
FALSE
)
SET
(
TD_APLHINE
FALSE
)
SET
(
TD_NINGSI
FALSE
)
SET
(
TD_NINGSI_60
FALSE
)
SET
(
TD_NINGSI_80
FALSE
)
SET
(
TD_WINDOWS
FALSE
)
SET
(
TD_WINDOWS_64
FALSE
)
SET
(
TD_WINDOWS_32
FALSE
)
...
...
@@ -99,3 +102,18 @@ ELSEIF (${CPUTYPE} MATCHES "x86")
ELSE
()
MESSAGE
(
STATUS
"input cpuType unknown "
$
{
CPUTYPE
})
ENDIF
()
# cmake -DOSTYPE=Ningsi
IF
(
$
{
OSTYPE
}
MATCHES
"Ningsi60"
)
SET
(
TD_NINGSI
TRUE
)
SET
(
TD_NINGSI_60
TRUE
)
MESSAGE
(
STATUS
"input osType: Ningsi60"
)
ELSEIF
(
$
{
OSTYPE
}
MATCHES
"Ningsi80"
)
SET
(
TD_NINGSI
TRUE
)
SET
(
TD_NINGSI_80
TRUE
)
MESSAGE
(
STATUS
"input osType: Ningsi80"
)
ELSEIF
(
$
{
OSTYPE
}
MATCHES
"Linux"
)
MESSAGE
(
STATUS
"input osType: Linux"
)
ELSE
()
MESSAGE
(
STATUS
"input osType unknown: "
$
{
OSTYPE
})
ENDIF
()
\ No newline at end of file
packaging/deb/tarbitratord
浏览文件 @
310ac98e
...
...
@@ -7,19 +7,19 @@
# chkconfig: 2345 99 01
#
### BEGIN INIT INFO
# Provides:
TDEngine
# Provides:
taoscluster
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts
TDEngine
tarbitrator
# Description: Starts
TDEngine
tarbitrator, a arbitrator
# Short-Description: Starts
taoscluster
tarbitrator
# Description: Starts
taoscluster
tarbitrator, a arbitrator
### END INIT INFO
set
-e
PATH
=
"/bin:/usr/bin:/sbin:/usr/sbin"
NAME
=
"ta
rbitrato
r"
NAME
=
"ta
oscluste
r"
USER
=
"root"
GROUP
=
"root"
DAEMON
=
"/usr/local/taos/bin/tarbitrator"
...
...
packaging/release.sh
浏览文件 @
310ac98e
...
...
@@ -7,22 +7,20 @@ set -e
# releash.sh -v [cluster | edge]
# -c [aarch32 | aarch64 | x64 | x86 | mips64 ...]
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows |
...]
# -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows |
Ningsi60 | Ningsi80 |...]
# -V [stable | beta]
# -l [full | lite]
# -s [static | dynamic]
# -n [2.0.0.3]
# set parameters by default value
verMode
=
edge
# [cluster, edge]
verType
=
stable
# [stable, beta]
cpuType
=
x64
# [aarch32 | aarch64 | x64 | x86 | mips64 ...]
osType
=
Linux
# [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...]
osType
=
Linux
# [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows |
Ningsi60 | Ningsi80 |
...]
pagMode
=
full
# [full | lite]
soMode
=
dynamic
# [static | dynamic]
verNumber
=
""
while
getopts
"hv:V:c:o:l:
s:
n:"
arg
while
getopts
"hv:V:c:o:l:n:"
arg
do
case
$arg
in
v
)
...
...
@@ -41,10 +39,6 @@ do
#echo "pagMode=$OPTARG"
pagMode
=
$(
echo
$OPTARG
)
;;
s
)
#echo "soMode=$OPTARG"
soMode
=
$(
echo
$OPTARG
)
;;
n
)
#echo "verNumber=$OPTARG"
verNumber
=
$(
echo
$OPTARG
)
...
...
@@ -56,10 +50,9 @@ do
h
)
echo
"Usage:
`
basename
$0
`
-v [cluster | edge] "
echo
" -c [aarch32 | aarch64 | x64 | x86 | mips64 ...] "
echo
" -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows | ...] "
echo
" -o [Linux | Kylin | Alpine | Raspberrypi | Darwin | Windows |
Ningsi60 | Ningsi80 |
...] "
echo
" -V [stable | beta] "
echo
" -l [full | lite] "
echo
" -s [static | dynamic] "
echo
" -n [version number] "
exit
0
;;
...
...
@@ -70,7 +63,7 @@ do
esac
done
echo
"verMode=
${
verMode
}
verType=
${
verType
}
cpuType=
${
cpuType
}
osType=
${
osType
}
pagMode=
${
pagMode
}
soMode=
${
soMode
}
verNumber=
${
verNumber
}
"
echo
"verMode=
${
verMode
}
verType=
${
verType
}
cpuType=
${
cpuType
}
osType=
${
osType
}
pagMode=
${
pagMode
}
verNumber=
${
verNumber
}
"
curr_dir
=
$(
pwd
)
...
...
@@ -230,9 +223,9 @@ cd ${compile_dir}
# check support cpu type
if
[[
"
$cpuType
"
==
"x64"
]]
||
[[
"
$cpuType
"
==
"aarch64"
]]
||
[[
"
$cpuType
"
==
"aarch32"
]]
||
[[
"
$cpuType
"
==
"mips64"
]]
;
then
if
[
"
$verMode
"
!=
"cluster"
]
;
then
cmake ../
-DCPUTYPE
=
${
cpuType
}
-DPAGMODE
=
${
pagMode
}
-D
SOMODE
=
${
soMod
e
}
cmake ../
-DCPUTYPE
=
${
cpuType
}
-DPAGMODE
=
${
pagMode
}
-D
OSTYPE
=
${
osTyp
e
}
else
cmake ../../
-DCPUTYPE
=
${
cpuType
}
-D
SOMODE
=
${
soMode
}
cmake ../../
-DCPUTYPE
=
${
cpuType
}
-D
OSTYPE
=
${
osType
}
fi
else
echo
"input cpuType=
${
cpuType
}
error!!!"
...
...
packaging/rpm/tarbitratord
浏览文件 @
310ac98e
...
...
@@ -7,10 +7,10 @@
#
#
### BEGIN INIT INFO
# Provides:
TDEngine
# Provides:
taoscluster
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Short-Description: start and stop ta
osd
# Short-Description: start and stop ta
rbitrator
# Description: tarbitrator is a arbitrator used in TDengine cluster.
### END INIT INFO
...
...
packaging/tools/install.sh
浏览文件 @
310ac98e
...
...
@@ -76,7 +76,11 @@ fi
# get the operating system type for using the corresponding init file
# ubuntu/debian(deb), centos/fedora(rpm), others: opensuse, redhat, ..., no verification
#osinfo=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
osinfo
=
$(
cat
/etc/os-release |
grep
"NAME"
|
cut
-d
'"'
-f2
)
if
[[
-d
/etc/os-release
]]
;
then
osinfo
=
$(
cat
/etc/os-release |
grep
"NAME"
|
cut
-d
'"'
-f2
)
||
:
else
osinfo
=
""
fi
#echo "osinfo: ${osinfo}"
os_type
=
0
if
echo
$osinfo
|
grep
-qwi
"ubuntu"
;
then
...
...
@@ -95,8 +99,10 @@ elif echo $osinfo | grep -qwi "fedora" ; then
# echo "This is fedora system"
os_type
=
2
else
echo
"
${
osinfo
}
: This is an officially unverified linux system, If there are any problems with the installation and operation, "
echo
"please feel free to contact taosdata.com for support."
echo
" osinfo:
${
osinfo
}
"
echo
" This is an officially unverified linux system,"
echo
" if there are any problems with the installation and operation, "
echo
" please feel free to contact taosdata.com for support."
os_type
=
1
fi
...
...
@@ -192,13 +198,12 @@ function install_lib() {
${
csudo
}
rm
-f
${
lib_link_dir
}
/libtaos.
*
||
:
${
csudo
}
rm
-f
${
lib64_link_dir
}
/libtaos.
*
||
:
#${csudo} rm -rf ${v15_java_app_dir} || :
${
csudo
}
cp
-rf
${
script_dir
}
/driver/
*
${
install_main_dir
}
/driver
&&
${
csudo
}
chmod
777
${
install_main_dir
}
/driver/
*
${
csudo
}
ln
-s
${
install_main_dir
}
/driver/libtaos.
*
${
lib_link_dir
}
/libtaos.so.1
${
csudo
}
ln
-s
${
lib_link_dir
}
/libtaos.so.1
${
lib_link_dir
}
/libtaos.so
if
[
-d
${
lib64_link_dir
}
]
;
then
if
[
[
-d
${
lib64_link_dir
}
&&
!
-e
${
lib64_link_dir
}
/libtaos.so
]
]
;
then
${
csudo
}
ln
-s
${
install_main_dir
}
/driver/libtaos.
*
${
lib64_link_dir
}
/libtaos.so.1
||
:
${
csudo
}
ln
-s
${
lib64_link_dir
}
/libtaos.so.1
${
lib64_link_dir
}
/libtaos.so
||
:
fi
...
...
@@ -306,15 +311,28 @@ function clean_service_on_sysvinit() {
fi
if
((
${
initd_mod
}
==
1
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
chkconfig
--del
taosd
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
chkconfig
--del
tarbitratord
||
:
fi
elif
((
${
initd_mod
}
==
2
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
insserv
-r
taosd
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
insserv
-r
tarbitratord
||
:
fi
elif
((
${
initd_mod
}
==
3
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
update-rc.d
-f
tarbitratord remove
||
:
fi
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/tarbitratord
||
:
...
...
@@ -326,7 +344,6 @@ function clean_service_on_sysvinit() {
function
install_service_on_sysvinit
()
{
clean_service_on_sysvinit
sleep
1
# Install taosd service
...
...
@@ -446,7 +463,7 @@ function install_service_on_systemd() {
${
csudo
}
bash
-c
"echo >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo '[Install]' >>
${
tarbitratord_service_config
}
"
${
csudo
}
bash
-c
"echo 'WantedBy=multi-user.target' >>
${
tarbitratord_service_config
}
"
#
${csudo} systemctl enable tarbitratord
#${csudo} systemctl enable tarbitratord
nginx_service_config
=
"
${
service_config_dir
}
/nginxd.service"
${
csudo
}
bash
-c
"echo '[Unit]' >>
${
nginx_service_config
}
"
...
...
packaging/tools/remove.sh
浏览文件 @
310ac98e
...
...
@@ -72,7 +72,6 @@ function clean_bin() {
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdemo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taosdump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
}
...
...
@@ -149,15 +148,27 @@ function clean_service_on_sysvinit() {
fi
if
((
${
initd_mod
}
==
1
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
chkconfig
--del
taosd
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
chkconfig
--del
tarbitratord
||
:
fi
elif
((
${
initd_mod
}
==
2
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
insserv
-r
taosd
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
insserv
-r
tarbitratord
||
:
fi
elif
((
${
initd_mod
}
==
3
))
;
then
if
[
-e
${
service_config_dir
}
/taosd
]
;
then
${
csudo
}
update-rc.d
-f
taosd remove
||
:
fi
if
[
-e
${
service_config_dir
}
/tarbitratord
]
;
then
${
csudo
}
update-rc.d
-f
tarbitratord remove
||
:
fi
fi
${
csudo
}
rm
-f
${
service_config_dir
}
/taosd
||
:
${
csudo
}
rm
-f
${
service_config_dir
}
/tarbitratord
||
:
...
...
@@ -196,13 +207,20 @@ ${csudo} rm -rf ${data_link_dir} || :
${
csudo
}
rm
-rf
${
install_main_dir
}
${
csudo
}
rm
-rf
${
install_nginxd_dir
}
if
[[
-d
/etc/os-release
]]
;
then
osinfo
=
$(
awk
-F
=
'/^NAME/{print $2}'
/etc/os-release
)
else
osinfo
=
""
fi
osinfo
=
$(
awk
-F
=
'/^NAME/{print $2}'
/etc/os-release
)
if
echo
$osinfo
|
grep
-qwi
"ubuntu"
;
then
# echo "this is ubuntu system"
${
csudo
}
rm
-f
/var/lib/dpkg/info/tdengine
*
||
:
elif
echo
$osinfo
|
grep
-qwi
"debian"
;
then
# echo "this is debian system"
${
csudo
}
rm
-f
/var/lib/dpkg/info/tdengine
*
||
:
elif
echo
$osinfo
|
grep
-qwi
"centos"
;
then
echo
"this is centos system"
#
echo "this is centos system"
${
csudo
}
rpm
-e
--noscripts
tdengine
||
:
fi
...
...
packaging/tools/remove_client.sh
浏览文件 @
310ac98e
...
...
@@ -37,7 +37,7 @@ function kill_client() {
function
clean_bin
()
{
# Remove link
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
ump
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/taos
demo
||
:
${
csudo
}
rm
-f
${
bin_link_dir
}
/rmtaos
||
:
}
...
...
src/client/src/tscFunctionImpl.c
浏览文件 @
310ac98e
...
...
@@ -56,7 +56,8 @@
for (int32_t i = 0; i < (ctx)->tagInfo.numOfTagCols; ++i) { \
SQLFunctionCtx *__ctx = (ctx)->tagInfo.pTagCtxList[i]; \
if (__ctx->functionId == TSDB_FUNC_TS_DUMMY) { \
__ctx->tag = (tVariant){.i64Key = (ts), .nType = TSDB_DATA_TYPE_BIGINT}; \
__ctx->tag.i64Key = (ts); \
__ctx->tag.nType = TSDB_DATA_TYPE_BIGINT; \
} \
aAggs[TSDB_FUNC_TAG].xFunction(__ctx); \
} \
...
...
@@ -963,7 +964,8 @@ static void minMax_function(SQLFunctionCtx *pCtx, char *pOutput, int32_t isMin,
for
(
int32_t
i
=
0
;
i
<
(
pCtx
)
->
tagInfo
.
numOfTagCols
;
++
i
)
{
SQLFunctionCtx
*
__ctx
=
pCtx
->
tagInfo
.
pTagCtxList
[
i
];
if
(
__ctx
->
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
__ctx
->
tag
=
(
tVariant
){.
i64Key
=
key
,
.
nType
=
TSDB_DATA_TYPE_BIGINT
};
__ctx
->
tag
.
i64Key
=
key
;
__ctx
->
tag
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
}
aAggs
[
TSDB_FUNC_TAG
].
xFunction
(
__ctx
);
...
...
@@ -1867,7 +1869,8 @@ static void valuePairAssign(tValuePair *dst, int16_t type, const char *val, int6
for
(
int32_t
i
=
0
;
i
<
pTagInfo
->
numOfTagCols
;
++
i
)
{
SQLFunctionCtx
*
ctx
=
pTagInfo
->
pTagCtxList
[
i
];
if
(
ctx
->
functionId
==
TSDB_FUNC_TS_DUMMY
)
{
ctx
->
tag
=
(
tVariant
)
{.
nType
=
TSDB_DATA_TYPE_BIGINT
,
.
i64Key
=
tsKey
};
ctx
->
tag
.
nType
=
TSDB_DATA_TYPE_BIGINT
;
ctx
->
tag
.
i64Key
=
tsKey
;
}
tVariantDump
(
&
ctx
->
tag
,
dst
->
pTags
+
size
,
ctx
->
tag
.
nType
,
true
);
...
...
src/client/src/tscSubquery.c
浏览文件 @
310ac98e
...
...
@@ -12,6 +12,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE
#include "os.h"
#include "qAst.h"
...
...
src/dnode/src/dnodeMgmt.c
浏览文件 @
310ac98e
...
...
@@ -717,6 +717,9 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
pStatus
->
clusterCfg
.
maxVgroupsPerDb
=
htonl
(
tsMaxVgroupsPerDb
);
tstrncpy
(
pStatus
->
clusterCfg
.
arbitrator
,
tsArbitrator
,
TSDB_EP_LEN
);
tstrncpy
(
pStatus
->
clusterCfg
.
timezone
,
tsTimezone
,
64
);
pStatus
->
clusterCfg
.
checkTime
=
0
;
char
timestr
[
32
]
=
"1970-01-01 00:00:00.00"
;
(
void
)
taosParseTime
(
timestr
,
&
pStatus
->
clusterCfg
.
checkTime
,
strlen
(
timestr
),
TSDB_TIME_PRECISION_MILLI
,
0
);
tstrncpy
(
pStatus
->
clusterCfg
.
locale
,
tsLocale
,
TSDB_LOCALE_LEN
);
tstrncpy
(
pStatus
->
clusterCfg
.
charset
,
tsCharset
,
TSDB_LOCALE_LEN
);
...
...
src/inc/taosmsg.h
浏览文件 @
310ac98e
...
...
@@ -575,6 +575,7 @@ typedef struct {
int32_t
maxVgroupsPerDb
;
char
arbitrator
[
TSDB_EP_LEN
];
// tsArbitrator
char
timezone
[
64
];
// tsTimezone
int64_t
checkTime
;
// 1970-01-01 00:00:00.000
char
locale
[
TSDB_LOCALE_LEN
];
// tsLocale
char
charset
[
TSDB_LOCALE_LEN
];
// tsCharset
}
SClusterCfg
;
...
...
src/mnode/src/mnodeDnode.c
浏览文件 @
310ac98e
...
...
@@ -363,10 +363,15 @@ static bool mnodeCheckClusterCfgPara(const SClusterCfg *clusterCfg) {
mError
(
"
\"
arbitrator
\"
[%s - %s] cfg parameters inconsistent"
,
clusterCfg
->
arbitrator
,
tsArbitrator
);
return
false
;
}
if
(
0
!=
strncasecmp
(
clusterCfg
->
timezone
,
tsTimezone
,
strlen
(
tsTimezone
)))
{
mError
(
"
\"
timezone
\"
[%s - %s] cfg parameters inconsistent"
,
clusterCfg
->
timezone
,
tsTimezone
);
int64_t
checkTime
=
0
;
char
timestr
[
32
]
=
"1970-01-01 00:00:00.00"
;
(
void
)
taosParseTime
(
timestr
,
&
checkTime
,
strlen
(
timestr
),
TSDB_TIME_PRECISION_MILLI
,
0
);
if
((
0
!=
strncasecmp
(
clusterCfg
->
timezone
,
tsTimezone
,
strlen
(
tsTimezone
)))
&&
(
checkTime
!=
clusterCfg
->
checkTime
))
{
mError
(
"
\"
timezone
\"
[%s - %s] [%"
PRId64
" - %"
PRId64
"] cfg parameters inconsistent"
,
clusterCfg
->
timezone
,
tsTimezone
,
clusterCfg
->
checkTime
,
checkTime
);
return
false
;
}
if
(
0
!=
strncasecmp
(
clusterCfg
->
locale
,
tsLocale
,
strlen
(
tsLocale
)))
{
mError
(
"
\"
locale
\"
[%s - %s] cfg parameters inconsistent"
,
clusterCfg
->
locale
,
tsLocale
);
return
false
;
...
...
src/os/inc/os.h
浏览文件 @
310ac98e
...
...
@@ -40,6 +40,10 @@ extern "C" {
#include "osAlpine.h"
#endif
#ifdef _TD_NINGSI_60_
#include "osNingsi.h"
#endif
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#include "osWindows.h"
#endif
...
...
src/os/inc/osNingsi.h
0 → 100644
浏览文件 @
310ac98e
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_OS_NINGSI_H
#define TDENGINE_OS_NINGSI_H
#ifdef __cplusplus
extern
"C"
{
#endif
#define TAOS_OS_FUNC_ATOMIC
/*
* type __sync_fetch_and_add (type *ptr, type value);
* type __sync_fetch_and_sub (type *ptr, type value);
* type __sync_fetch_and_or (type *ptr, type value);
* type __sync_fetch_and_and (type *ptr, type value);
* type __sync_fetch_and_xor (type *ptr, type value);
* type __sync_fetch_and_nand (type *ptr, type value);
* type __sync_add_and_fetch (type *ptr, type value);
* type __sync_sub_and_fetch (type *ptr, type value);
* type __sync_or_and_fetch (type *ptr, type value);
* type __sync_and_and_fetch (type *ptr, type value);
* type __sync_xor_and_fetch (type *ptr, type value);
* type __sync_nand_and_fetch (type *ptr, type value);
*
* bool __sync_bool_compare_and_swap (type*ptr, type oldval, type newval, ...)
* type __sync_val_compare_and_swap (type *ptr, type oldval, ?type newval, ...)
* */
#define atomic_load_8(ptr) __sync_fetch_and_add((ptr), 0)
#define atomic_load_16(ptr) __sync_fetch_and_add((ptr), 0)
#define atomic_load_32(ptr) __sync_fetch_and_add((ptr), 0)
#define atomic_load_64(ptr) __sync_fetch_and_add((ptr), 0)
#define atomic_load_ptr(ptr) __sync_fetch_and_add((ptr), 0)
#define atomic_store_8(ptr, val) (*(ptr)=(val))
#define atomic_store_16(ptr, val) (*(ptr)=(val))
#define atomic_store_32(ptr, val) (*(ptr)=(val))
#define atomic_store_64(ptr, val) (*(ptr)=(val))
#define atomic_store_ptr(ptr, val) (*(ptr)=(val))
int8_t
atomic_exchange_8_impl
(
int8_t
*
ptr
,
int8_t
val
);
int16_t
atomic_exchange_16_impl
(
int16_t
*
ptr
,
int16_t
val
);
int32_t
atomic_exchange_32_impl
(
int32_t
*
ptr
,
int32_t
val
);
int64_t
atomic_exchange_64_impl
(
int64_t
*
ptr
,
int64_t
val
);
void
*
atomic_exchange_ptr_impl
(
void
**
ptr
,
void
*
val
);
#define atomic_exchange_8(ptr, val) atomic_exchange_8_impl((int8_t*)ptr, (int8_t)val)
#define atomic_exchange_16(ptr, val) atomic_exchange_16_impl((int16_t*)ptr, (int16_t)val)
#define atomic_exchange_32(ptr, val) atomic_exchange_32_impl((int32_t*)ptr, (int32_t)val)
#define atomic_exchange_64(ptr, val) atomic_exchange_64_impl((int64_t*)ptr, (int64_t)val)
#define atomic_exchange_ptr(ptr, val) atomic_exchange_ptr_impl((void **)ptr, (void*)val)
#define atomic_val_compare_exchange_8 __sync_val_compare_and_swap
#define atomic_val_compare_exchange_16 __sync_val_compare_and_swap
#define atomic_val_compare_exchange_32 __sync_val_compare_and_swap
#define atomic_val_compare_exchange_64 __sync_val_compare_and_swap
#define atomic_val_compare_exchange_ptr __sync_val_compare_and_swap
#define atomic_add_fetch_8(ptr, val) __sync_add_and_fetch((ptr), (val))
#define atomic_add_fetch_16(ptr, val) __sync_add_and_fetch((ptr), (val))
#define atomic_add_fetch_32(ptr, val) __sync_add_and_fetch((ptr), (val))
#define atomic_add_fetch_64(ptr, val) __sync_add_and_fetch((ptr), (val))
#define atomic_add_fetch_ptr(ptr, val) __sync_add_and_fetch((ptr), (val))
#define atomic_fetch_add_8(ptr, val) __sync_fetch_and_add((ptr), (val))
#define atomic_fetch_add_16(ptr, val) __sync_fetch_and_add((ptr), (val))
#define atomic_fetch_add_32(ptr, val) __sync_fetch_and_add((ptr), (val))
#define atomic_fetch_add_64(ptr, val) __sync_fetch_and_add((ptr), (val))
#define atomic_fetch_add_ptr(ptr, val) __sync_fetch_and_add((ptr), (val))
#define atomic_sub_fetch_8(ptr, val) __sync_sub_and_fetch((ptr), (val))
#define atomic_sub_fetch_16(ptr, val) __sync_sub_and_fetch((ptr), (val))
#define atomic_sub_fetch_32(ptr, val) __sync_sub_and_fetch((ptr), (val))
#define atomic_sub_fetch_64(ptr, val) __sync_sub_and_fetch((ptr), (val))
#define atomic_sub_fetch_ptr(ptr, val) __sync_sub_and_fetch((ptr), (val))
#define atomic_fetch_sub_8(ptr, val) __sync_fetch_and_sub((ptr), (val))
#define atomic_fetch_sub_16(ptr, val) __sync_fetch_and_sub((ptr), (val))
#define atomic_fetch_sub_32(ptr, val) __sync_fetch_and_sub((ptr), (val))
#define atomic_fetch_sub_64(ptr, val) __sync_fetch_and_sub((ptr), (val))
#define atomic_fetch_sub_ptr(ptr, val) __sync_fetch_and_sub((ptr), (val))
#define atomic_and_fetch_8(ptr, val) __sync_and_and_fetch((ptr), (val))
#define atomic_and_fetch_16(ptr, val) __sync_and_and_fetch((ptr), (val))
#define atomic_and_fetch_32(ptr, val) __sync_and_and_fetch((ptr), (val))
#define atomic_and_fetch_64(ptr, val) __sync_and_and_fetch((ptr), (val))
#define atomic_and_fetch_ptr(ptr, val) __sync_and_and_fetch((ptr), (val))
#define atomic_fetch_and_8(ptr, val) __sync_fetch_and_and((ptr), (val))
#define atomic_fetch_and_16(ptr, val) __sync_fetch_and_and((ptr), (val))
#define atomic_fetch_and_32(ptr, val) __sync_fetch_and_and((ptr), (val))
#define atomic_fetch_and_64(ptr, val) __sync_fetch_and_and((ptr), (val))
#define atomic_fetch_and_ptr(ptr, val) __sync_fetch_and_and((ptr), (val))
#define atomic_or_fetch_8(ptr, val) __sync_or_and_fetch((ptr), (val))
#define atomic_or_fetch_16(ptr, val) __sync_or_and_fetch((ptr), (val))
#define atomic_or_fetch_32(ptr, val) __sync_or_and_fetch((ptr), (val))
#define atomic_or_fetch_64(ptr, val) __sync_or_and_fetch((ptr), (val))
#define atomic_or_fetch_ptr(ptr, val) __sync_or_and_fetch((ptr), (val))
#define atomic_fetch_or_8(ptr, val) __sync_fetch_and_or((ptr), (val))
#define atomic_fetch_or_16(ptr, val) __sync_fetch_and_or((ptr), (val))
#define atomic_fetch_or_32(ptr, val) __sync_fetch_and_or((ptr), (val))
#define atomic_fetch_or_64(ptr, val) __sync_fetch_and_or((ptr), (val))
#define atomic_fetch_or_ptr(ptr, val) __sync_fetch_and_or((ptr), (val))
#define atomic_xor_fetch_8(ptr, val) __sync_xor_and_fetch((ptr), (val))
#define atomic_xor_fetch_16(ptr, val) __sync_xor_and_fetch((ptr), (val))
#define atomic_xor_fetch_32(ptr, val) __sync_xor_and_fetch((ptr), (val))
#define atomic_xor_fetch_64(ptr, val) __sync_xor_and_fetch((ptr), (val))
#define atomic_xor_fetch_ptr(ptr, val) __sync_xor_and_fetch((ptr), (val))
#define atomic_fetch_xor_8(ptr, val) __sync_fetch_and_xor((ptr), (val))
#define atomic_fetch_xor_16(ptr, val) __sync_fetch_and_xor((ptr), (val))
#define atomic_fetch_xor_32(ptr, val) __sync_fetch_and_xor((ptr), (val))
#define atomic_fetch_xor_64(ptr, val) __sync_fetch_and_xor((ptr), (val))
#define atomic_fetch_xor_ptr(ptr, val) __sync_fetch_and_xor((ptr), (val))
#ifdef __cplusplus
}
#endif
#endif
src/os/src/linux/ningsi.c
0 → 100644
浏览文件 @
310ac98e
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#ifdef _TD_NINGSI_60_
void
*
atomic_exchange_ptr_impl
(
void
**
ptr
,
void
*
val
)
{
void
*
old
;
do
{
old
=
*
ptr
;
}
while
(
!
__sync_bool_compare_and_swap
(
ptr
,
old
,
val
)
);
return
old
;
}
int8_t
atomic_exchange_8_impl
(
int8_t
*
ptr
,
int8_t
val
)
{
int8_t
old
;
do
{
old
=
*
ptr
;
}
while
(
!
__sync_bool_compare_and_swap
(
ptr
,
old
,
val
)
);
return
old
;
}
int16_t
atomic_exchange_16_impl
(
int16_t
*
ptr
,
int16_t
val
)
{
int16_t
old
;
do
{
old
=
*
ptr
;
}
while
(
!
__sync_bool_compare_and_swap
(
ptr
,
old
,
val
)
);
return
old
;
}
int32_t
atomic_exchange_32_impl
(
int32_t
*
ptr
,
int32_t
val
)
{
int32_t
old
;
do
{
old
=
*
ptr
;
}
while
(
!
__sync_bool_compare_and_swap
(
ptr
,
old
,
val
)
);
return
old
;
}
int64_t
atomic_exchange_64_impl
(
int64_t
*
ptr
,
int64_t
val
)
{
int64_t
old
;
do
{
old
=
*
ptr
;
}
while
(
!
__sync_bool_compare_and_swap
(
ptr
,
old
,
val
)
);
return
old
;
}
#endif
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录