Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
fc5d0668
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1181
Star
22014
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,发现更多精彩内容 >>
提交
fc5d0668
编写于
5月 24, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cache/last_row: treat none as null with last_row
上级
26bfa436
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
44 deletion
+44
-44
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+44
-44
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
fc5d0668
...
@@ -404,16 +404,47 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
...
@@ -404,16 +404,47 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
SColVal
*
pColVal
=
(
SColVal
*
)
taosArrayGet
(
aColVal
,
i
);
SColVal
*
pColVal
=
(
SColVal
*
)
taosArrayGet
(
aColVal
,
i
);
if
(
!
COL_VAL_IS_NONE
(
pColVal
))
{
// if (!COL_VAL_IS_NONE(pColVal)) {
SLastCol
*
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
+
num_keys
]);
SLastCol
*
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
+
num_keys
]);
if
(
NULL
==
pLastCol
||
pLastCol
->
ts
<=
keyTs
)
{
char
*
value
=
NULL
;
size_t
vlen
=
0
;
tsdbCacheSerialize
(
&
(
SLastCol
){.
ts
=
keyTs
,
.
colVal
=
*
pColVal
},
&
value
,
&
vlen
);
SLastKey
key
=
(
SLastKey
){.
ltype
=
0
,
.
uid
=
uid
,
.
cid
=
pColVal
->
cid
};
size_t
klen
=
ROCKS_KEY_LEN
;
rocksdb_writebatch_put
(
wb
,
(
char
*
)
&
key
,
klen
,
value
,
vlen
);
pLastCol
=
(
SLastCol
*
)
value
;
SLastCol
*
pTmpLastCol
=
taosMemoryCalloc
(
1
,
sizeof
(
SLastCol
));
*
pTmpLastCol
=
*
pLastCol
;
pLastCol
=
pTmpLastCol
;
reallocVarData
(
&
pLastCol
->
colVal
);
size_t
charge
=
sizeof
(
*
pLastCol
);
if
(
IS_VAR_DATA_TYPE
(
pLastCol
->
colVal
.
type
))
{
charge
+=
pLastCol
->
colVal
.
value
.
nData
;
}
LRUStatus
status
=
taosLRUCacheInsert
(
pTsdb
->
lruCache
,
&
key
,
ROCKS_KEY_LEN
,
pLastCol
,
charge
,
tsdbCacheDeleter
,
NULL
,
TAOS_LRU_PRIORITY_LOW
);
if
(
status
!=
TAOS_LRU_STATUS_OK
)
{
code
=
-
1
;
}
taosMemoryFree
(
value
);
}
if
(
COL_VAL_IS_VALUE
(
pColVal
))
{
SLastCol
*
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
]);
if
(
NULL
==
pLastCol
||
pLastCol
->
ts
<=
keyTs
)
{
if
(
NULL
==
pLastCol
||
pLastCol
->
ts
<=
keyTs
)
{
char
*
value
=
NULL
;
char
*
value
=
NULL
;
size_t
vlen
=
0
;
size_t
vlen
=
0
;
tsdbCacheSerialize
(
&
(
SLastCol
){.
ts
=
keyTs
,
.
colVal
=
*
pColVal
},
&
value
,
&
vlen
);
tsdbCacheSerialize
(
&
(
SLastCol
){.
ts
=
keyTs
,
.
colVal
=
*
pColVal
},
&
value
,
&
vlen
);
SLastKey
key
=
(
SLastKey
){.
ltype
=
0
,
.
uid
=
uid
,
.
cid
=
pColVal
->
cid
};
SLastKey
key
=
(
SLastKey
){.
ltype
=
1
,
.
uid
=
uid
,
.
cid
=
pColVal
->
cid
};
size_t
klen
=
ROCKS_KEY_LEN
;
rocksdb_writebatch_put
(
wb
,
(
char
*
)
&
key
,
klen
,
value
,
vlen
);
rocksdb_writebatch_put
(
wb
,
(
char
*
)
&
key
,
ROCKS_KEY_LEN
,
value
,
vlen
);
pLastCol
=
(
SLastCol
*
)
value
;
pLastCol
=
(
SLastCol
*
)
value
;
SLastCol
*
pTmpLastCol
=
taosMemoryCalloc
(
1
,
sizeof
(
SLastCol
));
SLastCol
*
pTmpLastCol
=
taosMemoryCalloc
(
1
,
sizeof
(
SLastCol
));
...
@@ -434,39 +465,8 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
...
@@ -434,39 +465,8 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
taosMemoryFree
(
value
);
taosMemoryFree
(
value
);
}
}
if
(
COL_VAL_IS_VALUE
(
pColVal
))
{
SLastCol
*
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
]);
if
(
NULL
==
pLastCol
||
pLastCol
->
ts
<=
keyTs
)
{
char
*
value
=
NULL
;
size_t
vlen
=
0
;
tsdbCacheSerialize
(
&
(
SLastCol
){.
ts
=
keyTs
,
.
colVal
=
*
pColVal
},
&
value
,
&
vlen
);
SLastKey
key
=
(
SLastKey
){.
ltype
=
1
,
.
uid
=
uid
,
.
cid
=
pColVal
->
cid
};
rocksdb_writebatch_put
(
wb
,
(
char
*
)
&
key
,
ROCKS_KEY_LEN
,
value
,
vlen
);
pLastCol
=
(
SLastCol
*
)
value
;
SLastCol
*
pTmpLastCol
=
taosMemoryCalloc
(
1
,
sizeof
(
SLastCol
));
*
pTmpLastCol
=
*
pLastCol
;
pLastCol
=
pTmpLastCol
;
reallocVarData
(
&
pLastCol
->
colVal
);
size_t
charge
=
sizeof
(
*
pLastCol
);
if
(
IS_VAR_DATA_TYPE
(
pLastCol
->
colVal
.
type
))
{
charge
+=
pLastCol
->
colVal
.
value
.
nData
;
}
LRUStatus
status
=
taosLRUCacheInsert
(
pTsdb
->
lruCache
,
&
key
,
ROCKS_KEY_LEN
,
pLastCol
,
charge
,
tsdbCacheDeleter
,
NULL
,
TAOS_LRU_PRIORITY_LOW
);
if
(
status
!=
TAOS_LRU_STATUS_OK
)
{
code
=
-
1
;
}
taosMemoryFree
(
value
);
}
}
}
}
//}
rocksdb_free
(
values_list
[
i
]);
rocksdb_free
(
values_list
[
i
]);
rocksdb_free
(
values_list
[
i
+
num_keys
]);
rocksdb_free
(
values_list
[
i
+
num_keys
]);
...
@@ -474,7 +474,7 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
...
@@ -474,7 +474,7 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
taosMemoryFree
(
values_list
);
taosMemoryFree
(
values_list
);
taosMemoryFree
(
values_list_sizes
);
taosMemoryFree
(
values_list_sizes
);
rocksMayWrite
(
pTsdb
,
fals
e
,
false
,
false
);
rocksMayWrite
(
pTsdb
,
tru
e
,
false
,
false
);
taosThreadMutexUnlock
(
&
pTsdb
->
rCache
.
rMutex
);
taosThreadMutexUnlock
(
&
pTsdb
->
rCache
.
rMutex
);
_exit:
_exit:
...
@@ -3010,17 +3010,17 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
...
@@ -3010,17 +3010,17 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
memcpy
(
pCol
->
colVal
.
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
memcpy
(
pCol
->
colVal
.
value
.
pData
,
pColVal
->
value
.
pData
,
pColVal
->
value
.
nData
);
}
}
if
(
COL_VAL_IS_NONE
(
pColVal
))
{
/*
if (COL_VAL_IS_NONE(pColVal)) {
if (!setNoneCol) {
if (!setNoneCol) {
noneCol = iCol;
noneCol = iCol;
setNoneCol = true;
setNoneCol = true;
}
}
}
else
{
} else {*/
int32_t
aColIndex
=
taosArraySearchIdx
(
aColArray
,
&
pColVal
->
cid
,
compareInt16Val
,
TD_EQ
);
int32_t
aColIndex
=
taosArraySearchIdx
(
aColArray
,
&
pColVal
->
cid
,
compareInt16Val
,
TD_EQ
);
if
(
aColIndex
>=
0
)
{
if
(
aColIndex
>=
0
)
{
taosArrayRemove
(
aColArray
,
aColIndex
);
taosArrayRemove
(
aColArray
,
aColIndex
);
}
}
}
//}
}
}
if
(
!
setNoneCol
)
{
if
(
!
setNoneCol
)
{
// done, goto return pColArray
// done, goto return pColArray
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录