Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8cd3bffb
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
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看板
提交
8cd3bffb
编写于
6月 29, 2022
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tsdbCache/delete: refine tsdbCacheDelete API
上级
ddb6745b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
42 addition
and
4 deletion
+42
-4
source/dnode/vnode/src/inc/tsdb.h
source/dnode/vnode/src/inc/tsdb.h
+1
-1
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+40
-2
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+1
-1
未找到文件。
source/dnode/vnode/src/inc/tsdb.h
浏览文件 @
8cd3bffb
...
...
@@ -258,7 +258,7 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUHand
int32_t
tsdbCacheGetLastrowH
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STsdb
*
pTsdb
,
LRUHandle
**
h
);
int32_t
tsdbCacheRelease
(
SLRUCache
*
pCache
,
LRUHandle
*
h
);
int32_t
tsdbCacheDelete
Lastrow
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
TSKEY
eKey
);
int32_t
tsdbCacheDelete
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
TSKEY
eKey
);
// structs =======================
typedef
struct
{
...
...
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
8cd3bffb
...
...
@@ -51,6 +51,44 @@ static void getTableCacheKey(tb_uid_t uid, const char *cacheType, char *key, int
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
)
{
int32_t
code
=
0
;
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
getTableCacheKey
(
uid
,
"lr"
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
STSRow
*
pRow
=
(
STSRow
*
)
taosLRUCacheValue
(
pCache
,
h
);
if
(
pRow
->
ts
<=
eKey
)
{
taosLRUCacheRelease
(
pCache
,
h
,
true
);
}
else
{
taosLRUCacheRelease
(
pCache
,
h
,
false
);
}
// void taosLRUCacheErase(SLRUCache * cache, const void *key, size_t keyLen);
}
return
code
;
}
static
int32_t
tsdbCacheDeleteLast
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
TSKEY
eKey
)
{
int32_t
code
=
0
;
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
getTableCacheKey
(
uid
,
"l"
,
key
,
&
keyLen
);
LRUHandle
*
h
=
taosLRUCacheLookup
(
pCache
,
key
,
keyLen
);
if
(
h
)
{
// clear last cache anyway, no matter where eKey ends.
taosLRUCacheRelease
(
pCache
,
h
,
true
);
// void taosLRUCacheErase(SLRUCache * cache, const void *key, size_t keyLen);
}
return
code
;
}
int32_t
tsdbCacheInsertLastrow
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
STSRow
*
row
)
{
int32_t
code
=
0
;
STSRow
*
cacheRow
=
NULL
;
...
...
@@ -97,7 +135,7 @@ int32_t tsdbCacheInsertLast(SLRUCache *pCache, tb_uid_t uid, STSRow *row) {
if
(
TD_ROW_LEN
(
row
)
<=
TD_ROW_LEN
(
cacheRow
))
{
tdRowCpy
(
cacheRow
,
row
);
}
else
{
tsdbCacheDeleteLast
row
(
pCache
,
uid
,
TSKEY_MAX
);
tsdbCacheDeleteLast
(
pCache
,
uid
,
TSKEY_MAX
);
tsdbCacheInsertLastrow
(
pCache
,
uid
,
row
);
}
}
...
...
@@ -1092,7 +1130,7 @@ int32_t tsdbCacheGetLastH(SLRUCache *pCache, tb_uid_t uid, STsdb *pTsdb, LRUHand
return
code
;
}
int32_t
tsdbCacheDelete
Lastrow
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
TSKEY
eKey
)
{
int32_t
tsdbCacheDelete
(
SLRUCache
*
pCache
,
tb_uid_t
uid
,
TSKEY
eKey
)
{
int32_t
code
=
0
;
char
key
[
32
]
=
{
0
};
int
keyLen
=
0
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
8cd3bffb
...
...
@@ -180,7 +180,7 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid
pMemTable
->
nDel
++
;
if
(
tsdbKeyCmprFn
(
&
lastKey
,
&
pTbData
->
maxKey
)
>=
0
)
{
tsdbCacheDelete
Lastrow
(
pTsdb
->
lruCache
,
pTbData
->
uid
,
eKey
);
tsdbCacheDelete
(
pTsdb
->
lruCache
,
pTbData
->
uid
,
eKey
);
}
tsdbError
(
"vgId:%d, delete data from table suid:%"
PRId64
" uid:%"
PRId64
" skey:%"
PRId64
" eKey:%"
PRId64
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录