Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
9e2188b1
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e2188b1
编写于
8月 05, 2021
作者:
L
Liu Jicong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
small improvements, fix potential bug for inserting
上级
e45b047e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
11 deletion
+10
-11
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+10
-11
未找到文件。
src/tsdb/src/tsdbMemTable.c
浏览文件 @
9e2188b1
...
...
@@ -702,11 +702,12 @@ static int tsdbScanAndConvertSubmitMsg(STsdbRepo *pRepo, SSubmitMsg *pMsg) {
}
//row1 has higher priority
static
SMemRow
tsdbInsertDupKeyMerge
(
SMemRow
row1
,
SMemRow
row2
,
STsdbRepo
*
pRepo
,
STSchema
**
ppSchema1
,
STSchema
**
ppSchema2
,
STable
*
pTable
,
int32_t
*
pAffectedRows
,
int64_t
*
pPoints
,
SMemRow
*
pLastRow
)
{
static
SMemRow
tsdbInsertDupKeyMerge
(
SMemRow
row1
,
SMemRow
row2
,
STsdbRepo
*
pRepo
,
STSchema
**
ppSchema1
,
STSchema
**
ppSchema2
,
STable
*
pTable
,
int32_t
*
pPoints
,
SMemRow
*
pLastRow
)
{
//for compatiblity, duplicate key inserted when update=0 should be also calculated as affected rows!
if
(
row1
==
NULL
&&
row2
==
NULL
&&
pRepo
->
config
.
update
==
TD_ROW_DISCARD_UPDATE
)
{
(
*
pAffectedRows
)
++
;
(
*
pPoints
)
++
;
return
NULL
;
}
...
...
@@ -715,7 +716,6 @@ static SMemRow tsdbInsertDupKeyMerge(SMemRow row1, SMemRow row2, STsdbRepo* pRep
void
*
pMem
=
tsdbAllocBytes
(
pRepo
,
memRowTLen
(
row1
));
if
(
pMem
==
NULL
)
return
NULL
;
memRowCpy
(
pMem
,
row1
);
(
*
pAffectedRows
)
++
;
(
*
pPoints
)
++
;
*
pLastRow
=
pMem
;
return
pMem
;
...
...
@@ -750,7 +750,6 @@ static SMemRow tsdbInsertDupKeyMerge(SMemRow row1, SMemRow row2, STsdbRepo* pRep
if
(
pMem
==
NULL
)
return
NULL
;
memRowCpy
(
pMem
,
tmp
);
(
*
pAffectedRows
)
++
;
(
*
pPoints
)
++
;
*
pLastRow
=
pMem
;
...
...
@@ -758,10 +757,10 @@ static SMemRow tsdbInsertDupKeyMerge(SMemRow row1, SMemRow row2, STsdbRepo* pRep
}
static
void
*
tsdbInsertDupKeyMergePacked
(
void
**
args
)
{
return
tsdbInsertDupKeyMerge
(
args
[
0
],
args
[
1
],
args
[
2
],
(
STSchema
**
)
&
args
[
3
],
(
STSchema
**
)
&
args
[
4
],
args
[
5
],
args
[
6
],
args
[
7
]
,
args
[
8
]
);
return
tsdbInsertDupKeyMerge
(
args
[
0
],
args
[
1
],
args
[
2
],
(
STSchema
**
)
&
args
[
3
],
(
STSchema
**
)
&
args
[
4
],
args
[
5
],
args
[
6
],
args
[
7
]);
}
static
void
tsdbSetupSkipListHookFns
(
SSkipList
*
pSkipList
,
STsdbRepo
*
pRepo
,
STable
*
pTable
,
int32_t
*
p
AffectedRows
,
int64_t
*
p
Points
,
SMemRow
*
pLastRow
)
{
static
void
tsdbSetupSkipListHookFns
(
SSkipList
*
pSkipList
,
STsdbRepo
*
pRepo
,
STable
*
pTable
,
int32_t
*
pPoints
,
SMemRow
*
pLastRow
)
{
if
(
pSkipList
->
insertHandleFn
==
NULL
)
{
tGenericSavedFunc
*
dupHandleSavedFunc
=
genericSavedFuncInit
((
GenericVaFunc
)
&
tsdbInsertDupKeyMergePacked
,
9
);
...
...
@@ -769,17 +768,16 @@ static void tsdbSetupSkipListHookFns(SSkipList* pSkipList, STsdbRepo *pRepo, STa
dupHandleSavedFunc
->
args
[
3
]
=
NULL
;
dupHandleSavedFunc
->
args
[
4
]
=
NULL
;
dupHandleSavedFunc
->
args
[
5
]
=
pTable
;
dupHandleSavedFunc
->
args
[
6
]
=
pAffectedRows
;
dupHandleSavedFunc
->
args
[
7
]
=
pPoints
;
dupHandleSavedFunc
->
args
[
8
]
=
pLastRow
;
pSkipList
->
insertHandleFn
=
dupHandleSavedFunc
;
}
pSkipList
->
insertHandleFn
->
args
[
6
]
=
pPoints
;
pSkipList
->
insertHandleFn
->
args
[
7
]
=
pLastRow
;
}
static
int
tsdbInsertDataToTable
(
STsdbRepo
*
pRepo
,
SSubmitBlk
*
pBlock
,
int32_t
*
pAffectedRows
)
{
STsdbMeta
*
pMeta
=
pRepo
->
tsdbMeta
;
int
64
_t
points
=
0
;
int
32
_t
points
=
0
;
STable
*
pTable
=
NULL
;
SSubmitBlkIter
blkIter
=
{
0
};
SMemTable
*
pMemTable
=
NULL
;
...
...
@@ -830,9 +828,10 @@ static int tsdbInsertDataToTable(STsdbRepo* pRepo, SSubmitBlk* pBlock, int32_t *
SMemRow
lastRow
=
NULL
;
int64_t
osize
=
SL_SIZE
(
pTableData
->
pData
);
tsdbSetupSkipListHookFns
(
pTableData
->
pData
,
pRepo
,
pTable
,
pAffectedRows
,
&
points
,
&
lastRow
);
tsdbSetupSkipListHookFns
(
pTableData
->
pData
,
pRepo
,
pTable
,
&
points
,
&
lastRow
);
tSkipListPutBatchByIter
(
pTableData
->
pData
,
&
blkIter
,
(
iter_next_fn_t
)
tsdbGetSubmitBlkNext
);
int64_t
dsize
=
SL_SIZE
(
pTableData
->
pData
)
-
osize
;
(
*
pAffectedRows
)
+=
points
;
if
(
lastRow
!=
NULL
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录