Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
01d95b5e
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,发现更多精彩内容 >>
提交
01d95b5e
编写于
4月 21, 2023
作者:
M
Minglei Jin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
cache/read: use new interface with signle query
上级
0394c6a5
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
36 addition
and
70 deletion
+36
-70
source/dnode/vnode/src/tsdb/tsdbCache.c
source/dnode/vnode/src/tsdb/tsdbCache.c
+2
-0
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
+34
-70
未找到文件。
source/dnode/vnode/src/tsdb/tsdbCache.c
浏览文件 @
01d95b5e
...
...
@@ -273,6 +273,8 @@ int32_t tsdbCacheUpdate(STsdb *pTsdb, tb_uid_t suid, tb_uid_t uid, TSDBROW *pRow
taosMemoryFree
(
value
);
}
}
rocksdb_free
(
values_list
[
i
]);
}
taosMemoryFree
(
values_list
);
taosMemoryFree
(
values_list_sizes
);
...
...
source/dnode/vnode/src/tsdb/tsdbCacheRead.c
浏览文件 @
01d95b5e
...
...
@@ -199,7 +199,7 @@ void* tsdbCacherowsReaderClose(void* pReader) {
taosMemoryFree
(
pReader
);
return
NULL
;
}
/*
static int32_t doExtractCacheRow(SCacheRowsReader* pr, SLRUCache* lruCache, uint64_t uid, SArray** pRow,
LRUHandle** h) {
int32_t code = TSDB_CODE_SUCCESS;
...
...
@@ -222,7 +222,7 @@ static int32_t doExtractCacheRow(SCacheRowsReader* pr, SLRUCache* lruCache, uint
return code;
}
*/
static
void
freeItem
(
void
*
pItem
)
{
SLastCol
*
pCol
=
(
SLastCol
*
)
pItem
;
if
(
IS_VAR_DATA_TYPE
(
pCol
->
colVal
.
type
))
{
...
...
@@ -279,7 +279,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
p
->
ts
=
INT64_MIN
;
}
pLastCols
=
taosArrayInit
(
pr
->
pSchema
->
numOfCols
,
sizeof
(
SLastCol
));
pLastCols
=
taosArrayInit
(
pr
->
numOfCols
,
sizeof
(
SLastCol
));
if
(
pLastCols
==
NULL
)
{
code
=
TSDB_CODE_OUT_OF_MEMORY
;
goto
_end
;
...
...
@@ -303,6 +303,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
pr
->
pDataFReader
=
NULL
;
pr
->
pDataFReaderLast
=
NULL
;
char
const
*
lstring
=
pr
->
type
&
CACHESCAN_RETRIEVE_LAST
?
"last"
:
"last_row"
;
// retrieve the only one last row of all tables in the uid list.
if
(
HASTYPE
(
pr
->
type
,
CACHESCAN_RETRIEVE_TYPE_SINGLE
))
{
int64_t
st
=
taosGetTimestampUs
();
...
...
@@ -310,16 +312,9 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
for
(
int32_t
i
=
0
;
i
<
pr
->
numOfTables
;
++
i
)
{
STableKeyInfo
*
pKeyInfo
=
&
pr
->
pTableList
[
i
];
code
=
doExtractCacheRow
(
pr
,
lruCache
,
pKeyInfo
->
uid
,
&
pRow
,
&
h
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
goto
_end
;
}
if
(
h
==
NULL
)
{
continue
;
}
if
(
taosArrayGetSize
(
pRow
)
<=
0
)
{
tsdbCacheRelease
(
lruCache
,
h
);
tsdbCacheGet
(
pr
->
pTsdb
,
pKeyInfo
->
uid
,
&
pRow
,
pr
,
lstring
);
if
(
TARRAY_SIZE
(
pRow
)
<=
0
)
{
taosArrayDestroy
(
pRow
);
continue
;
}
...
...
@@ -327,20 +322,8 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
bool
hasNotNullRow
=
true
;
int64_t
singleTableLastTs
=
INT64_MAX
;
for
(
int32_t
k
=
0
;
k
<
pr
->
numOfCols
;
++
k
)
{
int32_t
slotId
=
slotIds
[
k
];
if
(
slotId
==
-
1
)
{
// the primary timestamp
SLastCol
*
p
=
taosArrayGet
(
pLastCols
,
0
);
SLastCol
*
pCol
=
(
SLastCol
*
)
taosArrayGet
(
pRow
,
0
);
if
(
pCol
->
ts
>
p
->
ts
)
{
hasRes
=
true
;
p
->
ts
=
pCol
->
ts
;
p
->
colVal
=
pCol
->
colVal
;
singleTableLastTs
=
pCol
->
ts
;
}
}
else
{
SLastCol
*
p
=
taosArrayGet
(
pLastCols
,
slotId
);
SLastCol
*
pColVal
=
(
SLastCol
*
)
taosArrayGet
(
pRow
,
slotId
);
SLastCol
*
p
=
taosArrayGet
(
pLastCols
,
k
);
SLastCol
*
pColVal
=
(
SLastCol
*
)
taosArrayGet
(
pRow
,
k
);
if
(
pColVal
->
ts
>
p
->
ts
)
{
if
(
!
COL_VAL_IS_VALUE
(
&
pColVal
->
colVal
)
&&
HASTYPE
(
pr
->
type
,
CACHESCAN_RETRIEVE_LAST
))
{
...
...
@@ -370,7 +353,6 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
}
}
}
}
if
(
hasNotNullRow
)
{
if
(
INT64_MAX
==
totalLastTs
||
(
INT64_MAX
!=
singleTableLastTs
&&
totalLastTs
<
singleTableLastTs
))
{
...
...
@@ -389,7 +371,7 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
taosArraySet
(
pTableUidList
,
0
,
&
pKeyInfo
->
uid
);
}
t
sdbCacheRelease
(
lruCache
,
h
);
t
aosArrayDestroy
(
pRow
);
}
if
(
hasRes
)
{
...
...
@@ -398,28 +380,10 @@ int32_t tsdbRetrieveCacheRows(void* pReader, SSDataBlock* pResBlock, const int32
}
else
if
(
HASTYPE
(
pr
->
type
,
CACHESCAN_RETRIEVE_TYPE_ALL
))
{
for
(
int32_t
i
=
pr
->
tableIndex
;
i
<
pr
->
numOfTables
;
++
i
)
{
STableKeyInfo
*
pKeyInfo
=
&
pr
->
pTableList
[
i
];
/*
code = doExtractCacheRow(pr, lruCache, pKeyInfo->uid, &pRow, &h);
if (code != TSDB_CODE_SUCCESS) {
goto _end;
}
if (h == NULL) {
continue;
}
if (taosArrayGetSize(pRow) <= 0) {
tsdbCacheRelease(lruCache, h);
continue;
}
saveOneRow(pRow, pResBlock, pr, slotIds, pRes, pr->idstr);
// TODO reset the pRes
tsdbCacheRelease(lruCache, h);
*/
char
const
*
lstring
=
pr
->
type
&
CACHESCAN_RETRIEVE_LAST
?
"last"
:
"last_row"
;
tsdbCacheGet
(
pr
->
pTsdb
,
pKeyInfo
->
uid
,
&
pRow
,
pr
,
lstring
);
if
(
TARRAY_SIZE
(
pRow
)
<=
0
)
{
taosArrayDestroy
(
pRow
);
continue
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录