Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8c5a3a95
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看板
提交
8c5a3a95
编写于
1月 11, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/TD-1925_new
上级
d0e18043
7dbfd400
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
118 addition
and
43 deletion
+118
-43
packaging/tools/install.sh
packaging/tools/install.sh
+2
-2
packaging/tools/install_power.sh
packaging/tools/install_power.sh
+2
-2
packaging/tools/post.sh
packaging/tools/post.sh
+2
-2
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+1
-1
src/kit/taosdemox/insert.json
src/kit/taosdemox/insert.json
+2
-1
src/kit/taosdemox/taosdemox.c
src/kit/taosdemox/taosdemox.c
+76
-23
src/os/inc/osSysinfo.h
src/os/inc/osSysinfo.h
+1
-0
src/os/src/linux/linuxEnv.c
src/os/src/linux/linuxEnv.c
+19
-1
tests/pytest/alter/alter_table.py
tests/pytest/alter/alter_table.py
+13
-11
未找到文件。
packaging/tools/install.sh
浏览文件 @
8c5a3a95
...
...
@@ -348,7 +348,7 @@ function set_ipAsFqdn() {
}
function
local_fqdn_check
()
{
#serverFqdn=$(hostname
-f
)
#serverFqdn=$(hostname)
echo
echo
-e
-n
"System hostname is:
${
GREEN
}
$serverFqdn
${
NC
}
"
echo
...
...
@@ -911,7 +911,7 @@ function install_TDengine() {
## ==============================Main program starts from here============================
serverFqdn
=
$(
hostname
-f
)
serverFqdn
=
$(
hostname
)
if
[
"
$verType
"
==
"server"
]
;
then
# Install server and client
if
[
-x
${
bin_dir
}
/taosd
]
;
then
...
...
packaging/tools/install_power.sh
浏览文件 @
8c5a3a95
...
...
@@ -345,7 +345,7 @@ function set_ipAsFqdn() {
}
function
local_fqdn_check
()
{
#serverFqdn=$(hostname
-f
)
#serverFqdn=$(hostname)
echo
echo
-e
-n
"System hostname is:
${
GREEN
}
$serverFqdn
${
NC
}
"
echo
...
...
@@ -881,7 +881,7 @@ function install_PowerDB() {
## ==============================Main program starts from here============================
serverFqdn
=
$(
hostname
-f
)
serverFqdn
=
$(
hostname
)
if
[
"
$verType
"
==
"server"
]
;
then
# Install server and client
if
[
-x
${
bin_dir
}
/powerd
]
;
then
...
...
packaging/tools/post.sh
浏览文件 @
8c5a3a95
...
...
@@ -228,7 +228,7 @@ function set_ipAsFqdn() {
}
function
local_fqdn_check
()
{
#serverFqdn=$(hostname
-f
)
#serverFqdn=$(hostname)
echo
echo
-e
-n
"System hostname is:
${
GREEN
}
$serverFqdn
${
NC
}
"
echo
...
...
@@ -492,5 +492,5 @@ function install_TDengine() {
## ==============================Main program starts from here============================
serverFqdn
=
$(
hostname
-f
)
serverFqdn
=
$(
hostname
)
install_TDengine
src/dnode/src/dnodeSystem.c
浏览文件 @
8c5a3a95
...
...
@@ -160,7 +160,7 @@ static void signal_handler(int32_t signum, siginfo_t *sigInfo, void *context) {
syslog
(
LOG_INFO
,
"Shut down signal is %d"
,
signum
);
syslog
(
LOG_INFO
,
"Shutting down TDengine service..."
);
// clean the system.
dInfo
(
"shut down signal is %d, sender PID:%d
"
,
signum
,
sigInfo
->
si_pid
);
dInfo
(
"shut down signal is %d, sender PID:%d
cmdline:%s"
,
signum
,
sigInfo
->
si_pid
,
taosGetCmdlineByPID
(
sigInfo
->
si_pid
)
);
// protect the application from receive another signal
struct
sigaction
act
=
{{
0
}};
...
...
src/kit/taosdemox/insert.json
浏览文件 @
8c5a3a95
...
...
@@ -5,7 +5,8 @@
"port"
:
6030
,
"user"
:
"root"
,
"password"
:
"taosdata"
,
"thread_count"
:
2
,
"thread_count"
:
4
,
"thread_count_create_tbl"
:
1
,
"result_file"
:
"./insert_res.txt"
,
"databases"
:
[{
"dbinfo"
:
{
...
...
src/kit/taosdemox/taosdemox.c
浏览文件 @
8c5a3a95
...
...
@@ -93,9 +93,6 @@ extern char configDir[];
#define MAX_QUERY_SQL_COUNT 10
#define MAX_QUERY_SQL_LENGTH 256
#define MAX_LINE_COUNT_IN_MEM 10000
typedef
enum
CREATE_SUB_TALBE_MOD_EN
{
PRE_CREATE_SUBTBL
,
AUTO_CREATE_SUBTBL
,
...
...
@@ -259,6 +256,7 @@ typedef struct SDbs_S {
bool
queryMode
;
int
threadCount
;
int
threadCountByCreateTbl
;
int
dbCount
;
SDataBase
db
[
MAX_DB_COUNT
];
...
...
@@ -1418,7 +1416,6 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, char* sTblName
char
command
[
BUFFER_SIZE
]
=
"
\0
"
;
TAOS_RES
*
res
;
TAOS_ROW
row
=
NULL
;
int
count
=
0
;
char
*
childTblName
=
*
childTblNameOfSuperTbl
;
...
...
@@ -1433,12 +1430,13 @@ static int getAllChildNameOfSuperTable(TAOS * taos, char* dbName, char* sTblName
exit
(
-
1
);
}
int
childTblCount
=
10000
;
count
=
0
;
int
childTblCount
=
10000
;
int
count
=
0
;
childTblName
=
(
char
*
)
calloc
(
1
,
childTblCount
*
TSDB_TABLE_NAME_LEN
);
char
*
pTblName
=
childTblName
;
while
((
row
=
taos_fetch_row
(
res
))
!=
NULL
)
{
strncpy
(
pTblName
,
(
char
*
)
row
[
0
],
TSDB_TABLE_NAME_LEN
);
int32_t
*
len
=
taos_fetch_lengths
(
res
);
strncpy
(
pTblName
,
(
char
*
)
row
[
0
],
len
[
0
]);
//printf("==== sub table name: %s\n", pTblName);
count
++
;
if
(
count
>=
childTblCount
-
1
)
{
...
...
@@ -1829,38 +1827,64 @@ static void createChildTables() {
if
((
AUTO_CREATE_SUBTBL
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
autoCreateTable
)
||
(
TBL_ALREADY_EXISTS
==
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblExists
))
{
continue
;
}
startMultiThreadCreateChildTable
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
colsOfCreatChildTable
,
g_Dbs
.
threadCount
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblCount
,
g_Dbs
.
db
[
i
].
dbName
,
&
(
g_Dbs
.
db
[
i
].
superTbls
[
j
]));
startMultiThreadCreateChildTable
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
colsOfCreatChildTable
,
g_Dbs
.
threadCount
ByCreateTbl
,
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblCount
,
g_Dbs
.
db
[
i
].
dbName
,
&
(
g_Dbs
.
db
[
i
].
superTbls
[
j
]));
g_totalChildTables
+=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblCount
;
}
}
}
/*
static int taosGetLineNum(const char *fileName)
{
int lineNum = 0;
char cmd[1024] = { 0 };
char buf[1024] = { 0 };
sprintf(cmd, "wc -l %s", fileName);
FILE *fp = popen(cmd, "r");
if (fp == NULL) {
fprintf(stderr, "ERROR: failed to execute:%s, error:%s\n", cmd, strerror(errno));
return lineNum;
}
if (fgets(buf, sizeof(buf), fp)) {
int index = strchr((const char*)buf, ' ') - buf;
buf[index] = '\0';
lineNum = atoi(buf);
}
pclose(fp);
return lineNum;
}
*/
/*
Read 10000 lines at most. If more than 10000 lines, continue to read after using
*/
int
readTagFromCsvFileToMem
(
SSuperTable
*
sup
t
erTblInfo
)
{
int
readTagFromCsvFileToMem
(
SSuperTable
*
superTblInfo
)
{
size_t
n
=
0
;
ssize_t
readLen
=
0
;
char
*
line
=
NULL
;
FILE
*
fp
=
fopen
(
sup
t
erTblInfo
->
tagsFile
,
"r"
);
FILE
*
fp
=
fopen
(
superTblInfo
->
tagsFile
,
"r"
);
if
(
fp
==
NULL
)
{
printf
(
"Failed to open tags file: %s, reason:%s
\n
"
,
sup
t
erTblInfo
->
tagsFile
,
strerror
(
errno
));
printf
(
"Failed to open tags file: %s, reason:%s
\n
"
,
superTblInfo
->
tagsFile
,
strerror
(
errno
));
return
-
1
;
}
if
(
sup
t
erTblInfo
->
tagDataBuf
)
{
free
(
sup
t
erTblInfo
->
tagDataBuf
);
sup
t
erTblInfo
->
tagDataBuf
=
NULL
;
if
(
superTblInfo
->
tagDataBuf
)
{
free
(
superTblInfo
->
tagDataBuf
);
superTblInfo
->
tagDataBuf
=
NULL
;
}
supterTblInfo
->
tagDataBuf
=
calloc
(
supterTblInfo
->
lenOfTagOfOneRow
*
MAX_LINE_COUNT_IN_MEM
,
1
);
if
(
supterTblInfo
->
tagDataBuf
==
NULL
)
{
int
tagCount
=
10000
;
int
count
=
0
;
char
*
tagDataBuf
=
calloc
(
1
,
superTblInfo
->
lenOfTagOfOneRow
*
tagCount
);
if
(
tagDataBuf
==
NULL
)
{
printf
(
"Failed to calloc, reason:%s
\n
"
,
strerror
(
errno
));
fclose
(
fp
);
return
-
1
;
}
while
((
readLen
=
getline
(
&
line
,
&
n
,
fp
))
!=
-
1
)
{
if
((
'\r'
==
line
[
readLen
-
1
])
||
(
'\n'
==
line
[
readLen
-
1
]))
{
line
[
--
readLen
]
=
0
;
...
...
@@ -1870,20 +1894,35 @@ int readTagFromCsvFileToMem(SSuperTable * supterTblInfo) {
continue
;
}
memcpy
(
supterTblInfo
->
tagDataBuf
+
supterTblInfo
->
tagSampleCount
*
supt
erTblInfo
->
lenOfTagOfOneRow
,
line
,
readLen
);
supterTblInfo
->
tagSampleC
ount
++
;
memcpy
(
tagDataBuf
+
count
*
sup
erTblInfo
->
lenOfTagOfOneRow
,
line
,
readLen
);
c
ount
++
;
if
(
supterTblInfo
->
tagSampleCount
>=
MAX_LINE_COUNT_IN_MEM
)
{
break
;
if
(
count
>=
tagCount
-
1
)
{
char
*
tmp
=
realloc
(
tagDataBuf
,
(
size_t
)
tagCount
*
1
.
5
*
superTblInfo
->
lenOfTagOfOneRow
);
if
(
tmp
!=
NULL
)
{
tagDataBuf
=
tmp
;
tagCount
=
(
int
)(
tagCount
*
1
.
5
);
memset
(
tagDataBuf
+
count
*
superTblInfo
->
lenOfTagOfOneRow
,
0
,
(
size_t
)((
tagCount
-
count
)
*
superTblInfo
->
lenOfTagOfOneRow
));
}
else
{
// exit, if allocate more memory failed
printf
(
"realloc fail for save tag val from %s
\n
"
,
superTblInfo
->
tagsFile
);
tmfree
(
tagDataBuf
);
free
(
line
);
fclose
(
fp
);
return
-
1
;
}
}
}
superTblInfo
->
tagDataBuf
=
tagDataBuf
;
superTblInfo
->
tagSampleCount
=
count
;
free
(
line
);
fclose
(
fp
);
return
0
;
}
int
readSampleFromJsonFileToMem
(
SSuperTable
*
sup
t
erTblInfo
)
{
int
readSampleFromJsonFileToMem
(
SSuperTable
*
superTblInfo
)
{
// TODO
return
0
;
}
...
...
@@ -2138,6 +2177,16 @@ static bool getMetaFromInsertJsonFile(cJSON* root) {
printf
(
"failed to read json, threads not found"
);
goto
PARSE_OVER
;
}
cJSON
*
threads2
=
cJSON_GetObjectItem
(
root
,
"thread_count_create_tbl"
);
if
(
threads2
&&
threads2
->
type
==
cJSON_Number
)
{
g_Dbs
.
threadCountByCreateTbl
=
threads2
->
valueint
;
}
else
if
(
!
threads2
)
{
g_Dbs
.
threadCountByCreateTbl
=
1
;
}
else
{
printf
(
"failed to read json, threads2 not found"
);
goto
PARSE_OVER
;
}
cJSON
*
dbs
=
cJSON_GetObjectItem
(
root
,
"databases"
);
if
(
!
dbs
||
dbs
->
type
!=
cJSON_Array
)
{
...
...
@@ -3008,6 +3057,10 @@ void postFreeResource() {
free
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBuf
);
g_Dbs
.
db
[
i
].
superTbls
[
j
].
sampleDataBuf
=
NULL
;
}
if
(
0
!=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagDataBuf
)
{
free
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagDataBuf
);
g_Dbs
.
db
[
i
].
superTbls
[
j
].
tagDataBuf
=
NULL
;
}
if
(
0
!=
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblName
)
{
free
(
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblName
);
g_Dbs
.
db
[
i
].
superTbls
[
j
].
childTblName
=
NULL
;
...
...
src/os/inc/osSysinfo.h
浏览文件 @
8c5a3a95
...
...
@@ -38,6 +38,7 @@ void taosPrintOsInfo();
int
taosSystem
(
const
char
*
cmd
)
;
void
taosKillSystem
();
bool
taosGetSystemUid
(
char
*
uid
);
char
*
taosGetCmdlineByPID
(
int
pid
);
// TAOS_OS_FUNC_SYSINFO_CORE
void
taosSetCoreDump
();
...
...
src/os/src/linux/linuxEnv.c
浏览文件 @
8c5a3a95
...
...
@@ -39,4 +39,22 @@ void osInit() {
strcpy
(
tsDnodeDir
,
""
);
strcpy
(
tsMnodeDir
,
""
);
strcpy
(
tsOsName
,
"Linux"
);
}
\ No newline at end of file
}
char
cmdline
[
1024
];
char
*
taosGetCmdlineByPID
(
int
pid
)
{
sprintf
(
cmdline
,
"/proc/%d/cmdline"
,
pid
);
FILE
*
f
=
fopen
(
cmdline
,
"r"
);
if
(
f
){
size_t
size
;
size
=
fread
(
cmdline
,
sizeof
(
char
),
1024
,
f
);
if
(
size
>
0
){
if
(
'\n'
==
cmdline
[
size
-
1
])
cmdline
[
size
-
1
]
=
'\0'
;
}
fclose
(
f
);
}
return
cmdline
;
}
tests/pytest/alter/alter_table.py
浏览文件 @
8c5a3a95
...
...
@@ -105,11 +105,11 @@ class TDTestCase:
# Create db
tdSql
.
execute
(
"drop database if exists %s"
%
(
db
))
tdSql
.
execute
(
"reset query cache"
)
tdSql
.
execute
(
"create database %s maxrows 200
maxtables 4
"
%
(
db
))
tdSql
.
execute
(
"create database %s maxrows 200"
%
(
db
))
tdSql
.
execute
(
"use %s"
%
(
db
))
# Create a table with one colunm of int type and insert 300 rows
tdLog
.
info
(
"
C
reate table tb"
)
tdLog
.
info
(
"
c
reate table tb"
)
tdSql
.
execute
(
"create table tb (ts timestamp, c1 int)"
)
tdLog
.
info
(
"Insert %d rows into tb"
%
(
self
.
rowNum
))
for
k
in
range
(
1
,
self
.
rowNum
+
1
):
...
...
@@ -119,20 +119,22 @@ class TDTestCase:
# Alter tb and add a column of smallint type, then query tb to see if
# all added column are NULL
self
.
addColumnAndCount
()
tdDnodes
.
stop
(
1
)
time
.
sleep
(
5
)
tdDnodes
.
start
(
1
)
time
.
sleep
(
5
)
tdDnodes
.
stop
(
1
)
tdDnodes
.
start
(
1
)
tdSql
.
query
(
self
.
sqlHead
+
self
.
sqlTail
)
for
i
in
range
(
2
,
len
(
self
.
types
)
+
2
):
tdSql
.
checkData
(
0
,
i
,
self
.
rowNum
*
(
len
(
self
.
types
)
+
2
-
i
))
size
=
len
(
self
.
types
)
+
2
for
i
in
range
(
2
,
size
):
tdSql
.
checkData
(
0
,
i
,
self
.
rowNum
*
(
size
-
i
))
self
.
dropColumnAndCount
()
tdSql
.
execute
(
"create table st(ts timestamp, c1 int) tags(t1 float)"
)
tdSql
.
execute
(
"create table t0 using st tags(null)"
)
tdSql
.
execute
(
"alter table t0 set tag t1=2.1"
)
tdSql
.
query
(
"show tables"
)
tdSql
.
checkRows
(
1
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
#tdCases.addWindows(__file__, TDTestCase())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录