Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
932116e4
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
932116e4
编写于
11月 30, 2022
作者:
X
Xiaoyu Wang
浏览文件
操作
浏览文件
下载
差异文件
merge refact/submit_req
上级
b93b7aa5
f5270f6a
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
82 addition
and
79 deletion
+82
-79
include/common/tdataformat.h
include/common/tdataformat.h
+2
-1
source/common/src/tdataformat.c
source/common/src/tdataformat.c
+8
-7
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+6
-6
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+4
-4
source/dnode/vnode/src/tsdb/tsdbRead.c
source/dnode/vnode/src/tsdb/tsdbRead.c
+54
-54
source/dnode/vnode/src/tsdb/tsdbUtil.c
source/dnode/vnode/src/tsdb/tsdbUtil.c
+6
-6
source/libs/parser/src/parInsertUtil.c
source/libs/parser/src/parInsertUtil.c
+2
-1
未找到文件。
include/common/tdataformat.h
浏览文件 @
932116e4
...
...
@@ -87,7 +87,8 @@ int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData);
int32_t
tRowBuild
(
SArray
*
aColVal
,
STSchema
*
pTSchema
,
SRow
**
ppRow
);
void
tRowGet
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
int32_t
iCol
,
SColVal
*
pColVal
);
void
tRowDestroy
(
SRow
*
pRow
);
int32_t
tRowMergeSort
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int8_t
flag
);
void
tRowSort
(
SArray
*
aRowP
);
int32_t
tRowMerge
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int8_t
flag
);
// SRowIter ================================
int32_t
tRowIterOpen
(
SRow
*
pRow
,
STSchema
*
pTSchema
,
SRowIter
**
ppIter
);
...
...
source/common/src/tdataformat.c
浏览文件 @
932116e4
...
...
@@ -527,7 +527,7 @@ static int32_t tRowPCmprFn(const void *p1, const void *p2) {
return
0
;
}
static
void
tRowPDestroy
(
SRow
**
ppRow
)
{
tRowDestroy
(
*
ppRow
);
}
static
int32_t
tRowMerge
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int32_t
iStart
,
int32_t
iEnd
,
int8_t
flag
)
{
static
int32_t
tRowMerge
Impl
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int32_t
iStart
,
int32_t
iEnd
,
int8_t
flag
)
{
int32_t
code
=
0
;
int32_t
nRow
=
iEnd
-
iStart
;
...
...
@@ -591,12 +591,14 @@ _exit:
if
(
code
)
tRowDestroy
(
pRow
);
return
code
;
}
int32_t
tRowMergeSort
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int8_t
flag
)
{
if
(
aRowP
->
size
<=
1
)
return
0
;
int32_t
code
=
0
;
void
tRowSort
(
SArray
*
aRowP
)
{
if
(
TARRAY_SIZE
(
aRowP
)
<=
1
)
return
;
taosArraySort
(
aRowP
,
tRowPCmprFn
);
}
int32_t
tRowMerge
(
SArray
*
aRowP
,
STSchema
*
pTSchema
,
int8_t
flag
)
{
int32_t
code
=
0
;
int32_t
iStart
=
0
;
while
(
iStart
<
aRowP
->
size
)
{
...
...
@@ -612,7 +614,7 @@ int32_t tRowMergeSort(SArray *aRowP, STSchema *pTSchema, int8_t flag) {
}
if
(
iEnd
-
iStart
>
1
)
{
code
=
tRowMerge
(
aRowP
,
pTSchema
,
iStart
,
iEnd
,
flag
);
code
=
tRowMerge
Impl
(
aRowP
,
pTSchema
,
iStart
,
iEnd
,
flag
);
}
// the array is also changing, so the iStart just ++ instead of iEnd
...
...
@@ -2186,7 +2188,6 @@ int32_t tGetColData(uint8_t *pBuf, SColData *pColData) {
n
+=
pColData
->
nData
;
}
else
{
pColData
->
nData
=
TYPE_BYTES
[
pColData
->
type
]
*
pColData
->
nVal
;
pColData
->
nData
=
pBuf
+
n
;
n
+=
pColData
->
nData
;
}
}
...
...
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
932116e4
...
...
@@ -115,13 +115,13 @@ int32_t tsdbRowCmprFn(const void *p1, const void *p2);
void
tsdbRowIterInit
(
STSDBRowIter
*
pIter
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
SColVal
*
tsdbRowIterNext
(
STSDBRowIter
*
pIter
);
// SRowMerger
int32_t
tRowMergerInit2
(
SRowMerger
*
pMerger
,
STSchema
*
pResTSchema
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
int32_t
tRowMergerAdd
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
int32_t
t
sdb
RowMergerInit2
(
SRowMerger
*
pMerger
,
STSchema
*
pResTSchema
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
int32_t
t
sdb
RowMergerAdd
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
int32_t
tRowMergerInit
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
void
tRowMergerClear
(
SRowMerger
*
pMerger
);
int32_t
tRowMerge
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
);
int32_t
tRowMergerGetRow
(
SRowMerger
*
pMerger
,
SRow
**
ppRow
);
int32_t
t
sdb
RowMergerInit
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
);
void
t
sdb
RowMergerClear
(
SRowMerger
*
pMerger
);
int32_t
t
sdb
RowMerge
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
);
int32_t
t
sdb
RowMergerGetRow
(
SRowMerger
*
pMerger
,
SRow
**
ppRow
);
// TABLEID
int32_t
tTABLEIDCmprFn
(
const
void
*
p1
,
const
void
*
p2
);
// TSDBKEY
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
932116e4
...
...
@@ -261,12 +261,12 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, SR
SRowMerger merger = {0};
STSchema *pTSchema = metaGetTbTSchema(pTsdb->pVnode->pMeta, uid, -1, 1);
tRowMergerInit(&merger, &tsdbRowFromTSRow(0, cacheRow), pTSchema);
t
sdb
RowMergerInit(&merger, &tsdbRowFromTSRow(0, cacheRow), pTSchema);
tRowMerge(&merger, &tsdbRowFromTSRow(1, row));
t
sdb
RowMerge(&merger, &tsdbRowFromTSRow(1, row));
tRowMergerGetRow(&merger, &mergedRow);
tRowMergerClear(&merger);
t
sdb
RowMergerGetRow(&merger, &mergedRow);
t
sdb
RowMergerClear(&merger);
taosMemoryFreeClear(pTSchema);
...
...
source/dnode/vnode/src/tsdb/tsdbRead.c
浏览文件 @
932116e4
...
...
@@ -1777,7 +1777,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
pReader
->
order
==
TSDB_ORDER_ASC
)
{
if
(
minKey
==
key
)
{
init
=
true
;
int32_t
code
=
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1787,10 +1787,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
tsLast
)
{
TSDBROW
fRow1
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
if
(
init
)
{
tRowMerge
(
&
merge
,
&
fRow1
);
t
sdb
RowMerge
(
&
merge
,
&
fRow1
);
}
else
{
init
=
true
;
int32_t
code
=
tRowMergerInit
(
&
merge
,
&
fRow1
,
pReader
->
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow1
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1800,11 +1800,11 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
k
.
ts
)
{
if
(
init
)
{
tRowMerge
(
&
merge
,
pRow
);
t
sdb
RowMerge
(
&
merge
,
pRow
);
}
else
{
init
=
true
;
STSchema
*
pSchema
=
doGetSchemaForTSRow
(
TSDBROW_SVERSION
(
pRow
),
pReader
,
pBlockScanInfo
->
uid
);
int32_t
code
=
tRowMergerInit
(
&
merge
,
pRow
,
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
pRow
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1818,7 +1818,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
k
.
ts
)
{
init
=
true
;
STSchema
*
pSchema
=
doGetSchemaForTSRow
(
TSDBROW_SVERSION
(
pRow
),
pReader
,
pBlockScanInfo
->
uid
);
int32_t
code
=
tRowMergerInit
(
&
merge
,
pRow
,
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
pRow
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1832,10 +1832,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
tsLast
)
{
TSDBROW
fRow1
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
if
(
init
)
{
tRowMerge
(
&
merge
,
&
fRow1
);
t
sdb
RowMerge
(
&
merge
,
&
fRow1
);
}
else
{
init
=
true
;
int32_t
code
=
tRowMergerInit
(
&
merge
,
&
fRow1
,
pReader
->
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow1
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1845,10 +1845,10 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
key
)
{
if
(
init
)
{
tRowMerge
(
&
merge
,
&
fRow
);
t
sdb
RowMerge
(
&
merge
,
&
fRow
);
}
else
{
init
=
true
;
int32_t
code
=
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1857,7 +1857,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
}
}
int32_t
code
=
tRowMergerGetRow
(
&
merge
,
&
pTSRow
);
int32_t
code
=
t
sdb
RowMergerGetRow
(
&
merge
,
&
pTSRow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1865,7 +1865,7 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo*
doAppendRowFromTSRow
(
pReader
->
pResBlock
,
pReader
,
pTSRow
,
pBlockScanInfo
);
taosMemoryFree
(
pTSRow
);
tRowMergerClear
(
&
merge
);
t
sdb
RowMergerClear
(
&
merge
);
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -1886,16 +1886,16 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
pBlockScanInfo
->
lastKey
=
tsLastBlock
;
return
TSDB_CODE_SUCCESS
;
}
else
{
int32_t
code
=
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
TSDBROW
fRow1
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
tRowMerge
(
&
merge
,
&
fRow1
);
t
sdb
RowMerge
(
&
merge
,
&
fRow1
);
doMergeRowsInLastBlock
(
pLastBlockReader
,
pBlockScanInfo
,
tsLastBlock
,
&
merge
,
&
pReader
->
verRange
);
code
=
tRowMergerGetRow
(
&
merge
,
&
pTSRow
);
code
=
t
sdb
RowMergerGetRow
(
&
merge
,
&
pTSRow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1903,10 +1903,10 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
doAppendRowFromTSRow
(
pReader
->
pResBlock
,
pReader
,
pTSRow
,
pBlockScanInfo
);
taosMemoryFree
(
pTSRow
);
tRowMergerClear
(
&
merge
);
t
sdb
RowMergerClear
(
&
merge
);
}
}
else
{
// not merge block data
int32_t
code
=
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1919,7 +1919,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
doMergeRowsInFileBlocks
(
pBlockData
,
pBlockScanInfo
,
pReader
,
&
merge
);
}
code
=
tRowMergerGetRow
(
&
merge
,
&
pTSRow
);
code
=
t
sdb
RowMergerGetRow
(
&
merge
,
&
pTSRow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1927,7 +1927,7 @@ static int32_t doMergeFileBlockAndLastBlock(SLastBlockReader* pLastBlockReader,
doAppendRowFromTSRow
(
pReader
->
pResBlock
,
pReader
,
pTSRow
,
pBlockScanInfo
);
taosMemoryFree
(
pTSRow
);
tRowMergerClear
(
&
merge
);
t
sdb
RowMergerClear
(
&
merge
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -1955,7 +1955,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
SRow
*
pTSRow
=
NULL
;
SRowMerger
merge
=
{
0
};
int32_t
code
=
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1963,11 +1963,11 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
doMergeRowsInFileBlocks
(
pBlockData
,
pBlockScanInfo
,
pReader
,
&
merge
);
TSDBROW
fRow1
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
tRowMerge
(
&
merge
,
&
fRow1
);
t
sdb
RowMerge
(
&
merge
,
&
fRow1
);
doMergeRowsInLastBlock
(
pLastBlockReader
,
pBlockScanInfo
,
ts
,
&
merge
,
&
pReader
->
verRange
);
code
=
tRowMergerGetRow
(
&
merge
,
&
pTSRow
);
code
=
t
sdb
RowMergerGetRow
(
&
merge
,
&
pTSRow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -1975,7 +1975,7 @@ static int32_t mergeFileBlockAndLastBlock(STsdbReader* pReader, SLastBlockReader
doAppendRowFromTSRow
(
pReader
->
pResBlock
,
pReader
,
pTSRow
,
pBlockScanInfo
);
taosMemoryFree
(
pTSRow
);
tRowMergerClear
(
&
merge
);
t
sdb
RowMergerClear
(
&
merge
);
return
code
;
}
else
{
ASSERT
(
0
);
...
...
@@ -2056,7 +2056,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
key
)
{
init
=
true
;
TSDBROW
fRow
=
tsdbRowFromBlockData
(
pBlockData
,
pDumpInfo
->
rowIndex
);
code
=
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2067,10 +2067,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
tsLast
)
{
TSDBROW
fRow1
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
if
(
init
)
{
tRowMerge
(
&
merge
,
&
fRow1
);
t
sdb
RowMerge
(
&
merge
,
&
fRow1
);
}
else
{
init
=
true
;
code
=
tRowMergerInit
(
&
merge
,
&
fRow1
,
pReader
->
pSchema
);
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow1
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2081,7 +2081,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
ik
.
ts
)
{
if
(
init
)
{
tRowMerge
(
&
merge
,
piRow
);
t
sdb
RowMerge
(
&
merge
,
piRow
);
}
else
{
init
=
true
;
STSchema
*
pSchema
=
doGetSchemaForTSRow
(
TSDBROW_SVERSION
(
piRow
),
pReader
,
pBlockScanInfo
->
uid
);
...
...
@@ -2089,7 +2089,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
return
code
;
}
code
=
tRowMergerInit
(
&
merge
,
piRow
,
pSchema
);
code
=
t
sdb
RowMergerInit
(
&
merge
,
piRow
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2108,10 +2108,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
return
code
;
}
tRowMerge
(
&
merge
,
pRow
);
t
sdb
RowMerge
(
&
merge
,
pRow
);
}
else
{
STSchema
*
pSchema
=
doGetSchemaForTSRow
(
TSDBROW_SVERSION
(
pRow
),
pReader
,
pBlockScanInfo
->
uid
);
code
=
tRowMergerInit
(
&
merge
,
pRow
,
pSchema
);
code
=
t
sdb
RowMergerInit
(
&
merge
,
pRow
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2126,7 +2126,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
k
.
ts
)
{
init
=
true
;
STSchema
*
pSchema
=
doGetSchemaForTSRow
(
TSDBROW_SVERSION
(
pRow
),
pReader
,
pBlockScanInfo
->
uid
);
code
=
tRowMergerInit
(
&
merge
,
pRow
,
pSchema
);
code
=
t
sdb
RowMergerInit
(
&
merge
,
pRow
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2140,11 +2140,11 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
ik
.
ts
)
{
if
(
init
)
{
tRowMerge
(
&
merge
,
piRow
);
t
sdb
RowMerge
(
&
merge
,
piRow
);
}
else
{
init
=
true
;
STSchema
*
pSchema
=
doGetSchemaForTSRow
(
TSDBROW_SVERSION
(
piRow
),
pReader
,
pBlockScanInfo
->
uid
);
code
=
tRowMergerInit
(
&
merge
,
piRow
,
pSchema
);
code
=
t
sdb
RowMergerInit
(
&
merge
,
piRow
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2159,10 +2159,10 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
tsLast
)
{
TSDBROW
fRow1
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
if
(
init
)
{
tRowMerge
(
&
merge
,
&
fRow1
);
t
sdb
RowMerge
(
&
merge
,
&
fRow1
);
}
else
{
init
=
true
;
code
=
tRowMergerInit
(
&
merge
,
&
fRow1
,
pReader
->
pSchema
);
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow1
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2173,7 +2173,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
minKey
==
key
)
{
TSDBROW
fRow
=
tsdbRowFromBlockData
(
pBlockData
,
pDumpInfo
->
rowIndex
);
if
(
!
init
)
{
code
=
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2181,7 +2181,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
if
(
merge
.
pTSchema
==
NULL
)
{
return
code
;
}
tRowMerge
(
&
merge
,
&
fRow
);
t
sdb
RowMerge
(
&
merge
,
&
fRow
);
}
doMergeRowsInFileBlocks
(
pBlockData
,
pBlockScanInfo
,
pReader
,
&
merge
);
}
...
...
@@ -2191,7 +2191,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
return
code
;
}
code
=
tRowMergerGetRow
(
&
merge
,
&
pTSRow
);
code
=
t
sdb
RowMergerGetRow
(
&
merge
,
&
pTSRow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2199,7 +2199,7 @@ static int32_t doMergeMultiLevelRows(STsdbReader* pReader, STableBlockScanInfo*
doAppendRowFromTSRow
(
pReader
->
pResBlock
,
pReader
,
pTSRow
,
pBlockScanInfo
);
taosMemoryFree
(
pTSRow
);
tRowMergerClear
(
&
merge
);
t
sdb
RowMergerClear
(
&
merge
);
return
code
;
}
...
...
@@ -2356,13 +2356,13 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc
SRow
*
pTSRow
=
NULL
;
SRowMerger
merge
=
{
0
};
int32_t
code
=
tRowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
&
fRow
,
pReader
->
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
doMergeRowsInFileBlocks
(
pBlockData
,
pBlockScanInfo
,
pReader
,
&
merge
);
code
=
tRowMergerGetRow
(
&
merge
,
&
pTSRow
);
code
=
t
sdb
RowMergerGetRow
(
&
merge
,
&
pTSRow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -2370,7 +2370,7 @@ int32_t mergeRowsInFileBlocks(SBlockData* pBlockData, STableBlockScanInfo* pBloc
doAppendRowFromTSRow
(
pReader
->
pResBlock
,
pReader
,
pTSRow
,
pBlockScanInfo
);
taosMemoryFree
(
pTSRow
);
tRowMergerClear
(
&
merge
);
t
sdb
RowMergerClear
(
&
merge
);
return
TSDB_CODE_SUCCESS
;
}
}
...
...
@@ -3232,7 +3232,7 @@ int32_t doMergeRowsInBuf(SIterInfo* pIter, uint64_t uid, int64_t ts, SArray* pDe
return
terrno
;
}
tRowMergerAdd
(
pMerger
,
pRow
,
pTSchema
);
t
sdb
RowMergerAdd
(
pMerger
,
pRow
,
pTSchema
);
}
return
TSDB_CODE_SUCCESS
;
...
...
@@ -3247,7 +3247,7 @@ static int32_t doMergeRowsInFileBlockImpl(SBlockData* pBlockData, int32_t rowInd
}
TSDBROW
fRow
=
tsdbRowFromBlockData
(
pBlockData
,
rowIndex
);
tRowMerge
(
pMerger
,
&
fRow
);
t
sdb
RowMerge
(
pMerger
,
&
fRow
);
rowIndex
+=
step
;
}
...
...
@@ -3344,7 +3344,7 @@ int32_t doMergeRowsInLastBlock(SLastBlockReader* pLastBlockReader, STableBlockSc
int64_t
next1
=
getCurrentKeyInLastBlock
(
pLastBlockReader
);
if
(
next1
==
ts
)
{
TSDBROW
fRow1
=
tMergeTreeGetRow
(
&
pLastBlockReader
->
mergeTree
);
tRowMerge
(
pMerger
,
&
fRow1
);
t
sdb
RowMerge
(
pMerger
,
&
fRow1
);
}
else
{
break
;
}
...
...
@@ -3394,7 +3394,7 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
pReader
->
pSchema
=
pTSchema
;
}
int32_t
code
=
tRowMergerInit2
(
&
merge
,
pReader
->
pSchema
,
&
current
,
pTSchema
);
int32_t
code
=
t
sdb
RowMergerInit2
(
&
merge
,
pReader
->
pSchema
,
&
current
,
pTSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -3404,19 +3404,19 @@ int32_t doMergeMemTableMultiRows(TSDBROW* pRow, uint64_t uid, SIterInfo* pIter,
return
terrno
;
}
tRowMergerAdd
(
&
merge
,
pNextRow
,
pTSchema1
);
t
sdb
RowMergerAdd
(
&
merge
,
pNextRow
,
pTSchema1
);
code
=
doMergeRowsInBuf
(
pIter
,
uid
,
current
.
pTSRow
->
ts
,
pDelList
,
&
merge
,
pReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
code
=
tRowMergerGetRow
(
&
merge
,
pTSRow
);
code
=
t
sdb
RowMergerGetRow
(
&
merge
,
pTSRow
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
tRowMergerClear
(
&
merge
);
t
sdb
RowMergerClear
(
&
merge
);
*
freeTSRow
=
true
;
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -3431,7 +3431,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
if
(
ASCENDING_TRAVERSE
(
pReader
->
order
))
{
// ascending order imem --> mem
STSchema
*
pSchema
=
doGetSchemaForTSRow
(
TSDBROW_SVERSION
(
pRow
),
pReader
,
pBlockScanInfo
->
uid
);
int32_t
code
=
tRowMergerInit
(
&
merge
,
piRow
,
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
piRow
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
return
code
;
}
...
...
@@ -3442,7 +3442,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
return
code
;
}
tRowMerge
(
&
merge
,
pRow
);
t
sdb
RowMerge
(
&
merge
,
pRow
);
code
=
doMergeRowsInBuf
(
&
pBlockScanInfo
->
iter
,
pBlockScanInfo
->
uid
,
k
.
ts
,
pBlockScanInfo
->
delSkyline
,
&
merge
,
pReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -3452,7 +3452,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
}
else
{
STSchema
*
pSchema
=
doGetSchemaForTSRow
(
TSDBROW_SVERSION
(
pRow
),
pReader
,
pBlockScanInfo
->
uid
);
int32_t
code
=
tRowMergerInit
(
&
merge
,
pRow
,
pSchema
);
int32_t
code
=
t
sdb
RowMergerInit
(
&
merge
,
pRow
,
pSchema
);
if
(
code
!=
TSDB_CODE_SUCCESS
||
merge
.
pTSchema
==
NULL
)
{
return
code
;
}
...
...
@@ -3463,7 +3463,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
return
code
;
}
tRowMerge
(
&
merge
,
piRow
);
t
sdb
RowMerge
(
&
merge
,
piRow
);
code
=
doMergeRowsInBuf
(
&
pBlockScanInfo
->
iiter
,
pBlockScanInfo
->
uid
,
ik
.
ts
,
pBlockScanInfo
->
delSkyline
,
&
merge
,
pReader
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
...
...
@@ -3471,7 +3471,7 @@ int32_t doMergeMemIMemRows(TSDBROW* pRow, TSDBROW* piRow, STableBlockScanInfo* p
}
}
int32_t
code
=
tRowMergerGetRow
(
&
merge
,
pTSRow
);
int32_t
code
=
t
sdb
RowMergerGetRow
(
&
merge
,
pTSRow
);
return
code
;
}
...
...
source/dnode/vnode/src/tsdb/tsdbUtil.c
浏览文件 @
932116e4
...
...
@@ -642,7 +642,7 @@ SColVal *tsdbRowIterNext(STSDBRowIter *pIter) {
// SRowMerger ======================================================
int32_t
tRowMergerInit2
(
SRowMerger
*
pMerger
,
STSchema
*
pResTSchema
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
)
{
int32_t
t
sdb
RowMergerInit2
(
SRowMerger
*
pMerger
,
STSchema
*
pResTSchema
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
)
{
int32_t
code
=
0
;
TSDBKEY
key
=
TSDBROW_KEY
(
pRow
);
SColVal
*
pColVal
=
&
(
SColVal
){
0
};
...
...
@@ -697,7 +697,7 @@ _exit:
return
code
;
}
int32_t
tRowMergerAdd
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
)
{
int32_t
t
sdb
RowMergerAdd
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
)
{
int32_t
code
=
0
;
TSDBKEY
key
=
TSDBROW_KEY
(
pRow
);
SColVal
*
pColVal
=
&
(
SColVal
){
0
};
...
...
@@ -736,7 +736,7 @@ int32_t tRowMergerAdd(SRowMerger *pMerger, TSDBROW *pRow, STSchema *pTSchema) {
return
code
;
}
int32_t
tRowMergerInit
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
)
{
int32_t
t
sdb
RowMergerInit
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
,
STSchema
*
pTSchema
)
{
int32_t
code
=
0
;
TSDBKEY
key
=
TSDBROW_KEY
(
pRow
);
SColVal
*
pColVal
=
&
(
SColVal
){
0
};
...
...
@@ -775,9 +775,9 @@ _exit:
return
code
;
}
void
tRowMergerClear
(
SRowMerger
*
pMerger
)
{
taosArrayDestroy
(
pMerger
->
pArray
);
}
void
t
sdb
RowMergerClear
(
SRowMerger
*
pMerger
)
{
taosArrayDestroy
(
pMerger
->
pArray
);
}
int32_t
tRowMerge
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
)
{
int32_t
t
sdb
RowMerge
(
SRowMerger
*
pMerger
,
TSDBROW
*
pRow
)
{
int32_t
code
=
0
;
TSDBKEY
key
=
TSDBROW_KEY
(
pRow
);
SColVal
*
pColVal
=
&
(
SColVal
){
0
};
...
...
@@ -807,7 +807,7 @@ _exit:
return
code
;
}
int32_t
tRowMergerGetRow
(
SRowMerger
*
pMerger
,
SRow
**
ppRow
)
{
int32_t
t
sdb
RowMergerGetRow
(
SRowMerger
*
pMerger
,
SRow
**
ppRow
)
{
return
tRowBuild
(
pMerger
->
pArray
,
pMerger
->
pTSchema
,
ppRow
);
}
...
...
source/libs/parser/src/parInsertUtil.c
浏览文件 @
932116e4
...
...
@@ -1197,8 +1197,9 @@ int32_t insMergeTableDataCxt(SHashObj* pTableHash, SArray** pVgDataBlocks) {
while
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
p
)
{
STableDataCxt
*
pTableCxt
=
*
(
STableDataCxt
**
)
p
;
if
(
pTableCxt
->
ordered
)
{
code
=
tRowMergeSort
(
pTableCxt
->
pData
->
aRowP
,
pTableCxt
->
pSchema
,
0
);
tRowSort
(
pTableCxt
->
pData
->
aRowP
);
}
code
=
tRowMerge
(
pTableCxt
->
pData
->
aRowP
,
pTableCxt
->
pSchema
,
0
);
if
(
TSDB_CODE_SUCCESS
==
code
)
{
SVgroupDataCxt
*
pVgCxt
=
NULL
;
int32_t
vgId
=
pTableCxt
->
pMeta
->
vgId
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录