Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b9006a2e
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看板
未验证
提交
b9006a2e
编写于
9月 25, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
9月 25, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3677 from taosdata/feature/ad
Feature/ad
上级
7533e3bc
2cd68ffe
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
113 addition
and
29 deletion
+113
-29
deps/zlib-1.2.11/CMakeLists.txt
deps/zlib-1.2.11/CMakeLists.txt
+8
-5
src/common/src/tglobal.c
src/common/src/tglobal.c
+1
-1
src/os/inc/osDir.h
src/os/inc/osDir.h
+1
-0
src/os/src/detail/CMakeLists.txt
src/os/src/detail/CMakeLists.txt
+1
-0
src/os/src/detail/osDir.c
src/os/src/detail/osDir.c
+49
-4
src/rpc/src/rpcMain.c
src/rpc/src/rpcMain.c
+3
-3
src/rpc/src/rpcTcp.c
src/rpc/src/rpcTcp.c
+1
-1
src/util/CMakeLists.txt
src/util/CMakeLists.txt
+1
-1
src/util/src/tlog.c
src/util/src/tlog.c
+10
-2
src/vnode/src/vnodeWrite.c
src/vnode/src/vnodeWrite.c
+9
-2
tests/test/c/CMakeLists.txt
tests/test/c/CMakeLists.txt
+2
-2
tests/test/c/createNormalTable.c
tests/test/c/createNormalTable.c
+27
-8
未找到文件。
deps/zlib-1.2.11/CMakeLists.txt
浏览文件 @
b9006a2e
CMAKE_MINIMUM_REQUIRED
(
VERSION 2.8
)
PROJECT
(
TDengine
)
IF
(
TD_LINUX
)
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
z
${
SRC
}
)
ENDIF
()
\ No newline at end of file
IF
(
TD_WINDOWS
)
SET
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS_DEBUG
}
/WX-"
)
SET
(
CMAKE_C_FLAGS_RELEASE
"
${
CMAKE_C_FLAGS_RELEASE
}
/WX-"
)
ENDIF
()
INCLUDE_DIRECTORIES
(
inc
)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
z
${
SRC
}
)
src/common/src/tglobal.c
浏览文件 @
b9006a2e
...
...
@@ -1014,7 +1014,7 @@ static void doInitGlobalConfig(void) {
cfg
.
ptr
=
&
tsLogKeepDays
;
cfg
.
valType
=
TAOS_CFG_VTYPE_INT32
;
cfg
.
cfgType
=
TSDB_CFG_CTYPE_B_CONFIG
|
TSDB_CFG_CTYPE_B_LOG
|
TSDB_CFG_CTYPE_B_CLIENT
;
cfg
.
minValue
=
0
;
cfg
.
minValue
=
-
36500
0
;
cfg
.
maxValue
=
365000
;
cfg
.
ptrLength
=
0
;
cfg
.
unitType
=
TAOS_CFG_UTYPE_NONE
;
...
...
src/os/inc/osDir.h
浏览文件 @
b9006a2e
...
...
@@ -25,6 +25,7 @@ void taosRemoveDir(char *rootDir);
int
taosMkDir
(
const
char
*
pathname
,
mode_t
mode
);
void
taosRename
(
char
*
oldName
,
char
*
newName
);
void
taosRemoveOldLogFiles
(
char
*
rootDir
,
int32_t
keepDays
);
int32_t
taosCompressFile
(
char
*
srcFileName
,
char
*
destFileName
);
#ifdef __cplusplus
}
...
...
src/os/src/detail/CMakeLists.txt
浏览文件 @
b9006a2e
...
...
@@ -2,6 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT
(
TDengine
)
INCLUDE_DIRECTORIES
(
.
)
INCLUDE_DIRECTORIES
(
${
TD_COMMUNITY_DIR
}
/deps/zlib-1.2.11/inc
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
SET_SOURCE_FILES_PROPERTIES
(
osSysinfo.c PROPERTIES COMPILE_FLAGS -w
)
SET_SOURCE_FILES_PROPERTIES
(
osCoredump.c PROPERTIES COMPILE_FLAGS -w
)
...
...
src/os/src/detail/osDir.c
浏览文件 @
b9006a2e
...
...
@@ -17,6 +17,9 @@
#include "os.h"
#include "tglobal.h"
#include "tulog.h"
#include "zlib.h"
#define COMPRESS_STEP_SIZE 163840
void
taosRemoveDir
(
char
*
rootDir
)
{
DIR
*
dir
=
opendir
(
rootDir
);
...
...
@@ -73,11 +76,11 @@ void taosRemoveOldLogFiles(char *rootDir, int32_t keepDays) {
if
(
de
->
d_type
&
DT_DIR
)
{
continue
;
}
else
{
// struct stat fState;
// if (stat(fname, &fState) < 0) {
// continue;
// }
int32_t
len
=
(
int32_t
)
strlen
(
filename
);
if
(
len
>
3
&&
strcmp
(
filename
+
len
-
3
,
".gz"
)
==
0
)
{
len
-=
3
;
}
int64_t
fileSec
=
0
;
for
(
int
i
=
len
-
1
;
i
>=
0
;
i
--
)
{
if
(
filename
[
i
]
==
'.'
)
{
...
...
@@ -100,3 +103,45 @@ void taosRemoveOldLogFiles(char *rootDir, int32_t keepDays) {
closedir
(
dir
);
rmdir
(
rootDir
);
}
int32_t
taosCompressFile
(
char
*
srcFileName
,
char
*
destFileName
)
{
int32_t
ret
=
0
;
int32_t
len
=
0
;
char
*
data
=
malloc
(
COMPRESS_STEP_SIZE
);
FILE
*
srcFp
=
NULL
;
gzFile
dstFp
=
NULL
;
srcFp
=
fopen
(
srcFileName
,
"r"
);
if
(
srcFp
==
NULL
)
{
ret
=
-
1
;
goto
cmp_end
;
}
int32_t
fd
=
open
(
destFileName
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
fd
<
0
)
{
ret
=
-
2
;
goto
cmp_end
;
}
dstFp
=
gzdopen
(
fd
,
"wb6f"
);
if
(
dstFp
==
NULL
)
{
ret
=
-
3
;
goto
cmp_end
;
}
while
(
!
feof
(
srcFp
))
{
len
=
(
int32_t
)
fread
(
data
,
1
,
COMPRESS_STEP_SIZE
,
srcFp
);
gzwrite
(
dstFp
,
data
,
len
);
}
cmp_end:
if
(
srcFp
)
{
fclose
(
srcFp
);
}
if
(
dstFp
)
{
gzclose
(
dstFp
);
}
free
(
data
);
return
ret
;
}
src/rpc/src/rpcMain.c
浏览文件 @
b9006a2e
...
...
@@ -323,14 +323,14 @@ void *rpcMallocCont(int contLen) {
tError
(
"failed to malloc msg, size:%d"
,
size
);
return
NULL
;
}
else
{
tDebug
(
"malloc m
em
: %p"
,
start
);
tDebug
(
"malloc m
sg
: %p"
,
start
);
}
return
start
+
sizeof
(
SRpcReqContext
)
+
sizeof
(
SRpcHead
);
}
void
rpcFreeCont
(
void
*
cont
)
{
if
(
cont
)
{
if
(
cont
)
{
char
*
temp
=
((
char
*
)
cont
)
-
sizeof
(
SRpcHead
)
-
sizeof
(
SRpcReqContext
);
free
(
temp
);
tDebug
(
"free mem: %p"
,
temp
);
...
...
@@ -553,7 +553,7 @@ static void rpcFreeMsg(void *msg) {
if
(
msg
)
{
char
*
temp
=
(
char
*
)
msg
-
sizeof
(
SRpcReqContext
);
free
(
temp
);
tDebug
(
"free m
em
: %p"
,
temp
);
tDebug
(
"free m
sg
: %p"
,
temp
);
}
}
...
...
src/rpc/src/rpcTcp.c
浏览文件 @
b9006a2e
...
...
@@ -421,7 +421,7 @@ static int taosReadTcpData(SFdObj *pFdObj, SRecvInfo *pInfo) {
msgLen
=
(
int32_t
)
htonl
((
uint32_t
)
rpcHead
.
msgLen
);
buffer
=
malloc
(
msgLen
+
tsRpcOverhead
);
if
(
NULL
==
buffer
)
{
if
(
NULL
==
buffer
)
{
tError
(
"%s %p TCP malloc(size:%d) fail"
,
pThreadObj
->
label
,
pFdObj
->
thandle
,
msgLen
);
return
-
1
;
}
else
{
...
...
src/util/CMakeLists.txt
浏览文件 @
b9006a2e
...
...
@@ -3,7 +3,7 @@ PROJECT(TDengine)
AUX_SOURCE_DIRECTORY
(
src SRC
)
ADD_LIBRARY
(
tutil
${
SRC
}
)
TARGET_LINK_LIBRARIES
(
tutil pthread osdetail lz4
)
TARGET_LINK_LIBRARIES
(
tutil pthread osdetail lz4
z
)
IF
(
TD_LINUX
)
TARGET_LINK_LIBRARIES
(
tutil m rt
)
...
...
src/util/src/tlog.c
浏览文件 @
b9006a2e
...
...
@@ -139,14 +139,22 @@ static void taosUnLockFile(int32_t fd) {
}
static
void
taosKeepOldLog
(
char
*
oldName
)
{
if
(
tsLogKeepDays
<
=
0
)
return
;
if
(
tsLogKeepDays
=
=
0
)
return
;
int64_t
fileSec
=
taosGetTimestampSec
();
char
fileName
[
LOG_FILE_NAME_LEN
+
20
];
snprintf
(
fileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
,
tsLogObj
.
logName
,
fileSec
);
taosRename
(
oldName
,
fileName
);
taosRemoveOldLogFiles
(
tsLogDir
,
tsLogKeepDays
);
if
(
tsLogKeepDays
<
0
)
{
char
compressFileName
[
LOG_FILE_NAME_LEN
+
20
];
snprintf
(
compressFileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
".gz"
,
tsLogObj
.
logName
,
fileSec
);
if
(
taosCompressFile
(
fileName
,
compressFileName
)
==
0
)
{
(
void
)
remove
(
fileName
);
}
}
taosRemoveOldLogFiles
(
tsLogDir
,
ABS
(
tsLogKeepDays
));
}
static
void
*
taosThreadToOpenNewFile
(
void
*
param
)
{
...
...
src/vnode/src/vnodeWrite.c
浏览文件 @
b9006a2e
...
...
@@ -130,8 +130,15 @@ static int32_t vnodeProcessCreateTableMsg(SVnodeObj *pVnode, void *pCont, SRspRe
int
code
=
TSDB_CODE_SUCCESS
;
STableCfg
*
pCfg
=
tsdbCreateTableCfgFromMsg
((
SMDCreateTableMsg
*
)
pCont
);
if
(
pCfg
==
NULL
)
return
terrno
;
if
(
tsdbCreateTable
(
pVnode
->
tsdb
,
pCfg
)
<
0
)
code
=
terrno
;
if
(
pCfg
==
NULL
)
{
ASSERT
(
terrno
!=
0
);
return
terrno
;
}
if
(
tsdbCreateTable
(
pVnode
->
tsdb
,
pCfg
)
<
0
)
{
code
=
terrno
;
ASSERT
(
code
!=
0
);
}
tsdbClearTableCfg
(
pCfg
);
return
code
;
...
...
tests/test/c/CMakeLists.txt
浏览文件 @
b9006a2e
...
...
@@ -22,8 +22,8 @@ IF (TD_LINUX)
#add_executable(importOneRow importOneRow.c)
#target_link_libraries(importOneRow taos_static pthread)
add_executable
(
importPerTable importPerTable.c
)
target_link_libraries
(
importPerTable taos_static pthread
)
#
add_executable(importPerTable importPerTable.c)
#
target_link_libraries(importPerTable taos_static pthread)
#add_executable(hashPerformance hashPerformance.c)
#target_link_libraries(hashPerformance taos_static tutil common pthread)
...
...
tests/test/c/createNormalTable.c
浏览文件 @
b9006a2e
...
...
@@ -50,7 +50,9 @@ void createDbAndSTable();
int
main
(
int
argc
,
char
*
argv
[])
{
shellParseArgument
(
argc
,
argv
);
taos_init
();
createDbAndSTable
();
if
(
replica
!=
0
)
{
createDbAndSTable
();
}
pPrint
(
"%d threads are spawned to create table"
,
numOfThreads
);
...
...
@@ -134,14 +136,31 @@ void *threadFunc(void *param) {
int64_t
startMs
=
taosGetTimestampMs
();
for
(
int32_t
t
=
pInfo
->
tableBeginIndex
;
t
<
pInfo
->
tableEndIndex
;
++
t
)
{
sprintf
(
qstr
,
"create table %s%d (ts timestamp, i int)"
,
stableName
,
t
);
TAOS_RES
*
pSql
=
taos_query
(
con
,
qstr
);
code
=
taos_errno
(
pSql
);
if
(
code
!=
0
)
{
pError
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
tstrerror
(
code
));
if
(
replica
!=
0
)
{
for
(
int32_t
t
=
pInfo
->
tableBeginIndex
;
t
<
pInfo
->
tableEndIndex
;
++
t
)
{
sprintf
(
qstr
,
"create table %s%d (ts timestamp, i int)"
,
stableName
,
t
);
TAOS_RES
*
pSql
=
taos_query
(
con
,
qstr
);
code
=
taos_errno
(
pSql
);
if
(
code
!=
0
)
{
pError
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
tstrerror
(
code
));
}
taos_free_result
(
pSql
);
}
}
else
{
for
(
int32_t
t
=
pInfo
->
tableBeginIndex
;
t
<
pInfo
->
tableEndIndex
;
++
t
)
{
sprintf
(
qstr
,
"insert into %s%d values(now, 1)"
,
stableName
,
t
);
TAOS_RES
*
pSql
=
taos_query
(
con
,
qstr
);
code
=
taos_errno
(
pSql
);
if
(
code
!=
0
)
{
if
(
code
!=
TSDB_CODE_MND_INVALID_TABLE_NAME
)
{
pError
(
"failed to create table %s%d, reason:%s"
,
stableName
,
t
,
tstrerror
(
code
));
}
if
(
code
==
TSDB_CODE_VND_INVALID_VGROUP_ID
)
{
exit
(
0
);
}
}
taos_free_result
(
pSql
);
}
taos_free_result
(
pSql
);
}
float
createTableSpeed
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录