Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2a17fa39
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看板
提交
2a17fa39
编写于
1月 08, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add tfile analysis tool
上级
f4389433
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
13 deletion
+50
-13
source/libs/index/src/index_tfile.c
source/libs/index/src/index_tfile.c
+6
-3
source/libs/index/test/fstTest.cc
source/libs/index/test/fstTest.cc
+31
-3
source/libs/index/test/indexTests.cc
source/libs/index/test/indexTests.cc
+13
-7
未找到文件。
source/libs/index/src/index_tfile.c
浏览文件 @
2a17fa39
...
...
@@ -527,9 +527,12 @@ static int tfileReaderLoadFst(TFileReader* reader) {
if
(
buf
==
NULL
)
{
return
-
1
;
}
WriterCtx
*
ctx
=
reader
->
ctx
;
int32_t
nread
=
ctx
->
readFrom
(
ctx
,
buf
,
FST_MAX_SIZE
,
reader
->
header
.
fstOffset
);
indexInfo
(
"nread = %d, and fst offset=%d, filename: %s, size: %d "
,
nread
,
reader
->
header
.
fstOffset
,
ctx
->
file
.
buf
,
ctx
->
file
.
size
);
int64_t
ts
=
taosGetTimestampUs
();
int32_t
nread
=
ctx
->
readFrom
(
ctx
,
buf
,
FST_MAX_SIZE
,
reader
->
header
.
fstOffset
);
int64_t
cost
=
taosGetTimestampUs
()
-
ts
;
indexInfo
(
"nread = %d, and fst offset=%d, filename: %s, size: %d, time cost: %"
PRId64
"us"
,
nread
,
reader
->
header
.
fstOffset
,
ctx
->
file
.
buf
,
ctx
->
file
.
size
,
cost
);
// we assuse fst size less than FST_MAX_SIZE
assert
(
nread
>
0
&&
nread
<
FST_MAX_SIZE
);
...
...
source/libs/index/test/fstTest.cc
浏览文件 @
2a17fa39
#include <algorithm>
#include <iostream>
#include <string>
#include <thread>
...
...
@@ -12,7 +13,6 @@
#include "index_tfile.h"
#include "tskiplist.h"
#include "tutil.h"
void
*
callback
(
void
*
s
)
{
return
s
;
}
static
std
::
string
fileName
=
"/tmp/tindex.tindex"
;
...
...
@@ -293,7 +293,7 @@ void validateTFile(char* arg) {
std
::
thread
threads
[
NUM_OF_THREAD
];
// std::vector<std::thread> threads;
TFileReader
*
reader
=
tfileReaderOpen
(
arg
,
0
,
999992
,
"tag1"
);
TFileReader
*
reader
=
tfileReaderOpen
(
arg
,
0
,
20000000
,
"tag1"
);
for
(
int
i
=
0
;
i
<
NUM_OF_THREAD
;
i
++
)
{
threads
[
i
]
=
std
::
thread
(
fst_get
,
reader
->
fst
);
...
...
@@ -306,13 +306,41 @@ void validateTFile(char* arg) {
}
tfCleanup
();
}
void
iterTFileReader
(
char
*
path
,
char
*
ver
)
{
tfInit
();
int
version
=
atoi
(
ver
);
TFileReader
*
reader
=
tfileReaderOpen
(
path
,
0
,
version
,
"tag1"
);
Iterate
*
iter
=
tfileIteratorCreate
(
reader
);
bool
tn
=
iter
?
iter
->
next
(
iter
)
:
false
;
int
count
=
0
;
int
termCount
=
0
;
while
(
tn
==
true
)
{
count
++
;
IterateValue
*
cv
=
iter
->
getValue
(
iter
);
termCount
+=
(
int
)
taosArrayGetSize
(
cv
->
val
);
printf
(
"col val: %s, size: %d
\n
"
,
cv
->
colVal
,
(
int
)
taosArrayGetSize
(
cv
->
val
));
tn
=
iter
->
next
(
iter
);
}
printf
(
"total size: %d
\n
term count: %d
\n
"
,
count
,
termCount
);
tfileIteratorDestroy
(
iter
);
tfCleanup
();
}
int
main
(
int
argc
,
char
*
argv
[])
{
// tool to check all kind of fst test
// if (argc > 1) { validateTFile(argv[1]); }
if
(
argc
>
2
)
{
// opt
iterTFileReader
(
argv
[
1
],
argv
[
2
]);
}
// checkFstCheckIterator();
// checkFstLongTerm();
// checkFstPrefixSearch();
checkMillonWriteAndReadOfFst
();
// checkMillonWriteAndReadOfFst();
return
1
;
}
source/libs/index/test/indexTests.cc
浏览文件 @
2a17fa39
...
...
@@ -665,14 +665,19 @@ class IndexObj {
size_t
numOfTable
=
100
*
10000
)
{
std
::
string
tColVal
=
colVal
;
size_t
colValSize
=
tColVal
.
size
();
int
skip
=
100
;
numOfTable
/=
skip
;
for
(
int
i
=
0
;
i
<
numOfTable
;
i
++
)
{
tColVal
[
i
%
colValSize
]
=
'a'
+
i
%
26
;
for
(
int
k
=
0
;
k
<
10
&&
k
<
colVal
.
size
();
k
++
)
{
// opt
tColVal
[
rand
()
%
colValSize
]
=
'a'
+
k
%
26
;
}
SIndexTerm
*
term
=
indexTermCreate
(
0
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
colName
.
c_str
(),
colName
.
size
(),
tColVal
.
c_str
(),
tColVal
.
size
());
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
indexMultiTermAdd
(
terms
,
term
);
for
(
size_t
i
=
0
;
i
<
10
;
i
++
)
{
int
ret
=
Put
(
terms
,
i
);
for
(
size_t
j
=
0
;
j
<
skip
;
j
++
)
{
int
ret
=
Put
(
terms
,
j
);
assert
(
ret
==
0
);
}
indexMultiTermDestroy
(
terms
);
...
...
@@ -939,10 +944,11 @@ TEST_F(IndexEnv2, testIndex_read_performance) {
TEST_F
(
IndexEnv2
,
testIndexMultiTag
)
{
std
::
string
path
=
"/tmp/multi_tag"
;
if
(
index
->
Init
(
path
)
!=
0
)
{}
index
->
WriteMultiMillonData
(
"tag1"
,
"Hello"
,
100
*
10000
);
index
->
WriteMultiMillonData
(
"tag2"
,
"Test"
,
100
*
10000
);
index
->
WriteMultiMillonData
(
"tag3"
,
"Test"
,
100
*
10000
);
index
->
WriteMultiMillonData
(
"tag4"
,
"Test"
,
100
*
10000
);
int64_t
st
=
taosGetTimestampUs
();
int32_t
num
=
1000
*
10000
;
index
->
WriteMultiMillonData
(
"tag1"
,
"xxxxxxxxxxxxxxx"
,
num
);
std
::
cout
<<
"numOfRow: "
<<
num
<<
"
\t
time cost:"
<<
taosGetTimestampUs
()
-
st
<<
std
::
endl
;
// index->WriteMultiMillonData("tag2", "xxxxxxxxxxxxxxxxxxxxxxxxx", 100 * 10000);
}
TEST_F
(
IndexEnv2
,
testLongComVal
)
{
std
::
string
path
=
"/tmp/long_colVal"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录