Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
04a06d43
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
04a06d43
编写于
8月 18, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'refact/tsdb_last' of github.com:taosdata/tdengine into refact/tsdb_last
上级
eaef3dff
538f130a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
84 addition
and
73 deletion
+84
-73
cmake/cmake.install
cmake/cmake.install
+1
-31
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+0
-18
packaging/tools/make_install.bat
packaging/tools/make_install.bat
+41
-1
packaging/tools/make_install.sh
packaging/tools/make_install.sh
+3
-1
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+2
-1
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+36
-20
source/dnode/vnode/src/tsdb/tsdbOpen.c
source/dnode/vnode/src/tsdb/tsdbOpen.c
+1
-1
未找到文件。
cmake/cmake.install
浏览文件 @
04a06d43
IF
(
EXISTS
/
var
/
lib
/
taos
/
dnode
/
dnodeCfg
.
json
)
IF
(
TD_LINUX
)
INSTALL
(
CODE
"MESSAGE(
\"
The default data directory /var/lib/taos contains old data of tdengine 2.x, please clear it before installing!
\"
)"
)
ELSEIF
(
EXISTS
C
:/
TDengine
/
data
/
dnode
/
dnodeCfg
.
json
)
INSTALL
(
CODE
"MESSAGE(
\"
The default data directory C:/TDengine/data contains old data of tdengine 2.x, please clear it before installing!
\"
)"
)
ELSEIF
(
TD_LINUX
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.sh"
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.sh"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})"
)
INSTALL
(
CODE
"execute_process(COMMAND bash ${TD_MAKE_INSTALL_SH} ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Linux ${TD_VER_NUMBER})"
)
ELSEIF
(
TD_WINDOWS
)
ELSEIF
(
TD_WINDOWS
)
SET
(
CMAKE_INSTALL_PREFIX
C
:/
TDengine
)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/go DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/nodejs DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/python DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/src/connector/C\# DESTINATION connector)
# INSTALL(DIRECTORY ${TD_SOURCE_DIR}/examples DESTINATION .)
INSTALL
(
CODE
"IF (NOT EXISTS ${CMAKE_INSTALL_PREFIX}/cfg/taos.cfg)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${TD_SOURCE_DIR}/packaging/cfg/taos.cfg ${CMAKE_INSTALL_PREFIX}/cfg/taos.cfg)
ENDIF ()"
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
include
/
client
/
taos
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
include
/
util
/
taoserror
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
TD_SOURCE_DIR
}
/
include
/
libs
/
function
/
taosudf
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos_static
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
dll
DESTINATION
driver
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taos
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taosd
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
udfd
.
exe
DESTINATION
.
)
IF
(
BUILD_TOOLS
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taosBenchmark
.
exe
DESTINATION
.
)
ENDIF
()
IF
(
TD_MVN_INSTALLED
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
-
jdbcdriver
-
2.0.38
-
dist
.
jar
DESTINATION
connector
/
jdbc
)
ENDIF
()
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.bat"
)
SET
(
TD_MAKE_INSTALL_SH
"${TD_SOURCE_DIR}/packaging/tools/make_install.bat"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"MESSAGE(
\"
make install script: ${TD_MAKE_INSTALL_SH}
\"
)"
)
INSTALL
(
CODE
"execute_process(COMMAND ${TD_MAKE_INSTALL_SH} :needAdmin ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Windows ${TD_VER_NUMBER})"
)
INSTALL
(
CODE
"execute_process(COMMAND ${TD_MAKE_INSTALL_SH} :needAdmin ${TD_SOURCE_DIR} ${PROJECT_BINARY_DIR} Windows ${TD_VER_NUMBER})"
)
...
...
contrib/CMakeLists.txt
浏览文件 @
04a06d43
...
@@ -135,24 +135,6 @@ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
...
@@ -135,24 +135,6 @@ execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
WORKING_DIRECTORY
"
${
TD_CONTRIB_DIR
}
/deps-download"
)
WORKING_DIRECTORY
"
${
TD_CONTRIB_DIR
}
/deps-download"
)
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
execute_process
(
COMMAND
"
${
CMAKE_COMMAND
}
"
--build .
WORKING_DIRECTORY
"
${
TD_CONTRIB_DIR
}
/deps-download"
)
WORKING_DIRECTORY
"
${
TD_CONTRIB_DIR
}
/deps-download"
)
# clear submodule
execute_process
(
COMMAND git submodule deinit -f tools/taos-tools
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git rm --cached tools/taos-tools
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git submodule deinit -f tools/taosadapter
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git rm --cached tools/taosadapter
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git submodule deinit -f tools/taosws-rs
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git rm --cached tools/taosws-rs
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git submodule deinit -f examples/rust
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
execute_process
(
COMMAND git rm --cached examples/rust
WORKING_DIRECTORY
"
${
TD_SOURCE_DIR
}
"
)
# ================================================================================================
# ================================================================================================
# Build
# Build
...
...
packaging/tools/make_install.bat
浏览文件 @
04a06d43
@echo
off
@echo
off
goto
%
1
goto
%
1
:needAdmin
:needAdmin
if
exist
C
:\\TDengine\\data\\dnode\\dnodeCfg.json
(
echo
The
default
data
directory
C
:/TDengine/data
contains
old
data
of
tdengine
2
.x
,
please
clear
it
before
installing
!
)
set
source_dir
=
%
2
set
source_dir
=
%source
_dir:/
=
\\
%
set
binary_dir
=
%
3
set
binary_dir
=
%binary
_dir:/
=
\\
%
set
osType
=
%
4
set
verNumber
=
%
5
set
tagert_dir
=
C
:\\TDengine
if
not
exist
%tagert_dir%
(
mkdir
%tagert_dir%
)
if
not
exist
%tagert_dir%
\\cfg
(
mkdir
%tagert_dir%
\\cfg
)
if
not
exist
%tagert_dir%
\\include
(
mkdir
%tagert_dir%
\\include
)
if
not
exist
%tagert_dir%
\\driver
(
mkdir
%tagert_dir%
\\driver
)
if
not
exist
C
:\\TDengine\\cfg\\taos.cfg
(
copy
%source_dir%
\\packaging\\cfg\\taos.cfg
%tagert_dir%
\\cfg\\taos.cfg
>
nul
)
copy
%source_dir%
\\include\\client\\taos.h
%tagert_dir%
\\include
>
nul
copy
%source_dir%
\\include\\util\\taoserror.h
%tagert_dir%
\\include
>
nul
copy
%source_dir%
\\include\\libs\\function\\taosudf.h
%tagert_dir%
\\include
>
nul
copy
%binary_dir%
\\build\\lib\\taos.lib
%tagert_dir%
\\driver
>
nul
copy
%binary_dir%
\\build\\lib\\taos_static.lib
%tagert_dir%
\\driver
>
nul
copy
%binary_dir%
\\build\\lib\\taos.dll
%tagert_dir%
\\driver
>
nul
copy
%binary_dir%
\\build\\bin\\taos.exe
%tagert_dir%
>
nul
copy
%binary_dir%
\\build\\bin\\taosd.exe
%tagert_dir%
>
nul
copy
%binary_dir%
\\build\\bin\\udfd.exe
%tagert_dir%
>
nul
if
exist
%binary_dir%
\\build\\bin\\taosBenchmark.exe
(
copy
%binary_dir%
\\build\\bin\\taosBenchmark.exe
%tagert_dir%
>
nul
)
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&&
echo
To
start
/stop
TDengine
with
administrator
privileges
:
sc
start
/stop
taosd
&
goto
:eof
mshta
vbscript
:createobject
(
"shell.application"
)
.shellexecute
(
"
%~s0
"
,
":hasAdmin"
,
""
,
"runas"
,
1
)(
window
.close
)&&
echo
To
start
/stop
TDengine
with
administrator
privileges
:
sc
start
/stop
taosd
&
goto
:eof
:hasAdmin
:hasAdmin
c
p
-f
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
c
opy
/y
C
:\\TDengine\\driver\\taos.dll
C
:\\Windows\\System32
>
nul
sc
query
"taosd"
>
nul
||
sc
create
"taosd"
binPath
=
"C:\\TDengine\\taosd.exe --win_service"
start
=
DEMAND
sc
query
"taosd"
>
nul
||
sc
create
"taosd"
binPath
=
"C:\\TDengine\\taosd.exe --win_service"
start
=
DEMAND
packaging/tools/make_install.sh
浏览文件 @
04a06d43
...
@@ -664,7 +664,9 @@ function install_TDengine() {
...
@@ -664,7 +664,9 @@ function install_TDengine() {
## ==============================Main program starts from here============================
## ==============================Main program starts from here============================
echo source
directory:
$1
echo source
directory:
$1
echo
binary directory:
$2
echo
binary directory:
$2
if
[
"
$osType
"
!=
"Darwin"
]
;
then
if
[
-x
${
data_dir
}
/dnode/dnodeCfg.json
]
;
then
echo
-e
"
\0
33[44;31;5mThe default data directory
${
data_dir
}
contains old data of tdengine 2.x, please clear it before installing!
\0
33[0m"
elif
[
"
$osType
"
!=
"Darwin"
]
;
then
if
[
-x
${
bin_dir
}
/
${
clientName
}
]
;
then
if
[
-x
${
bin_dir
}
/
${
clientName
}
]
;
then
update_TDengine
update_TDengine
else
else
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
04a06d43
...
@@ -286,7 +286,7 @@ void tsdbUntakeReadSnap(STsdb *pTsdb, STsdbReadSnap *pSnap);
...
@@ -286,7 +286,7 @@ void tsdbUntakeReadSnap(STsdb *pTsdb, STsdbReadSnap *pSnap);
// tsdbCache
// tsdbCache
int32_t
tsdbOpenCache
(
STsdb
*
pTsdb
);
int32_t
tsdbOpenCache
(
STsdb
*
pTsdb
);
void
tsdbCloseCache
(
S
LRUCache
*
pCache
);
void
tsdbCloseCache
(
S
Tsdb
*
pTsdb
);
int32_t
tsdbCacheInsertLast
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STSRow
*
row
,
STsdb
*
pTsdb
);
int32_t
tsdbCacheInsertLast
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STSRow
*
row
,
STsdb
*
pTsdb
);
int32_t
tsdbCacheInsertLastrow
(
SLRUCache
*
pCache
,
STsdb
*
pTsdb
,
tb_uid_t
uid
,
STSRow
*
row
,
bool
dup
);
int32_t
tsdbCacheInsertLastrow
(
SLRUCache
*
pCache
,
STsdb
*
pTsdb
,
tb_uid_t
uid
,
STSRow
*
row
,
bool
dup
);
int32_t
tsdbCacheGetLastH
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STsdb
*
pTsdb
,
LRUHandle
**
h
);
int32_t
tsdbCacheGetLastH
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STsdb
*
pTsdb
,
LRUHandle
**
h
);
...
@@ -317,6 +317,7 @@ struct STsdb {
...
@@ -317,6 +317,7 @@ struct STsdb {
SMemTable
*
imem
;
SMemTable
*
imem
;
STsdbFS
fs
;
STsdbFS
fs
;
SLRUCache
*
lruCache
;
SLRUCache
*
lruCache
;
TdThreadMutex
lruMutex
;
};
};
struct
TSDBKEY
{
struct
TSDBKEY
{
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
04a06d43
...
@@ -33,16 +33,21 @@ int32_t tsdbOpenCache(STsdb *pTsdb) {
...
@@ -33,16 +33,21 @@ int32_t tsdbOpenCache(STsdb *pTsdb) {
taosLRUCacheSetStrictCapacity
(
pCache
,
true
);
taosLRUCacheSetStrictCapacity
(
pCache
,
true
);
taosThreadMutexInit
(
&
pTsdb
->
lruMutex
,
NULL
);
_err:
_err:
pTsdb
->
lruCache
=
pCache
;
pTsdb
->
lruCache
=
pCache
;
return
code
;
return
code
;
}
}
void
tsdbCloseCache
(
SLRUCache
*
pCache
)
{
void
tsdbCloseCache
(
STsdb
*
pTsdb
)
{
SLRUCache
*
pCache
=
pTsdb
->
lruCache
;
if
(
pCache
)
{
if
(
pCache
)
{
taosLRUCacheEraseUnrefEntries
(
pCache
);
taosLRUCacheEraseUnrefEntries
(
pCache
);
taosLRUCacheCleanup
(
pCache
);
taosLRUCacheCleanup
(
pCache
);
taosThreadMutexDestroy
(
&
pTsdb
->
lruMutex
);
}
}
}
}
...
@@ -1278,29 +1283,40 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUH
...
@@ -1278,29 +1283,40 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUH
// getTableCacheKeyS(uid, "lr", key, &keyLen);
// getTableCacheKeyS(uid, "lr", key, &keyLen);
getTableCacheKey
(
uid
,
0
,
key
,
&
keyLen
);
getTableCacheKey
(
uid
,
0
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
if
(
!
h
)
{
}
else
{
taosThreadMutexLock
(
&
pTsdb
->
lruMutex
);
STSRow
*
pRow
=
NULL
;
bool
dup
=
false
;
// which is always false for now
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
code
=
mergeLastRow
(
uid
,
pTsdb
,
&
dup
,
&
pRow
);
if
(
!
h
)
{
// if table's empty or error, return code of -1
STSRow
*
pRow
=
NULL
;
if
(
code
<
0
||
pRow
==
NULL
)
{
bool
dup
=
false
;
// which is always false for now
if
(
!
dup
&&
pRow
)
{
code
=
mergeLastRow
(
uid
,
pTsdb
,
&
dup
,
&
pRow
);
taosMemoryFree
(
pRow
);
// if table's empty or error, return code of -1
if
(
code
<
0
||
pRow
==
NULL
)
{
if
(
!
dup
&&
pRow
)
{
taosMemoryFree
(
pRow
);
}
taosThreadMutexUnlock
(
&
pTsdb
->
lruMutex
);
*
handle
=
NULL
;
return
0
;
}
}
*
handle
=
NULL
;
_taos_lru_deleter_t
deleter
=
deleteTableCacheLastrow
;
return
0
;
LRUStatus
status
=
}
taosLRUCacheInsert
(
pCache
,
key
,
keyLen
,
pRow
,
TD_ROW_LEN
(
pRow
),
deleter
,
NULL
,
TAOS_LRU_PRIORITY_LOW
);
if
(
status
!=
TAOS_LRU_STATUS_OK
)
{
code
=
-
1
;
}
_taos_lru_deleter_t
deleter
=
deleteTableCacheLastrow
;
taosThreadMutexUnlock
(
&
pTsdb
->
lruMutex
);
LRUStatus
status
=
taosLRUCacheInsert
(
pCache
,
key
,
keyLen
,
pRow
,
TD_ROW_LEN
(
pRow
),
deleter
,
NULL
,
TAOS_LRU_PRIORITY_LOW
);
if
(
status
!=
TAOS_LRU_STATUS_OK
)
{
code
=
-
1
;
}
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
}
else
{
taosThreadMutexUnlock
(
&
pTsdb
->
lruMutex
);
}
}
}
*
handle
=
h
;
*
handle
=
h
;
...
...
source/dnode/vnode/src/tsdb/tsdbOpen.c
浏览文件 @
04a06d43
...
@@ -86,7 +86,7 @@ int tsdbClose(STsdb **pTsdb) {
...
@@ -86,7 +86,7 @@ int tsdbClose(STsdb **pTsdb) {
if
(
*
pTsdb
)
{
if
(
*
pTsdb
)
{
taosThreadRwlockDestroy
(
&
(
*
pTsdb
)
->
rwLock
);
taosThreadRwlockDestroy
(
&
(
*
pTsdb
)
->
rwLock
);
tsdbFSClose
(
*
pTsdb
);
tsdbFSClose
(
*
pTsdb
);
tsdbCloseCache
(
(
*
pTsdb
)
->
lruCache
);
tsdbCloseCache
(
*
pTsdb
);
taosMemoryFreeClear
(
*
pTsdb
);
taosMemoryFreeClear
(
*
pTsdb
);
}
}
return
0
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录