Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
77c12bcb
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
77c12bcb
编写于
5月 12, 2022
作者:
S
slzhou@taodata.com
浏览文件
操作
浏览文件
下载
差异文件
Merge branch '3.0' of github.com:taosdata/TDengine into feature/udf
上级
d7bd6822
b1ca5d7e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
8 deletion
+46
-8
source/dnode/vnode/src/meta/metaQuery.c
source/dnode/vnode/src/meta/metaQuery.c
+9
-1
source/dnode/vnode/src/tsdb/tsdbCommit.c
source/dnode/vnode/src/tsdb/tsdbCommit.c
+36
-6
source/libs/tdb/src/db/tdbPCache.c
source/libs/tdb/src/db/tdbPCache.c
+1
-1
未找到文件。
source/dnode/vnode/src/meta/metaQuery.c
浏览文件 @
77c12bcb
...
...
@@ -158,7 +158,9 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
skmDbKey
.
sver
=
sver
;
pKey
=
&
skmDbKey
;
kLen
=
sizeof
(
skmDbKey
);
metaRLock
(
pMeta
);
ret
=
tdbDbGet
(
pMeta
->
pSkmDb
,
pKey
,
kLen
,
&
pVal
,
&
vLen
);
metaULock
(
pMeta
);
if
(
ret
<
0
)
{
return
NULL
;
}
...
...
@@ -181,6 +183,7 @@ SSchemaWrapper *metaGetTableSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver, boo
}
struct
SMCtbCursor
{
SMeta
*
pMeta
;
TDBC
*
pCur
;
tb_uid_t
suid
;
void
*
pKey
;
...
...
@@ -200,9 +203,13 @@ SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid) {
return
NULL
;
}
pCtbCur
->
pMeta
=
pMeta
;
pCtbCur
->
suid
=
uid
;
metaRLock
(
pMeta
);
ret
=
tdbDbcOpen
(
pMeta
->
pCtbIdx
,
&
pCtbCur
->
pCur
,
NULL
);
if
(
ret
<
0
)
{
metaULock
(
pMeta
);
taosMemoryFree
(
pCtbCur
);
return
NULL
;
}
...
...
@@ -220,6 +227,7 @@ SMCtbCursor *metaOpenCtbCursor(SMeta *pMeta, tb_uid_t uid) {
void
metaCloseCtbCurosr
(
SMCtbCursor
*
pCtbCur
)
{
if
(
pCtbCur
)
{
if
(
pCtbCur
->
pMeta
)
metaULock
(
pCtbCur
->
pMeta
);
if
(
pCtbCur
->
pCur
)
{
tdbDbcClose
(
pCtbCur
->
pCur
);
...
...
@@ -269,7 +277,7 @@ STSchema *metaGetTbTSchema(SMeta *pMeta, tb_uid_t uid, int32_t sver) {
pSW
=
metaGetTableSchema
(
pMeta
,
quid
,
sver
,
0
);
if
(
!
pSW
)
return
NULL
;
tdInitTSchemaBuilder
(
&
sb
,
0
);
for
(
int
i
=
0
;
i
<
pSW
->
nCols
;
i
++
)
{
pSchema
=
pSW
->
pSchema
+
i
;
...
...
source/dnode/vnode/src/tsdb/tsdbCommit.c
浏览文件 @
77c12bcb
...
...
@@ -70,6 +70,7 @@ static int tsdbCommitToFile(SCommitH *pCommith, SDFileSet *pSet, int fid);
static
void
tsdbResetCommitFile
(
SCommitH
*
pCommith
);
static
int
tsdbSetAndOpenCommitFile
(
SCommitH
*
pCommith
,
SDFileSet
*
pSet
,
int
fid
);
static
int
tsdbCommitToTable
(
SCommitH
*
pCommith
,
int
tid
);
static
bool
tsdbCommitIsSameFile
(
SCommitH
*
pCommith
,
int
bidx
);
static
int
tsdbMoveBlkIdx
(
SCommitH
*
pCommith
,
SBlockIdx
*
pIdx
);
static
int
tsdbSetCommitTable
(
SCommitH
*
pCommith
,
STable
*
pTable
);
static
int
tsdbComparKeyBlock
(
const
void
*
arg1
,
const
void
*
arg2
);
...
...
@@ -891,9 +892,11 @@ static int tsdbCommitToTable(SCommitH *pCommith, int tid) {
}
static
int
tsdbMoveBlkIdx
(
SCommitH
*
pCommith
,
SBlockIdx
*
pIdx
)
{
SReadH
*
pReadh
=
&
pCommith
->
readh
;
int
nBlocks
=
pIdx
->
numOfBlocks
;
int
bidx
=
0
;
SReadH
*
pReadh
=
&
pCommith
->
readh
;
STsdb
*
pTsdb
=
TSDB_READ_REPO
(
pReadh
);
STSchema
*
pTSchema
=
NULL
;
int
nBlocks
=
pIdx
->
numOfBlocks
;
int
bidx
=
0
;
tsdbResetCommitTable
(
pCommith
);
...
...
@@ -903,30 +906,49 @@ static int tsdbMoveBlkIdx(SCommitH *pCommith, SBlockIdx *pIdx) {
return
-
1
;
}
STable
table
=
{.
tid
=
pIdx
->
uid
,
.
uid
=
pIdx
->
uid
,
.
pSchema
=
NULL
};
pCommith
->
pTable
=
&
table
;
while
(
bidx
<
nBlocks
)
{
if
(
!
pTSchema
&&
!
tsdbCommitIsSameFile
(
pCommith
,
bidx
))
{
// Set commit table
pTSchema
=
metaGetTbTSchema
(
REPO_META
(
pTsdb
),
pIdx
->
uid
,
0
);
// TODO: schema version
if
(
!
pTSchema
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
return
-
1
;
}
table
.
pSchema
=
pTSchema
;
if
(
tsdbSetCommitTable
(
pCommith
,
&
table
)
<
0
)
{
taosMemoryFreeClear
(
pTSchema
);
return
-
1
;
}
}
if
(
tsdbMoveBlock
(
pCommith
,
bidx
)
<
0
)
{
tsdbError
(
"vgId:%d failed to move block into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
taosMemoryFreeClear
(
pTSchema
);
return
-
1
;
}
++
bidx
;
}
STable
table
=
{.
tid
=
pIdx
->
uid
,
.
uid
=
pIdx
->
uid
,
.
pSchema
=
NULL
};
TSDB_COMMIT_TABLE
(
pCommith
)
=
&
table
;
if
(
tsdbWriteBlockInfo
(
pCommith
)
<
0
)
{
tsdbError
(
"vgId:%d failed to write SBlockInfo part into file %s since %s"
,
TSDB_COMMIT_REPO_ID
(
pCommith
),
TSDB_FILE_FULL_NAME
(
TSDB_COMMIT_HEAD_FILE
(
pCommith
)),
tstrerror
(
terrno
));
taosMemoryFreeClear
(
pTSchema
);
return
-
1
;
}
taosMemoryFreeClear
(
pTSchema
);
return
0
;
}
static
int
tsdbSetCommitTable
(
SCommitH
*
pCommith
,
STable
*
pTable
)
{
STSchema
*
pSchema
=
tsdbGetTableSchemaImpl
(
pTable
,
false
,
false
,
-
1
);
pCommith
->
pTable
=
pTable
;
if
(
tdInitDataCols
(
pCommith
->
pDataCols
,
pSchema
)
<
0
)
{
...
...
@@ -1323,6 +1345,14 @@ static int tsdbMergeMemData(SCommitH *pCommith, SCommitIter *pIter, int bidx) {
return
0
;
}
static
bool
tsdbCommitIsSameFile
(
SCommitH
*
pCommith
,
int
bidx
)
{
SBlock
*
pBlock
=
pCommith
->
readh
.
pBlkInfo
->
blocks
+
bidx
;
if
(
pBlock
->
last
)
{
return
pCommith
->
isLFileSame
;
}
return
pCommith
->
isDFileSame
;
}
static
int
tsdbMoveBlock
(
SCommitH
*
pCommith
,
int
bidx
)
{
SBlock
*
pBlock
=
pCommith
->
readh
.
pBlkInfo
->
blocks
+
bidx
;
SDFile
*
pDFile
;
...
...
source/libs/tdb/src/db/tdbPCache.c
浏览文件 @
77c12bcb
...
...
@@ -242,7 +242,7 @@ static void tdbPCacheRemovePageFromHash(SPCache *pCache, SPage *pPage) {
int
h
;
h
=
tdbPCachePageHash
(
&
(
pPage
->
pgid
));
for
(
ppPage
=
&
(
pCache
->
pgHash
[
h
%
pCache
->
nHash
]);
*
ppPage
!=
pPage
;
ppPage
=
&
((
*
ppPage
)
->
pHashNext
))
for
(
ppPage
=
&
(
pCache
->
pgHash
[
h
%
pCache
->
nHash
]);
(
*
ppPage
)
&&
*
ppPage
!=
pPage
;
ppPage
=
&
((
*
ppPage
)
->
pHashNext
))
;
ASSERT
(
*
ppPage
==
pPage
);
*
ppPage
=
pPage
->
pHashNext
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录