Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
99770a1e
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
99770a1e
编写于
12月 24, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enh: assert remove in tpagebuf.c tlosertree.c texception.c
上级
61571975
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
24 deletion
+29
-24
source/util/src/texception.c
source/util/src/texception.c
+7
-6
source/util/src/tlosertree.c
source/util/src/tlosertree.c
+3
-3
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+19
-15
未找到文件。
source/util/src/texception.c
浏览文件 @
99770a1e
...
...
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "texception.h"
#include "tlog.h"
static
threadlocal
SExceptionNode
*
expList
;
...
...
@@ -71,7 +72,7 @@ static wrapper wrappers[] = {
};
void
cleanupPush_void_ptr_ptr
(
bool
failOnly
,
void
*
func
,
void
*
arg1
,
void
*
arg2
)
{
assert
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
);
ASSERTS
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
,
"numCleanupAction over maxCleanupAction"
);
SCleanupAction
*
ca
=
expList
->
cleanupActions
+
expList
->
numCleanupAction
++
;
ca
->
wrapper
=
0
;
...
...
@@ -82,7 +83,7 @@ void cleanupPush_void_ptr_ptr(bool failOnly, void* func, void* arg1, void* arg2)
}
void
cleanupPush_void_ptr_bool
(
bool
failOnly
,
void
*
func
,
void
*
arg1
,
bool
arg2
)
{
assert
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
);
ASSERTS
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
,
"numCleanupAction over maxCleanupAction"
);
SCleanupAction
*
ca
=
expList
->
cleanupActions
+
expList
->
numCleanupAction
++
;
ca
->
wrapper
=
1
;
...
...
@@ -93,7 +94,7 @@ void cleanupPush_void_ptr_bool(bool failOnly, void* func, void* arg1, bool arg2)
}
void
cleanupPush_void_ptr
(
bool
failOnly
,
void
*
func
,
void
*
arg
)
{
assert
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
);
ASSERTS
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
,
"numCleanupAction over maxCleanupAction"
);
SCleanupAction
*
ca
=
expList
->
cleanupActions
+
expList
->
numCleanupAction
++
;
ca
->
wrapper
=
2
;
...
...
@@ -103,7 +104,7 @@ void cleanupPush_void_ptr(bool failOnly, void* func, void* arg) {
}
void
cleanupPush_int_int
(
bool
failOnly
,
void
*
func
,
int32_t
arg
)
{
assert
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
);
ASSERTS
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
,
"numCleanupAction over maxCleanupAction"
);
SCleanupAction
*
ca
=
expList
->
cleanupActions
+
expList
->
numCleanupAction
++
;
ca
->
wrapper
=
3
;
...
...
@@ -113,7 +114,7 @@ void cleanupPush_int_int(bool failOnly, void* func, int32_t arg) {
}
void
cleanupPush_void
(
bool
failOnly
,
void
*
func
)
{
assert
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
);
ASSERTS
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
,
"numCleanupAction over maxCleanupAction"
);
SCleanupAction
*
ca
=
expList
->
cleanupActions
+
expList
->
numCleanupAction
++
;
ca
->
wrapper
=
4
;
...
...
@@ -122,7 +123,7 @@ void cleanupPush_void(bool failOnly, void* func) {
}
void
cleanupPush_int_ptr
(
bool
failOnly
,
void
*
func
,
void
*
arg
)
{
assert
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
);
ASSERTS
(
expList
->
numCleanupAction
<
expList
->
maxCleanupAction
,
"numCleanupAction over maxCleanupAction"
);
SCleanupAction
*
ca
=
expList
->
cleanupActions
+
expList
->
numCleanupAction
++
;
ca
->
wrapper
=
5
;
...
...
source/util/src/tlosertree.c
浏览文件 @
99770a1e
...
...
@@ -20,7 +20,7 @@
// Set the initial value of the multiway merge tree.
static
void
tMergeTreeInit
(
SMultiwayMergeTreeInfo
*
pTree
)
{
assert
((
pTree
->
totalSources
&
0x01
)
==
0
&&
(
pTree
->
numOfSources
<<
1
==
pTree
->
totalSources
));
ASSERT
((
pTree
->
totalSources
&
0x01
)
==
0
&&
(
pTree
->
numOfSources
<<
1
==
pTree
->
totalSources
));
for
(
int32_t
i
=
0
;
i
<
pTree
->
totalSources
;
++
i
)
{
if
(
i
<
pTree
->
numOfSources
)
{
...
...
@@ -80,7 +80,7 @@ void tMergeTreeDestroy(SMultiwayMergeTreeInfo* pTree) {
}
void
tMergeTreeAdjust
(
SMultiwayMergeTreeInfo
*
pTree
,
int32_t
idx
)
{
assert
(
idx
<=
pTree
->
totalSources
-
1
&&
idx
>=
pTree
->
numOfSources
&&
pTree
->
totalSources
>=
2
);
ASSERT
(
idx
<=
pTree
->
totalSources
-
1
&&
idx
>=
pTree
->
numOfSources
&&
pTree
->
totalSources
>=
2
);
if
(
pTree
->
totalSources
==
2
)
{
pTree
->
pNode
[
0
].
index
=
0
;
...
...
@@ -115,7 +115,7 @@ void tMergeTreeAdjust(SMultiwayMergeTreeInfo* pTree, int32_t idx) {
}
void
tMergeTreeRebuild
(
SMultiwayMergeTreeInfo
*
pTree
)
{
assert
((
pTree
->
totalSources
&
0x1
)
==
0
);
ASSERT
((
pTree
->
totalSources
&
0x1
)
==
0
);
tMergeTreeInit
(
pTree
);
for
(
int32_t
i
=
pTree
->
totalSources
-
1
;
i
>=
pTree
->
numOfSources
;
i
--
)
{
...
...
source/util/src/tpagedbuf.c
浏览文件 @
99770a1e
...
...
@@ -125,20 +125,20 @@ static FORCE_INLINE size_t getAllocPageSize(int32_t pageSize) { return pageSize
* @return
*/
static
char
*
doFlushPageToDisk
(
SDiskbasedBuf
*
pBuf
,
SPageInfo
*
pg
)
{
assert
(
!
pg
->
used
&&
pg
->
pData
!=
NULL
);
ASSERT
(
!
pg
->
used
&&
pg
->
pData
!=
NULL
);
int32_t
size
=
pBuf
->
pageSize
;
char
*
t
=
NULL
;
if
(
pg
->
offset
==
-
1
||
pg
->
dirty
)
{
void
*
payload
=
GET_DATA_PAYLOAD
(
pg
);
t
=
doCompressData
(
payload
,
pBuf
->
pageSize
,
&
size
,
pBuf
);
assert
(
size
>=
0
);
ASSERTS
(
size
>=
0
,
"size is negative"
);
}
// this page is flushed to disk for the first time
if
(
pg
->
dirty
)
{
if
(
pg
->
offset
==
-
1
)
{
assert
(
pg
->
dirty
==
true
);
ASSERTS
(
pg
->
dirty
==
true
,
"pg->dirty is false"
);
pg
->
offset
=
allocatePositionInFile
(
pBuf
,
size
);
pBuf
->
nextPos
+=
size
;
...
...
@@ -210,7 +210,7 @@ static char* doFlushPageToDisk(SDiskbasedBuf* pBuf, SPageInfo* pg) {
static
char
*
flushPageToDisk
(
SDiskbasedBuf
*
pBuf
,
SPageInfo
*
pg
)
{
int32_t
ret
=
TSDB_CODE_SUCCESS
;
assert
(((
int64_t
)
pBuf
->
numOfPages
*
pBuf
->
pageSize
)
==
pBuf
->
totalBufSize
&&
pBuf
->
numOfPages
>=
pBuf
->
inMemPages
);
ASSERT
(((
int64_t
)
pBuf
->
numOfPages
*
pBuf
->
pageSize
)
==
pBuf
->
totalBufSize
&&
pBuf
->
numOfPages
>=
pBuf
->
inMemPages
);
if
(
pBuf
->
pFile
==
NULL
)
{
if
((
ret
=
createDiskFile
(
pBuf
))
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -272,7 +272,7 @@ static SListNode* getEldestUnrefedPage(SDiskbasedBuf* pBuf) {
SListNode
*
pn
=
NULL
;
while
((
pn
=
tdListNext
(
&
iter
))
!=
NULL
)
{
SPageInfo
*
pageInfo
=
*
(
SPageInfo
**
)
pn
->
data
;
assert
(
pageInfo
->
pageId
>=
0
&&
pageInfo
->
pn
==
pn
);
ASSERT
(
pageInfo
->
pageId
>=
0
&&
pageInfo
->
pn
==
pn
);
if
(
!
pageInfo
->
used
)
{
// printf("%d is chosen\n", pageInfo->pageId);
...
...
@@ -303,7 +303,7 @@ static char* evacOneDataPage(SDiskbasedBuf* pBuf) {
tdListPopNode
(
pBuf
->
lruList
,
pn
);
SPageInfo
*
d
=
*
(
SPageInfo
**
)
pn
->
data
;
assert
(
d
->
pn
==
pn
);
ASSERT
(
d
->
pn
==
pn
,
"d->pn not equal pn"
);
d
->
pn
=
NULL
;
taosMemoryFreeClear
(
pn
);
...
...
@@ -353,7 +353,7 @@ int32_t createDiskbasedBuf(SDiskbasedBuf** pBuf, int32_t pagesize, int32_t inMem
pPBuf
->
freePgList
=
tdListNew
(
POINTER_BYTES
);
// at least more than 2 pages must be in memory
assert
(
inMemBufSize
>=
pagesize
*
2
);
ASSERT
(
inMemBufSize
>=
pagesize
*
2
);
pPBuf
->
lruList
=
tdListNew
(
POINTER_BYTES
);
...
...
@@ -402,7 +402,7 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t* pageId) {
}
// add to LRU list
assert
(
listNEles
(
pBuf
->
lruList
)
<
pBuf
->
inMemPages
&&
pBuf
->
inMemPages
>
0
);
ASSERT
(
listNEles
(
pBuf
->
lruList
)
<
pBuf
->
inMemPages
&&
pBuf
->
inMemPages
>
0
);
lruListPushFront
(
pBuf
->
lruList
,
pi
);
// allocate buf
...
...
@@ -421,11 +421,11 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t* pageId) {
}
void
*
getBufPage
(
SDiskbasedBuf
*
pBuf
,
int32_t
id
)
{
assert
(
pBuf
!=
NULL
&&
id
>=
0
);
ASSERT
(
pBuf
!=
NULL
&&
id
>=
0
);
pBuf
->
statis
.
getPages
+=
1
;
SPageInfo
**
pi
=
taosHashGet
(
pBuf
->
all
,
&
id
,
sizeof
(
int32_t
));
assert
(
pi
!=
NULL
&&
*
pi
!=
NULL
);
ASSERT
(
pi
!=
NULL
&&
*
pi
!=
NULL
);
if
((
*
pi
)
->
pData
!=
NULL
)
{
// it is in memory
// no need to update the LRU list if only one page exists
...
...
@@ -435,7 +435,7 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
}
SPageInfo
**
pInfo
=
(
SPageInfo
**
)((
*
pi
)
->
pn
->
data
);
assert
(
*
pInfo
==
*
pi
);
ASSERT
(
*
pInfo
==
*
pi
);
lruListMoveToFront
(
pBuf
->
lruList
,
(
*
pi
));
(
*
pi
)
->
used
=
true
;
...
...
@@ -444,7 +444,7 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
#endif
return
(
void
*
)(
GET_DATA_PAYLOAD
(
*
pi
));
}
else
{
// not in memory
assert
((
*
pi
)
->
pData
==
NULL
&&
(
*
pi
)
->
pn
==
NULL
&&
ASSERT
((
*
pi
)
->
pData
==
NULL
&&
(
*
pi
)
->
pn
==
NULL
&&
(((
*
pi
)
->
length
>=
0
&&
(
*
pi
)
->
offset
>=
0
)
||
((
*
pi
)
->
length
==
-
1
&&
(
*
pi
)
->
offset
==
-
1
)));
char
*
availablePage
=
NULL
;
...
...
@@ -482,7 +482,9 @@ void* getBufPage(SDiskbasedBuf* pBuf, int32_t id) {
}
void
releaseBufPage
(
SDiskbasedBuf
*
pBuf
,
void
*
page
)
{
assert
(
pBuf
!=
NULL
&&
page
!=
NULL
);
if
(
ASSERTS
(
pBuf
==
NULL
||
page
==
NULL
,
"pBuf or page is NULL"
))
{
return
;
}
SPageInfo
*
ppi
=
getPageInfoFromPayload
(
page
);
releaseBufPageInfo
(
pBuf
,
ppi
);
}
...
...
@@ -491,8 +493,10 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) {
#ifdef BUF_PAGE_DEBUG
uDebug
(
"page_releaseBufPageInfo pageId:%d, used:%d, offset:%"
PRId64
,
pi
->
pageId
,
pi
->
used
,
pi
->
offset
);
#endif
// assert(pi->pData != NULL && pi->used == true);
assert
(
pi
->
pData
!=
NULL
);
if
(
ASSERTS
(
pi
->
pData
==
NULL
,
"pi->pData is NULL"
))
{
return
;
}
pi
->
used
=
false
;
pBuf
->
statis
.
releasePages
+=
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录