Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a511aed8
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,发现更多精彩内容 >>
提交
a511aed8
编写于
1月 10, 2022
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more
上级
8d8b7b1c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
47 addition
and
9 deletion
+47
-9
include/dnode/vnode/meta/meta.h
include/dnode/vnode/meta/meta.h
+1
-0
include/dnode/vnode/tsdb/tsdb.h
include/dnode/vnode/tsdb/tsdb.h
+2
-1
source/dnode/vnode/impl/src/vnodeMain.c
source/dnode/vnode/impl/src/vnodeMain.c
+1
-1
source/dnode/vnode/meta/src/metaBDBImpl.c
source/dnode/vnode/meta/src/metaBDBImpl.c
+23
-0
source/dnode/vnode/tsdb/CMakeLists.txt
source/dnode/vnode/tsdb/CMakeLists.txt
+1
-0
source/dnode/vnode/tsdb/inc/tsdbDef.h
source/dnode/vnode/tsdb/inc/tsdbDef.h
+2
-0
source/dnode/vnode/tsdb/inc/tsdbFS.h
source/dnode/vnode/tsdb/inc/tsdbFS.h
+2
-2
source/dnode/vnode/tsdb/src/tsdbCommit.c
source/dnode/vnode/tsdb/src/tsdbCommit.c
+7
-0
source/dnode/vnode/tsdb/src/tsdbFS.c
source/dnode/vnode/tsdb/src/tsdbFS.c
+1
-1
source/dnode/vnode/tsdb/src/tsdbMain.c
source/dnode/vnode/tsdb/src/tsdbMain.c
+7
-4
未找到文件。
include/dnode/vnode/meta/meta.h
浏览文件 @
a511aed8
...
@@ -58,6 +58,7 @@ int metaCommit(SMeta *pMeta);
...
@@ -58,6 +58,7 @@ int metaCommit(SMeta *pMeta);
STbCfg
*
metaGetTbInfoByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
STbCfg
*
metaGetTbInfoByUid
(
SMeta
*
pMeta
,
tb_uid_t
uid
);
STbCfg
*
metaGetTbInfoByName
(
SMeta
*
pMeta
,
char
*
tbname
,
tb_uid_t
*
uid
);
STbCfg
*
metaGetTbInfoByName
(
SMeta
*
pMeta
,
char
*
tbname
,
tb_uid_t
*
uid
);
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
);
SSchemaWrapper
*
metaGetTableSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
,
bool
isinline
);
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
);
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
);
SMTbCursor
*
metaOpenTbCursor
(
SMeta
*
pMeta
);
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
);
void
metaCloseTbCursor
(
SMTbCursor
*
pTbCur
);
...
...
include/dnode/vnode/tsdb/tsdb.h
浏览文件 @
a511aed8
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#define _TD_TSDB_H_
#define _TD_TSDB_H_
#include "mallocator.h"
#include "mallocator.h"
#include "meta.h"
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
...
@@ -58,7 +59,7 @@ typedef struct STsdbCfg {
...
@@ -58,7 +59,7 @@ typedef struct STsdbCfg {
}
STsdbCfg
;
}
STsdbCfg
;
// STsdb
// STsdb
STsdb
*
tsdbOpen
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
);
STsdb
*
tsdbOpen
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
,
SMeta
*
pMeta
);
void
tsdbClose
(
STsdb
*
);
void
tsdbClose
(
STsdb
*
);
void
tsdbRemove
(
const
char
*
path
);
void
tsdbRemove
(
const
char
*
path
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
SSubmitMsg
*
pMsg
,
SSubmitRsp
*
pRsp
);
int
tsdbInsertData
(
STsdb
*
pTsdb
,
SSubmitMsg
*
pMsg
,
SSubmitRsp
*
pRsp
);
...
...
source/dnode/vnode/impl/src/vnodeMain.c
浏览文件 @
a511aed8
...
@@ -106,7 +106,7 @@ static int vnodeOpenImpl(SVnode *pVnode) {
...
@@ -106,7 +106,7 @@ static int vnodeOpenImpl(SVnode *pVnode) {
// Open tsdb
// Open tsdb
sprintf
(
dir
,
"%s/tsdb"
,
pVnode
->
path
);
sprintf
(
dir
,
"%s/tsdb"
,
pVnode
->
path
);
pVnode
->
pTsdb
=
tsdbOpen
(
dir
,
pVnode
->
vgId
,
&
(
pVnode
->
config
.
tsdbCfg
),
vBufPoolGetMAF
(
pVnode
));
pVnode
->
pTsdb
=
tsdbOpen
(
dir
,
pVnode
->
vgId
,
&
(
pVnode
->
config
.
tsdbCfg
),
vBufPoolGetMAF
(
pVnode
)
,
pVnode
->
pMeta
);
if
(
pVnode
->
pTsdb
==
NULL
)
{
if
(
pVnode
->
pTsdb
==
NULL
)
{
// TODO: handle error
// TODO: handle error
return
-
1
;
return
-
1
;
...
...
source/dnode/vnode/meta/src/metaBDBImpl.c
浏览文件 @
a511aed8
...
@@ -589,4 +589,27 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) {
...
@@ -589,4 +589,27 @@ char *metaTbCursorNext(SMTbCursor *pTbCur) {
return
NULL
;
return
NULL
;
}
}
}
}
}
STSchema
*
metaGetTbTSchema
(
SMeta
*
pMeta
,
tb_uid_t
uid
,
int32_t
sver
)
{
STSchemaBuilder
sb
;
STSchema
*
pTSchema
=
NULL
;
SSchema
*
pSchema
;
SSchemaWrapper
*
pSW
;
pSW
=
metaGetTableSchema
(
pMeta
,
uid
,
sver
,
true
);
if
(
pSW
==
NULL
)
{
return
NULL
;
}
// Rebuild a schema
tdInitTSchemaBuilder
(
&
sb
,
0
);
for
(
int32_t
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
pSchema
=
pSW
->
pSchema
+
i
;
tdAddColToSchema
(
&
sb
,
pSchema
->
type
,
pSchema
->
colId
,
pSchema
->
bytes
);
}
pTSchema
=
tdGetSchemaFromBuilder
(
&
sb
);
tdDestroyTSchemaBuilder
(
&
sb
);
return
pTSchema
;
}
}
\ No newline at end of file
source/dnode/vnode/tsdb/CMakeLists.txt
浏览文件 @
a511aed8
...
@@ -29,4 +29,5 @@ target_link_libraries(
...
@@ -29,4 +29,5 @@ target_link_libraries(
PUBLIC common
PUBLIC common
PUBLIC tkv
PUBLIC tkv
PUBLIC tfs
PUBLIC tfs
PUBLIC meta
)
)
\ No newline at end of file
source/dnode/vnode/tsdb/inc/tsdbDef.h
浏览文件 @
a511aed8
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#define _TD_TSDB_DEF_H_
#define _TD_TSDB_DEF_H_
#include "mallocator.h"
#include "mallocator.h"
#include "meta.h"
#include "tcompression.h"
#include "tcompression.h"
#include "tglobal.h"
#include "tglobal.h"
#include "thash.h"
#include "thash.h"
...
@@ -48,6 +49,7 @@ struct STsdb {
...
@@ -48,6 +49,7 @@ struct STsdb {
SRtn
rtn
;
SRtn
rtn
;
SMemAllocatorFactory
*
pmaf
;
SMemAllocatorFactory
*
pmaf
;
STsdbFS
*
fs
;
STsdbFS
*
fs
;
SMeta
*
pMeta
;
};
};
#define REPO_ID(r) ((r)->vgId)
#define REPO_ID(r) ((r)->vgId)
...
...
source/dnode/vnode/tsdb/inc/tsdbFS.h
浏览文件 @
a511aed8
...
@@ -70,7 +70,7 @@ typedef struct {
...
@@ -70,7 +70,7 @@ typedef struct {
#define TSDB_FS_ITER_FORWARD TSDB_ORDER_ASC
#define TSDB_FS_ITER_FORWARD TSDB_ORDER_ASC
#define TSDB_FS_ITER_BACKWARD TSDB_ORDER_DESC
#define TSDB_FS_ITER_BACKWARD TSDB_ORDER_DESC
STsdbFS
*
tsdbNewFS
(
STsdbCfg
*
pCfg
);
STsdbFS
*
tsdbNewFS
(
const
STsdbCfg
*
pCfg
);
void
*
tsdbFreeFS
(
STsdbFS
*
pfs
);
void
*
tsdbFreeFS
(
STsdbFS
*
pfs
);
int
tsdbOpenFS
(
STsdb
*
pRepo
);
int
tsdbOpenFS
(
STsdb
*
pRepo
);
void
tsdbCloseFS
(
STsdb
*
pRepo
);
void
tsdbCloseFS
(
STsdb
*
pRepo
);
...
@@ -79,7 +79,7 @@ int tsdbEndFSTxn(STsdb *pRepo);
...
@@ -79,7 +79,7 @@ int tsdbEndFSTxn(STsdb *pRepo);
int
tsdbEndFSTxnWithError
(
STsdbFS
*
pfs
);
int
tsdbEndFSTxnWithError
(
STsdbFS
*
pfs
);
void
tsdbUpdateFSTxnMeta
(
STsdbFS
*
pfs
,
STsdbFSMeta
*
pMeta
);
void
tsdbUpdateFSTxnMeta
(
STsdbFS
*
pfs
,
STsdbFSMeta
*
pMeta
);
// void tsdbUpdateMFile(STsdbFS *pfs, const SMFile *pMFile);
// void tsdbUpdateMFile(STsdbFS *pfs, const SMFile *pMFile);
int
tsdbUpdateDFileSet
(
STsdbFS
*
pfs
,
const
SDFileSet
*
pSet
);
int
tsdbUpdateDFileSet
(
STsdbFS
*
pfs
,
const
SDFileSet
*
pSet
);
void
tsdbFSIterInit
(
SFSIter
*
pIter
,
STsdbFS
*
pfs
,
int
direction
);
void
tsdbFSIterInit
(
SFSIter
*
pIter
,
STsdbFS
*
pfs
,
int
direction
);
void
tsdbFSIterSeek
(
SFSIter
*
pIter
,
int
fid
);
void
tsdbFSIterSeek
(
SFSIter
*
pIter
,
int
fid
);
...
...
source/dnode/vnode/tsdb/src/tsdbCommit.c
浏览文件 @
a511aed8
...
@@ -420,6 +420,13 @@ static int tsdbCreateCommitIters(SCommitH *pCommith) {
...
@@ -420,6 +420,13 @@ static int tsdbCreateCommitIters(SCommitH *pCommith) {
pCommitIter
=
pCommith
->
iters
+
i
;
pCommitIter
=
pCommith
->
iters
+
i
;
pCommitIter
->
pIter
=
tSkipListCreateIter
(
pTbData
->
pData
);
pCommitIter
->
pIter
=
tSkipListCreateIter
(
pTbData
->
pData
);
tSkipListIterNext
(
pCommitIter
->
pIter
);
tSkipListIterNext
(
pCommitIter
->
pIter
);
#if 0
// TODO
pCommitIter->pTable = (STable *)malloc(sizeof(STable));
pCommitIter->pTable->uid = pTbData->uid;
pCommitIter->pTable->pSchema = metaGetTableSchema();
#endif
}
}
return
0
;
return
0
;
...
...
source/dnode/vnode/tsdb/src/tsdbFS.c
浏览文件 @
a511aed8
...
@@ -191,7 +191,7 @@ static int tsdbAddDFileSetToStatus(SFSStatus *pStatus, const SDFileSet *pSet) {
...
@@ -191,7 +191,7 @@ static int tsdbAddDFileSetToStatus(SFSStatus *pStatus, const SDFileSet *pSet) {
}
}
// ================== STsdbFS
// ================== STsdbFS
STsdbFS
*
tsdbNewFS
(
STsdbCfg
*
pCfg
)
{
STsdbFS
*
tsdbNewFS
(
const
STsdbCfg
*
pCfg
)
{
int
keep
=
pCfg
->
keep
;
int
keep
=
pCfg
->
keep
;
int
days
=
pCfg
->
daysPerFile
;
int
days
=
pCfg
->
daysPerFile
;
int
maxFSet
=
TSDB_MAX_FSETS
(
keep
,
days
);
int
maxFSet
=
TSDB_MAX_FSETS
(
keep
,
days
);
...
...
source/dnode/vnode/tsdb/src/tsdbMain.c
浏览文件 @
a511aed8
...
@@ -15,12 +15,13 @@
...
@@ -15,12 +15,13 @@
#include "tsdbDef.h"
#include "tsdbDef.h"
static
STsdb
*
tsdbNew
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
);
static
STsdb
*
tsdbNew
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
,
SMeta
*
pMeta
);
static
void
tsdbFree
(
STsdb
*
pTsdb
);
static
void
tsdbFree
(
STsdb
*
pTsdb
);
static
int
tsdbOpenImpl
(
STsdb
*
pTsdb
);
static
int
tsdbOpenImpl
(
STsdb
*
pTsdb
);
static
void
tsdbCloseImpl
(
STsdb
*
pTsdb
);
static
void
tsdbCloseImpl
(
STsdb
*
pTsdb
);
STsdb
*
tsdbOpen
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
)
{
STsdb
*
tsdbOpen
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
,
SMeta
*
pMeta
)
{
STsdb
*
pTsdb
=
NULL
;
STsdb
*
pTsdb
=
NULL
;
// Set default TSDB Options
// Set default TSDB Options
...
@@ -35,7 +36,7 @@ STsdb *tsdbOpen(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAl
...
@@ -35,7 +36,7 @@ STsdb *tsdbOpen(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg, SMemAl
}
}
// Create the handle
// Create the handle
pTsdb
=
tsdbNew
(
path
,
vgId
,
pTsdbCfg
,
pMAF
);
pTsdb
=
tsdbNew
(
path
,
vgId
,
pTsdbCfg
,
pMAF
,
pMeta
);
if
(
pTsdb
==
NULL
)
{
if
(
pTsdb
==
NULL
)
{
// TODO: handle error
// TODO: handle error
return
NULL
;
return
NULL
;
...
@@ -62,7 +63,8 @@ void tsdbClose(STsdb *pTsdb) {
...
@@ -62,7 +63,8 @@ void tsdbClose(STsdb *pTsdb) {
void
tsdbRemove
(
const
char
*
path
)
{
taosRemoveDir
(
path
);
}
void
tsdbRemove
(
const
char
*
path
)
{
taosRemoveDir
(
path
);
}
/* ------------------------ STATIC METHODS ------------------------ */
/* ------------------------ STATIC METHODS ------------------------ */
static
STsdb
*
tsdbNew
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
)
{
static
STsdb
*
tsdbNew
(
const
char
*
path
,
int32_t
vgId
,
const
STsdbCfg
*
pTsdbCfg
,
SMemAllocatorFactory
*
pMAF
,
SMeta
*
pMeta
)
{
STsdb
*
pTsdb
=
NULL
;
STsdb
*
pTsdb
=
NULL
;
pTsdb
=
(
STsdb
*
)
calloc
(
1
,
sizeof
(
STsdb
));
pTsdb
=
(
STsdb
*
)
calloc
(
1
,
sizeof
(
STsdb
));
...
@@ -75,6 +77,7 @@ static STsdb *tsdbNew(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg,
...
@@ -75,6 +77,7 @@ static STsdb *tsdbNew(const char *path, int32_t vgId, const STsdbCfg *pTsdbCfg,
pTsdb
->
vgId
=
vgId
;
pTsdb
->
vgId
=
vgId
;
tsdbOptionsCopy
(
&
(
pTsdb
->
config
),
pTsdbCfg
);
tsdbOptionsCopy
(
&
(
pTsdb
->
config
),
pTsdbCfg
);
pTsdb
->
pmaf
=
pMAF
;
pTsdb
->
pmaf
=
pMAF
;
pTsdb
->
pMeta
=
pMeta
;
pTsdb
->
fs
=
tsdbNewFS
(
pTsdbCfg
);
pTsdb
->
fs
=
tsdbNewFS
(
pTsdbCfg
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录