Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
978c73fb
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看板
提交
978c73fb
编写于
3月 27, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
69a2f712
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
217 addition
and
83 deletion
+217
-83
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
+14
-14
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
+10
-1
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
+21
-0
source/dnode/vnode/src/tsdb/dev/tsdbFSet.h
source/dnode/vnode/src/tsdb/dev/tsdbFSet.h
+34
-0
source/dnode/vnode/src/tsdb/dev/tsdbFile.h
source/dnode/vnode/src/tsdb/dev/tsdbFile.h
+9
-31
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
+87
-30
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.h
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.h
+8
-7
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
+31
-0
source/dnode/vnode/src/tsdb/dev/tsdbUtil.h
source/dnode/vnode/src/tsdb/dev/tsdbUtil.h
+3
-0
未找到文件。
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
浏览文件 @
978c73fb
...
...
@@ -83,7 +83,7 @@ static int32_t tsdbCommitWriteDelData(SCommitter *pCommitter, int64_t suid, int6
return
code
;
}
static
int32_t
tsdbCommitTSD
ata
(
SCommitter
*
pCommitter
)
{
static
int32_t
commit_timeseries_d
ata
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
int32_t
lino
;
...
...
@@ -126,7 +126,7 @@ _exit:
return
code
;
}
static
int32_t
tsdbCommitDLD
ata
(
SCommitter
*
pCommitter
)
{
static
int32_t
commit_delete_d
ata
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
int32_t
lino
;
...
...
@@ -165,7 +165,7 @@ _exit:
return
code
;
}
static
int32_t
tsdbCommitFSetStar
t
(
SCommitter
*
pCommitter
)
{
static
int32_t
start_commit_file_se
t
(
SCommitter
*
pCommitter
)
{
pCommitter
->
fid
=
tsdbKeyFid
(
pCommitter
->
nextKey
,
pCommitter
->
minutes
,
pCommitter
->
precision
);
tsdbFidKeyRange
(
pCommitter
->
fid
,
pCommitter
->
minutes
,
pCommitter
->
precision
,
&
pCommitter
->
minKey
,
&
pCommitter
->
maxKey
);
...
...
@@ -178,7 +178,7 @@ static int32_t tsdbCommitFSetStart(SCommitter *pCommitter) {
return
0
;
}
static
int32_t
tsdbCommitFSetEnd
(
SCommitter
*
pCommitter
)
{
static
int32_t
end_commit_file_set
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
...
...
@@ -191,23 +191,23 @@ _exit:
return
code
;
}
static
int32_t
tsdbCommitNextFS
et
(
SCommitter
*
pCommitter
)
{
static
int32_t
commit_next_file_s
et
(
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
int32_t
lino
=
0
;
// fset commit start
code
=
tsdbCommitFSetStar
t
(
pCommitter
);
code
=
start_commit_file_se
t
(
pCommitter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// commit fset
code
=
tsdbCommitTSD
ata
(
pCommitter
);
code
=
commit_timeseries_d
ata
(
pCommitter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
tsdbCommitDLD
ata
(
pCommitter
);
code
=
commit_delete_d
ata
(
pCommitter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
// fset commit end
code
=
tsdbCommitFSetEnd
(
pCommitter
);
code
=
end_commit_file_set
(
pCommitter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
...
...
@@ -218,7 +218,7 @@ _exit:
return
code
;
}
static
int32_t
tsdbCommitterOpen
(
STsdb
*
pTsdb
,
SCommitInfo
*
pInfo
,
SCommitter
*
pCommitter
)
{
static
int32_t
open_committer
(
STsdb
*
pTsdb
,
SCommitInfo
*
pInfo
,
SCommitter
*
pCommitter
)
{
int32_t
code
=
0
;
int32_t
lino
;
...
...
@@ -250,7 +250,7 @@ _exit:
return
code
;
}
static
int32_t
tsdbCommitterClose
(
SCommitter
*
pCommiter
,
int32_t
eno
)
{
static
int32_t
close_committer
(
SCommitter
*
pCommiter
,
int32_t
eno
)
{
int32_t
code
=
0
;
// TODO
return
code
;
...
...
@@ -280,15 +280,15 @@ int32_t tsdbCommitBegin(STsdb *pTsdb, SCommitInfo *pInfo) {
}
else
{
SCommitter
committer
;
code
=
tsdbCommitterOpen
(
pTsdb
,
pInfo
,
&
committer
);
code
=
open_committer
(
pTsdb
,
pInfo
,
&
committer
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
while
(
committer
.
nextKey
!=
TSKEY_MAX
)
{
code
=
tsdbCommitNextFS
et
(
&
committer
);
code
=
commit_next_file_s
et
(
&
committer
);
if
(
code
)
break
;
}
code
=
tsdbCommitterClose
(
&
committer
,
code
);
code
=
close_committer
(
&
committer
,
code
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
浏览文件 @
978c73fb
...
...
@@ -13,4 +13,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dev.h"
\ No newline at end of file
#include "dev.h"
struct
STFileSystem
{
STsdb
*
pTsdb
;
};
int32_t
tsdbOpenFileSystem
(
STsdb
*
pTsdb
,
struct
STFileSystem
**
ppFS
)
{
// TODO
return
0
;
}
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
0 → 100644
浏览文件 @
978c73fb
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dev.h"
struct
SFileSet
{
struct
STFile
*
files
[
TSDB_FTYPE_MAX
];
SRBTree
fsttTree
;
};
\ No newline at end of file
source/dnode/vnode/src/tsdb/dev/tsdbFSet.h
0 → 100644
浏览文件 @
978c73fb
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TSDB_FILE_SET_H
#define _TSDB_FILE_SET_H
#ifdef __cplusplus
extern
"C"
{
#endif
/* Exposed Handle */
struct
SFileSet
;
/* Exposed APIs */
/* Exposed Structs */
#ifdef __cplusplus
}
#endif
#endif
/*_TSDB_FILE_SET_H*/
\ No newline at end of file
source/dnode/vnode/src/tsdb/dev/tsdbFile.h
浏览文件 @
978c73fb
...
...
@@ -23,40 +23,25 @@ extern "C" {
#endif
/* Exposed Handle */
typedef
struct
STFile
STFile
;
typedef
struct
SFileOp
SFileOp
;
struct
STFile
;
struct
SFileOp
;
typedef
enum
{
TSDB_FTYPE_NONE
=
0
,
// no file type
TSDB_FTYPE_STT
,
// .stt
TSDB_FTYPE_HEAD
,
// .head
TSDB_FTYPE_HEAD
=
0
,
// .head
TSDB_FTYPE_DATA
,
// .data
TSDB_FTYPE_SMA
,
// .sma
TSDB_FTYPE_TOMB
,
// .tomb
TSDB_FTYPE_MAX
,
// max file type
TSDB_FTYPE_STT
,
// .stt
}
tsdb_ftype_t
;
/* Exposed APIs */
/* Exposed Structs */
typedef
struct
SFStt
{
int64_t
offset
;
}
SFStt
;
typedef
struct
SFHead
{
int64_t
offset
;
}
SFHead
;
typedef
struct
SFData
{
// TODO
}
SFData
;
typedef
struct
SFSma
{
// TODO
}
SFSma
;
typedef
struct
SFTomb
{
// TODO
}
SFTomb
;
struct
FStt
{
int32_t
level
;
int32_t
nStt
;
};
struct
STFile
{
char
fname
[
TSDB_FILENAME_LEN
];
SDiskID
diskId
;
...
...
@@ -65,13 +50,6 @@ struct STFile {
int32_t
fid
;
int32_t
ref
;
tsdb_ftype_t
type
;
union
{
SFStt
fstt
;
SFHead
fhead
;
SFData
fdata
;
SFSma
fsma
;
SFTomb
ftomb
;
};
};
#ifdef __cplusplus
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.c
浏览文件 @
978c73fb
...
...
@@ -32,10 +32,12 @@ struct SSttFWriter {
// helper data
SSkmInfo
skmTb
;
SSkmInfo
skmRow
;
int32_t
aBufSize
[
5
];
uint8_t
*
aBuf
[
5
];
STsdbFD
*
pFd
;
};
static
int32_t
write_ts_block
(
struct
SSttFWriter
*
pWriter
)
{
static
int32_t
write_t
imeserie
s_block
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
int32_t
lino
;
...
...
@@ -50,37 +52,67 @@ static int32_t write_ts_block(struct SSttFWriter *pWriter) {
pSttBlk
->
minUid
=
pBData
->
aUid
[
0
];
pSttBlk
->
maxUid
=
pBData
->
aUid
[
pBData
->
nRow
-
1
];
pSttBlk
->
minKey
=
pSttBlk
->
maxKey
=
pBData
->
aTSKEY
[
0
];
pSttBlk
->
minVer
=
pSttBlk
->
maxVer
=
pBData
->
a
TSKEY
[
0
];
pSttBlk
->
minVer
=
pSttBlk
->
maxVer
=
pBData
->
a
Version
[
0
];
pSttBlk
->
nRow
=
pBData
->
nRow
;
for
(
int32_t
iRow
=
1
;
iRow
<
pBData
->
nRow
;
iRow
++
)
{
pSttBlk
->
minKey
=
TMIN
(
pSttBlk
->
minKey
,
pBData
->
aTSKEY
[
iRow
])
;
pSttBlk
->
maxKey
=
TMAX
(
pSttBlk
->
maxKey
,
pBData
->
aTSKEY
[
iRow
])
;
pSttBlk
->
minVer
=
TMIN
(
pSttBlk
->
minVer
,
pBData
->
aVersion
[
iRow
])
;
pSttBlk
->
maxVer
=
TMAX
(
pSttBlk
->
maxVer
,
pBData
->
aVersion
[
iRow
])
;
if
(
pSttBlk
->
minKey
>
pBData
->
aTSKEY
[
iRow
])
pSttBlk
->
minKey
=
pBData
->
aTSKEY
[
iRow
]
;
if
(
pSttBlk
->
maxKey
<
pBData
->
aTSKEY
[
iRow
])
pSttBlk
->
maxKey
=
pBData
->
aTSKEY
[
iRow
]
;
if
(
pSttBlk
->
minVer
>
pBData
->
aVersion
[
iRow
])
pSttBlk
->
minVer
=
pBData
->
aVersion
[
iRow
]
;
if
(
pSttBlk
->
maxVer
<
pBData
->
aVersion
[
iRow
])
pSttBlk
->
maxVer
=
pBData
->
aVersion
[
iRow
]
;
}
// compress data block
code
=
tCmprBlockData
(
pBData
,
pWriter
->
config
.
cmprAlg
,
NULL
,
NULL
,
NULL
/* TODO */
,
NULL
/* TODO */
);
code
=
tCmprBlockData
(
pBData
,
pWriter
->
config
.
cmprAlg
,
NULL
,
NULL
,
pWriter
->
config
.
aBuf
,
pWriter
->
aBufSize
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pSttBlk
->
bInfo
.
offset
=
pWriter
->
config
.
file
.
size
;
pSttBlk
->
bInfo
.
szKey
=
pWriter
->
aBufSize
[
2
]
+
pWriter
->
aBufSize
[
3
];
pSttBlk
->
bInfo
.
szBlock
=
pWriter
->
aBufSize
[
0
]
+
pWriter
->
aBufSize
[
1
]
+
pSttBlk
->
bInfo
.
szKey
;
for
(
int32_t
iBuf
=
3
;
iBuf
>=
0
;
iBuf
--
)
{
if
(
pWriter
->
aBufSize
[
iBuf
])
{
code
=
tsdbWriteFile
(
pWriter
->
pFd
,
pWriter
->
config
.
file
.
size
,
pWriter
->
config
.
aBuf
[
iBuf
],
pWriter
->
aBufSize
[
iBuf
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
pWriter
->
config
.
file
.
size
+=
pWriter
->
aBufSize
[
iBuf
];
}
}
tBlockDataClear
(
pBData
);
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
else
{
// tsdbTrace();
}
return
code
;
}
static
int32_t
write_
del_bloc
k
(
struct
SSttFWriter
*
pWriter
)
{
static
int32_t
write_
stt_bl
k
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
// TODO
int32_t
lino
;
if
(
taosArrayGetSize
(
pWriter
->
aSttBlk
)
==
0
)
{
goto
_exit
;
}
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
else
{
// tsdbDebug("vgId:%d %s done, offset:%" PRId64 " size:%" PRId64 " # of stt block:%d",
// TD_VID(pWriter->config.pTsdb->pVnode), __func__);
}
return
code
;
}
static
int32_t
write_
stt_bl
k
(
struct
SSttFWriter
*
pWriter
)
{
static
int32_t
write_
del_bloc
k
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
// TODO
return
code
;
}
...
...
@@ -91,7 +123,7 @@ static int32_t write_del_blk(struct SSttFWriter *pWriter) {
return
code
;
}
static
int32_t
stt_fwriter_create
(
const
struct
SSttFWriterConf
*
pConf
,
struct
SSttFWriter
**
ppWriter
)
{
static
int32_t
create_stt_fwriter
(
const
struct
SSttFWriterConf
*
pConf
,
struct
SSttFWriter
**
ppWriter
)
{
int32_t
code
=
0
;
if
((
ppWriter
[
0
]
=
taosMemoryCalloc
(
1
,
sizeof
(
*
ppWriter
[
0
])))
==
NULL
)
{
...
...
@@ -100,11 +132,14 @@ static int32_t stt_fwriter_create(const struct SSttFWriterConf *pConf, struct SS
}
ppWriter
[
0
]
->
config
=
pConf
[
0
];
if
(
pConf
->
pSkmTb
==
NULL
)
{
ppWriter
[
0
]
->
config
.
pSkmTb
=
&
ppWriter
[
0
]
->
skmTb
;
}
if
(
pConf
->
pSkmRow
==
NULL
)
{
ppWriter
[
0
]
->
config
.
pSkmRow
=
&
ppWriter
[
0
]
->
skmRow
;
}
if
(
pConf
->
pSkmTb
==
NULL
)
{
ppWriter
[
0
]
->
config
.
pSkmTb
=
&
ppWriter
[
0
]
->
skmTb
;
if
(
pConf
->
aBuf
==
NULL
)
{
ppWriter
[
0
]
->
config
.
aBuf
=
ppWriter
[
0
]
->
aBuf
;
}
tBlockDataCreate
(
&
ppWriter
[
0
]
->
bData
);
...
...
@@ -124,10 +159,11 @@ _exit:
return
code
;
}
static
int32_t
stt_fwriter_destroy
(
struct
SSttFWriter
*
pWriter
)
{
static
int32_t
destroy_stt_fwriter
(
struct
SSttFWriter
*
pWriter
)
{
if
(
pWriter
)
{
tDestroyTSchema
(
pWriter
->
skmTb
.
pTSchema
);
tDestroyTSchema
(
pWriter
->
skmRow
.
pTSchema
);
for
(
int32_t
i
=
0
;
i
<
sizeof
(
pWriter
->
aBuf
)
/
sizeof
(
pWriter
->
aBuf
[
0
]);
i
++
)
taosMemoryFree
(
pWriter
->
aBuf
[
i
]);
taosArrayDestroy
(
pWriter
->
aSttBlk
);
tBlockDataDestroy
(
&
pWriter
->
bData
);
taosMemoryFree
(
pWriter
);
...
...
@@ -135,26 +171,36 @@ static int32_t stt_fwriter_destroy(struct SSttFWriter *pWriter) {
return
0
;
}
static
int32_t
stt_fwriter_open
(
struct
SSttFWriter
*
pWriter
)
{
static
int32_t
open_stt_fwriter
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
// TODO
int32_t
lino
;
int32_t
flag
=
TD_FILE_READ
|
TD_FILE_WRITE
|
TD_FILE_CREATE
|
TD_FILE_TRUNC
;
// TODO
code
=
tsdbOpenFile
(
pWriter
->
config
.
file
.
fname
,
pWriter
->
config
.
szPage
,
flag
,
&
pWriter
->
pFd
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
if
(
code
)
{
tsdbError
(
"vgId:%d %s failed at line %d since %s"
,
TD_VID
(
pWriter
->
config
.
pTsdb
->
pVnode
),
__func__
,
lino
,
tstrerror
(
code
));
}
return
code
;
}
static
int32_t
stt_fwriter_close
(
struct
SSttFWriter
*
pWriter
)
{
int32_t
code
=
0
;
// TODO
return
code
;
static
int32_t
close_stt_fwriter
(
struct
SSttFWriter
*
pWriter
)
{
tsdbCloseFile
(
&
pWriter
->
pFd
);
return
0
;
}
int32_t
tsdbSttFWriterOpen
(
const
struct
SSttFWriterConf
*
pConf
,
struct
SSttFWriter
**
ppWriter
)
{
int32_t
code
=
0
;
int32_t
lino
;
code
=
stt_fwriter_create
(
pConf
,
ppWriter
);
code
=
create_stt_fwriter
(
pConf
,
ppWriter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
stt_fwriter_open
(
ppWriter
[
0
]);
code
=
open_stt_fwriter
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
_exit:
...
...
@@ -173,10 +219,22 @@ int32_t tsdbSttFWriterClose(struct SSttFWriter **ppWriter) {
int32_t
code
=
0
;
int32_t
lino
;
code
=
stt_fwriter_close
(
ppWriter
[
0
]);
if
(
ppWriter
[
0
]
->
bData
.
nRow
>
0
)
{
code
=
write_timeseries_block
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
code
=
write_stt_blk
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
write_del_blk
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
code
=
close_stt_fwriter
(
ppWriter
[
0
]);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
stt_fwriter_close
(
ppWriter
[
0
]);
destroy_stt_fwriter
(
ppWriter
[
0
]);
ppWriter
[
0
]
=
NULL
;
_exit:
if
(
code
)
{
...
...
@@ -191,21 +249,20 @@ int32_t tsdbSttFWriteTSData(struct SSttFWriter *pWriter, TABLEID *tbid, TSDBROW
if
(
!
TABLE_SAME_SCHEMA
(
pWriter
->
bData
.
suid
,
pWriter
->
bData
.
uid
,
tbid
->
suid
,
tbid
->
uid
))
{
if
(
pWriter
->
bData
.
nRow
>
0
)
{
code
=
write_ts_block
(
pWriter
);
code
=
write_t
imeserie
s_block
(
pWriter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
// TODO: code = tsdbUpdateTableSchema(pWriter->config.pTsdb, tbid->uid, tbid->su
id, pWriter->config.pSkmTb);
code
=
tsdbUpdateSkmTb
(
pWriter
->
config
.
pTsdb
,
tb
id
,
pWriter
->
config
.
pSkmTb
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
TABLEID
id
=
{.
suid
=
tbid
->
suid
,
.
uid
=
tbid
->
suid
?
0
:
tbid
->
uid
};
TABLEID
id
=
{.
suid
=
tbid
->
suid
,
0
};
code
=
tBlockDataInit
(
&
pWriter
->
bData
,
&
id
,
pWriter
->
config
.
pSkmTb
->
pTSchema
,
NULL
,
0
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
if
(
pRow
->
type
==
TSDBROW_ROW_FMT
)
{
// TODO: code = tsdbUpdateRowSchema(pWriter->config.pTsdb, tbid->uid, tbid->suid, pRow->row,
// pWriter->config.pSkmRow);
code
=
tsdbUpdateSkmRow
(
pWriter
->
config
.
pTsdb
,
tbid
,
TSDBROW_SVERSION
(
pRow
),
pWriter
->
config
.
pSkmRow
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
@@ -213,7 +270,7 @@ int32_t tsdbSttFWriteTSData(struct SSttFWriter *pWriter, TABLEID *tbid, TSDBROW
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
if
(
pWriter
->
bData
.
nRow
>=
pWriter
->
config
.
maxRow
)
{
code
=
write_ts_block
(
pWriter
);
code
=
write_t
imeserie
s_block
(
pWriter
);
TSDB_CHECK_CODE
(
code
,
lino
,
_exit
);
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttFWriter.h
浏览文件 @
978c73fb
...
...
@@ -31,13 +31,14 @@ int32_t tsdbSttFWriteTSData(struct SSttFWriter *pWriter, TABLEID *tbid, TSDBROW
int32_t
tsdbSttFWriteDLData
(
struct
SSttFWriter
*
pWriter
,
TABLEID
*
tbid
,
SDelData
*
pDelData
);
struct
SSttFWriterConf
{
STsdb
*
pTsdb
;
SSkmInfo
*
pSkmTb
;
SSkmInfo
*
pSkmRow
;
STFile
file
;
int32_t
maxRow
;
int32_t
szPage
;
int8_t
cmprAlg
;
STsdb
*
pTsdb
;
struct
STFile
file
;
SSkmInfo
*
pSkmTb
;
SSkmInfo
*
pSkmRow
;
int32_t
maxRow
;
int32_t
szPage
;
int8_t
cmprAlg
;
uint8_t
**
aBuf
;
};
#ifdef __cplusplus
...
...
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
浏览文件 @
978c73fb
...
...
@@ -53,4 +53,35 @@ int32_t tDelBlockAppend(SDelBlock *pDelBlock, const TABLEID *tbid, const SDelDat
code
=
tColDataAppendValue
(
&
pDelBlock
->
aColData
[
4
],
&
cv
);
return
code
;
}
int32_t
tsdbUpdateSkmTb
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
SSkmInfo
*
pSkmTb
)
{
if
(
tbid
->
suid
)
{
if
(
pSkmTb
->
suid
==
tbid
->
suid
)
{
pSkmTb
->
uid
=
tbid
->
uid
;
return
0
;
}
}
else
if
(
pSkmTb
->
uid
==
tbid
->
uid
)
{
return
0
;
}
pSkmTb
->
suid
=
tbid
->
suid
;
pSkmTb
->
uid
=
tbid
->
uid
;
tDestroyTSchema
(
pSkmTb
->
pTSchema
);
return
metaGetTbTSchemaEx
(
pTsdb
->
pVnode
->
pMeta
,
tbid
->
suid
,
tbid
->
uid
,
-
1
,
&
pSkmTb
->
pTSchema
);
}
int32_t
tsdbUpdateSkmRow
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
int32_t
sver
,
SSkmInfo
*
pSkmRow
)
{
if
(
pSkmRow
->
pTSchema
&&
pSkmRow
->
suid
==
tbid
->
suid
)
{
if
(
pSkmRow
->
suid
)
{
if
(
sver
==
pSkmRow
->
pTSchema
->
version
)
return
0
;
}
else
if
(
pSkmRow
->
uid
==
tbid
->
uid
&&
pSkmRow
->
pTSchema
->
version
==
sver
)
{
return
0
;
}
}
pSkmRow
->
suid
=
tbid
->
suid
;
pSkmRow
->
uid
=
tbid
->
uid
;
tDestroyTSchema
(
pSkmRow
->
pTSchema
);
return
metaGetTbTSchemaEx
(
pTsdb
->
pVnode
->
pMeta
,
tbid
->
suid
,
tbid
->
uid
,
sver
,
&
pSkmRow
->
pTSchema
);
}
\ No newline at end of file
source/dnode/vnode/src/tsdb/dev/tsdbUtil.h
浏览文件 @
978c73fb
...
...
@@ -32,6 +32,9 @@ int32_t tDelBlockDestroy(SDelBlock *pDelBlock);
int32_t
tDelBlockClear
(
SDelBlock
*
pDelBlock
);
int32_t
tDelBlockAppend
(
SDelBlock
*
pDelBlock
,
const
TABLEID
*
tbid
,
const
SDelData
*
pDelData
);
int32_t
tsdbUpdateSkmTb
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
SSkmInfo
*
pSkmTb
);
int32_t
tsdbUpdateSkmRow
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
int32_t
sver
,
SSkmInfo
*
pSkmRow
);
/* Exposed Structs */
struct
SDelBlock
{
SColData
aColData
[
5
];
// <suid, uid, version, skey, ekey>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录