Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
buyaopa
TDengine
提交
d6319c19
T
TDengine
项目概览
buyaopa
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d6319c19
编写于
5月 09, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add sync function, need to refactor again
上级
15d6f34d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
53 addition
and
9 deletion
+53
-9
src/inc/tsdb.h
src/inc/tsdb.h
+2
-0
src/tsdb/inc/tsdbMain.h
src/tsdb/inc/tsdbMain.h
+4
-3
src/tsdb/src/tsdbMain.c
src/tsdb/src/tsdbMain.c
+43
-1
src/tsdb/src/tsdbMetaFile.c
src/tsdb/src/tsdbMetaFile.c
+2
-2
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+2
-3
未找到文件。
src/inc/tsdb.h
浏览文件 @
d6319c19
...
...
@@ -109,6 +109,8 @@ int tsdbDropTable(TsdbRepoT *pRepo, STableId tableId);
int
tsdbAlterTable
(
TsdbRepoT
*
repo
,
STableCfg
*
pCfg
);
TSKEY
tsdbGetTableLastKey
(
TsdbRepoT
*
repo
,
int64_t
uid
);
uint32_t
tsdbGetFileInfo
(
TsdbRepoT
*
repo
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
);
// the TSDB repository info
typedef
struct
STsdbRepoInfo
{
STsdbCfg
tsdbCfg
;
...
...
src/tsdb/inc/tsdbMain.h
浏览文件 @
d6319c19
...
...
@@ -490,9 +490,10 @@ int tsdbWriteCompInfo(SRWHelper *pHelper);
int
tsdbWriteCompIdx
(
SRWHelper
*
pHelper
);
// --------- Other functions need to further organize
void
tsdbFitRetention
(
STsdbRepo
*
pRepo
);
int
tsdbAlterCacheTotalBlocks
(
STsdbRepo
*
pRepo
,
int
totalBlocks
);
void
tsdbAdjustCacheBlocks
(
STsdbCache
*
pCache
);
void
tsdbFitRetention
(
STsdbRepo
*
pRepo
);
int
tsdbAlterCacheTotalBlocks
(
STsdbRepo
*
pRepo
,
int
totalBlocks
);
void
tsdbAdjustCacheBlocks
(
STsdbCache
*
pCache
);
int32_t
tsdbGetMetaFileName
(
char
*
rootDir
,
char
*
fname
);
#ifdef __cplusplus
}
...
...
src/tsdb/src/tsdbMain.c
浏览文件 @
d6319c19
...
...
@@ -7,6 +7,7 @@
#include "tscompression.h"
#include "tchecksum.h"
#include "ttime.h"
#include <sys/stat.h>
int
tsdbDebugFlag
=
135
;
...
...
@@ -760,7 +761,7 @@ static int32_t tsdbSetRepoEnv(STsdbRepo *pRepo) {
return
-
1
;
}
tsdb
Error
(
tsdb
Trace
(
"id %d: set up tsdb environment succeed! cacheBlockSize %d, totalBlocks %d, maxTables %d, daysPerFile %d, keep "
"%d, minRowsPerFileBlock %d, maxRowsPerFileBlock %d, precision %d, compression%d"
,
pRepo
->
config
.
tsdbId
,
pCfg
->
cacheBlockSize
,
pCfg
->
totalBlocks
,
pCfg
->
maxTables
,
pCfg
->
daysPerFile
,
pCfg
->
keep
,
...
...
@@ -1124,4 +1125,45 @@ static void tsdbAlterKeep(STsdbRepo *pRepo, int32_t keep) {
static
void
tsdbAlterMaxTables
(
STsdbRepo
*
pRepo
,
int32_t
maxTables
)
{
// TODO
}
uint32_t
tsdbGetFileInfo
(
TsdbRepoT
*
repo
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
)
{
// TODO: need to refactor this function
tsdbError
(
"name:%s index:%d size:%d"
,
name
,
*
index
,
*
size
);
STsdbRepo
*
pRepo
=
(
STsdbRepo
*
)
repo
;
// STsdbMeta *pMeta = pRepo->tsdbMeta;
STsdbFileH
*
pFileH
=
pRepo
->
tsdbFileH
;
uint32_t
magic
=
0
;
char
fname
[
256
]
=
"
\0
"
;
struct
stat
fState
;
if
(
name
[
0
]
==
0
)
{
// Map index to the file name
int
fid
=
(
*
index
)
/
3
;
if
(
fid
>
pFileH
->
numOfFGroups
)
{
// return meta data file
if
((
*
index
)
%
3
>
0
)
{
// it is finished
return
0
;
}
else
{
tsdbGetMetaFileName
(
pRepo
->
rootDir
,
fname
);
}
}
else
{
// return data file name
strcpy
(
fname
,
pFileH
->
fGroup
[
fid
].
files
[(
*
index
)
%
3
].
fname
);
}
strcpy
(
name
,
fname
);
}
else
{
// Name is provided, need to get the file info
sprintf
(
fname
,
"%s/%s"
,
pRepo
->
rootDir
,
name
);
}
if
(
stat
(
fname
,
&
fState
)
<
0
)
return
0
;
*
size
=
fState
.
st_size
;
magic
=
*
size
;
return
magic
;
}
\ No newline at end of file
src/tsdb/src/tsdbMetaFile.c
浏览文件 @
d6319c19
...
...
@@ -28,7 +28,7 @@ typedef struct {
int64_t
uid
;
}
SRecordInfo
;
static
int32_t
tsdbGetMetaFileName
(
char
*
rootDir
,
char
*
fname
);
//
static int32_t tsdbGetMetaFileName(char *rootDir, char *fname);
// static int32_t tsdbCheckMetaHeader(int fd);
static
int32_t
tsdbWriteMetaHeader
(
int
fd
);
static
int
tsdbCreateMetaFile
(
char
*
fname
);
...
...
@@ -180,7 +180,7 @@ void tsdbCloseMetaFile(SMetaFile *mfh) {
tfree
(
mfh
);
}
static
int32_t
tsdbGetMetaFileName
(
char
*
rootDir
,
char
*
fname
)
{
int32_t
tsdbGetMetaFileName
(
char
*
rootDir
,
char
*
fname
)
{
if
(
rootDir
==
NULL
)
return
-
1
;
sprintf
(
fname
,
"%s/%s"
,
rootDir
,
TSDB_META_FILE_NAME
);
return
0
;
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
d6319c19
...
...
@@ -383,9 +383,8 @@ static int vnodeWalCallback(void *arg) {
}
static
uint32_t
vnodeGetFileInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
,
int32_t
*
size
)
{
// SVnodeObj *pVnode = ahandle;
//tsdbGetFileInfo(pVnode->tsdb, name, index, size);
return
0
;
SVnodeObj
*
pVnode
=
ahandle
;
return
tsdbGetFileInfo
(
pVnode
->
tsdb
,
name
,
index
,
size
);
}
static
int
vnodeGetWalInfo
(
void
*
ahandle
,
char
*
name
,
uint32_t
*
index
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录