Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
33f6755a
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
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看板
提交
33f6755a
编写于
4月 01, 2020
作者:
H
hzcheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some compile warnings
上级
6ab57852
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
27 deletion
+24
-27
src/vnode/tsdb/inc/tsdbMain.h
src/vnode/tsdb/inc/tsdbMain.h
+3
-3
src/vnode/tsdb/src/tsdbCache.c
src/vnode/tsdb/src/tsdbCache.c
+2
-2
src/vnode/tsdb/src/tsdbFile.c
src/vnode/tsdb/src/tsdbFile.c
+7
-10
src/vnode/tsdb/src/tsdbMain.c
src/vnode/tsdb/src/tsdbMain.c
+7
-7
src/vnode/tsdb/src/tsdbMeta.c
src/vnode/tsdb/src/tsdbMeta.c
+2
-2
src/vnode/tsdb/src/tsdbMetaFile.c
src/vnode/tsdb/src/tsdbMetaFile.c
+3
-3
未找到文件。
src/vnode/tsdb/inc/tsdbMain.h
浏览文件 @
33f6755a
...
...
@@ -78,7 +78,7 @@ typedef struct STable {
void
*
tsdbEncodeTable
(
STable
*
pTable
,
int
*
contLen
);
STable
*
tsdbDecodeTable
(
void
*
cont
,
int
contLen
);
void
*
tsdbFreeEncode
(
void
*
cont
);
void
tsdbFreeEncode
(
void
*
cont
);
// ---------- TSDB META HANDLE DEFINITION
typedef
struct
{
...
...
@@ -97,7 +97,7 @@ typedef struct {
int
maxCols
;
}
STsdbMeta
;
STsdbMeta
*
tsdbInitMeta
(
c
onst
c
har
*
rootDir
,
int32_t
maxTables
);
STsdbMeta
*
tsdbInitMeta
(
char
*
rootDir
,
int32_t
maxTables
);
int32_t
tsdbFreeMeta
(
STsdbMeta
*
pMeta
);
STSchema
*
tsdbGetTableSchema
(
STsdbMeta
*
pMeta
,
STable
*
pTable
);
...
...
@@ -216,7 +216,7 @@ typedef struct {
STsdbFileH
*
tsdbInitFileH
(
char
*
dataDir
,
int
maxFiles
);
void
tsdbCloseFileH
(
STsdbFileH
*
pFileH
);
int
tsdbCreateFile
(
char
*
dataDir
,
int
fileId
,
char
*
suffix
,
int
maxTables
,
SFile
*
pFile
,
int
writeHeader
,
int
toClose
);
int
tsdbCreateFile
(
char
*
dataDir
,
int
fileId
,
c
onst
c
har
*
suffix
,
int
maxTables
,
SFile
*
pFile
,
int
writeHeader
,
int
toClose
);
int
tsdbCreateFGroup
(
STsdbFileH
*
pFileH
,
char
*
dataDir
,
int
fid
,
int
maxTables
);
int
tsdbOpenFile
(
SFile
*
pFile
,
int
oflag
);
int
tsdbCloseFile
(
SFile
*
pFile
);
SFileGroup
*
tsdbOpenFilesForCommit
(
STsdbFileH
*
pFileH
,
int
fid
);
...
...
src/vnode/tsdb/src/tsdbCache.c
浏览文件 @
33f6755a
...
...
@@ -72,7 +72,7 @@ void *tsdbAllocFromCache(STsdbCache *pCache, int bytes, TSKEY key) {
if
(
bytes
>
pCache
->
cacheBlockSize
)
return
NULL
;
if
(
pCache
->
curBlock
==
NULL
||
pCache
->
curBlock
->
remain
<
bytes
)
{
if
(
pCache
->
curBlock
!=
NULL
&&
(
pCache
->
mem
->
list
)
>=
pCache
->
totalCacheBlocks
/
2
)
{
if
(
pCache
->
curBlock
!=
NULL
&&
listNEles
(
pCache
->
mem
->
list
)
>=
pCache
->
totalCacheBlocks
/
2
)
{
tsdbTriggerCommit
(
pCache
->
pRepo
);
}
...
...
@@ -130,7 +130,7 @@ static int tsdbAllocBlockFromPool(STsdbCache *pCache) {
if
(
pCache
->
mem
==
NULL
)
{
// Create a new one
pCache
->
mem
=
(
SCacheMem
*
)
malloc
(
sizeof
(
SCacheMem
));
if
(
pCache
->
mem
==
NULL
)
return
NULL
;
if
(
pCache
->
mem
==
NULL
)
return
-
1
;
pCache
->
mem
->
keyFirst
=
INT64_MAX
;
pCache
->
mem
->
keyLast
=
0
;
pCache
->
mem
->
numOfPoints
=
0
;
...
...
src/vnode/tsdb/src/tsdbFile.c
浏览文件 @
33f6755a
...
...
@@ -33,7 +33,7 @@ const char *tsdbFileSuffix[] = {
static
int
compFGroupKey
(
const
void
*
key
,
const
void
*
fgroup
);
static
int
compFGroup
(
const
void
*
arg1
,
const
void
*
arg2
);
static
int
tsdbGetFileName
(
char
*
dataDir
,
int
fileId
,
char
*
suffix
,
char
*
fname
);
static
int
tsdbGetFileName
(
char
*
dataDir
,
int
fileId
,
c
onst
c
har
*
suffix
,
char
*
fname
);
static
int
tsdbWriteFileHead
(
SFile
*
pFile
);
static
int
tsdbWriteHeadFileIdx
(
SFile
*
pFile
,
int
maxTables
);
static
int
tsdbOpenFGroup
(
STsdbFileH
*
pFileH
,
char
*
dataDir
,
int
fid
);
...
...
@@ -53,8 +53,6 @@ STsdbFileH *tsdbInitFileH(char *dataDir, int maxFiles) {
}
struct
dirent
*
dp
=
NULL
;
int
fid
=
0
;
SFileGroup
fGroup
=
{
0
};
while
((
dp
=
readdir
(
dir
))
!=
NULL
)
{
if
(
strncmp
(
dp
->
d_name
,
"."
,
1
)
==
0
||
strncmp
(
dp
->
d_name
,
".."
,
1
)
==
0
)
continue
;
int
fid
=
0
;
...
...
@@ -70,7 +68,7 @@ STsdbFileH *tsdbInitFileH(char *dataDir, int maxFiles) {
void
tsdbCloseFileH
(
STsdbFileH
*
pFileH
)
{
free
(
pFileH
);
}
static
int
tsdbInitFile
(
char
*
dataDir
,
int
fid
,
char
*
suffix
,
SFile
*
pFile
)
{
static
int
tsdbInitFile
(
char
*
dataDir
,
int
fid
,
c
onst
c
har
*
suffix
,
SFile
*
pFile
)
{
tsdbGetFileName
(
dataDir
,
fid
,
suffix
,
pFile
->
fname
);
if
(
access
(
pFile
->
fname
,
F_OK
|
R_OK
|
W_OK
)
<
0
)
return
-
1
;
pFile
->
fd
=
-
1
;
...
...
@@ -82,7 +80,6 @@ static int tsdbInitFile(char *dataDir, int fid, char *suffix, SFile *pFile) {
static
int
tsdbOpenFGroup
(
STsdbFileH
*
pFileH
,
char
*
dataDir
,
int
fid
)
{
if
(
tsdbSearchFGroup
(
pFileH
,
fid
)
!=
NULL
)
return
0
;
char
fname
[
128
]
=
"
\0
"
;
SFileGroup
fGroup
=
{
0
};
fGroup
.
fileId
=
fid
;
...
...
@@ -163,8 +160,8 @@ SFileGroup *tsdbGetFileGroupNext(SFileGroupIter *pIter) {
SFileGroup
*
ret
=
pIter
->
pFileGroup
;
if
(
ret
==
NULL
)
return
NULL
;
if
(
pIter
->
direction
=
TSDB_FGROUP_ITER_FORWARD
)
{
if
(
pIter
->
pFileGroup
+
1
==
pIter
->
base
+
pIter
->
numOfFGroups
)
{
if
(
pIter
->
direction
=
=
TSDB_FGROUP_ITER_FORWARD
)
{
if
(
(
pIter
->
pFileGroup
+
1
)
==
(
pIter
->
base
+
pIter
->
numOfFGroups
)
)
{
pIter
->
pFileGroup
=
NULL
;
}
else
{
pIter
->
pFileGroup
+=
1
;
...
...
@@ -223,7 +220,7 @@ int tsdbCopyBlockDataInFile(SFile *pOutFile, SFile *pInFile, SCompInfo *pCompInf
if
(
pCompData
==
NULL
)
return
-
1
;
// Load data from the block
if
(
tsdbLoadDataBlock
(
pOutFile
,
pStartBlock
,
numOfBlocks
,
pCols
,
pCompData
));
//
if (tsdbLoadDataBlock(pOutFile, pStartBlock, numOfBlocks, pCols, pCompData));
// Write data block to the file
{
...
...
@@ -315,7 +312,7 @@ static int tsdbWriteHeadFileIdx(SFile *pFile, int maxTables) {
return
0
;
}
static
int
tsdbGetFileName
(
char
*
dataDir
,
int
fileId
,
char
*
suffix
,
char
*
fname
)
{
static
int
tsdbGetFileName
(
char
*
dataDir
,
int
fileId
,
c
onst
c
har
*
suffix
,
char
*
fname
)
{
if
(
dataDir
==
NULL
||
fname
==
NULL
)
return
-
1
;
sprintf
(
fname
,
"%s/f%d%s"
,
dataDir
,
fileId
,
suffix
);
...
...
@@ -348,7 +345,7 @@ SFileGroup * tsdbOpenFilesForCommit(STsdbFileH *pFileH, int fid) {
return
pGroup
;
}
int
tsdbCreateFile
(
char
*
dataDir
,
int
fileId
,
char
*
suffix
,
int
maxTables
,
SFile
*
pFile
,
int
writeHeader
,
int
toClose
)
{
int
tsdbCreateFile
(
char
*
dataDir
,
int
fileId
,
c
onst
c
har
*
suffix
,
int
maxTables
,
SFile
*
pFile
,
int
writeHeader
,
int
toClose
)
{
memset
((
void
*
)
pFile
,
0
,
sizeof
(
SFile
));
pFile
->
fd
=
-
1
;
...
...
src/vnode/tsdb/src/tsdbMain.c
浏览文件 @
33f6755a
...
...
@@ -806,7 +806,7 @@ static void tsdbDestroyTableIters(SSkipListIterator **iters, int maxTables) {
}
static
SSkipListIterator
**
tsdbCreateTableIters
(
STsdbMeta
*
pMeta
,
int
maxTables
)
{
SSkipListIterator
**
iters
=
(
SSkipListIterator
*
)
calloc
(
maxTables
,
sizeof
(
SSkipListIterator
*
));
SSkipListIterator
**
iters
=
(
SSkipListIterator
*
*
)
calloc
(
maxTables
,
sizeof
(
SSkipListIterator
*
));
if
(
iters
==
NULL
)
return
NULL
;
for
(
int
tid
=
0
;
tid
<
maxTables
;
tid
++
)
{
...
...
@@ -893,9 +893,9 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
SFileGroup
*
pGroup
=
NULL
;
SCompIdx
*
pIndices
=
NULL
;
SCompInfo
*
pCompInfo
=
NULL
;
size_t
compInfoSize
=
0
;
SCompBlock
compBlock
;
SCompBlock
*
pBlock
=
&
compBlock
;
//
size_t compInfoSize = 0;
//
SCompBlock compBlock;
//
SCompBlock *pBlock = &compBlock;
TSKEY
minKey
=
0
,
maxKey
=
0
;
tsdbGetKeyRangeOfFileId
(
pCfg
->
daysPerFile
,
pCfg
->
precision
,
fid
,
&
minKey
,
&
maxKey
);
...
...
@@ -963,10 +963,11 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SSkipListIterator **iters
TSDB_COMPBLOCK_GET_START_AND_SIZE
(
pCompInfo
,
pTBlock
,
nBlocks
);
SCompBlock
tBlock
;
int64_t
toffset
,
tlen
;
int64_t
toffset
;
int32_t
tlen
;
tsdbLoadDataBlock
(
&
pGroup
->
files
[
TSDB_FILE_TYPE_LAST
],
pTBlock
,
nBlocks
,
pCols
,
&
tBlock
);
tsdbWriteBlockToFileImpl
(
&
lFile
,
pCols
,
pCols
->
numOfPoints
,
&
toffset
,
tlen
,
pTable
->
tableId
.
uid
);
tsdbWriteBlockToFileImpl
(
&
lFile
,
pCols
,
pCols
->
numOfPoints
,
&
toffset
,
&
tlen
,
pTable
->
tableId
.
uid
);
pTBlock
=
TSDB_COMPBLOCK_AT
(
pCompInfo
,
pIdx
->
numOfSuperBlocks
);
pTBlock
->
offset
=
toffset
;
pTBlock
->
len
=
tlen
;
...
...
@@ -1164,7 +1165,6 @@ static int compareKeyBlock(const void *arg1, const void *arg2) {
int
tsdbWriteBlockToFile
(
STsdbRepo
*
pRepo
,
SFileGroup
*
pGroup
,
SCompIdx
*
pIdx
,
SCompInfo
*
pCompInfo
,
SDataCols
*
pCols
,
SCompBlock
*
pCompBlock
,
SFile
*
lFile
,
int64_t
uid
)
{
STsdbCfg
*
pCfg
=
&
(
pRepo
->
config
);
SCompData
*
pCompData
=
NULL
;
SFile
*
pFile
=
NULL
;
int
numOfPointsToWrite
=
0
;
int64_t
offset
=
0
;
...
...
src/vnode/tsdb/src/tsdbMeta.c
浏览文件 @
33f6755a
...
...
@@ -89,7 +89,7 @@ STable *tsdbDecodeTable(void *cont, int contLen) {
return
pTable
;
}
void
*
tsdbFreeEncode
(
void
*
cont
)
{
void
tsdbFreeEncode
(
void
*
cont
)
{
if
(
cont
!=
NULL
)
free
(
cont
);
}
...
...
@@ -124,7 +124,7 @@ void tsdbOrgMeta(void *pHandle) {
* Initialize the meta handle
* ASSUMPTIONS: VALID PARAMETER
*/
STsdbMeta
*
tsdbInitMeta
(
c
onst
c
har
*
rootDir
,
int32_t
maxTables
)
{
STsdbMeta
*
tsdbInitMeta
(
char
*
rootDir
,
int32_t
maxTables
)
{
STsdbMeta
*
pMeta
=
(
STsdbMeta
*
)
malloc
(
sizeof
(
STsdbMeta
));
if
(
pMeta
==
NULL
)
return
NULL
;
...
...
src/vnode/tsdb/src/tsdbMetaFile.c
浏览文件 @
33f6755a
...
...
@@ -174,7 +174,7 @@ int32_t tsdbUpdateMetaRecord(SMetaFile *mfh, int64_t uid, void *cont, int32_t co
void
tsdbCloseMetaFile
(
SMetaFile
*
mfh
)
{
if
(
mfh
==
NULL
)
return
;
close
(
mfh
);
close
(
mfh
->
fd
);
taosHashCleanup
(
mfh
->
map
);
}
...
...
@@ -210,7 +210,7 @@ static int tsdbCreateMetaFile(char *fname) {
if
(
tsdbWriteMetaHeader
(
fd
)
<
0
)
{
close
(
fd
);
return
NULL
;
return
-
1
;
}
return
fd
;
...
...
@@ -242,7 +242,7 @@ static int tsdbRestoreFromMetaFile(char *fname, SMetaFile *mfh) {
mfh
->
fd
=
fd
;
void
*
buf
=
NULL
;
int
buf_size
=
0
;
//
int buf_size = 0;
SRecordInfo
info
;
while
(
1
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录