Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
4bdac1fd
T
TDengine
项目概览
taosdata
/
TDengine
大约 2 年 前同步成功
通知
1192
Star
22018
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看板
提交
4bdac1fd
编写于
1月 04, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
optimize tfile
上级
4079bd2b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
14 deletion
+13
-14
source/libs/index/src/index.c
source/libs/index/src/index.c
+1
-1
source/libs/index/src/index_cache.c
source/libs/index/src/index_cache.c
+1
-1
source/libs/index/src/index_tfile.c
source/libs/index/src/index_tfile.c
+6
-5
source/libs/index/test/indexTests.cc
source/libs/index/test/indexTests.cc
+5
-7
未找到文件。
source/libs/index/src/index.c
浏览文件 @
4bdac1fd
...
@@ -397,7 +397,7 @@ static void indexDestroyTempResult(SArray* result) {
...
@@ -397,7 +397,7 @@ static void indexDestroyTempResult(SArray* result) {
}
}
int
indexFlushCacheTFile
(
SIndex
*
sIdx
,
void
*
cache
)
{
int
indexFlushCacheTFile
(
SIndex
*
sIdx
,
void
*
cache
)
{
if
(
sIdx
==
NULL
)
{
return
-
1
;
}
if
(
sIdx
==
NULL
)
{
return
-
1
;
}
index
Warn
(
"suid %"
PRIu64
" merge cache into tindex"
,
sIdx
->
suid
);
index
Info
(
"suid %"
PRIu64
" merge cache into tindex"
,
sIdx
->
suid
);
IndexCache
*
pCache
=
(
IndexCache
*
)
cache
;
IndexCache
*
pCache
=
(
IndexCache
*
)
cache
;
TFileReader
*
pReader
=
tfileGetReaderByCol
(
sIdx
->
tindex
,
pCache
->
suid
,
pCache
->
colName
);
TFileReader
*
pReader
=
tfileGetReaderByCol
(
sIdx
->
tindex
,
pCache
->
suid
,
pCache
->
colName
);
...
...
source/libs/index/src/index_cache.c
浏览文件 @
4bdac1fd
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
#define MAX_INDEX_KEY_LEN 256 // test only, change later
#define MAX_INDEX_KEY_LEN 256 // test only, change later
#define MEM_TERM_LIMIT
5
* 10000
#define MEM_TERM_LIMIT
10
* 10000
// ref index_cache.h:22
// ref index_cache.h:22
//#define CACHE_KEY_LEN(p) \
//#define CACHE_KEY_LEN(p) \
// (sizeof(int32_t) + sizeof(uint16_t) + sizeof(p->colType) + sizeof(p->nColVal) + p->nColVal + sizeof(uint64_t) +
// (sizeof(int32_t) + sizeof(uint16_t) + sizeof(p->colType) + sizeof(p->nColVal) + p->nColVal + sizeof(uint64_t) +
...
...
source/libs/index/src/index_tfile.c
浏览文件 @
4bdac1fd
...
@@ -264,7 +264,8 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
...
@@ -264,7 +264,8 @@ int tfileWriterPut(TFileWriter* tw, void* data, bool order) {
// ugly code, refactor later
// ugly code, refactor later
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
for
(
size_t
i
=
0
;
i
<
sz
;
i
++
)
{
TFileValue
*
v
=
taosArrayGetP
((
SArray
*
)
data
,
i
);
TFileValue
*
v
=
taosArrayGetP
((
SArray
*
)
data
,
i
);
// taosArrayRemoveDuplicate(v->tablId, tfileUidCompare, NULL);
taosArraySort
(
v
->
tableId
,
tfileUidCompare
);
taosArrayRemoveDuplicate
(
v
->
tableId
,
tfileUidCompare
,
NULL
);
int32_t
tbsz
=
taosArrayGetSize
(
v
->
tableId
);
int32_t
tbsz
=
taosArrayGetSize
(
v
->
tableId
);
fstOffset
+=
TF_TABLE_TATOAL_SIZE
(
tbsz
);
fstOffset
+=
TF_TABLE_TATOAL_SIZE
(
tbsz
);
}
}
...
@@ -545,8 +546,8 @@ static int tfileReaderLoadHeader(TFileReader* reader) {
...
@@ -545,8 +546,8 @@ static int tfileReaderLoadHeader(TFileReader* reader) {
indexError
(
"actual Read: %d, to read: %d, errno: %d, filefd: %d, filename: %s"
,
(
int
)(
nread
),
(
int
)
sizeof
(
buf
),
indexError
(
"actual Read: %d, to read: %d, errno: %d, filefd: %d, filename: %s"
,
(
int
)(
nread
),
(
int
)
sizeof
(
buf
),
errno
,
reader
->
ctx
->
file
.
fd
,
reader
->
ctx
->
file
.
buf
);
errno
,
reader
->
ctx
->
file
.
fd
,
reader
->
ctx
->
file
.
buf
);
}
else
{
}
else
{
index
Error
(
"actual Read: %d, to read: %d, errno
: %d, filefd: %d, filename: %s"
,
(
int
)(
nread
),
(
int
)
sizeof
(
buf
),
index
Info
(
"actual Read: %d, to read
: %d, filefd: %d, filename: %s"
,
(
int
)(
nread
),
(
int
)
sizeof
(
buf
),
errno
,
reader
->
ctx
->
file
.
fd
,
reader
->
ctx
->
file
.
buf
);
reader
->
ctx
->
file
.
fd
,
reader
->
ctx
->
file
.
buf
);
}
}
// assert(nread == sizeof(buf));
// assert(nread == sizeof(buf));
memcpy
(
&
reader
->
header
,
buf
,
sizeof
(
buf
));
memcpy
(
&
reader
->
header
,
buf
,
sizeof
(
buf
));
...
@@ -562,8 +563,8 @@ static int tfileReaderLoadFst(TFileReader* reader) {
...
@@ -562,8 +563,8 @@ static int tfileReaderLoadFst(TFileReader* reader) {
WriterCtx
*
ctx
=
reader
->
ctx
;
WriterCtx
*
ctx
=
reader
->
ctx
;
int32_t
nread
=
ctx
->
readFrom
(
ctx
,
buf
,
FST_MAX_SIZE
,
reader
->
header
.
fstOffset
);
int32_t
nread
=
ctx
->
readFrom
(
ctx
,
buf
,
FST_MAX_SIZE
,
reader
->
header
.
fstOffset
);
index
Error
(
"nread = %d, and fst offset=%d, filename: %s, size: %d "
,
nread
,
reader
->
header
.
fstOffset
,
ctx
->
file
.
buf
,
index
Info
(
"nread = %d, and fst offset=%d, filename: %s, size: %d "
,
nread
,
reader
->
header
.
fstOffset
,
ctx
->
file
.
buf
,
ctx
->
file
.
size
);
ctx
->
file
.
size
);
// we assuse fst size less than FST_MAX_SIZE
// we assuse fst size less than FST_MAX_SIZE
assert
(
nread
>
0
&&
nread
<
FST_MAX_SIZE
);
assert
(
nread
>
0
&&
nread
<
FST_MAX_SIZE
);
...
...
source/libs/index/test/indexTests.cc
浏览文件 @
4bdac1fd
...
@@ -701,7 +701,8 @@ class IndexObj {
...
@@ -701,7 +701,8 @@ class IndexObj {
int64_t
s
=
taosGetTimestampUs
();
int64_t
s
=
taosGetTimestampUs
();
if
(
Search
(
mq
,
result
)
==
0
)
{
if
(
Search
(
mq
,
result
)
==
0
)
{
int64_t
e
=
taosGetTimestampUs
();
int64_t
e
=
taosGetTimestampUs
();
std
::
cout
<<
"search one successfully and time cost:"
<<
e
-
s
<<
std
::
endl
;
std
::
cout
<<
"search one successfully and time cost:"
<<
e
-
s
<<
"
\t
query col:"
<<
colName
<<
"
\t
val: "
<<
colVal
<<
"
\t
size:"
<<
taosArrayGetSize
(
result
)
<<
std
::
endl
;
}
else
{
}
else
{
}
}
int
sz
=
taosArrayGetSize
(
result
);
int
sz
=
taosArrayGetSize
(
result
);
...
@@ -834,11 +835,8 @@ static void write_and_search(IndexObj* idx) {
...
@@ -834,11 +835,8 @@ static void write_and_search(IndexObj* idx) {
std
::
string
colName
(
"tag1"
),
colVal
(
"Hello"
);
std
::
string
colName
(
"tag1"
),
colVal
(
"Hello"
);
int
target
=
idx
->
SearchOne
(
"tag1"
,
"Hello"
);
int
target
=
idx
->
SearchOne
(
"tag1"
,
"Hello"
);
std
::
cout
<<
"search: "
<<
target
<<
std
::
endl
;
target
=
idx
->
SearchOne
(
"tag2"
,
"Test"
);
target
=
idx
->
SearchOne
(
"tag2"
,
"Test"
);
std
::
cout
<<
"search: "
<<
target
<<
std
::
endl
;
// idx->PutOne(colName, colVal);
idx
->
PutOne
(
colName
,
colVal
);
}
}
TEST_F
(
IndexEnv2
,
testIndex_serarch_cache_and_tfile
)
{
TEST_F
(
IndexEnv2
,
testIndex_serarch_cache_and_tfile
)
{
std
::
string
path
=
"/tmp/cache_and_tfile"
;
std
::
string
path
=
"/tmp/cache_and_tfile"
;
...
@@ -847,8 +845,8 @@ TEST_F(IndexEnv2, testIndex_serarch_cache_and_tfile) {
...
@@ -847,8 +845,8 @@ TEST_F(IndexEnv2, testIndex_serarch_cache_and_tfile) {
}
}
index
->
PutOne
(
"tag1"
,
"Hello"
);
index
->
PutOne
(
"tag1"
,
"Hello"
);
index
->
PutOne
(
"tag2"
,
"Test"
);
index
->
PutOne
(
"tag2"
,
"Test"
);
index
->
WriteMultiMillonData
(
"tag1"
,
"Hello"
,
5
0
*
10000
);
index
->
WriteMultiMillonData
(
"tag1"
,
"Hello"
,
10
0
*
10000
);
index
->
WriteMultiMillonData
(
"tag2"
,
"Test"
,
10
*
10000
);
index
->
WriteMultiMillonData
(
"tag2"
,
"Test"
,
10
0
*
10000
);
std
::
thread
threads
[
NUM_OF_THREAD
];
std
::
thread
threads
[
NUM_OF_THREAD
];
for
(
int
i
=
0
;
i
<
NUM_OF_THREAD
;
i
++
)
{
for
(
int
i
=
0
;
i
<
NUM_OF_THREAD
;
i
++
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录