Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
85343a0e
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
85343a0e
编写于
10月 11, 2021
作者:
C
Cary Xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TS-414]<fix>: pCol->len logic fix for partial update of columns
上级
26993d55
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
36 addition
and
20 deletion
+36
-20
src/common/inc/tdataformat.h
src/common/inc/tdataformat.h
+10
-2
src/common/src/tdataformat.c
src/common/src/tdataformat.c
+22
-15
src/tsdb/src/tsdbCommit.c
src/tsdb/src/tsdbCommit.c
+3
-2
src/tsdb/src/tsdbMemTable.c
src/tsdb/src/tsdbMemTable.c
+1
-1
未找到文件。
src/common/inc/tdataformat.h
浏览文件 @
85343a0e
...
...
@@ -339,7 +339,15 @@ static FORCE_INLINE void dataColReset(SDataCol *pDataCol) { pDataCol->len = 0; }
int
tdAllocMemForCol
(
SDataCol
*
pCol
,
int
maxPoints
);
void
dataColInit
(
SDataCol
*
pDataCol
,
STColumn
*
pCol
,
int
maxPoints
);
int
dataColAppendVal
(
SDataCol
*
pCol
,
const
void
*
value
,
int
numOfRows
,
int
maxPoints
);
// value from timestamp should be TKEY here instead of TSKEY
int
dataColAppendValEx
(
SDataCol
*
pCol
,
const
void
*
value
,
int
numOfRows
,
int
maxPoints
,
bool
isAppend
);
// value from timestamp should be TKEY here instead of TSKEY
FORCE_INLINE
int
dataColAppendVal
(
SDataCol
*
pCol
,
const
void
*
value
,
int
numOfRows
,
int
maxPoints
)
{
return
dataColAppendValEx
(
pCol
,
value
,
numOfRows
,
maxPoints
,
true
);
}
void
dataColSetOffset
(
SDataCol
*
pCol
,
int
nEle
);
bool
isNEleNull
(
SDataCol
*
pCol
,
int
nEle
);
...
...
@@ -670,7 +678,7 @@ static FORCE_INLINE char *memRowEnd(SMemRow row) {
#define memRowDeleted(r) TKEY_IS_DELETED(memRowTKey(r))
SMemRow
tdMemRowDup
(
SMemRow
row
);
void
tdAppendMemRowToDataCol
(
SMemRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
forceSetNull
);
void
tdAppendMemRowToDataCol
(
SMemRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
forceSetNull
,
bool
isAppend
);
// NOTE: offset here including the header size
static
FORCE_INLINE
void
*
tdGetMemRowDataOfCol
(
void
*
row
,
int16_t
colId
,
int8_t
colType
,
uint16_t
offset
)
{
...
...
src/common/src/tdataformat.c
浏览文件 @
85343a0e
...
...
@@ -240,7 +240,7 @@ void dataColInit(SDataCol *pDataCol, STColumn *pCol, int maxPoints) {
pDataCol
->
len
=
0
;
}
// value from timestamp should be TKEY here instead of TSKEY
int
dataColAppendVal
(
SDataCol
*
pCol
,
const
void
*
value
,
int
numOfRows
,
int
maxPoints
)
{
int
dataColAppendVal
Ex
(
SDataCol
*
pCol
,
const
void
*
value
,
int
numOfRows
,
int
maxPoints
,
bool
isAppend
)
{
ASSERT
(
pCol
!=
NULL
&&
value
!=
NULL
);
if
(
isAllRowsNull
(
pCol
))
{
...
...
@@ -264,9 +264,15 @@ int dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPo
// Update the length
pCol
->
len
+=
varDataTLen
(
value
);
}
else
{
ASSERT
(
pCol
->
len
==
TYPE_BYTES
[
pCol
->
type
]
*
numOfRows
);
memcpy
(
POINTER_SHIFT
(
pCol
->
pData
,
pCol
->
len
),
value
,
pCol
->
bytes
);
pCol
->
len
+=
pCol
->
bytes
;
if
(
isAppend
)
{
// append the value
ASSERT
(
pCol
->
len
==
TYPE_BYTES
[
pCol
->
type
]
*
numOfRows
);
memcpy
(
POINTER_SHIFT
(
pCol
->
pData
,
pCol
->
len
),
value
,
pCol
->
bytes
);
pCol
->
len
+=
pCol
->
bytes
;
}
else
{
// update the value of last row by increasing the pCol->len and keeping the original numOfRows
ASSERT
((
pCol
->
len
==
TYPE_BYTES
[
pCol
->
type
]
*
(
numOfRows
+
1
))
&&
(
pCol
->
len
>
TYPE_BYTES
[
pCol
->
type
]));
memcpy
(
POINTER_SHIFT
(
pCol
->
pData
,
pCol
->
len
-
TYPE_BYTES
[
pCol
->
type
]),
value
,
pCol
->
bytes
);
}
}
return
0
;
}
...
...
@@ -441,7 +447,8 @@ void tdResetDataCols(SDataCols *pCols) {
}
}
static
void
tdAppendDataRowToDataCol
(
SDataRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
forceSetNull
)
{
static
void
tdAppendDataRowToDataCol
(
SDataRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
forceSetNull
,
bool
isAppend
)
{
ASSERT
(
pCols
->
numOfRows
==
0
||
dataColsKeyLast
(
pCols
)
<
dataRowKey
(
row
));
int
rcol
=
0
;
...
...
@@ -451,7 +458,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
bool
setCol
=
0
;
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
schemaNCols
(
pSchema
))
{
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
Ex
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
,
isAppend
);
dcol
++
;
continue
;
}
...
...
@@ -460,14 +467,14 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
if
(
pRowCol
->
colId
==
pDataCol
->
colId
)
{
void
*
value
=
tdGetRowDataOfCol
(
row
,
pRowCol
->
type
,
pRowCol
->
offset
+
TD_DATA_ROW_HEAD_SIZE
);
if
(
!
isNull
(
value
,
pDataCol
->
type
))
setCol
=
1
;
dataColAppendVal
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
Ex
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
isAppend
);
dcol
++
;
rcol
++
;
}
else
if
(
pRowCol
->
colId
<
pDataCol
->
colId
)
{
rcol
++
;
}
else
{
if
(
forceSetNull
||
setCol
)
{
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
Ex
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
,
isAppend
);
}
dcol
++
;
}
...
...
@@ -475,7 +482,7 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
pCols
->
numOfRows
++
;
}
static
void
tdAppendKvRowToDataCol
(
SKVRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
forceSetNull
)
{
static
void
tdAppendKvRowToDataCol
(
SKVRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
forceSetNull
,
bool
isAppend
)
{
ASSERT
(
pCols
->
numOfRows
==
0
||
dataColsKeyLast
(
pCols
)
<
kvRowKey
(
row
));
int
rcol
=
0
;
...
...
@@ -487,7 +494,7 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
bool
setCol
=
0
;
SDataCol
*
pDataCol
=
&
(
pCols
->
cols
[
dcol
]);
if
(
rcol
>=
nRowCols
||
rcol
>=
schemaNCols
(
pSchema
))
{
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
Ex
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
,
isAppend
);
++
dcol
;
continue
;
}
...
...
@@ -497,14 +504,14 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
if
(
colIdx
->
colId
==
pDataCol
->
colId
)
{
void
*
value
=
tdGetKvRowDataOfCol
(
row
,
colIdx
->
offset
);
if
(
!
isNull
(
value
,
pDataCol
->
type
))
setCol
=
1
;
dataColAppendVal
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
Ex
(
pDataCol
,
value
,
pCols
->
numOfRows
,
pCols
->
maxPoints
,
isAppend
);
++
dcol
;
++
rcol
;
}
else
if
(
colIdx
->
colId
<
pDataCol
->
colId
)
{
++
rcol
;
}
else
{
if
(
forceSetNull
||
setCol
)
{
dataColAppendVal
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
);
dataColAppendVal
Ex
(
pDataCol
,
getNullValue
(
pDataCol
->
type
),
pCols
->
numOfRows
,
pCols
->
maxPoints
,
isAppend
);
}
++
dcol
;
}
...
...
@@ -512,11 +519,11 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
pCols
->
numOfRows
++
;
}
void
tdAppendMemRowToDataCol
(
SMemRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
forceSetNull
)
{
void
tdAppendMemRowToDataCol
(
SMemRow
row
,
STSchema
*
pSchema
,
SDataCols
*
pCols
,
bool
forceSetNull
,
bool
isAppend
)
{
if
(
isDataRow
(
row
))
{
tdAppendDataRowToDataCol
(
memRowDataBody
(
row
),
pSchema
,
pCols
,
forceSetNull
);
tdAppendDataRowToDataCol
(
memRowDataBody
(
row
),
pSchema
,
pCols
,
forceSetNull
,
isAppend
);
}
else
if
(
isKvRow
(
row
))
{
tdAppendKvRowToDataCol
(
memRowKvBody
(
row
),
pSchema
,
pCols
,
forceSetNull
);
tdAppendKvRowToDataCol
(
memRowKvBody
(
row
),
pSchema
,
pCols
,
forceSetNull
,
isAppend
);
}
else
{
ASSERT
(
0
);
}
...
...
src/tsdb/src/tsdbCommit.c
浏览文件 @
85343a0e
...
...
@@ -1288,7 +1288,7 @@ static void tsdbLoadAndMergeFromCache(SDataCols *pDataCols, int *iter, SCommitIt
ASSERT
(
pSchema
!=
NULL
);
}
tdAppendMemRowToDataCol
(
row
,
pSchema
,
pTarget
,
true
);
tdAppendMemRowToDataCol
(
row
,
pSchema
,
pTarget
,
true
,
true
);
tSkipListIterNext
(
pCommitIter
->
pIter
);
}
else
{
...
...
@@ -1310,7 +1310,8 @@ static void tsdbLoadAndMergeFromCache(SDataCols *pDataCols, int *iter, SCommitIt
ASSERT
(
pSchema
!=
NULL
);
}
tdAppendMemRowToDataCol
(
row
,
pSchema
,
pTarget
,
update
==
TD_ROW_OVERWRITE_UPDATE
);
tdAppendMemRowToDataCol
(
row
,
pSchema
,
pTarget
,
update
==
TD_ROW_OVERWRITE_UPDATE
,
update
!=
TD_ROW_PARTIAL_UPDATE
);
}
(
*
iter
)
++
;
tSkipListIterNext
(
pCommitIter
->
pIter
);
...
...
src/tsdb/src/tsdbMemTable.c
浏览文件 @
85343a0e
...
...
@@ -589,7 +589,7 @@ static int tsdbAppendTableRowToCols(STable *pTable, SDataCols *pCols, STSchema *
}
}
tdAppendMemRowToDataCol
(
row
,
*
ppSchema
,
pCols
,
true
);
tdAppendMemRowToDataCol
(
row
,
*
ppSchema
,
pCols
,
true
,
true
);
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录