Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d0d56645
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d0d56645
编写于
12月 16, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
1ab4f2c4
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
70 addition
and
26 deletion
+70
-26
include/dnode/vnode/meta/meta.h
include/dnode/vnode/meta/meta.h
+3
-3
include/dnode/vnode/tq/tq.h
include/dnode/vnode/tq/tq.h
+1
-1
include/dnode/vnode/tsdb/tsdb.h
include/dnode/vnode/tsdb/tsdb.h
+3
-1
source/dnode/vnode/impl/inc/vnodeBufferPool.h
source/dnode/vnode/impl/inc/vnodeBufferPool.h
+2
-0
source/dnode/vnode/impl/inc/vnodeMAF.h
source/dnode/vnode/impl/inc/vnodeMAF.h
+32
-0
source/dnode/vnode/impl/src/vnodeBufferPool.c
source/dnode/vnode/impl/src/vnodeBufferPool.c
+4
-2
source/dnode/vnode/impl/src/vnodeMain.c
source/dnode/vnode/impl/src/vnodeMain.c
+5
-3
source/dnode/vnode/meta/src/metaMain.c
source/dnode/vnode/meta/src/metaMain.c
+8
-8
source/dnode/vnode/tq/src/tq.c
source/dnode/vnode/tq/src/tq.c
+4
-0
source/dnode/vnode/tsdb/src/tsdbMain.c
source/dnode/vnode/tsdb/src/tsdbMain.c
+8
-8
未找到文件。
include/dnode/vnode/meta/meta.h
浏览文件 @
d0d56645
...
...
@@ -71,7 +71,7 @@ typedef struct STbCfg {
}
STbCfg
;
// SMeta operations
SMeta
*
metaOpen
(
const
char
*
path
,
const
SMetaCfg
*
p
Options
);
SMeta
*
metaOpen
(
const
char
*
path
,
const
SMetaCfg
*
p
MetaCfg
);
void
metaClose
(
SMeta
*
pMeta
);
void
metaRemove
(
const
char
*
path
);
int
metaCreateTable
(
SMeta
*
pMeta
,
STbCfg
*
pTbCfg
);
...
...
@@ -79,8 +79,8 @@ int metaDropTable(SMeta *pMeta, tb_uid_t uid);
int
metaCommit
(
SMeta
*
pMeta
);
// Options
void
metaOptionsInit
(
SMetaCfg
*
p
Options
);
void
metaOptionsClear
(
SMetaCfg
*
p
Options
);
void
metaOptionsInit
(
SMetaCfg
*
p
MetaCfg
);
void
metaOptionsClear
(
SMetaCfg
*
p
MetaCfg
);
// STbCfg
#define META_INIT_STB_CFG(NAME, TTL, KEEP, SUID, PSCHEMA, PTAGSCHEMA) \
...
...
include/dnode/vnode/tq/tq.h
浏览文件 @
d0d56645
...
...
@@ -264,7 +264,7 @@ typedef struct STQ {
// open in each vnode
STQ
*
tqOpen
(
const
char
*
path
,
STqCfg
*
tqConfig
,
TqLogReader
*
tqLogReader
,
SMemAllocatorFactory
*
allocFac
);
void
tq
Destroy
(
STQ
*
);
void
tq
Close
(
STQ
*
);
// void* will be replace by a msg type
int
tqPushMsg
(
STQ
*
,
void
*
msg
,
int64_t
version
);
...
...
include/dnode/vnode/tsdb/tsdb.h
浏览文件 @
d0d56645
...
...
@@ -16,6 +16,8 @@
#ifndef _TD_TSDB_H_
#define _TD_TSDB_H_
#include "mallocator.h"
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
@@ -25,7 +27,7 @@ typedef struct STsdb STsdb;
typedef
struct
STsdbCfg
STsdbCfg
;
// STsdb
STsdb
*
tsdbOpen
(
const
char
*
path
,
const
STsdbCfg
*
pTsdbCfg
);
STsdb
*
tsdbOpen
(
const
char
*
path
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
);
void
tsdbClose
(
STsdb
*
);
void
tsdbRemove
(
const
char
*
path
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
SSubmitMsg
*
pMsg
);
...
...
source/dnode/vnode/impl/inc/vnodeBufferPool.h
浏览文件 @
d0d56645
...
...
@@ -32,6 +32,8 @@ int vnodeBufPoolRecycle(SVnode *pVnode);
void
*
vnodeMalloc
(
SVnode
*
pVnode
,
uint64_t
size
);
bool
vnodeBufPoolIsFull
(
SVnode
*
pVnode
);
SMemAllocatorFactory
*
vBufPoolGetMAF
(
SVnode
*
pVnode
);
#ifdef __cplusplus
}
#endif
...
...
source/dnode/vnode/impl/inc/vnodeMAF.h
0 → 100644
浏览文件 @
d0d56645
/*
* 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 _TD_VNODE_MAF_H_
#define _TD_VNODE_MAF_H_
#include "vnode.h"
#ifdef __cplusplus
extern
"C"
{
#endif
int
vnodeOpenMAF
(
SVnode
*
pVnode
);
void
vnodeCloseMAF
(
SVnode
*
pVnode
);
#ifdef __cplusplus
}
#endif
#endif
/*_TD_VNODE_MAF_H_*/
\ No newline at end of file
source/dnode/vnode/impl/src/vnodeBufferPool.c
浏览文件 @
d0d56645
...
...
@@ -24,8 +24,8 @@ struct SVBufPool {
TD_DLIST
(
SVMemAllocator
)
free
;
TD_DLIST
(
SVMemAllocator
)
incycle
;
SVMemAllocator
*
inuse
;
// MAF for submodules
// SMemAllocatorFactory maf
;
// MAF for submodules
to use
SMemAllocatorFactory
*
pMAF
;
};
int
vnodeOpenBufPool
(
SVnode
*
pVnode
)
{
...
...
@@ -125,6 +125,8 @@ bool vnodeBufPoolIsFull(SVnode *pVnode) {
return
vmaIsFull
(
pVnode
->
pBufPool
->
inuse
);
}
SMemAllocatorFactory
*
vBufPoolGetMAF
(
SVnode
*
pVnode
)
{
return
pVnode
->
pBufPool
->
pMAF
;
}
#if 0
typedef enum {
...
...
source/dnode/vnode/impl/src/vnodeMain.c
浏览文件 @
d0d56645
...
...
@@ -102,7 +102,7 @@ static int vnodeOpenImpl(SVnode *pVnode) {
// Open tsdb
sprintf
(
dir
,
"%s/tsdb"
,
pVnode
->
path
);
pVnode
->
pTsdb
=
tsdbOpen
(
dir
,
&
(
pVnode
->
config
.
tsdbCfg
));
pVnode
->
pTsdb
=
tsdbOpen
(
dir
,
&
(
pVnode
->
config
.
tsdbCfg
)
,
vBufPoolGetMAF
(
pVnode
)
);
if
(
pVnode
->
pTsdb
==
NULL
)
{
// TODO: handle error
return
-
1
;
...
...
@@ -110,7 +110,7 @@ static int vnodeOpenImpl(SVnode *pVnode) {
// TODO: Open TQ
sprintf
(
dir
,
"%s/tq"
,
pVnode
->
path
);
pVnode
->
pTq
=
tqOpen
(
dir
,
&
(
pVnode
->
config
.
tqCfg
),
NULL
,
NULL
);
pVnode
->
pTq
=
tqOpen
(
dir
,
&
(
pVnode
->
config
.
tqCfg
),
NULL
,
vBufPoolGetMAF
(
pVnode
)
);
if
(
pVnode
->
pTq
==
NULL
)
{
// TODO: handle error
return
-
1
;
...
...
@@ -131,7 +131,9 @@ static int vnodeOpenImpl(SVnode *pVnode) {
static
void
vnodeCloseImpl
(
SVnode
*
pVnode
)
{
if
(
pVnode
)
{
vnodeCloseBufPool
(
pVnode
);
tsdbClose
(
pVnode
->
pTsdb
);
metaClose
(
pVnode
->
pMeta
);
tsdbClose
(
pVnode
->
pTsdb
);
tqClose
(
pVnode
->
pTq
);
walClose
(
pVnode
->
pWal
);
}
}
\ No newline at end of file
source/dnode/vnode/meta/src/metaMain.c
浏览文件 @
d0d56645
...
...
@@ -17,27 +17,27 @@
#include "metaDef.h"
static
SMeta
*
metaNew
(
const
char
*
path
,
const
SMetaCfg
*
pMeta
Options
);
static
SMeta
*
metaNew
(
const
char
*
path
,
const
SMetaCfg
*
pMeta
Cfg
);
static
void
metaFree
(
SMeta
*
pMeta
);
static
int
metaOpenImpl
(
SMeta
*
pMeta
);
static
void
metaCloseImpl
(
SMeta
*
pMeta
);
SMeta
*
metaOpen
(
const
char
*
path
,
const
SMetaCfg
*
pMeta
Options
)
{
SMeta
*
metaOpen
(
const
char
*
path
,
const
SMetaCfg
*
pMeta
Cfg
)
{
SMeta
*
pMeta
=
NULL
;
// Set default options
if
(
pMeta
Options
==
NULL
)
{
pMeta
Options
=
&
defaultMetaOptions
;
if
(
pMeta
Cfg
==
NULL
)
{
pMeta
Cfg
=
&
defaultMetaOptions
;
}
// Validate the options
if
(
metaValidateOptions
(
pMeta
Options
)
<
0
)
{
if
(
metaValidateOptions
(
pMeta
Cfg
)
<
0
)
{
// TODO: deal with error
return
NULL
;
}
// Allocate handle
pMeta
=
metaNew
(
path
,
pMeta
Options
);
pMeta
=
metaNew
(
path
,
pMeta
Cfg
);
if
(
pMeta
==
NULL
)
{
// TODO: handle error
return
NULL
;
...
...
@@ -65,7 +65,7 @@ void metaClose(SMeta *pMeta) {
void
metaRemove
(
const
char
*
path
)
{
taosRemoveDir
(
path
);
}
/* ------------------------ STATIC METHODS ------------------------ */
static
SMeta
*
metaNew
(
const
char
*
path
,
const
SMetaCfg
*
pMeta
Options
)
{
static
SMeta
*
metaNew
(
const
char
*
path
,
const
SMetaCfg
*
pMeta
Cfg
)
{
SMeta
*
pMeta
;
size_t
psize
=
strlen
(
path
);
...
...
@@ -80,7 +80,7 @@ static SMeta *metaNew(const char *path, const SMetaCfg *pMetaOptions) {
return
NULL
;
}
metaOptionsCopy
(
&
(
pMeta
->
options
),
pMeta
Options
);
metaOptionsCopy
(
&
(
pMeta
->
options
),
pMeta
Cfg
);
return
pMeta
;
};
...
...
source/dnode/vnode/tq/src/tq.c
浏览文件 @
d0d56645
...
...
@@ -66,6 +66,10 @@ STQ* tqOpen(const char* path, STqCfg* tqConfig, TqLogReader* tqLogReader, SMemAl
return
pTq
;
}
void
tqClose
(
STQ
*
pTq
)
{
// TODO
}
static
int
tqProtoCheck
(
TmqMsgHead
*
pMsg
)
{
return
pMsg
->
protoVer
==
0
;
}
...
...
source/dnode/vnode/tsdb/src/tsdbMain.c
浏览文件 @
d0d56645
...
...
@@ -15,27 +15,27 @@
#include "tsdbDef.h"
static
STsdb
*
tsdbNew
(
const
char
*
path
,
const
STsdbCfg
*
pTsdb
Options
);
static
STsdb
*
tsdbNew
(
const
char
*
path
,
const
STsdbCfg
*
pTsdb
Cfg
);
static
void
tsdbFree
(
STsdb
*
pTsdb
);
static
int
tsdbOpenImpl
(
STsdb
*
pTsdb
);
static
void
tsdbCloseImpl
(
STsdb
*
pTsdb
);
STsdb
*
tsdbOpen
(
const
char
*
path
,
const
STsdbCfg
*
pTsdb
Options
)
{
STsdb
*
tsdbOpen
(
const
char
*
path
,
const
STsdbCfg
*
pTsdb
Cfg
,
SMemAllocatorFactory
*
pMAF
)
{
STsdb
*
pTsdb
=
NULL
;
// Set default TSDB Options
if
(
pTsdb
Options
==
NULL
)
{
pTsdb
Options
=
&
defautlTsdbOptions
;
if
(
pTsdb
Cfg
==
NULL
)
{
pTsdb
Cfg
=
&
defautlTsdbOptions
;
}
// Validate the options
if
(
tsdbValidateOptions
(
pTsdb
Options
)
<
0
)
{
if
(
tsdbValidateOptions
(
pTsdb
Cfg
)
<
0
)
{
// TODO: handle error
return
NULL
;
}
// Create the handle
pTsdb
=
tsdbNew
(
path
,
pTsdb
Options
);
pTsdb
=
tsdbNew
(
path
,
pTsdb
Cfg
);
if
(
pTsdb
==
NULL
)
{
// TODO: handle error
return
NULL
;
...
...
@@ -62,7 +62,7 @@ void tsdbClose(STsdb *pTsdb) {
void
tsdbRemove
(
const
char
*
path
)
{
taosRemoveDir
(
path
);
}
/* ------------------------ STATIC METHODS ------------------------ */
static
STsdb
*
tsdbNew
(
const
char
*
path
,
const
STsdbCfg
*
pTsdb
Options
)
{
static
STsdb
*
tsdbNew
(
const
char
*
path
,
const
STsdbCfg
*
pTsdb
Cfg
)
{
STsdb
*
pTsdb
=
NULL
;
pTsdb
=
(
STsdb
*
)
calloc
(
1
,
sizeof
(
STsdb
));
...
...
@@ -72,7 +72,7 @@ static STsdb *tsdbNew(const char *path, const STsdbCfg *pTsdbOptions) {
}
pTsdb
->
path
=
strdup
(
path
);
tsdbOptionsCopy
(
&
(
pTsdb
->
options
),
pTsdb
Options
);
tsdbOptionsCopy
(
&
(
pTsdb
->
options
),
pTsdb
Cfg
);
return
pTsdb
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录