Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
0b4d0122
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b4d0122
编写于
2月 08, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-11818] Refactor and add error check.
上级
c57e99e4
变更
13
展开全部
显示空白变更内容
内联
并排
Showing
13 changed file
with
278 addition
and
553 deletion
+278
-553
include/common/tep.h
include/common/tep.h
+4
-0
include/util/tlosertree.h
include/util/tlosertree.h
+12
-15
include/util/tpagedfile.h
include/util/tpagedfile.h
+3
-3
source/common/src/tep.c
source/common/src/tep.c
+71
-19
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+4
-4
source/libs/executor/inc/executorimpl.h
source/libs/executor/inc/executorimpl.h
+12
-11
source/libs/executor/src/executil.c
source/libs/executor/src/executil.c
+4
-4
source/libs/executor/src/executorimpl.c
source/libs/executor/src/executorimpl.c
+97
-443
source/libs/function/inc/thistogram.h
source/libs/function/inc/thistogram.h
+1
-1
source/libs/function/src/thistogram.c
source/libs/function/src/thistogram.c
+12
-12
source/libs/function/src/tpercentile.c
source/libs/function/src/tpercentile.c
+1
-1
source/util/src/tlosertree.c
source/util/src/tlosertree.c
+54
-37
source/util/src/tpagedfile.c
source/util/src/tpagedfile.c
+3
-3
未找到文件。
include/common/tep.h
浏览文件 @
0b4d0122
...
@@ -52,8 +52,12 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf);
...
@@ -52,8 +52,12 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf);
size_t
blockDataGetSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetRowSize
(
const
SSDataBlock
*
pBlock
);
size_t
blockDataGetRowSize
(
const
SSDataBlock
*
pBlock
);
int32_t
blockDataSort
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
,
bool
nullFirst
);
int32_t
blockDataSort
(
SSDataBlock
*
pDataBlock
,
SArray
*
pOrderInfo
,
bool
nullFirst
);
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
);
void
blockDataClearup
(
SSDataBlock
*
pDataBlock
,
bool
hasVarCol
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
include/util/tlosertree.h
浏览文件 @
0b4d0122
...
@@ -22,28 +22,25 @@ extern "C" {
...
@@ -22,28 +22,25 @@ extern "C" {
typedef
int
(
*
__merge_compare_fn_t
)(
const
void
*
,
const
void
*
,
void
*
param
);
typedef
int
(
*
__merge_compare_fn_t
)(
const
void
*
,
const
void
*
,
void
*
param
);
typedef
struct
SLoserTreeNode
{
typedef
struct
SMultiwayMergeTreeInfo
{
int32_t
index
;
int32_t
numOfSources
;
void
*
pData
;
// TODO remove it?
int32_t
totalSources
;
}
SLoserTreeNode
;
typedef
struct
SLoserTreeInfo
{
int32_t
numOfEntries
;
int32_t
totalEntries
;
__merge_compare_fn_t
comparFn
;
__merge_compare_fn_t
comparFn
;
void
*
param
;
void
*
param
;
SLoserTreeNode
*
pNode
;
struct
STreeNode
*
pNode
;
}
S
Loser
TreeInfo
;
}
S
MultiwayMerge
TreeInfo
;
int32_t
t
LoserTreeCreate
(
SLoser
TreeInfo
**
pTree
,
uint32_t
numOfEntries
,
void
*
param
,
__merge_compare_fn_t
compareFn
);
int32_t
t
MergeTreeCreate
(
SMultiwayMerge
TreeInfo
**
pTree
,
uint32_t
numOfEntries
,
void
*
param
,
__merge_compare_fn_t
compareFn
);
void
t
LoserTreeInit
(
SLoserTreeInfo
*
pTree
);
void
t
MergeTreeAdjust
(
SMultiwayMergeTreeInfo
*
pTree
,
int32_t
idx
);
void
t
LoserTreeAdjust
(
SLoserTreeInfo
*
pTree
,
int32_t
idx
);
void
t
MergeTreeRebuild
(
SMultiwayMergeTreeInfo
*
pTree
);
void
t
LoserTreeRebuild
(
SLoser
TreeInfo
*
pTree
);
void
t
MergeTreePrint
(
const
SMultiwayMerge
TreeInfo
*
pTree
);
void
tLoserTreeDisplay
(
SLoserTreeInfo
*
pTree
);
int32_t
tMergeTreeGetChosenIndex
(
const
SMultiwayMergeTreeInfo
*
pTree
);
int32_t
tMergeTreeAdjustIndex
(
const
SMultiwayMergeTreeInfo
*
pTree
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
include/util/tpagedfile.h
浏览文件 @
0b4d0122
...
@@ -47,7 +47,7 @@ typedef struct SFilePage {
...
@@ -47,7 +47,7 @@ typedef struct SFilePage {
* @param handle
* @param handle
* @return
* @return
*/
*/
int32_t
createDiskbased
Result
Buffer
(
SDiskbasedBuf
**
pResultBuf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
uint64_t
qId
,
const
char
*
dir
);
int32_t
createDiskbasedBuffer
(
SDiskbasedBuf
**
pResultBuf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
uint64_t
qId
,
const
char
*
dir
);
/**
/**
*
*
...
@@ -113,14 +113,14 @@ void destroyResultBuf(SDiskbasedBuf* pResultBuf);
...
@@ -113,14 +113,14 @@ void destroyResultBuf(SDiskbasedBuf* pResultBuf);
* @param pList
* @param pList
* @return
* @return
*/
*/
struct
SPageInfo
*
getLastPageInfo
(
SIDList
pList
);
SPageInfo
*
getLastPageInfo
(
SIDList
pList
);
/**
/**
*
*
* @param pPgInfo
* @param pPgInfo
* @return
* @return
*/
*/
int32_t
getPageId
(
const
struct
SPageInfo
*
pPgInfo
);
int32_t
getPageId
(
const
SPageInfo
*
pPgInfo
);
/**
/**
* Return the buffer page size.
* Return the buffer page size.
...
...
source/common/src/tep.c
浏览文件 @
0b4d0122
...
@@ -359,17 +359,16 @@ size_t blockDataGetSize(const SSDataBlock* pBlock) {
...
@@ -359,17 +359,16 @@ size_t blockDataGetSize(const SSDataBlock* pBlock) {
int32_t
blockDataSplitRows
(
SSDataBlock
*
pBlock
,
bool
hasVarCol
,
int32_t
startIndex
,
int32_t
*
stopIndex
,
int32_t
pageSize
)
{
int32_t
blockDataSplitRows
(
SSDataBlock
*
pBlock
,
bool
hasVarCol
,
int32_t
startIndex
,
int32_t
*
stopIndex
,
int32_t
pageSize
)
{
ASSERT
(
pBlock
!=
NULL
&&
stopIndex
!=
NULL
);
ASSERT
(
pBlock
!=
NULL
&&
stopIndex
!=
NULL
);
int32_t
size
=
0
;
int32_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
int32_t
numOfCols
=
pBlock
->
info
.
numOfCols
;
int32_t
numOfRows
=
pBlock
->
info
.
rows
;
int32_t
numOfRows
=
pBlock
->
info
.
rows
;
size_t
headerSize
=
sizeof
(
int32_t
);
size_t
headerSize
=
sizeof
(
int32_t
);
size_t
colHeaderSize
=
sizeof
(
int32_t
)
*
numOfCols
;
// TODO speedup by checking if the whole page can fit in firstly.
// TODO speedup by checking if the whole page can fit in firstly.
if
(
!
hasVarCol
)
{
if
(
!
hasVarCol
)
{
size_t
rowSize
=
blockDataGetRowSize
(
pBlock
);
size_t
rowSize
=
blockDataGetRowSize
(
pBlock
);
int32_t
capacity
=
((
pageSize
-
headerSize
)
/
(
rowSize
*
8
+
1
))
*
8
;
int32_t
capacity
=
((
pageSize
-
headerSize
-
colHeaderSize
)
/
(
rowSize
*
8
+
1
))
*
8
;
*
stopIndex
=
startIndex
+
capacity
;
*
stopIndex
=
startIndex
+
capacity
;
if
(
*
stopIndex
>=
numOfRows
)
{
if
(
*
stopIndex
>=
numOfRows
)
{
...
@@ -379,7 +378,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
...
@@ -379,7 +378,7 @@ int32_t blockDataSplitRows(SSDataBlock* pBlock, bool hasVarCol, int32_t startInd
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
else
{
}
else
{
// iterate the rows that can be fit in this buffer page
// iterate the rows that can be fit in this buffer page
size
+=
headerSize
;
int32_t
size
=
(
headerSize
+
colHeaderSize
)
;
for
(
int32_t
j
=
startIndex
;
j
<
numOfRows
;
++
j
)
{
for
(
int32_t
j
=
startIndex
;
j
<
numOfRows
;
++
j
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
...
@@ -423,6 +422,10 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
...
@@ -423,6 +422,10 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
}
}
SSDataBlock
*
pDst
=
calloc
(
1
,
sizeof
(
SSDataBlock
));
SSDataBlock
*
pDst
=
calloc
(
1
,
sizeof
(
SSDataBlock
));
if
(
pDst
==
NULL
)
{
return
NULL
;
}
pDst
->
info
=
pBlock
->
info
;
pDst
->
info
=
pBlock
->
info
;
pDst
->
info
.
rows
=
0
;
pDst
->
info
.
rows
=
0
;
...
@@ -472,7 +475,7 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
...
@@ -472,7 +475,7 @@ SSDataBlock* blockDataExtractBlock(SSDataBlock* pBlock, int32_t startIndex, int3
* @param pBlock
* @param pBlock
* @return
* @return
*/
*/
int32_t
blockDataToBuf
(
char
*
buf
,
const
SSDataBlock
*
pBlock
)
{
// TODO add the column length!!
int32_t
blockDataToBuf
(
char
*
buf
,
const
SSDataBlock
*
pBlock
)
{
ASSERT
(
pBlock
!=
NULL
);
ASSERT
(
pBlock
!=
NULL
);
// write the number of rows
// write the number of rows
...
@@ -516,21 +519,9 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
...
@@ -516,21 +519,9 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
size_t
metaSize
=
pBlock
->
info
.
rows
*
sizeof
(
int32_t
);
size_t
metaSize
=
pBlock
->
info
.
rows
*
sizeof
(
int32_t
);
if
(
IS_VAR_DATA_TYPE
(
pCol
->
info
.
type
))
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
info
.
type
))
{
char
*
p
=
realloc
(
pCol
->
varmeta
.
offset
,
metaSize
);
if
(
p
==
NULL
)
{
// TODO handle error
}
pCol
->
varmeta
.
offset
=
(
int32_t
*
)
p
;
memcpy
(
pCol
->
varmeta
.
offset
,
pStart
,
metaSize
);
memcpy
(
pCol
->
varmeta
.
offset
,
pStart
,
metaSize
);
pStart
+=
metaSize
;
pStart
+=
metaSize
;
}
else
{
}
else
{
char
*
p
=
realloc
(
pCol
->
nullbitmap
,
BitmapLen
(
pBlock
->
info
.
rows
));
if
(
p
==
NULL
)
{
// TODO handle error
}
pCol
->
nullbitmap
=
p
;
memcpy
(
pCol
->
nullbitmap
,
pStart
,
BitmapLen
(
pBlock
->
info
.
rows
));
memcpy
(
pCol
->
nullbitmap
,
pStart
,
BitmapLen
(
pBlock
->
info
.
rows
));
pStart
+=
BitmapLen
(
pBlock
->
info
.
rows
);
pStart
+=
BitmapLen
(
pBlock
->
info
.
rows
);
}
}
...
@@ -538,13 +529,26 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
...
@@ -538,13 +529,26 @@ int32_t blockDataFromBuf(SSDataBlock* pBlock, const char* buf) {
int32_t
colLength
=
*
(
int32_t
*
)
pStart
;
int32_t
colLength
=
*
(
int32_t
*
)
pStart
;
pStart
+=
sizeof
(
int32_t
);
pStart
+=
sizeof
(
int32_t
);
if
(
pCol
->
pData
==
NULL
)
{
if
(
IS_VAR_DATA_TYPE
(
pCol
->
info
.
type
))
{
pCol
->
pData
=
malloc
(
pCol
->
info
.
bytes
*
4096
);
// TODO refactor the memory mgmt
if
(
pCol
->
varmeta
.
allocLen
<
colLength
)
{
char
*
tmp
=
realloc
(
pCol
->
pData
,
colLength
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pCol
->
pData
=
tmp
;
pCol
->
varmeta
.
allocLen
=
colLength
;
}
pCol
->
varmeta
.
length
=
colLength
;
ASSERT
(
pCol
->
varmeta
.
length
<=
pCol
->
varmeta
.
allocLen
);
}
}
memcpy
(
pCol
->
pData
,
pStart
,
colLength
);
memcpy
(
pCol
->
pData
,
pStart
,
colLength
);
pStart
+=
colLength
;
pStart
+=
colLength
;
}
}
return
TSDB_CODE_SUCCESS
;
}
}
size_t
blockDataGetRowSize
(
const
SSDataBlock
*
pBlock
)
{
size_t
blockDataGetRowSize
(
const
SSDataBlock
*
pBlock
)
{
...
@@ -759,3 +763,51 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirs
...
@@ -759,3 +763,51 @@ int32_t blockDataSort(SSDataBlock* pDataBlock, SArray* pOrderInfo, bool nullFirs
printf
(
"sort:%ld, create:%ld, assign:%ld, copyback:%ld
\n
"
,
p1
-
p0
,
p2
-
p1
,
p3
-
p2
,
p4
-
p3
);
printf
(
"sort:%ld, create:%ld, assign:%ld, copyback:%ld
\n
"
,
p1
-
p0
,
p2
-
p1
,
p3
-
p2
,
p4
-
p3
);
destroyTupleIndex
(
index
);
destroyTupleIndex
(
index
);
}
}
void
blockDataClearup
(
SSDataBlock
*
pDataBlock
,
bool
hasVarCol
)
{
pDataBlock
->
info
.
rows
=
0
;
if
(
hasVarCol
)
{
for
(
int32_t
i
=
0
;
i
<
pDataBlock
->
info
.
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
p
->
info
.
type
))
{
p
->
varmeta
.
length
=
0
;
}
}
}
}
int32_t
blockDataEnsureCapacity
(
SSDataBlock
*
pDataBlock
,
uint32_t
numOfRows
)
{
for
(
int32_t
i
=
0
;
i
<
pDataBlock
->
info
.
numOfCols
;
++
i
)
{
SColumnInfoData
*
p
=
taosArrayGet
(
pDataBlock
->
pDataBlock
,
i
);
if
(
IS_VAR_DATA_TYPE
(
p
->
info
.
type
))
{
char
*
tmp
=
realloc
(
p
->
varmeta
.
offset
,
sizeof
(
int32_t
)
*
numOfRows
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
p
->
varmeta
.
offset
=
(
int32_t
*
)
tmp
;
memset
(
p
->
varmeta
.
offset
,
0
,
sizeof
(
int32_t
)
*
numOfRows
);
p
->
varmeta
.
length
=
0
;
p
->
varmeta
.
allocLen
=
0
;
tfree
(
p
->
pData
);
}
else
{
char
*
tmp
=
realloc
(
p
->
nullbitmap
,
BitmapLen
(
numOfRows
));
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
p
->
nullbitmap
=
tmp
;
memset
(
p
->
nullbitmap
,
0
,
BitmapLen
(
numOfRows
));
tmp
=
realloc
(
p
->
pData
,
numOfRows
*
p
->
info
.
bytes
);
if
(
tmp
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
p
->
pData
=
tmp
;
}
}
}
\ No newline at end of file
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
0b4d0122
...
@@ -2171,8 +2171,8 @@ static int32_t createDataBlocksInfo(STsdbReadHandle* pTsdbReadHandle, int32_t nu
...
@@ -2171,8 +2171,8 @@ static int32_t createDataBlocksInfo(STsdbReadHandle* pTsdbReadHandle, int32_t nu
assert
(
cnt
<=
numOfBlocks
&&
numOfQualTables
<=
numOfTables
);
// the pTableQueryInfo[j]->numOfBlocks may be 0
assert
(
cnt
<=
numOfBlocks
&&
numOfQualTables
<=
numOfTables
);
// the pTableQueryInfo[j]->numOfBlocks may be 0
sup
.
numOfTables
=
numOfQualTables
;
sup
.
numOfTables
=
numOfQualTables
;
S
Loser
TreeInfo
*
pTree
=
NULL
;
S
MultiwayMerge
TreeInfo
*
pTree
=
NULL
;
uint8_t
ret
=
t
Loser
TreeCreate
(
&
pTree
,
sup
.
numOfTables
,
&
sup
,
dataBlockOrderCompar
);
uint8_t
ret
=
t
Merge
TreeCreate
(
&
pTree
,
sup
.
numOfTables
,
&
sup
,
dataBlockOrderCompar
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
cleanBlockOrderSupporter
(
&
sup
,
numOfTables
);
cleanBlockOrderSupporter
(
&
sup
,
numOfTables
);
return
TSDB_CODE_TDB_OUT_OF_MEMORY
;
return
TSDB_CODE_TDB_OUT_OF_MEMORY
;
...
@@ -2181,7 +2181,7 @@ static int32_t createDataBlocksInfo(STsdbReadHandle* pTsdbReadHandle, int32_t nu
...
@@ -2181,7 +2181,7 @@ static int32_t createDataBlocksInfo(STsdbReadHandle* pTsdbReadHandle, int32_t nu
int32_t
numOfTotal
=
0
;
int32_t
numOfTotal
=
0
;
while
(
numOfTotal
<
cnt
)
{
while
(
numOfTotal
<
cnt
)
{
int32_t
pos
=
pTree
->
pNode
[
0
].
index
;
int32_t
pos
=
tMergeTreeGetChosenIndex
(
pTree
)
;
int32_t
index
=
sup
.
blockIndexArray
[
pos
]
++
;
int32_t
index
=
sup
.
blockIndexArray
[
pos
]
++
;
STableBlockInfo
*
pBlocksInfo
=
sup
.
pDataBlockInfo
[
pos
];
STableBlockInfo
*
pBlocksInfo
=
sup
.
pDataBlockInfo
[
pos
];
...
@@ -2192,7 +2192,7 @@ static int32_t createDataBlocksInfo(STsdbReadHandle* pTsdbReadHandle, int32_t nu
...
@@ -2192,7 +2192,7 @@ static int32_t createDataBlocksInfo(STsdbReadHandle* pTsdbReadHandle, int32_t nu
sup
.
blockIndexArray
[
pos
]
=
sup
.
numOfBlocksPerTable
[
pos
]
+
1
;
sup
.
blockIndexArray
[
pos
]
=
sup
.
numOfBlocksPerTable
[
pos
]
+
1
;
}
}
t
LoserTreeAdjust
(
pTree
,
pos
+
sup
.
numOfTables
);
t
MergeTreeAdjust
(
pTree
,
tMergeTreeAdjustIndex
(
pTree
)
);
}
}
/*
/*
...
...
source/libs/executor/inc/executorimpl.h
浏览文件 @
0b4d0122
...
@@ -560,15 +560,16 @@ typedef struct SMultiwayMergeInfo {
...
@@ -560,15 +560,16 @@ typedef struct SMultiwayMergeInfo {
typedef
struct
SOrderOperatorInfo
{
typedef
struct
SOrderOperatorInfo
{
int32_t
sourceId
;
int32_t
sourceId
;
uint32_t
sortBufSize
;
// max buffer size for in-memory sort
uint32_t
sortBufSize
;
// max buffer size for in-memory sort
SArray
*
orderInfo
;
// SArray<SBlockOrderInfo>
SArray
*
orderInfo
;
// SArray<SBlockOrderInfo>
SSDataBlock
*
pDataBlock
;
SSDataBlock
*
pDataBlock
;
bool
nullFirst
;
// null value is put in the front
bool
nullFirst
;
// null value is put in the front
bool
hasVarCol
;
// has variable length column, such as binary/varchar/nchar
bool
hasVarCol
;
// has variable length column, such as binary/varchar/nchar
SDiskbasedBuf
*
pSortInternalBuf
;
int32_t
numOfSources
;
int32_t
numOfSources
;
int32_t
numOfCompleted
;
int32_t
numOfCompleted
;
SLoserTreeInfo
*
pMergeTree
;
SDiskbasedBuf
*
pSortInternalBuf
;
SMultiwayMergeTreeInfo
*
pMergeTree
;
SArray
*
pSources
;
// SArray<SExternalMemSource*>
SArray
*
pSources
;
// SArray<SExternalMemSource*>
int32_t
capacity
;
}
SOrderOperatorInfo
;
}
SOrderOperatorInfo
;
SOperatorInfo
*
createExchangeOperatorInfo
(
const
SArray
*
pSources
,
const
SArray
*
pSchema
,
SExecTaskInfo
*
pTaskInfo
);
SOperatorInfo
*
createExchangeOperatorInfo
(
const
SArray
*
pSources
,
const
SArray
*
pSchema
,
SExecTaskInfo
*
pTaskInfo
);
...
...
source/libs/executor/src/executil.c
浏览文件 @
0b4d0122
...
@@ -533,7 +533,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
...
@@ -533,7 +533,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
code
=
TSDB_CODE_SUCCESS
;
int32_t
*
posList
=
NULL
;
int32_t
*
posList
=
NULL
;
S
Loser
TreeInfo
*
pTree
=
NULL
;
S
MultiwayMerge
TreeInfo
*
pTree
=
NULL
;
STableQueryInfo
**
pTableQueryInfoList
=
NULL
;
STableQueryInfo
**
pTableQueryInfoList
=
NULL
;
size_t
size
=
taosArrayGetSize
(
pTableList
);
size_t
size
=
taosArrayGetSize
(
pTableList
);
...
@@ -566,7 +566,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
...
@@ -566,7 +566,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
SCompSupporter
cs
=
{
pTableQueryInfoList
,
posList
,
pRuntimeEnv
->
pQueryAttr
->
order
.
order
};
SCompSupporter
cs
=
{
pTableQueryInfoList
,
posList
,
pRuntimeEnv
->
pQueryAttr
->
order
.
order
};
int32_t
ret
=
t
Loser
TreeCreate
(
&
pTree
,
numOfTables
,
&
cs
,
tableResultComparFn
);
int32_t
ret
=
t
Merge
TreeCreate
(
&
pTree
,
numOfTables
,
&
cs
,
tableResultComparFn
);
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
if
(
ret
!=
TSDB_CODE_SUCCESS
)
{
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
code
=
TSDB_CODE_QRY_OUT_OF_MEMORY
;
goto
_end
;
goto
_end
;
...
@@ -576,7 +576,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
...
@@ -576,7 +576,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
int64_t
startt
=
taosGetTimestampMs
();
int64_t
startt
=
taosGetTimestampMs
();
while
(
1
)
{
while
(
1
)
{
int32_t
tableIndex
=
pTree
->
pNode
[
0
].
index
;
int32_t
tableIndex
=
tMergeTreeGetChosenIndex
(
pTree
)
;
SResultRowInfo
*
pWindowResInfo
=
&
pTableQueryInfoList
[
tableIndex
]
->
resInfo
;
SResultRowInfo
*
pWindowResInfo
=
&
pTableQueryInfoList
[
tableIndex
]
->
resInfo
;
SResultRow
*
pWindowRes
=
getResultRow
(
pWindowResInfo
,
cs
.
rowIndex
[
tableIndex
]);
SResultRow
*
pWindowRes
=
getResultRow
(
pWindowResInfo
,
cs
.
rowIndex
[
tableIndex
]);
...
@@ -612,7 +612,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
...
@@ -612,7 +612,7 @@ static UNUSED_FUNC int32_t mergeIntoGroupResultImpl(STaskRuntimeEnv *pRuntimeEnv
}
}
}
}
t
LoserTreeAdjust
(
pTree
,
tableIndex
+
pTree
->
numOfEntries
);
t
MergeTreeAdjust
(
pTree
,
tMergeTreeAdjustIndex
(
pTree
)
);
}
}
int64_t
endt
=
taosGetTimestampMs
();
int64_t
endt
=
taosGetTimestampMs
();
...
...
source/libs/executor/src/executorimpl.c
浏览文件 @
0b4d0122
此差异已折叠。
点击以展开。
source/libs/function/inc/thistogram.h
浏览文件 @
0b4d0122
...
@@ -49,7 +49,7 @@ typedef struct SHistogramInfo {
...
@@ -49,7 +49,7 @@ typedef struct SHistogramInfo {
SHistBin
*
elems
;
SHistBin
*
elems
;
#else
#else
tSkipList
*
pList
;
tSkipList
*
pList
;
S
Loser
TreeInfo
*
pLoserTree
;
S
MultiwayMerge
TreeInfo
*
pLoserTree
;
int32_t
maxIndex
;
int32_t
maxIndex
;
bool
ordered
;
bool
ordered
;
#endif
#endif
...
...
source/libs/function/src/thistogram.c
浏览文件 @
0b4d0122
...
@@ -117,14 +117,14 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
...
@@ -117,14 +117,14 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
if
((
*
pHisto
)
->
ordered
)
{
if
((
*
pHisto
)
->
ordered
)
{
int32_t
lastIndex
=
(
*
pHisto
)
->
maxIndex
;
int32_t
lastIndex
=
(
*
pHisto
)
->
maxIndex
;
S
Loser
TreeInfo
*
pTree
=
(
*
pHisto
)
->
pLoserTree
;
S
MultiwayMerge
TreeInfo
*
pTree
=
(
*
pHisto
)
->
pLoserTree
;
(
*
pHisto
)
->
pLoserTree
->
pNode
[
lastIndex
+
pTree
->
numOfEntries
].
pData
=
pResNode
;
(
*
pHisto
)
->
pLoserTree
->
pNode
[
lastIndex
+
pTree
->
numOfEntries
].
pData
=
pResNode
;
pEntry1
->
index
=
(
*
pHisto
)
->
pLoserTree
->
pNode
[
lastIndex
+
pTree
->
numOfEntries
].
index
;
pEntry1
->
index
=
(
*
pHisto
)
->
pLoserTree
->
pNode
[
lastIndex
+
pTree
->
numOfEntries
].
index
;
// update the loser tree
// update the loser tree
if
((
*
pHisto
)
->
ordered
)
{
if
((
*
pHisto
)
->
ordered
)
{
t
Loser
TreeAdjust
(
pTree
,
pEntry1
->
index
+
pTree
->
numOfEntries
);
t
Merge
TreeAdjust
(
pTree
,
pEntry1
->
index
+
pTree
->
numOfEntries
);
}
}
tSkipListKey
kx
=
tSkipListKey
kx
=
...
@@ -142,10 +142,10 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
...
@@ -142,10 +142,10 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
SHistBin
*
pPrevEntry
=
(
SHistBin
*
)
pResNode
->
pBackward
[
0
]
->
pData
;
SHistBin
*
pPrevEntry
=
(
SHistBin
*
)
pResNode
->
pBackward
[
0
]
->
pData
;
pPrevEntry
->
delta
=
val
-
pPrevEntry
->
val
;
pPrevEntry
->
delta
=
val
-
pPrevEntry
->
val
;
S
Loser
TreeInfo
*
pTree
=
(
*
pHisto
)
->
pLoserTree
;
S
MultiwayMerge
TreeInfo
*
pTree
=
(
*
pHisto
)
->
pLoserTree
;
if
((
*
pHisto
)
->
ordered
)
{
if
((
*
pHisto
)
->
ordered
)
{
t
Loser
TreeAdjust
(
pTree
,
pPrevEntry
->
index
+
pTree
->
numOfEntries
);
t
Merge
TreeAdjust
(
pTree
,
pPrevEntry
->
index
+
pTree
->
numOfEntries
);
t
LoserTreeDisplay
(
pTree
);
t
MergeTreePrint
(
pTree
);
}
}
}
}
...
@@ -155,7 +155,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
...
@@ -155,7 +155,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
if
(
!
(
*
pHisto
)
->
ordered
)
{
if
(
!
(
*
pHisto
)
->
ordered
)
{
SSkipListPrint
((
*
pHisto
)
->
pList
,
1
);
SSkipListPrint
((
*
pHisto
)
->
pList
,
1
);
S
Loser
TreeInfo
*
pTree
=
(
*
pHisto
)
->
pLoserTree
;
S
MultiwayMerge
TreeInfo
*
pTree
=
(
*
pHisto
)
->
pLoserTree
;
tSkipListNode
*
pHead
=
(
*
pHisto
)
->
pList
->
pHead
.
pForward
[
0
];
tSkipListNode
*
pHead
=
(
*
pHisto
)
->
pList
->
pHead
.
pForward
[
0
];
tSkipListNode
*
p1
=
pHead
;
tSkipListNode
*
p1
=
pHead
;
...
@@ -183,13 +183,13 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
...
@@ -183,13 +183,13 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
pTree
->
pNode
[
i
].
index
=
-
1
;
pTree
->
pNode
[
i
].
index
=
-
1
;
}
}
t
LoserTreeDisplay
(
pTree
);
t
MergeTreePrint
(
pTree
);
for
(
int32_t
i
=
pTree
->
totalEntries
-
1
;
i
>=
pTree
->
numOfEntries
;
i
--
)
{
for
(
int32_t
i
=
pTree
->
totalEntries
-
1
;
i
>=
pTree
->
numOfEntries
;
i
--
)
{
t
Loser
TreeAdjust
(
pTree
,
i
);
t
Merge
TreeAdjust
(
pTree
,
i
);
}
}
t
LoserTreeDisplay
(
pTree
);
t
MergeTreePrint
(
pTree
);
(
*
pHisto
)
->
ordered
=
true
;
(
*
pHisto
)
->
ordered
=
true
;
}
}
...
@@ -219,7 +219,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
...
@@ -219,7 +219,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
pPrevEntry
->
delta
=
pEntry
->
val
-
pPrevEntry
->
val
;
pPrevEntry
->
delta
=
pEntry
->
val
-
pPrevEntry
->
val
;
}
}
S
Loser
TreeInfo
*
pTree
=
(
*
pHisto
)
->
pLoserTree
;
S
MultiwayMerge
TreeInfo
*
pTree
=
(
*
pHisto
)
->
pLoserTree
;
if
(
pNextEntry
->
index
!=
-
1
)
{
if
(
pNextEntry
->
index
!=
-
1
)
{
(
*
pHisto
)
->
maxIndex
=
pNextEntry
->
index
;
(
*
pHisto
)
->
maxIndex
=
pNextEntry
->
index
;
...
@@ -230,12 +230,12 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
...
@@ -230,12 +230,12 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
printf
(
"disappear index is:%d
\n
"
,
f
);
printf
(
"disappear index is:%d
\n
"
,
f
);
}
}
t
Loser
TreeAdjust
(
pTree
,
pEntry
->
index
+
pTree
->
numOfEntries
);
t
Merge
TreeAdjust
(
pTree
,
pEntry
->
index
+
pTree
->
numOfEntries
);
// remove the next node in skiplist
// remove the next node in skiplist
tSkipListRemoveNode
((
*
pHisto
)
->
pList
,
pNext
);
tSkipListRemoveNode
((
*
pHisto
)
->
pList
,
pNext
);
SSkipListPrint
((
*
pHisto
)
->
pList
,
1
);
SSkipListPrint
((
*
pHisto
)
->
pList
,
1
);
t
LoserTreeDisplay
((
*
pHisto
)
->
pLoserTree
);
t
MergeTreePrint
((
*
pHisto
)
->
pLoserTree
);
}
else
{
// add to heap
}
else
{
// add to heap
if
(
pResNode
->
pForward
[
0
]
!=
NULL
)
{
if
(
pResNode
->
pForward
[
0
]
!=
NULL
)
{
pEntry1
->
delta
=
((
SHistBin
*
)
pResNode
->
pForward
[
0
]
->
pData
)
->
val
-
val
;
pEntry1
->
delta
=
((
SHistBin
*
)
pResNode
->
pForward
[
0
]
->
pData
)
->
val
-
val
;
...
...
source/libs/function/src/tpercentile.c
浏览文件 @
0b4d0122
...
@@ -254,7 +254,7 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
...
@@ -254,7 +254,7 @@ tMemBucket *tMemBucketCreate(int16_t nElemSize, int16_t dataType, double minval,
resetSlotInfo
(
pBucket
);
resetSlotInfo
(
pBucket
);
int32_t
ret
=
createDiskbased
Result
Buffer
(
&
pBucket
->
pBuffer
,
pBucket
->
bufPageSize
,
pBucket
->
bufPageSize
*
512
,
1
,
tsTempDir
);
int32_t
ret
=
createDiskbasedBuffer
(
&
pBucket
->
pBuffer
,
pBucket
->
bufPageSize
,
pBucket
->
bufPageSize
*
512
,
1
,
tsTempDir
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
tMemBucketDestroy
(
pBucket
);
tMemBucketDestroy
(
pBucket
);
return
NULL
;
return
NULL
;
...
...
source/util/src/tlosertree.c
浏览文件 @
0b4d0122
...
@@ -17,79 +17,76 @@
...
@@ -17,79 +17,76 @@
#include "tlosertree.h"
#include "tlosertree.h"
#include "ulog.h"
#include "ulog.h"
// set initial value for loser tree
typedef
struct
STreeNode
{
void
tLoserTreeInit
(
SLoserTreeInfo
*
pTree
)
{
int32_t
index
;
assert
((
pTree
->
totalEntries
&
0x01
)
==
0
&&
(
pTree
->
numOfEntries
<<
1
==
pTree
->
totalEntries
));
void
*
pData
;
// TODO remove it?
}
STreeNode
;
for
(
int32_t
i
=
0
;
i
<
pTree
->
totalEntries
;
++
i
)
{
// Set the initial value of the multiway merge tree.
if
(
i
<
pTree
->
numOfEntries
)
{
static
void
tMergeTreeInit
(
SMultiwayMergeTreeInfo
*
pTree
)
{
assert
((
pTree
->
totalSources
&
0x01
)
==
0
&&
(
pTree
->
numOfSources
<<
1
==
pTree
->
totalSources
));
for
(
int32_t
i
=
0
;
i
<
pTree
->
totalSources
;
++
i
)
{
if
(
i
<
pTree
->
numOfSources
)
{
pTree
->
pNode
[
i
].
index
=
-
1
;
pTree
->
pNode
[
i
].
index
=
-
1
;
}
else
{
}
else
{
pTree
->
pNode
[
i
].
index
=
i
-
pTree
->
numOf
Entri
es
;
pTree
->
pNode
[
i
].
index
=
i
-
pTree
->
numOf
Sourc
es
;
}
}
}
}
}
}
/*
int32_t
tMergeTreeCreate
(
SMultiwayMergeTreeInfo
**
pTree
,
uint32_t
numOfSources
,
void
*
param
,
__merge_compare_fn_t
compareFn
)
{
* display whole loser tree on screen for debug purpose only.
*/
void
tLoserTreeDisplay
(
SLoserTreeInfo
*
pTree
)
{
printf
(
"the value of loser tree:
\t
"
);
for
(
int32_t
i
=
0
;
i
<
pTree
->
totalEntries
;
++
i
)
printf
(
"%d
\t
"
,
pTree
->
pNode
[
i
].
index
);
printf
(
"
\n
"
);
}
int32_t
tLoserTreeCreate
(
SLoserTreeInfo
**
pTree
,
uint32_t
numOfSources
,
void
*
param
,
__merge_compare_fn_t
compareFn
)
{
int32_t
totalEntries
=
numOfSources
<<
1u
;
int32_t
totalEntries
=
numOfSources
<<
1u
;
*
pTree
=
(
SLoserTreeInfo
*
)
calloc
(
1
,
sizeof
(
SLoserTreeInfo
)
+
sizeof
(
SLoser
TreeNode
)
*
totalEntries
);
SMultiwayMergeTreeInfo
*
pTreeInfo
=
(
SMultiwayMergeTreeInfo
*
)
calloc
(
1
,
sizeof
(
SMultiwayMergeTreeInfo
)
+
sizeof
(
S
TreeNode
)
*
totalEntries
);
if
((
*
pTree
)
==
NULL
)
{
if
((
*
pTree
)
==
NULL
)
{
uError
(
"allocate memory for loser-tree failed. reason:%s"
,
strerror
(
errno
));
uError
(
"allocate memory for loser-tree failed. reason:%s"
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
(
*
pTree
)
->
pNode
=
(
SLoserTreeNode
*
)(((
char
*
)(
*
pTree
))
+
sizeof
(
SLoser
TreeInfo
));
pTreeInfo
->
pNode
=
(
STreeNode
*
)(((
char
*
)(
*
pTree
))
+
sizeof
(
SMultiwayMerge
TreeInfo
));
(
*
pTree
)
->
numOfEntri
es
=
numOfSources
;
pTreeInfo
->
numOfSourc
es
=
numOfSources
;
(
*
pTree
)
->
totalEntri
es
=
totalEntries
;
pTreeInfo
->
totalSourc
es
=
totalEntries
;
(
*
pTree
)
->
param
=
param
;
pTreeInfo
->
param
=
param
;
(
*
pTree
)
->
comparFn
=
compareFn
;
pTreeInfo
->
comparFn
=
compareFn
;
// set initial value for loser tree
// set initial value for loser tree
t
LoserTreeInit
(
*
pTree
);
t
MergeTreeInit
(
pTreeInfo
);
#ifdef _DEBUG_VIEW
#ifdef _DEBUG_VIEW
printf
(
"the initial value of loser tree:
\n
"
);
printf
(
"the initial value of loser tree:
\n
"
);
tLoserTreeDisplay
(
*
pTree
)
;
tLoserTreeDisplay
pTreeInfo
;
#endif
#endif
for
(
int32_t
i
=
totalEntries
-
1
;
i
>=
numOfSources
;
i
--
)
{
for
(
int32_t
i
=
totalEntries
-
1
;
i
>=
numOfSources
;
i
--
)
{
t
LoserTreeAdjust
(
*
pTree
,
i
);
t
MergeTreeAdjust
(
pTreeInfo
,
i
);
}
}
#if defined(_DEBUG_VIEW)
#if defined(_DEBUG_VIEW)
printf
(
"after adjust:
\n
"
);
printf
(
"after adjust:
\n
"
);
tLoserTreeDisplay
(
*
pTree
)
;
tLoserTreeDisplay
pTreeInfo
;
printf
(
"initialize local reducer completed!
\n
"
);
printf
(
"initialize local reducer completed!
\n
"
);
#endif
#endif
*
pTree
=
pTreeInfo
;
return
0
;
return
0
;
}
}
void
t
LoserTreeAdjust
(
SLoser
TreeInfo
*
pTree
,
int32_t
idx
)
{
void
t
MergeTreeAdjust
(
SMultiwayMerge
TreeInfo
*
pTree
,
int32_t
idx
)
{
assert
(
idx
<=
pTree
->
total
Entries
-
1
&&
idx
>=
pTree
->
numOfEntries
&&
pTree
->
totalEntri
es
>=
2
);
assert
(
idx
<=
pTree
->
total
Sources
-
1
&&
idx
>=
pTree
->
numOfSources
&&
pTree
->
totalSourc
es
>=
2
);
if
(
pTree
->
total
Entri
es
==
2
)
{
if
(
pTree
->
total
Sourc
es
==
2
)
{
pTree
->
pNode
[
0
].
index
=
0
;
pTree
->
pNode
[
0
].
index
=
0
;
pTree
->
pNode
[
1
].
index
=
0
;
pTree
->
pNode
[
1
].
index
=
0
;
return
;
return
;
}
}
int32_t
parentId
=
idx
>>
1
;
int32_t
parentId
=
idx
>>
1
;
S
Loser
TreeNode
kLeaf
=
pTree
->
pNode
[
idx
];
STreeNode
kLeaf
=
pTree
->
pNode
[
idx
];
while
(
parentId
>
0
)
{
while
(
parentId
>
0
)
{
S
Loser
TreeNode
*
pCur
=
&
pTree
->
pNode
[
parentId
];
STreeNode
*
pCur
=
&
pTree
->
pNode
[
parentId
];
if
(
pCur
->
index
==
-
1
)
{
if
(
pCur
->
index
==
-
1
)
{
pTree
->
pNode
[
parentId
]
=
kLeaf
;
pTree
->
pNode
[
parentId
]
=
kLeaf
;
return
;
return
;
...
@@ -97,7 +94,7 @@ void tLoserTreeAdjust(SLoserTreeInfo* pTree, int32_t idx) {
...
@@ -97,7 +94,7 @@ void tLoserTreeAdjust(SLoserTreeInfo* pTree, int32_t idx) {
int32_t
ret
=
pTree
->
comparFn
(
pCur
,
&
kLeaf
,
pTree
->
param
);
int32_t
ret
=
pTree
->
comparFn
(
pCur
,
&
kLeaf
,
pTree
->
param
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
S
Loser
TreeNode
t
=
pTree
->
pNode
[
parentId
];
STreeNode
t
=
pTree
->
pNode
[
parentId
];
pTree
->
pNode
[
parentId
]
=
kLeaf
;
pTree
->
pNode
[
parentId
]
=
kLeaf
;
kLeaf
=
t
;
kLeaf
=
t
;
}
}
...
@@ -111,11 +108,31 @@ void tLoserTreeAdjust(SLoserTreeInfo* pTree, int32_t idx) {
...
@@ -111,11 +108,31 @@ void tLoserTreeAdjust(SLoserTreeInfo* pTree, int32_t idx) {
}
}
}
}
void
t
LoserTreeRebuild
(
SLoser
TreeInfo
*
pTree
)
{
void
t
MergeTreeRebuild
(
SMultiwayMerge
TreeInfo
*
pTree
)
{
assert
((
pTree
->
total
Entri
es
&
0x1
)
==
0
);
assert
((
pTree
->
total
Sourc
es
&
0x1
)
==
0
);
t
Loser
TreeInit
(
pTree
);
t
Merge
TreeInit
(
pTree
);
for
(
int32_t
i
=
pTree
->
total
Entries
-
1
;
i
>=
pTree
->
numOfEntri
es
;
i
--
)
{
for
(
int32_t
i
=
pTree
->
total
Sources
-
1
;
i
>=
pTree
->
numOfSourc
es
;
i
--
)
{
t
Loser
TreeAdjust
(
pTree
,
i
);
t
Merge
TreeAdjust
(
pTree
,
i
);
}
}
}
}
/*
* display whole loser tree on screen for debug purpose only.
*/
void
tMergeTreePrint
(
const
SMultiwayMergeTreeInfo
*
pTree
)
{
printf
(
"the value of loser tree:
\t
"
);
for
(
int32_t
i
=
0
;
i
<
pTree
->
totalSources
;
++
i
)
{
printf
(
"%d
\t
"
,
pTree
->
pNode
[
i
].
index
);
}
printf
(
"
\n
"
);
}
int32_t
tMergeTreeGetChosenIndex
(
const
SMultiwayMergeTreeInfo
*
pTree
)
{
return
pTree
->
pNode
[
0
].
index
;
}
int32_t
tMergeTreeAdjustIndex
(
const
SMultiwayMergeTreeInfo
*
pTree
)
{
return
tMergeTreeGetChosenIndex
(
pTree
)
+
pTree
->
numOfSources
;
}
source/util/src/tpagedfile.c
浏览文件 @
0b4d0122
...
@@ -55,7 +55,7 @@ typedef struct SDiskbasedBuf {
...
@@ -55,7 +55,7 @@ typedef struct SDiskbasedBuf {
SDiskbasedBufStatis
statis
;
SDiskbasedBufStatis
statis
;
}
SDiskbasedBuf
;
}
SDiskbasedBuf
;
int32_t
createDiskbased
Result
Buffer
(
SDiskbasedBuf
**
pResultBuf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
uint64_t
qId
,
const
char
*
dir
)
{
int32_t
createDiskbasedBuffer
(
SDiskbasedBuf
**
pResultBuf
,
int32_t
pagesize
,
int32_t
inMemBufSize
,
uint64_t
qId
,
const
char
*
dir
)
{
*
pResultBuf
=
calloc
(
1
,
sizeof
(
SDiskbasedBuf
));
*
pResultBuf
=
calloc
(
1
,
sizeof
(
SDiskbasedBuf
));
SDiskbasedBuf
*
pResBuf
=
*
pResultBuf
;
SDiskbasedBuf
*
pResBuf
=
*
pResultBuf
;
...
@@ -492,13 +492,13 @@ void destroyResultBuf(SDiskbasedBuf* pResultBuf) {
...
@@ -492,13 +492,13 @@ void destroyResultBuf(SDiskbasedBuf* pResultBuf) {
tfree
(
pResultBuf
);
tfree
(
pResultBuf
);
}
}
struct
SPageInfo
*
getLastPageInfo
(
SIDList
pList
)
{
SPageInfo
*
getLastPageInfo
(
SIDList
pList
)
{
size_t
size
=
taosArrayGetSize
(
pList
);
size_t
size
=
taosArrayGetSize
(
pList
);
SPageInfo
*
pPgInfo
=
taosArrayGetP
(
pList
,
size
-
1
);
SPageInfo
*
pPgInfo
=
taosArrayGetP
(
pList
,
size
-
1
);
return
pPgInfo
;
return
pPgInfo
;
}
}
int32_t
getPageId
(
const
struct
SPageInfo
*
pPgInfo
)
{
int32_t
getPageId
(
const
SPageInfo
*
pPgInfo
)
{
ASSERT
(
pPgInfo
!=
NULL
);
ASSERT
(
pPgInfo
!=
NULL
);
return
pPgInfo
->
pageId
;
return
pPgInfo
->
pageId
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录