Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
47f31a09
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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,发现更多精彩内容 >>
提交
47f31a09
编写于
7月 02, 2022
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tsdbCache/last: fix block data clear
上级
ac91127b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
14 deletion
+34
-14
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+34
-14
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
47f31a09
...
...
@@ -42,13 +42,21 @@ void tsdbCloseCache(SLRUCache *pCache) {
}
}
static
void
getTableCacheKey
(
tb_uid_t
uid
,
const
char
*
cacheType
,
char
*
key
,
int
*
len
)
{
int
keyLen
=
0
;
static
void
getTableCacheKeyS
(
tb_uid_t
uid
,
const
char
*
cacheType
,
char
*
key
,
int
*
len
)
{
snprintf
(
key
,
30
,
"%"
PRIi64
"%s"
,
uid
,
cacheType
);
*
len
=
strlen
(
key
);
}
static
void
getTableCacheKey
(
tb_uid_t
uid
,
int
cacheType
,
char
*
key
,
int
*
len
)
{
if
(
cacheType
==
0
)
{
// last_row
*
(
uint64_t
*
)
key
=
(
uint64_t
)
uid
;
}
else
{
// last
*
(
uint64_t
*
)
key
=
((
uint64_t
)
uid
)
|
0x8000000000000000
;
}
*
len
=
sizeof
(
uint64_t
);
}
static
void
deleteTableCacheLastrow
(
const
void
*
key
,
size_t
keyLen
,
void
*
value
)
{
taosMemoryFree
(
value
);
}
static
int32_t
tsdbCacheDeleteLastrow
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
TSKEY
eKey
)
{
...
...
@@ -56,7 +64,8 @@ static int32_t tsdbCacheDeleteLastrow(SLRUCache *pCache, tb_uid_t uid, TSKEY eKe
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
getTableCacheKey
(
uid
,
"lr"
,
key
,
&
keyLen
);
// getTableCacheKey(uid, "lr", key, &keyLen);
getTableCacheKey
(
uid
,
0
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
STSRow
*
pRow
=
(
STSRow
*
)
taosLRUCacheValue
(
pCache
,
h
);
...
...
@@ -77,7 +86,8 @@ static int32_t tsdbCacheDeleteLast(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey)
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
getTableCacheKey
(
uid
,
"l"
,
key
,
&
keyLen
);
// getTableCacheKey(uid, "l", key, &keyLen);
getTableCacheKey
(
uid
,
1
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
// clear last cache anyway, no matter where eKey ends.
...
...
@@ -95,7 +105,8 @@ int32_t tsdbCacheInsertLastrow(SLRUCache *pCache, STsdb *pTsdb, tb_uid_t uid, ST
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
getTableCacheKey
(
uid
,
"lr"
,
key
,
&
keyLen
);
// getTableCacheKey(uid, "lr", key, &keyLen);
getTableCacheKey
(
uid
,
0
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
cacheRow
=
(
STSRow
*
)
taosLRUCacheValue
(
pCache
,
h
);
...
...
@@ -164,7 +175,8 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, STSRow *row) {
((
void
)(
row
));
getTableCacheKey
(
uid
,
"l"
,
key
,
&
keyLen
);
// getTableCacheKey(uid, "l", key, &keyLen);
getTableCacheKey
(
uid
,
1
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
// clear last cache anyway, lazy load when get last lookup
...
...
@@ -341,6 +353,8 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
if
(
--
state
->
iFileSet
>=
0
)
{
pFileSet
=
(
SDFileSet
*
)
taosArrayGet
(
state
->
aDFileSet
,
state
->
iFileSet
);
}
else
{
tBlockDataClear
(
&
state
->
blockData
);
*
ppRow
=
NULL
;
return
code
;
}
...
...
@@ -407,7 +421,6 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow) {
if
(
state
->
aBlockIdx
)
{
taosArrayDestroy
(
state
->
aBlockIdx
);
}
tBlockDataClear
(
&
state
->
blockData
);
state
->
state
=
SFSNEXTROW_FILESET
;
}
...
...
@@ -879,6 +892,9 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) {
tRowMergerGetRow
(
&
merger
,
ppRow
);
tRowMergerClear
(
&
merger
);
}
}
else
{
*
ppRow
=
NULL
;
return
code
;
}
if
(
iCol
==
0
)
{
...
...
@@ -919,11 +935,11 @@ static int32_t mergeLast(tb_uid_t uid, STsdb *pTsdb, STSRow **ppRow) {
--
nilColCount
;
}
}
/*
if (*ppRow) {
taosMemoryFreeClear(*ppRow);
}
*/
continue
;
}
...
...
@@ -981,7 +997,8 @@ int32_t tsdbCacheGetLastrowH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUH
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
getTableCacheKey
(
uid
,
"lr"
,
key
,
&
keyLen
);
// getTableCacheKey(uid, "lr", key, &keyLen);
getTableCacheKey
(
uid
,
0
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
//*ppRow = (STSRow *)taosLRUCacheValue(pCache, h);
...
...
@@ -1014,7 +1031,8 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUHand
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
getTableCacheKey
(
uid
,
"l"
,
key
,
&
keyLen
);
// getTableCacheKey(uid, "l", key, &keyLen);
getTableCacheKey
(
uid
,
1
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
//*ppRow = (STSRow *)taosLRUCacheValue(pCache, h);
...
...
@@ -1049,7 +1067,8 @@ int32_t tsdbCacheDelete(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey) {
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
getTableCacheKey
(
uid
,
"lr"
,
key
,
&
keyLen
);
// getTableCacheKey(uid, "lr", key, &keyLen);
getTableCacheKey
(
uid
,
0
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
STSRow
*
pRow
=
(
STSRow
*
)
taosLRUCacheValue
(
pCache
,
h
);
...
...
@@ -1062,7 +1081,8 @@ int32_t tsdbCacheDelete(SLRUCache *pCache, tb_uid_t uid, TSKEY eKey) {
// void taosLRUCacheErase(SLRUCache * cache, const void *key, size_t keyLen);
}
getTableCacheKey
(
uid
,
"l"
,
key
,
&
keyLen
);
// getTableCacheKey(uid, "l", key, &keyLen);
getTableCacheKey
(
uid
,
1
,
key
,
&
keyLen
);
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
// clear last cache anyway, no matter where eKey ends.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录