Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8ee12886
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看板
提交
8ee12886
编写于
5月 25, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(cache): remove deleted data
上级
1a206f3f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
30 deletion
+38
-30
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+35
-27
source/dnode/vnode/src/tsdb/tsdbMemTable.c
source/dnode/vnode/src/tsdb/tsdbMemTable.c
+3
-3
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
8ee12886
...
...
@@ -937,14 +937,14 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
}
// build keys & multi get from rocks
int
num_keys
=
pTSchema
->
numOfCols
;
char
**
keys_list
=
taosMemoryCalloc
(
num_keys
*
2
,
sizeof
(
char
*
));
size_t
*
keys_list_sizes
=
taosMemoryCalloc
(
num_keys
*
2
,
sizeof
(
size_t
));
int
num_keys
=
pTSchema
->
numOfCols
;
char
**
keys_list
=
taosMemoryCalloc
(
num_keys
*
2
,
sizeof
(
char
*
));
size_t
*
keys_list_sizes
=
taosMemoryCalloc
(
num_keys
*
2
,
sizeof
(
size_t
));
const
size_t
klen
=
ROCKS_KEY_LEN
;
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
int16_t
cid
=
pTSchema
->
columns
[
i
].
colId
;
size_t
klen
=
ROCKS_KEY_LEN
;
char
*
keys
=
taosMemoryCalloc
(
2
,
sizeof
(
SLastKey
));
char
*
keys
=
taosMemoryCalloc
(
2
,
sizeof
(
SLastKey
));
((
SLastKey
*
)
keys
)[
0
]
=
(
SLastKey
){.
ltype
=
1
,
.
uid
=
uid
,
.
cid
=
cid
};
((
SLastKey
*
)
keys
)[
1
]
=
(
SLastKey
){.
ltype
=
0
,
.
uid
=
uid
,
.
cid
=
cid
};
...
...
@@ -960,39 +960,35 @@ int32_t tsdbCacheDel(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSKEY sKey, TSKE
rocksMayWrite
(
pTsdb
,
true
,
false
,
false
);
rocksdb_multi_get
(
pTsdb
->
rCache
.
db
,
pTsdb
->
rCache
.
readoptions
,
num_keys
*
2
,
(
const
char
*
const
*
)
keys_list
,
keys_list_sizes
,
values_list
,
values_list_sizes
,
errs
);
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
taosMemoryFree
(
keys_list
[
i
]);
}
for
(
int
i
=
0
;
i
<
num_keys
*
2
;
++
i
)
{
rocksdb_free
(
errs
[
i
]);
if
(
errs
[
i
])
{
rocksdb_free
(
errs
[
i
]);
}
}
taosMemoryFree
(
keys_list
);
taosMemoryFree
(
keys_list_sizes
);
taosMemoryFree
(
errs
);
rocksdb_writebatch_t
*
wb
=
pTsdb
->
rCache
.
writebatch
;
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
SLastCol
*
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
]);
if
(
NULL
!=
pLastCol
&&
(
pLastCol
->
ts
<=
eKey
&&
pLastCol
->
ts
>=
sKey
))
{
SLastKey
*
key
=
&
(
SLastKey
){.
ltype
=
1
,
.
uid
=
uid
,
.
cid
=
pLastCol
->
colVal
.
cid
};
size_t
klen
=
ROCKS_KEY_LEN
;
rocksdb_writebatch_delete
(
wb
,
(
char
*
)
key
,
klen
);
taosLRUCacheErase
(
pTsdb
->
lruCache
,
key
,
klen
);
rocksdb_writebatch_delete
(
wb
,
keys_list
[
i
],
klen
);
}
taosLRUCacheErase
(
pTsdb
->
lruCache
,
keys_list
[
i
],
klen
);
pLastCol
=
tsdbCacheDeserialize
(
values_list
[
i
+
num_keys
]);
if
(
NULL
!=
pLastCol
&&
(
pLastCol
->
ts
<=
eKey
&&
pLastCol
->
ts
>=
sKey
))
{
SLastKey
*
key
=
&
(
SLastKey
){.
ltype
=
0
,
.
uid
=
uid
,
.
cid
=
pLastCol
->
colVal
.
cid
};
size_t
klen
=
ROCKS_KEY_LEN
;
rocksdb_writebatch_delete
(
wb
,
(
char
*
)
key
,
klen
);
taosLRUCacheErase
(
pTsdb
->
lruCache
,
key
,
klen
);
rocksdb_writebatch_delete
(
wb
,
keys_list
[
num_keys
+
i
],
klen
);
}
taosLRUCacheErase
(
pTsdb
->
lruCache
,
keys_list
[
num_keys
+
i
],
klen
);
rocksdb_free
(
values_list
[
i
]);
rocksdb_free
(
values_list
[
i
+
num_keys
]);
}
for
(
int
i
=
0
;
i
<
num_keys
;
++
i
)
{
taosMemoryFree
(
keys_list
[
i
]);
}
taosMemoryFree
(
keys_list
);
taosMemoryFree
(
keys_list_sizes
);
taosMemoryFree
(
values_list
);
taosMemoryFree
(
values_list_sizes
);
...
...
@@ -1871,10 +1867,14 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
skipBlock
=
false
;
break
;
}
else
if
(
pColData
->
flag
&
(
HAS_VALUE
|
HAS_NULL
))
{
}
/*
else if (pColData->flag & (HAS_VALUE | HAS_NULL)) {
skipBlock = false;
break;
}
}*/
}
if
(
!
isLast
)
{
skipBlock
=
false
;
}
if
(
skipBlock
)
{
...
...
@@ -1908,6 +1908,9 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if
(
checkRemainingRow
)
{
bool
skipBlock
=
true
;
int
inputColIndex
=
0
;
if
(
aCols
[
0
]
==
PRIMARYKEY_TIMESTAMP_COL_ID
)
{
++
inputColIndex
;
}
for
(
int
colIndex
=
0
;
colIndex
<
state
->
pBlockData
->
nColData
;
++
colIndex
)
{
SColData
*
pColData
=
&
state
->
pBlockData
->
aColData
[
colIndex
];
int16_t
cid
=
pColData
->
cid
;
...
...
@@ -1916,15 +1919,19 @@ static int32_t getNextRowFromFS(void *iter, TSDBROW **ppRow, bool *pIgnoreEarlie
if
(
isLast
&&
(
pColData
->
flag
&
HAS_VALUE
))
{
skipBlock
=
false
;
break
;
}
else
if
(
pColData
->
flag
&
(
HAS_VALUE
|
HAS_NULL
))
{
}
/*
else if (pColData->flag & (HAS_VALUE | HAS_NULL)) {
skipBlock = false;
break;
}
}*/
++
inputColIndex
;
}
}
if
(
!
isLast
)
{
skipBlock
=
false
;
}
if
(
skipBlock
)
{
if
(
--
state
->
iBlock
<
0
)
{
tsdbDataFReaderClose
(
state
->
pDataFReader
);
...
...
@@ -2144,7 +2151,8 @@ static bool tsdbKeyDeleted(TSDBKEY *key, SArray *pSkyline, int64_t *iSkyline) {
if
(
key
->
ts
>
pItemBack
->
ts
)
{
return
false
;
}
else
if
(
key
->
ts
>=
pItemFront
->
ts
&&
key
->
ts
<=
pItemBack
->
ts
)
{
if
(
key
->
version
<=
pItemFront
->
version
||
(
key
->
ts
==
pItemBack
->
ts
&&
key
->
version
<=
pItemBack
->
version
))
{
// if (key->version <= pItemFront->version || (key->ts == pItemBack->ts && key->version <= pItemBack->version)) {
if
(
key
->
version
<=
pItemFront
->
version
||
key
->
version
<=
pItemBack
->
version
)
{
return
true
;
}
else
{
return
false
;
...
...
@@ -2959,7 +2967,7 @@ static int32_t mergeLastRowCid(tb_uid_t uid, STsdb *pTsdb, SArray **ppLastArray,
do
{
TSDBROW
*
pRow
=
NULL
;
nextRowIterGet
(
&
iter
,
&
pRow
,
&
ignoreEarlierTs
,
tru
e
,
TARRAY_DATA
(
aColArray
),
TARRAY_SIZE
(
aColArray
));
nextRowIterGet
(
&
iter
,
&
pRow
,
&
ignoreEarlierTs
,
fals
e
,
TARRAY_DATA
(
aColArray
),
TARRAY_SIZE
(
aColArray
));
if
(
!
pRow
)
{
break
;
...
...
source/dnode/vnode/src/tsdb/tsdbMemTable.c
浏览文件 @
8ee12886
...
...
@@ -190,9 +190,9 @@ int32_t tsdbDeleteTableData(STsdb *pTsdb, int64_t version, tb_uid_t suid, tb_uid
tsdbCacheDeleteLast(pTsdb->lruCache, pTbData->uid, eKey);
}
*/
if
(
eKey
>=
pTbData
->
maxKey
&&
sKey
<=
pTbData
->
maxKey
)
{
tsdbCacheDel
(
pTsdb
,
suid
,
uid
,
sKey
,
eKey
);
}
//
if (eKey >= pTbData->maxKey && sKey <= pTbData->maxKey) {
tsdbCacheDel
(
pTsdb
,
suid
,
uid
,
sKey
,
eKey
);
//
}
tsdbTrace
(
"vgId:%d, delete data from table suid:%"
PRId64
" uid:%"
PRId64
" skey:%"
PRId64
" eKey:%"
PRId64
" at version %"
PRId64
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录