Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6bdb6aad
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
6bdb6aad
编写于
9月 15, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--force-compact-file
上级
38ad8374
变更
9
显示空白变更内容
内联
并排
Showing
9 changed file
with
30 addition
and
24 deletion
+30
-24
src/common/inc/tglobal.h
src/common/inc/tglobal.h
+2
-1
src/common/src/tglobal.c
src/common/src/tglobal.c
+2
-1
src/dnode/src/dnodeSystem.c
src/dnode/src/dnodeSystem.c
+4
-2
src/tsdb/inc/tsdbReadImpl.h
src/tsdb/inc/tsdbReadImpl.h
+1
-1
src/tsdb/src/tsdbCompact.c
src/tsdb/src/tsdbCompact.c
+4
-1
src/tsdb/src/tsdbFS.c
src/tsdb/src/tsdbFS.c
+1
-1
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+2
-1
src/tsdb/src/tsdbReadImpl.c
src/tsdb/src/tsdbReadImpl.c
+11
-11
src/tsdb/src/tsdbRecover.c
src/tsdb/src/tsdbRecover.c
+3
-5
未找到文件。
src/common/inc/tglobal.h
浏览文件 @
6bdb6aad
...
...
@@ -110,7 +110,8 @@ extern int8_t tsCacheLastRow;
//tsdb
extern
bool
tsdbForceKeepFile
;
extern
bool
tsdbEnableUpgradeFS
;
extern
bool
tsdbForceCompactFile
;
extern
bool
tsdbEnableUpgradeFile
;
#ifdef __TD_6117__
extern
bool
tsdbQueryFromSMA
;
...
...
src/common/src/tglobal.c
浏览文件 @
6bdb6aad
...
...
@@ -156,7 +156,8 @@ int32_t tsTsdbMetaCompactRatio = TSDB_META_COMPACT_RATIO;
// tsdb config
// For backward compatibility
bool
tsdbForceKeepFile
=
false
;
bool
tsdbEnableUpgradeFS
=
false
;
bool
tsdbForceCompactFile
=
false
;
// compact TSDB fileset forcibly
bool
tsdbEnableUpgradeFile
=
false
;
// upgrade TSDB .head from v0 to v1+
#ifdef __TD_6117__
bool
tsdbQueryFromSMA
=
true
;
...
...
src/dnode/src/dnodeSystem.c
浏览文件 @
6bdb6aad
...
...
@@ -42,10 +42,12 @@ int32_t main(int32_t argc, char *argv[]) {
}
}
else
if
(
strcmp
(
argv
[
i
],
"-C"
)
==
0
)
{
dump_config
=
1
;
}
else
if
(
strcmp
(
argv
[
i
],
"--enable-upgrade-f
s
"
)
==
0
)
{
tsdbEnableUpgradeF
S
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"--enable-upgrade-f
ile
"
)
==
0
)
{
tsdbEnableUpgradeF
ile
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"--disable-query-from-sma"
)
==
0
)
{
tsdbQueryFromSMA
=
false
;
}
else
if
(
strcmp
(
argv
[
i
],
"--force-compact-file"
)
==
0
)
{
tsdbForceCompactFile
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"--force-keep-file"
)
==
0
)
{
tsdbForceKeepFile
=
true
;
}
else
if
(
strcmp
(
argv
[
i
],
"--compact-mnode-wal"
)
==
0
)
{
...
...
src/tsdb/inc/tsdbReadImpl.h
浏览文件 @
6bdb6aad
...
...
@@ -236,7 +236,7 @@ int tsdbSetAndOpenReadFSet(SReadH *pReadh, SDFileSet *pSet);
void
tsdbCloseAndUnsetFSet
(
SReadH
*
pReadh
);
int
tsdbLoadBlockIdx
(
SReadH
*
pReadh
);
int
tsdbSetReadTable
(
SReadH
*
pReadh
,
STable
*
pTable
);
int
tsdbLoadBlockInfo
(
SReadH
*
pReadh
,
void
**
pTarget
,
int32_t
*
extendedLen
);
int
tsdbLoadBlockInfo
(
SReadH
*
pReadh
,
void
**
pTarget
,
u
int32_t
*
extendedLen
);
int
tsdbLoadBlockData
(
SReadH
*
pReadh
,
SBlock
*
pBlock
,
SBlockInfo
*
pBlockInfo
);
int
tsdbLoadBlockDataCols
(
SReadH
*
pReadh
,
SBlock
*
pBlock
,
SBlockInfo
*
pBlkInfo
,
int16_t
*
colIds
,
int
numOfColsIds
);
int
tsdbLoadBlockStatis
(
SReadH
*
pReadh
,
SBlock
*
pBlock
);
...
...
src/tsdb/src/tsdbCompact.c
浏览文件 @
6bdb6aad
...
...
@@ -220,6 +220,9 @@ static int tsdbCompactMeta(STsdbRepo *pRepo) {
}
static
bool
tsdbShouldCompact
(
SCompactH
*
pComph
)
{
if
(
tsdbForceCompactFile
)
{
return
true
;
}
STsdbRepo
*
pRepo
=
TSDB_COMPACT_REPO
(
pComph
);
STsdbCfg
*
pCfg
=
REPO_CFG
(
pRepo
);
SReadH
*
pReadh
=
&
(
pComph
->
readh
);
...
...
@@ -390,7 +393,7 @@ static int tsdbCompactMeta(STsdbRepo *pRepo) {
// if (tsdbMakeRoom((void **)(&(pTh->pInfo)), pTh->pBlkIdx->len) < 0) {
// return -1;
// }
int32_t
originLen
=
0
;
u
int32_t
originLen
=
0
;
if
(
tsdbLoadBlockInfo
(
pReadH
,
(
void
**
)(
&
(
pTh
->
pInfo
)),
&
originLen
)
<
0
)
{
return
-
1
;
}
...
...
src/tsdb/src/tsdbFS.c
浏览文件 @
6bdb6aad
...
...
@@ -341,7 +341,7 @@ int tsdbOpenFS(STsdbRepo *pRepo) {
return
-
1
;
}
if
(
tsdbEnableUpgradeF
S
&&
tsdbRefactorFS
(
pRepo
)
<
0
)
{
if
(
tsdbEnableUpgradeF
ile
&&
tsdbRefactorFS
(
pRepo
)
<
0
)
{
tsdbError
(
"vgId:%d failed to refactor FS since %s"
,
REPO_ID
(
pRepo
),
tstrerror
(
terrno
));
return
-
1
;
}
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
6bdb6aad
...
...
@@ -1102,7 +1102,8 @@ static int32_t loadBlockInfo(STsdbQueryHandle * pQueryHandle, int32_t index, int
// pCheckInfo->compSize = compIndex->len;
// }
if
(
tsdbLoadBlockInfo
(
&
(
pQueryHandle
->
rhelper
),
(
void
**
)(
&
pCheckInfo
->
pCompInfo
),
&
pCheckInfo
->
compSize
)
<
0
)
{
if
(
tsdbLoadBlockInfo
(
&
(
pQueryHandle
->
rhelper
),
(
void
**
)(
&
pCheckInfo
->
pCompInfo
),
(
uint32_t
*
)(
&
pCheckInfo
->
compSize
))
<
0
)
{
return
terrno
;
}
SBlockInfo
*
pCompInfo
=
pCheckInfo
->
pCompInfo
;
...
...
src/tsdb/src/tsdbReadImpl.c
浏览文件 @
6bdb6aad
...
...
@@ -269,16 +269,16 @@ static FORCE_INLINE size_t tsdbSizeOfSBlock(int32_t sBlkVer) {
}
}
static
int
tsdbHeadRefactor
(
SDFile
*
pHeadf
,
SBlockInfo
**
pDstBlkInfo
,
uint32_t
srcBlkInfoLen
,
int32_t
*
dstBlkInfoLen
)
{
static
int
tsdbHeadRefactor
(
SDFile
*
pHeadf
,
SBlockInfo
**
pDstBlkInfo
,
uint32_t
srcBlkInfoLen
,
u
int32_t
*
dstBlkInfoLen
)
{
int
sBlkVer
=
tsdbGetSBlockVer
(
pHeadf
->
info
.
fver
);
if
(
sBlkVer
==
SBlockVerLatest
)
{
*
dstBlkInfoLen
=
srcBlkInfoLen
;
return
TSDB_CODE_SUCCESS
;
}
uint32
_t
originBlkSize
=
tsdbSizeOfSBlock
(
sBlkVer
);
int
nBlks
=
(
srcBlkInfoLen
-
sizeof
(
SBlockInfo
))
/
originBlkSize
;
size
_t
originBlkSize
=
tsdbSizeOfSBlock
(
sBlkVer
);
size_t
nBlks
=
(
srcBlkInfoLen
-
sizeof
(
SBlockInfo
))
/
originBlkSize
;
*
dstBlkInfoLen
=
sizeof
(
SBlockInfo
)
+
nBlks
*
sizeof
(
SBlock
);
*
dstBlkInfoLen
=
(
uint32_t
)(
sizeof
(
SBlockInfo
)
+
nBlks
*
sizeof
(
SBlock
)
);
if
(
srcBlkInfoLen
==
*
dstBlkInfoLen
)
{
return
TSDB_CODE_SUCCESS
;
...
...
@@ -300,7 +300,7 @@ static int tsdbHeadRefactor(SDFile *pHeadf, SBlockInfo **pDstBlkInfo, uint32_t s
return
TSDB_CODE_SUCCESS
;
}
int
tsdbLoadBlockInfo
(
SReadH
*
pReadh
,
void
**
pTarget
,
int32_t
*
extendedLen
)
{
int
tsdbLoadBlockInfo
(
SReadH
*
pReadh
,
void
**
pTarget
,
u
int32_t
*
extendedLen
)
{
ASSERT
(
pReadh
->
pBlkIdx
!=
NULL
);
SDFile
*
pHeadf
=
TSDB_READ_HEAD_FILE
(
pReadh
);
...
...
@@ -337,7 +337,7 @@ int tsdbLoadBlockInfo(SReadH *pReadh, void **pTarget, int32_t *extendedLen) {
ASSERT
(
pBlkIdx
->
tid
==
pReadh
->
pBlkInfo
->
tid
&&
pBlkIdx
->
uid
==
pReadh
->
pBlkInfo
->
uid
);
int32_t
dstBlkInfoLen
=
0
;
u
int32_t
dstBlkInfoLen
=
0
;
if
(
tsdbHeadRefactor
(
pHeadf
,
&
(
pReadh
->
pBlkInfo
),
pBlkIdx
->
len
,
&
dstBlkInfoLen
)
<
0
)
{
return
-
1
;
}
...
...
@@ -422,7 +422,7 @@ static int tsdbLoadBlockStatisFromDFile(SReadH *pReadh, SBlock *pBlock) {
return
-
1
;
}
size_t
size
=
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
pBlock
->
blkVer
);
size_t
size
=
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
if
(
tsdbMakeRoom
((
void
**
)(
&
(
pReadh
->
pBlkData
)),
size
)
<
0
)
return
-
1
;
int64_t
nread
=
tsdbReadDFile
(
pDFile
,
(
void
*
)(
pReadh
->
pBlkData
),
size
);
...
...
@@ -462,7 +462,7 @@ static int tsdbLoadBlockStatisFromAggr(SReadH *pReadh, SBlock *pBlock) {
return
-
1
;
}
size_t
sizeAggr
=
tsdbBlockAggrSize
(
pBlock
->
numOfCols
,
pBlock
->
blkVer
);
size_t
sizeAggr
=
tsdbBlockAggrSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
if
(
tsdbMakeRoom
((
void
**
)(
&
(
pReadh
->
pAggrBlkData
)),
sizeAggr
)
<
0
)
return
-
1
;
int64_t
nreadAggr
=
tsdbReadDFile
(
pDFileAggr
,
(
void
*
)(
pReadh
->
pAggrBlkData
),
sizeAggr
);
...
...
@@ -647,7 +647,7 @@ static int tsdbLoadBlockDataImpl(SReadH *pReadh, SBlock *pBlock, SDataCols *pDat
return
-
1
;
}
int32_t
tsize
=
(
int32_t
)
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
pBlock
->
blkVer
);
int32_t
tsize
=
(
int32_t
)
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
);
if
(
!
taosCheckChecksumWhole
((
uint8_t
*
)
TSDB_READ_BUF
(
pReadh
),
tsize
))
{
terrno
=
TSDB_CODE_TDB_FILE_CORRUPTED
;
tsdbError
(
"vgId:%d block statis part in file %s is corrupted since wrong checksum, offset:%"
PRId64
" len :%d"
,
...
...
@@ -846,8 +846,8 @@ static int tsdbLoadColData(SReadH *pReadh, SDFile *pDFile, SBlock *pBlock, SBloc
if
(
tsdbMakeRoom
((
void
**
)(
&
TSDB_READ_BUF
(
pReadh
)),
pBlockCol
->
len
)
<
0
)
return
-
1
;
if
(
tsdbMakeRoom
((
void
**
)(
&
TSDB_READ_COMP_BUF
(
pReadh
)),
tsize
)
<
0
)
return
-
1
;
int64_t
offset
=
pBlock
->
offset
+
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
pBlock
->
blkVer
)
+
tsdbGetBlockColOffset
(
pBlockCol
);
int64_t
offset
=
pBlock
->
offset
+
tsdbBlockStatisSize
(
pBlock
->
numOfCols
,
(
uint32_t
)
pBlock
->
blkVer
)
+
tsdbGetBlockColOffset
(
pBlockCol
);
if
(
tsdbSeekDFile
(
pDFile
,
offset
,
SEEK_SET
)
<
0
)
{
tsdbError
(
"vgId:%d failed to load block column data while seek file %s to offset %"
PRId64
" since %s"
,
TSDB_READ_REPO_ID
(
pReadh
),
TSDB_FILE_FULL_NAME
(
pDFile
),
offset
,
tstrerror
(
terrno
));
...
...
src/tsdb/src/tsdbRecover.c
浏览文件 @
6bdb6aad
...
...
@@ -226,8 +226,7 @@ static int tsdbDestroyHFile(SDFile *pDFile) {
static
int
tsdbRefactorHeadF
(
STsdbRepo
*
pRepo
,
SRecoverH
*
pRecoverH
,
SDFileSet
*
pSet
,
int32_t
*
nRemain
)
{
SDFile
*
pHeadF
=
TSDB_DFILE_IN_SET
(
pSet
,
TSDB_FILE_HEAD
);
if
(
pHeadF
->
info
.
fver
==
tsdbGetDFSVersion
(
TSDB_FILE_HEAD
))
{
if
(
taosArrayPush
(
REPO_FS
(
pRepo
)
->
nstatus
->
df
,
pSet
)
==
NULL
)
{
terrno
=
TSDB_CODE_FS_OUT_OF_MEMORY
;
if
(
tsdbUpdateDFileSet
(
REPO_FS
(
pRepo
),
pSet
)
<
0
)
{
return
-
1
;
}
++*
nRemain
;
...
...
@@ -321,8 +320,7 @@ static int tsdbRefactorHeadF(STsdbRepo *pRepo, SRecoverH *pRecoverH, SDFileSet *
SDFileSet
*
pDestFSet
=
TSDB_READ_FSET
(
pReadH
);
tsdbInitDFileEx
(
TSDB_DFILE_IN_SET
(
pDestFSet
,
TSDB_FILE_HEAD
),
pTmpHeadF
);
if
(
taosArrayPush
(
REPO_FS
(
pRepo
)
->
nstatus
->
df
,
pDestFSet
)
==
NULL
)
{
terrno
=
TSDB_CODE_FS_OUT_OF_MEMORY
;
if
(
tsdbUpdateDFileSet
(
REPO_FS
(
pRepo
),
pDestFSet
)
<
0
)
{
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录