Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2f5f0b75
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看板
提交
2f5f0b75
编写于
6月 08, 2023
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refact code
上级
91c8391b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
76 addition
and
84 deletion
+76
-84
include/util/tarray2.h
include/util/tarray2.h
+8
-14
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
+13
-15
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
+2
-2
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
+11
-11
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
+4
-4
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
+4
-4
source/dnode/vnode/src/tsdb/dev/tsdbIter.c
source/dnode/vnode/src/tsdb/dev/tsdbIter.c
+6
-6
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
+3
-3
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
+10
-10
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
+15
-15
未找到文件。
include/util/tarray2.h
浏览文件 @
2f5f0b75
...
...
@@ -75,16 +75,6 @@ static FORCE_INLINE int32_t tarray2_make_room( //
#define TARRAY2_INIT(a) TARRAY2_INIT_EX(a, 0, 0, NULL)
#define TARRAY2_INITIALIZER \
{ 0, 0, NULL }
#define TARRAY2_FREE(a) \
do { \
if ((a)->data) { \
taosMemoryFree((a)->data); \
} \
} while (0)
#define TARRAY2_CLEAR(a, cb) \
do { \
if ((cb) && (a)->size > 0) { \
...
...
@@ -96,10 +86,14 @@ static FORCE_INLINE int32_t tarray2_make_room( //
(a)->size = 0; \
} while (0)
#define TARRAY2_CLEAR_FREE(a, cb) \
do { \
TARRAY2_CLEAR(a, cb); \
TARRAY2_FREE(a); \
#define TARRAY2_DESTROY(a, cb) \
do { \
TARRAY2_CLEAR(a, cb); \
if ((a)->data) { \
taosMemoryFree((a)->data); \
(a)->data = NULL; \
} \
(a)->capacity = 0; \
} while (0)
#define TARRAY2_INSERT(a, idx, e) \
...
...
source/dnode/vnode/src/tsdb/dev/inc/tsdbUtil.h
浏览文件 @
2f5f0b75
...
...
@@ -22,11 +22,10 @@
extern
"C"
{
#endif
// SDelBlock ----------
#define TOMB_RECORD_NUM_ELEM 5
// STombRecord ----------
#define TOMB_RECORD_ELEM_NUM 5
typedef
union
{
int64_t
aData
[
TOMB_RECORD_NUM_ELE
M
];
int64_t
dataArr
[
TOMB_RECORD_ELEM_NU
M
];
struct
{
int64_t
suid
;
int64_t
uid
;
...
...
@@ -37,7 +36,7 @@ typedef union {
}
STombRecord
;
typedef
union
{
TARRAY2
(
int64_t
)
dataArr
[
TOMB_RECORD_
NUM_ELE
M
];
TARRAY2
(
int64_t
)
dataArr
[
TOMB_RECORD_
ELEM_NU
M
];
struct
{
TARRAY2
(
int64_t
)
suid
[
1
];
TARRAY2
(
int64_t
)
uid
[
1
];
...
...
@@ -49,9 +48,9 @@ typedef union {
typedef
struct
{
int32_t
numRec
;
int32_t
size
[
TOMB_RECORD_
NUM_ELE
M
];
TABLEID
minTid
;
TABLEID
maxTid
;
int32_t
size
[
TOMB_RECORD_
ELEM_NU
M
];
TABLEID
minT
b
id
;
TABLEID
maxT
b
id
;
int64_t
minVer
;
int64_t
maxVer
;
SFDataPtr
dp
[
1
];
...
...
@@ -59,17 +58,16 @@ typedef struct {
#define TOMB_BLOCK_SIZE(db) TARRAY2_SIZE((db)->suid)
int32_t
tTombBlockInit
(
STombBlock
*
delBlock
);
int32_t
tTombBlockFree
(
STombBlock
*
delBlock
);
int32_t
tTombBlockClear
(
STombBlock
*
delBlock
);
int32_t
tTombBlockPut
(
STombBlock
*
delBlock
,
const
STombRecord
*
delRecord
);
int32_t
tTombRecordCmpr
(
const
STombRecord
*
r1
,
const
STombRecord
*
r2
);
int32_t
tTombBlockInit
(
STombBlock
*
tombBlock
);
int32_t
tTombBlockDestroy
(
STombBlock
*
tombBlock
);
int32_t
tTombBlockClear
(
STombBlock
*
tombBlock
);
int32_t
tTombBlockPut
(
STombBlock
*
tombBlock
,
const
STombRecord
*
record
);
int32_t
tTombRecordCompare
(
const
STombRecord
*
record1
,
const
STombRecord
*
record2
);
// STbStatisBlock ----------
#define STATIS_RECORD_NUM_ELEM 9
typedef
union
{
int64_t
aData
[
STATIS_RECORD_NUM_ELEM
];
int64_t
dataArr
[
STATIS_RECORD_NUM_ELEM
];
struct
{
int64_t
suid
;
int64_t
uid
;
...
...
source/dnode/vnode/src/tsdb/dev/tsdbCommit.c
浏览文件 @
2f5f0b75
...
...
@@ -417,8 +417,8 @@ static int32_t tsdbCloseCommitter(SCommitter2 *committer, int32_t eno) {
ASSERT
(
committer
->
dataWriter
==
NULL
);
ASSERT
(
committer
->
sttWriter
==
NULL
);
ASSERT
(
committer
->
iterMerger
==
NULL
);
TARRAY2_
FREE
(
committer
->
iterArray
);
TARRAY2_
FREE
(
committer
->
fopArray
);
TARRAY2_
DESTROY
(
committer
->
iterArray
,
NULL
);
TARRAY2_
DESTROY
(
committer
->
fopArray
,
NULL
);
tsdbFSDestroyCopySnapshot
(
&
committer
->
fsetArr
);
_exit:
...
...
source/dnode/vnode/src/tsdb/dev/tsdbDataFileRW.c
浏览文件 @
2f5f0b75
...
...
@@ -135,8 +135,8 @@ _exit:
int32_t
tsdbDataFileReaderClose
(
SDataFileReader
**
reader
)
{
if
(
reader
[
0
]
==
NULL
)
return
0
;
TARRAY2_
FREE
(
reader
[
0
]
->
dataBlkArray
);
TARRAY2_
FREE
(
reader
[
0
]
->
blockIdxArray
);
TARRAY2_
DESTROY
(
reader
[
0
]
->
dataBlkArray
,
NULL
);
TARRAY2_
DESTROY
(
reader
[
0
]
->
blockIdxArray
,
NULL
);
for
(
int32_t
i
=
0
;
i
<
TSDB_FTYPE_MAX
;
++
i
)
{
tsdbCloseFile
(
&
reader
[
0
]
->
fd
[
i
]);
...
...
@@ -389,13 +389,13 @@ static int32_t tsdbDataFileWriterDoClose(SDataFileWriter *writer) {
tsdbDataFileReaderClose
(
&
writer
->
ctx
->
reader
);
}
tTombBlock
Free
(
writer
->
tData
);
tTombBlock
Destroy
(
writer
->
tData
);
tStatisBlockFree
(
writer
->
sData
);
tBlockDataDestroy
(
writer
->
bData
);
TARRAY2_
FREE
(
writer
->
tombBlkArray
);
TARRAY2_
FREE
(
writer
->
dataBlkArray
);
TARRAY2_
FREE
(
writer
->
blockIdxArray
);
tTombBlock
Free
(
writer
->
ctx
->
tData
);
TARRAY2_
DESTROY
(
writer
->
tombBlkArray
,
NULL
);
TARRAY2_
DESTROY
(
writer
->
dataBlkArray
,
NULL
);
TARRAY2_
DESTROY
(
writer
->
blockIdxArray
,
NULL
);
tTombBlock
Destroy
(
writer
->
ctx
->
tData
);
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
writer
->
bufArr
);
++
i
)
{
tFree
(
writer
->
bufArr
[
i
]);
...
...
@@ -587,7 +587,7 @@ static int32_t tsdbDataFileWriteDataBlock(SDataFileWriter *writer, SBlockData *b
writer
->
files
[
TSDB_FTYPE_SMA
].
size
+=
dataBlk
->
smaInfo
.
size
;
}
TARRAY2_
FREE
(
smaArr
);
TARRAY2_
DESTROY
(
smaArr
,
NULL
);
// to dataBlkArray
code
=
TARRAY2_APPEND_PTR
(
writer
->
dataBlkArray
,
dataBlk
);
...
...
@@ -857,12 +857,12 @@ static int32_t tsdbDataFileDoWriteTombBlock(SDataFileWriter *writer) {
STombBlk
tombBlk
[
1
]
=
{{
.
numRec
=
TOMB_BLOCK_SIZE
(
writer
->
tData
),
.
minTid
=
.
minT
b
id
=
{
.
suid
=
TARRAY2_FIRST
(
writer
->
tData
->
suid
),
.
uid
=
TARRAY2_FIRST
(
writer
->
tData
->
uid
),
},
.
maxTid
=
.
maxT
b
id
=
{
.
suid
=
TARRAY2_LAST
(
writer
->
tData
->
suid
),
.
uid
=
TARRAY2_LAST
(
writer
->
tData
->
uid
),
...
...
@@ -961,7 +961,7 @@ static int32_t tsdbDataFileDoWriteTombRecord(SDataFileWriter *writer, const STom
.
ekey
=
TARRAY2_GET
(
writer
->
ctx
->
tData
->
ekey
,
writer
->
ctx
->
iRowTomb
),
}};
int32_t
c
=
tTombRecordC
mpr
(
record
,
record1
);
int32_t
c
=
tTombRecordC
ompare
(
record
,
record1
);
if
(
c
<
0
)
{
break
;
}
else
if
(
c
>
0
)
{
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFS.c
浏览文件 @
2f5f0b75
...
...
@@ -56,8 +56,8 @@ static int32_t create_fs(STsdb *pTsdb, STFileSystem **fs) {
static
int32_t
destroy_fs
(
STFileSystem
**
fs
)
{
if
(
fs
[
0
]
==
NULL
)
return
0
;
TARRAY2_
FREE
(
fs
[
0
]
->
fSetArr
);
TARRAY2_
FREE
(
fs
[
0
]
->
fSetArrTmp
);
TARRAY2_
DESTROY
(
fs
[
0
]
->
fSetArr
,
NULL
);
TARRAY2_
DESTROY
(
fs
[
0
]
->
fSetArrTmp
,
NULL
);
tsem_destroy
(
&
fs
[
0
]
->
canEdit
);
taosMemoryFree
(
fs
[
0
]);
fs
[
0
]
=
NULL
;
...
...
@@ -664,7 +664,7 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
taosThreadRwlockUnlock
(
&
fs
->
tsdb
->
rwLock
);
if
(
code
)
{
TARRAY2_
CLEAR_FREE
(
fsetArr
[
0
],
tsdbTFileSetClear
);
TARRAY2_
DESTROY
(
fsetArr
[
0
],
tsdbTFileSetClear
);
taosMemoryFree
(
fsetArr
[
0
]);
fsetArr
[
0
]
=
NULL
;
}
...
...
@@ -673,7 +673,7 @@ int32_t tsdbFSCreateCopySnapshot(STFileSystem *fs, TFileSetArray **fsetArr) {
int32_t
tsdbFSDestroyCopySnapshot
(
TFileSetArray
**
fsetArr
)
{
if
(
fsetArr
[
0
])
{
TARRAY2_
CLEAR_FREE
(
fsetArr
[
0
],
tsdbTFileSetClear
);
TARRAY2_
DESTROY
(
fsetArr
[
0
],
tsdbTFileSetClear
);
fsetArr
[
0
]
=
NULL
;
}
return
0
;
...
...
source/dnode/vnode/src/tsdb/dev/tsdbFSet.c
浏览文件 @
2f5f0b75
...
...
@@ -24,7 +24,7 @@ static int32_t tsdbSttLvlInit(int32_t level, SSttLvl **lvl) {
static
void
tsdbSttLvlClearFObj
(
void
*
data
)
{
tsdbTFileObjUnref
(
*
(
STFileObj
**
)
data
);
}
static
int32_t
tsdbSttLvlClear
(
SSttLvl
**
lvl
)
{
TARRAY2_
CLEAR_FREE
(
lvl
[
0
]
->
fobjArr
,
tsdbSttLvlClearFObj
);
TARRAY2_
DESTROY
(
lvl
[
0
]
->
fobjArr
,
tsdbSttLvlClearFObj
);
taosMemoryFree
(
lvl
[
0
]);
lvl
[
0
]
=
NULL
;
return
0
;
...
...
@@ -50,7 +50,7 @@ static int32_t tsdbSttLvlInitEx(STsdb *pTsdb, const SSttLvl *lvl1, SSttLvl **lvl
static
void
tsdbSttLvlRemoveFObj
(
void
*
data
)
{
tsdbTFileObjRemove
(
*
(
STFileObj
**
)
data
);
}
static
void
tsdbSttLvlRemove
(
SSttLvl
**
lvl
)
{
TARRAY2_
CLEAR_FREE
(
lvl
[
0
]
->
fobjArr
,
tsdbSttLvlRemoveFObj
);
TARRAY2_
DESTROY
(
lvl
[
0
]
->
fobjArr
,
tsdbSttLvlRemoveFObj
);
taosMemoryFree
(
lvl
[
0
]);
lvl
[
0
]
=
NULL
;
}
...
...
@@ -443,7 +443,7 @@ int32_t tsdbTFileSetClear(STFileSet **fset) {
tsdbTFileObjUnref
(
fset
[
0
]
->
farr
[
ftype
]);
}
TARRAY2_
CLEAR_FREE
(
fset
[
0
]
->
lvlArr
,
tsdbSttLvlClear
);
TARRAY2_
DESTROY
(
fset
[
0
]
->
lvlArr
,
tsdbSttLvlClear
);
taosMemoryFree
(
fset
[
0
]);
fset
[
0
]
=
NULL
;
...
...
@@ -457,7 +457,7 @@ int32_t tsdbTFileSetRemove(STFileSet **fset) {
tsdbTFileObjRemove
(
fset
[
0
]
->
farr
[
ftype
]);
}
TARRAY2_
CLEAR_FREE
(
fset
[
0
]
->
lvlArr
,
tsdbSttLvlRemove
);
TARRAY2_
DESTROY
(
fset
[
0
]
->
lvlArr
,
tsdbSttLvlRemove
);
taosMemoryFree
(
fset
[
0
]);
fset
[
0
]
=
NULL
;
return
0
;
...
...
source/dnode/vnode/src/tsdb/dev/tsdbIter.c
浏览文件 @
2f5f0b75
...
...
@@ -246,8 +246,8 @@ static int32_t tsdbDataTombIterNext(STsdbIter *iter, const TABLEID *tbid) {
iter
->
dataTomb
->
tombBlkArrayIdx
++
)
{
const
STombBlk
*
tombBlk
=
TARRAY2_GET_PTR
(
iter
->
dataTomb
->
tombBlkArray
,
iter
->
dataTomb
->
tombBlkArrayIdx
);
if
(
tbid
&&
tbid
->
suid
==
tombBlk
->
minT
id
.
suid
&&
tbid
->
uid
==
tombBlk
->
minT
id
.
uid
&&
tbid
->
suid
==
tombBlk
->
maxT
id
.
suid
&&
tbid
->
uid
==
tombBlk
->
maxT
id
.
uid
)
{
if
(
tbid
&&
tbid
->
suid
==
tombBlk
->
minT
bid
.
suid
&&
tbid
->
uid
==
tombBlk
->
minTb
id
.
uid
&&
tbid
->
suid
==
tombBlk
->
maxT
bid
.
suid
&&
tbid
->
uid
==
tombBlk
->
maxTb
id
.
uid
)
{
continue
;
}
...
...
@@ -372,8 +372,8 @@ static int32_t tsdbSttTombIterNext(STsdbIter *iter, const TABLEID *tbid) {
iter
->
sttTomb
->
tombBlkArrayIdx
++
)
{
const
STombBlk
*
tombBlk
=
TARRAY2_GET_PTR
(
iter
->
sttTomb
->
tombBlkArray
,
iter
->
sttTomb
->
tombBlkArrayIdx
);
if
(
tbid
&&
tbid
->
suid
==
tombBlk
->
minT
id
.
suid
&&
tbid
->
uid
==
tombBlk
->
minT
id
.
uid
&&
tbid
->
suid
==
tombBlk
->
maxT
id
.
suid
&&
tbid
->
uid
==
tombBlk
->
maxT
id
.
uid
)
{
if
(
tbid
&&
tbid
->
suid
==
tombBlk
->
minT
bid
.
suid
&&
tbid
->
uid
==
tombBlk
->
minTb
id
.
uid
&&
tbid
->
suid
==
tombBlk
->
maxT
bid
.
suid
&&
tbid
->
uid
==
tombBlk
->
maxTb
id
.
uid
)
{
continue
;
}
...
...
@@ -453,12 +453,12 @@ int32_t tsdbIterOpen(const STsdbIterConfig *config, STsdbIter **iter) {
}
static
int32_t
tsdbSttTombIterClose
(
STsdbIter
*
iter
)
{
tTombBlock
Free
(
iter
->
sttTomb
->
tData
);
tTombBlock
Destroy
(
iter
->
sttTomb
->
tData
);
return
0
;
}
static
int32_t
tsdbDataTombIterClose
(
STsdbIter
*
iter
)
{
tTombBlock
Free
(
iter
->
dataTomb
->
tData
);
tTombBlock
Destroy
(
iter
->
dataTomb
->
tData
);
return
0
;
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbMerge.c
浏览文件 @
2f5f0b75
...
...
@@ -93,9 +93,9 @@ static int32_t tsdbMergerClose(SMerger *merger) {
ASSERT
(
TARRAY2_SIZE
(
merger
->
sttReaderArr
)
==
0
);
// clear the merge
TARRAY2_
FREE
(
merger
->
dataIterArr
);
TARRAY2_
FREE
(
merger
->
sttReaderArr
);
TARRAY2_
FREE
(
merger
->
fopArr
);
TARRAY2_
DESTROY
(
merger
->
dataIterArr
,
NULL
);
TARRAY2_
DESTROY
(
merger
->
sttReaderArr
,
NULL
);
TARRAY2_
DESTROY
(
merger
->
fopArr
,
NULL
);
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
merger
->
ctx
->
bData
);
i
++
)
{
tBlockDataDestroy
(
merger
->
ctx
->
bData
+
i
);
}
...
...
source/dnode/vnode/src/tsdb/dev/tsdbSttFileRW.c
浏览文件 @
2f5f0b75
...
...
@@ -69,9 +69,9 @@ _exit:
static
int32_t
tsdbSttSegReaderClose
(
SSttSegReader
**
reader
)
{
if
(
reader
[
0
])
{
TARRAY2_
FREE
(
reader
[
0
]
->
sttBlkArray
);
TARRAY2_
FREE
(
reader
[
0
]
->
tombBlkArray
);
TARRAY2_
FREE
(
reader
[
0
]
->
statisBlkArray
);
TARRAY2_
DESTROY
(
reader
[
0
]
->
sttBlkArray
,
NULL
);
TARRAY2_
DESTROY
(
reader
[
0
]
->
tombBlkArray
,
NULL
);
TARRAY2_
DESTROY
(
reader
[
0
]
->
statisBlkArray
,
NULL
);
taosMemoryFree
(
reader
[
0
]);
reader
[
0
]
=
NULL
;
}
...
...
@@ -122,7 +122,7 @@ int32_t tsdbSttFileReaderClose(SSttFileReader **reader) {
tFree
(
reader
[
0
]
->
bufArr
[
i
]);
}
tsdbCloseFile
(
&
reader
[
0
]
->
fd
);
TARRAY2_
CLEAR_FREE
(
reader
[
0
]
->
readerArray
,
tsdbSttSegReaderClose
);
TARRAY2_
DESTROY
(
reader
[
0
]
->
readerArray
,
tsdbSttSegReaderClose
);
taosMemoryFree
(
reader
[
0
]);
reader
[
0
]
=
NULL
;
}
...
...
@@ -454,12 +454,12 @@ static int32_t tsdbSttFileDoWriteTombBlock(SSttFileWriter *writer) {
STombBlk
tombBlk
[
1
]
=
{{
.
numRec
=
TOMB_BLOCK_SIZE
(
writer
->
tData
),
.
minTid
=
.
minT
b
id
=
{
.
suid
=
TARRAY2_FIRST
(
writer
->
tData
->
suid
),
.
uid
=
TARRAY2_FIRST
(
writer
->
tData
->
uid
),
},
.
maxTid
=
.
maxT
b
id
=
{
.
suid
=
TARRAY2_LAST
(
writer
->
tData
->
suid
),
.
uid
=
TARRAY2_LAST
(
writer
->
tData
->
uid
),
...
...
@@ -625,12 +625,12 @@ static void tsdbSttFWriterDoClose(SSttFileWriter *writer) {
}
tDestroyTSchema
(
writer
->
skmRow
->
pTSchema
);
tDestroyTSchema
(
writer
->
skmTb
->
pTSchema
);
tTombBlock
Free
(
writer
->
tData
);
tTombBlock
Destroy
(
writer
->
tData
);
tStatisBlockFree
(
writer
->
sData
);
tBlockDataDestroy
(
writer
->
bData
);
TARRAY2_
FREE
(
writer
->
tombBlkArray
);
TARRAY2_
FREE
(
writer
->
statisBlkArray
);
TARRAY2_
FREE
(
writer
->
sttBlkArray
);
TARRAY2_
DESTROY
(
writer
->
tombBlkArray
,
NULL
);
TARRAY2_
DESTROY
(
writer
->
statisBlkArray
,
NULL
);
TARRAY2_
DESTROY
(
writer
->
sttBlkArray
,
NULL
);
}
static
int32_t
tsdbSttFileDoUpdateHeader
(
SSttFileWriter
*
writer
)
{
...
...
source/dnode/vnode/src/tsdb/dev/tsdbUtil.c
浏览文件 @
2f5f0b75
...
...
@@ -16,36 +16,36 @@
#include "dev.h"
// SDelBlock ----------
int32_t
tTombBlockInit
(
STombBlock
*
del
Block
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
delBlock
->
dataArr
)
;
++
i
)
{
TARRAY2_INIT
(
&
del
Block
->
dataArr
[
i
]);
int32_t
tTombBlockInit
(
STombBlock
*
tomb
Block
)
{
for
(
int32_t
i
=
0
;
i
<
TOMB_RECORD_ELEM_NUM
;
++
i
)
{
TARRAY2_INIT
(
&
tomb
Block
->
dataArr
[
i
]);
}
return
0
;
}
int32_t
tTombBlock
Free
(
STombBlock
*
del
Block
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
delBlock
->
dataArr
)
;
++
i
)
{
TARRAY2_
FREE
(
&
delBlock
->
dataArr
[
i
]
);
int32_t
tTombBlock
Destroy
(
STombBlock
*
tomb
Block
)
{
for
(
int32_t
i
=
0
;
i
<
TOMB_RECORD_ELEM_NUM
;
++
i
)
{
TARRAY2_
DESTROY
(
&
tombBlock
->
dataArr
[
i
],
NULL
);
}
return
0
;
}
int32_t
tTombBlockClear
(
STombBlock
*
del
Block
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
delBlock
->
dataArr
)
;
++
i
)
{
TARRAY2_CLEAR
(
&
del
Block
->
dataArr
[
i
],
NULL
);
int32_t
tTombBlockClear
(
STombBlock
*
tomb
Block
)
{
for
(
int32_t
i
=
0
;
i
<
TOMB_RECORD_ELEM_NUM
;
++
i
)
{
TARRAY2_CLEAR
(
&
tomb
Block
->
dataArr
[
i
],
NULL
);
}
return
0
;
}
int32_t
tTombBlockPut
(
STombBlock
*
delBlock
,
const
STombRecord
*
delR
ecord
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
delBlock
->
dataArr
)
;
++
i
)
{
int32_t
code
=
TARRAY2_APPEND
(
&
delBlock
->
dataArr
[
i
],
delRecord
->
aData
[
i
]);
int32_t
tTombBlockPut
(
STombBlock
*
tombBlock
,
const
STombRecord
*
r
ecord
)
{
for
(
int32_t
i
=
0
;
i
<
TOMB_RECORD_ELEM_NUM
;
++
i
)
{
int32_t
code
=
TARRAY2_APPEND
(
&
tombBlock
->
dataArr
[
i
],
record
->
dataArr
[
i
]);
if
(
code
)
return
code
;
}
return
0
;
}
int32_t
tTombRecordC
mpr
(
const
STombRecord
*
r1
,
const
STombRecord
*
r2
)
{
int32_t
tTombRecordC
ompare
(
const
STombRecord
*
r1
,
const
STombRecord
*
r2
)
{
if
(
r1
->
suid
<
r2
->
suid
)
return
-
1
;
if
(
r1
->
suid
>
r2
->
suid
)
return
1
;
if
(
r1
->
uid
<
r2
->
uid
)
return
-
1
;
...
...
@@ -65,7 +65,7 @@ int32_t tStatisBlockInit(STbStatisBlock *statisBlock) {
int32_t
tStatisBlockFree
(
STbStatisBlock
*
statisBlock
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
statisBlock
->
dataArr
);
++
i
)
{
TARRAY2_
FREE
(
&
statisBlock
->
dataArr
[
i
]
);
TARRAY2_
DESTROY
(
&
statisBlock
->
dataArr
[
i
],
NULL
);
}
return
0
;
}
...
...
@@ -79,7 +79,7 @@ int32_t tStatisBlockClear(STbStatisBlock *statisBlock) {
int32_t
tStatisBlockPut
(
STbStatisBlock
*
statisBlock
,
const
STbStatisRecord
*
statisRecord
)
{
for
(
int32_t
i
=
0
;
i
<
ARRAY_SIZE
(
statisBlock
->
dataArr
);
++
i
)
{
int32_t
code
=
TARRAY2_APPEND
(
&
statisBlock
->
dataArr
[
i
],
statisRecord
->
aData
[
i
]);
int32_t
code
=
TARRAY2_APPEND
(
&
statisBlock
->
dataArr
[
i
],
statisRecord
->
dataArr
[
i
]);
if
(
code
)
return
code
;
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录