Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
685c0e55
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
685c0e55
编写于
6月 08, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
more code
上级
0c9b66b5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
138 addition
and
2 deletion
+138
-2
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
+67
-2
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
+71
-0
未找到文件。
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
浏览文件 @
685c0e55
...
@@ -62,9 +62,10 @@ int32_t tTombBlockInit(STombBlock *tombBlock);
...
@@ -62,9 +62,10 @@ int32_t tTombBlockInit(STombBlock *tombBlock);
int32_t
tTombBlockDestroy
(
STombBlock
*
tombBlock
);
int32_t
tTombBlockDestroy
(
STombBlock
*
tombBlock
);
int32_t
tTombBlockClear
(
STombBlock
*
tombBlock
);
int32_t
tTombBlockClear
(
STombBlock
*
tombBlock
);
int32_t
tTombBlockPut
(
STombBlock
*
tombBlock
,
const
STombRecord
*
record
);
int32_t
tTombBlockPut
(
STombBlock
*
tombBlock
,
const
STombRecord
*
record
);
int32_t
tTombBlockGet
(
STombBlock
*
tombBlock
,
int32_t
idx
,
STombRecord
*
record
);
int32_t
tTombRecordCompare
(
const
STombRecord
*
record1
,
const
STombRecord
*
record2
);
int32_t
tTombRecordCompare
(
const
STombRecord
*
record1
,
const
STombRecord
*
record2
);
// STbStatis
Block
----------
// STbStatis
Record
----------
#define STATIS_RECORD_NUM_ELEM 7
#define STATIS_RECORD_NUM_ELEM 7
typedef
union
{
typedef
union
{
int64_t
dataArr
[
STATIS_RECORD_NUM_ELEM
];
int64_t
dataArr
[
STATIS_RECORD_NUM_ELEM
];
...
@@ -92,7 +93,7 @@ typedef union {
...
@@ -92,7 +93,7 @@ typedef union {
};
};
}
STbStatisBlock
;
}
STbStatisBlock
;
typedef
struct
SStatisBlk
{
typedef
struct
{
int32_t
numRec
;
int32_t
numRec
;
int32_t
size
[
STATIS_RECORD_NUM_ELEM
];
int32_t
size
[
STATIS_RECORD_NUM_ELEM
];
TABLEID
minTbid
;
TABLEID
minTbid
;
...
@@ -108,6 +109,70 @@ int32_t tStatisBlockInit(STbStatisBlock *statisBlock);
...
@@ -108,6 +109,70 @@ int32_t tStatisBlockInit(STbStatisBlock *statisBlock);
int32_t
tStatisBlockDestroy
(
STbStatisBlock
*
statisBlock
);
int32_t
tStatisBlockDestroy
(
STbStatisBlock
*
statisBlock
);
int32_t
tStatisBlockClear
(
STbStatisBlock
*
statisBlock
);
int32_t
tStatisBlockClear
(
STbStatisBlock
*
statisBlock
);
int32_t
tStatisBlockPut
(
STbStatisBlock
*
statisBlock
,
const
STbStatisRecord
*
record
);
int32_t
tStatisBlockPut
(
STbStatisBlock
*
statisBlock
,
const
STbStatisRecord
*
record
);
int32_t
tStatisBlockGet
(
STbStatisBlock
*
statisBlock
,
int32_t
idx
,
STbStatisRecord
*
record
);
// SBrinRecord ----------
typedef
union
{
struct
{
int64_t
dataArr1
[
10
];
int32_t
dataArr2
[
5
];
};
struct
{
int64_t
suid
;
int64_t
uid
;
int64_t
firstKey
;
int64_t
firstKeyVer
;
int64_t
lastKey
;
int64_t
lastKeyVer
;
int64_t
minVer
;
int64_t
maxVer
;
int64_t
blockOffset
;
int64_t
smaOffset
;
int32_t
blockSize
;
int32_t
blockKeySize
;
int32_t
smaSize
;
int32_t
numRow
;
int32_t
count
;
};
}
SBrinRecord
;
typedef
union
{
struct
{
TARRAY2
(
int64_t
)
dataArr1
[
10
];
TARRAY2
(
int32_t
)
dataArr2
[
5
];
};
struct
{
TARRAY2
(
int64_t
)
suid
[
1
];
TARRAY2
(
int64_t
)
uid
[
1
];
TARRAY2
(
int64_t
)
firstKey
[
1
];
TARRAY2
(
int64_t
)
firstKeyVer
[
1
];
TARRAY2
(
int64_t
)
lastKey
[
1
];
TARRAY2
(
int64_t
)
lastKeyVer
[
1
];
TARRAY2
(
int64_t
)
minVer
[
1
];
TARRAY2
(
int64_t
)
maxVer
[
1
];
TARRAY2
(
int64_t
)
blockOffset
[
1
];
TARRAY2
(
int64_t
)
smaOffset
[
1
];
TARRAY2
(
int32_t
)
blockSize
[
1
];
TARRAY2
(
int32_t
)
blockKeySize
[
1
];
TARRAY2
(
int32_t
)
smaSize
[
1
];
TARRAY2
(
int32_t
)
numRow
[
1
];
TARRAY2
(
int32_t
)
count
[
1
];
};
}
SBrinBlock
;
typedef
struct
{
TABLEID
minTbid
;
TABLEID
maxTbid
;
SFDataPtr
dp
[
1
];
}
SBrinBlk
;
#define BRIN_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
int32_t
tBrinBlockInit
(
SBrinBlock
*
brinBlock
);
int32_t
tBrinBlockDestroy
(
SBrinBlock
*
brinBlock
);
int32_t
tBrinBlockClear
(
SBrinBlock
*
brinBlock
);
int32_t
tBrinBlockPut
(
SBrinBlock
*
brinBlock
,
const
SBrinRecord
*
record
);
int32_t
tBrinBlockGet
(
SBrinBlock
*
brinBlock
,
int32_t
idx
,
SBrinRecord
*
record
);
// other apis
// other apis
int32_t
tsdbUpdateSkmTb
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
SSkmInfo
*
pSkmTb
);
int32_t
tsdbUpdateSkmTb
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
SSkmInfo
*
pSkmTb
);
...
...
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
浏览文件 @
685c0e55
...
@@ -46,6 +46,14 @@ int32_t tTombBlockPut(STombBlock *tombBlock, const STombRecord *record) {
...
@@ -46,6 +46,14 @@ int32_t tTombBlockPut(STombBlock *tombBlock, const STombRecord *record) {
return
0
;
return
0
;
}
}
int32_t
tTombBlockGet
(
STombBlock
*
tombBlock
,
int32_t
idx
,
STombRecord
*
record
)
{
if
(
idx
>=
TOMB_BLOCK_SIZE
(
tombBlock
))
return
TSDB_CODE_OUT_OF_RANGE
;
for
(
int32_t
i
=
0
;
i
<
TOMB_RECORD_ELEM_NUM
;
++
i
)
{
record
->
dataArr
[
i
]
=
TARRAY2_GET
(
&
tombBlock
->
dataArr
[
i
],
idx
);
}
return
0
;
}
int32_t
tTombRecordCompare
(
const
STombRecord
*
r1
,
const
STombRecord
*
r2
)
{
int32_t
tTombRecordCompare
(
const
STombRecord
*
r1
,
const
STombRecord
*
r2
)
{
if
(
r1
->
suid
<
r2
->
suid
)
return
-
1
;
if
(
r1
->
suid
<
r2
->
suid
)
return
-
1
;
if
(
r1
->
suid
>
r2
->
suid
)
return
1
;
if
(
r1
->
suid
>
r2
->
suid
)
return
1
;
...
@@ -87,6 +95,69 @@ int32_t tStatisBlockPut(STbStatisBlock *statisBlock, const STbStatisRecord *reco
...
@@ -87,6 +95,69 @@ int32_t tStatisBlockPut(STbStatisBlock *statisBlock, const STbStatisRecord *reco
return
0
;
return
0
;
}
}
int32_t
tStatisBlockGet
(
STbStatisBlock
*
statisBlock
,
int32_t
idx
,
STbStatisRecord
*
record
)
{
if
(
idx
>=
STATIS_BLOCK_SIZE
(
statisBlock
))
return
TSDB_CODE_OUT_OF_RANGE
;
for
(
int32_t
i
=
0
;
i
<
STATIS_RECORD_NUM_ELEM
;
++
i
)
{
record
->
dataArr
[
i
]
=
TARRAY2_GET
(
&
statisBlock
->
dataArr
[
i
],
idx
);
}
return
0
;
}
// SBrinRecord ----------
int32_t
tBrinBlockInit
(
SBrinBlock
*
brinBlock
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr1
);
++
i
)
{
TARRAY2_INIT
(
&
brinBlock
->
dataArr1
[
i
]);
}
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr2
);
++
i
)
{
TARRAY2_INIT
(
&
brinBlock
->
dataArr2
[
i
]);
}
return
0
;
}
int32_t
tBrinBlockDestroy
(
SBrinBlock
*
brinBlock
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr1
);
++
i
)
{
TARRAY2_DESTROY
(
&
brinBlock
->
dataArr1
[
i
],
NULL
);
}
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr2
);
++
i
)
{
TARRAY2_DESTROY
(
&
brinBlock
->
dataArr2
[
i
],
NULL
);
}
return
0
;
}
int32_t
tBrinBlockClear
(
SBrinBlock
*
brinBlock
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr1
);
++
i
)
{
TARRAY2_CLEAR
(
&
brinBlock
->
dataArr1
[
i
],
NULL
);
}
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr2
);
++
i
)
{
TARRAY2_CLEAR
(
&
brinBlock
->
dataArr2
[
i
],
NULL
);
}
return
0
;
}
int32_t
tBrinBlockPut
(
SBrinBlock
*
brinBlock
,
const
SBrinRecord
*
record
)
{
int32_t
code
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr1
);
++
i
)
{
code
=
TARRAY2_APPEND
(
&
brinBlock
->
dataArr1
[
i
],
record
->
dataArr1
[
i
]);
if
(
code
)
return
code
;
}
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr2
);
++
i
)
{
code
=
TARRAY2_APPEND
(
&
brinBlock
->
dataArr2
[
i
],
record
->
dataArr2
[
i
]);
if
(
code
)
return
code
;
}
return
0
;
}
int32_t
tBrinBlockGet
(
SBrinBlock
*
brinBlock
,
int32_t
idx
,
SBrinRecord
*
record
)
{
if
(
idx
>=
BRIN_BLOCK_SIZE
(
brinBlock
))
return
TSDB_CODE_OUT_OF_RANGE
;
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr1
);
++
i
)
{
record
->
dataArr1
[
i
]
=
TARRAY2_GET
(
&
brinBlock
->
dataArr1
[
i
],
idx
);
}
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
brinBlock
->
dataArr2
);
++
i
)
{
record
->
dataArr2
[
i
]
=
TARRAY2_GET
(
&
brinBlock
->
dataArr2
[
i
],
idx
);
}
return
0
;
}
// other apis ----------
// other apis ----------
int32_t
tsdbUpdateSkmTb
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
SSkmInfo
*
pSkmTb
)
{
int32_t
tsdbUpdateSkmTb
(
STsdb
*
pTsdb
,
const
TABLEID
*
tbid
,
SSkmInfo
*
pSkmTb
)
{
if
(
tbid
->
suid
)
{
if
(
tbid
->
suid
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录