Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c1a2366d
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22017
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看板
提交
c1a2366d
编写于
1月 03, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor code
上级
88ba5fae
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
15 addition
and
7 deletion
+15
-7
source/libs/index/src/index.c
source/libs/index/src/index.c
+3
-0
source/libs/index/src/index_fst_counting_writer.c
source/libs/index/src/index_fst_counting_writer.c
+2
-0
source/libs/index/src/index_tfile.c
source/libs/index/src/index_tfile.c
+7
-4
source/libs/index/test/indexTests.cc
source/libs/index/test/indexTests.cc
+3
-3
未找到文件。
source/libs/index/src/index.c
浏览文件 @
c1a2366d
...
...
@@ -73,6 +73,7 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
#ifdef USE_INVERTED_INDEX
// sIdx->cache = (void*)indexCacheCreate(sIdx);
sIdx
->
tindex
=
indexTFileCreate
(
path
);
if
(
sIdx
->
tindex
==
NULL
)
{
goto
END
;
}
sIdx
->
colObj
=
taosHashInit
(
8
,
taosGetDefaultHashFunction
(
TSDB_DATA_TYPE_BINARY
),
true
,
HASH_ENTRY_LOCK
);
sIdx
->
cVersion
=
1
;
sIdx
->
path
=
calloc
(
1
,
strlen
(
path
)
+
1
);
...
...
@@ -83,6 +84,8 @@ int indexOpen(SIndexOpts* opts, const char* path, SIndex** index) {
return
0
;
#endif
END:
if
(
sIdx
!=
NULL
)
{
indexClose
(
sIdx
);
}
*
index
=
NULL
;
return
-
1
;
...
...
source/libs/index/src/index_fst_counting_writer.c
浏览文件 @
c1a2366d
...
...
@@ -72,12 +72,14 @@ WriterCtx* writerCtxCreate(WriterType type, const char* path, bool readOnly, int
if
(
readOnly
==
false
)
{
// ctx->file.fd = open(path, O_WRONLY | O_CREAT | O_APPEND, S_IRWXU | S_IRWXG | S_IRWXO);
ctx
->
file
.
fd
=
tfOpenCreateWriteAppend
(
path
);
struct
stat
fstat
;
stat
(
path
,
&
fstat
);
ctx
->
file
.
size
=
fstat
.
st_size
;
}
else
{
// ctx->file.fd = open(path, O_RDONLY, S_IRWXU | S_IRWXG | S_IRWXO);
ctx
->
file
.
fd
=
tfOpenRead
(
path
);
struct
stat
fstat
;
stat
(
path
,
&
fstat
);
ctx
->
file
.
size
=
fstat
.
st_size
;
...
...
source/libs/index/src/index_tfile.c
浏览文件 @
c1a2366d
...
...
@@ -66,12 +66,14 @@ TFileCache* tfileCacheCreate(const char* path) {
int32_t
colId
,
version
;
for
(
size_t
i
=
0
;
i
<
taosArrayGetSize
(
files
);
i
++
)
{
char
*
file
=
taosArrayGetP
(
files
,
i
);
char
colName
[
256
]
=
{
0
};
// refactor later, use colname and version info
char
colName
[
256
]
=
{
0
};
if
(
0
!=
tfileParseFileName
(
file
,
&
suid
,
colName
,
(
int
*
)
&
version
))
{
indexInfo
(
"try parse invalid file: %s, skip it"
,
file
);
continue
;
}
// use version info later
char
fullName
[
256
]
=
{
0
};
sprintf
(
fullName
,
"%s/%s"
,
path
,
file
);
...
...
@@ -204,7 +206,7 @@ int tfileReaderSearch(TFileReader* reader, SIndexTermQuery* query, SArray* resul
TFileWriter
*
tfileWriterOpen
(
char
*
path
,
uint64_t
suid
,
int32_t
version
,
const
char
*
colName
,
uint8_t
colType
)
{
char
fullname
[
256
]
=
{
0
};
tfileGenFileFullName
(
fullname
,
path
,
suid
,
colName
,
version
);
indexInfo
(
"open write file name %s"
,
fullname
);
//
indexInfo("open write file name %s", fullname);
WriterCtx
*
wcx
=
writerCtxCreate
(
TFile
,
fullname
,
false
,
1024
*
1024
*
64
);
if
(
wcx
==
NULL
)
{
return
NULL
;
}
...
...
@@ -221,7 +223,7 @@ TFileReader* tfileReaderOpen(char* path, uint64_t suid, int32_t version, const c
tfileGenFileFullName
(
fullname
,
path
,
suid
,
colName
,
version
);
WriterCtx
*
wc
=
writerCtxCreate
(
TFile
,
fullname
,
true
,
1024
*
1024
*
1024
);
indexInfo
(
"open read file name:%s, size: %d"
,
wc
->
file
.
buf
,
wc
->
file
.
size
);
//
indexInfo("open read file name:%s, size: %d", wc->file.buf, wc->file.size);
if
(
wc
==
NULL
)
{
return
NULL
;
}
TFileReader
*
reader
=
tfileReaderCreate
(
wc
);
...
...
@@ -356,6 +358,7 @@ IndexTFile* indexTFileCreate(const char* path) {
return
tfile
;
}
void
indexTFileDestroy
(
IndexTFile
*
tfile
)
{
if
(
tfile
==
NULL
)
{
return
;
}
tfileCacheDestroy
(
tfile
->
cache
);
free
(
tfile
);
}
...
...
source/libs/index/test/indexTests.cc
浏览文件 @
c1a2366d
...
...
@@ -823,7 +823,7 @@ TEST_F(IndexEnv2, testIndex_TrigeFlush) {
// r
std
::
cout
<<
"failed to init"
<<
std
::
endl
;
}
int
numOfTable
=
2
*
10000
;
int
numOfTable
=
100
*
10000
;
index
->
WriteMillonData
(
"tag1"
,
"Hello Wolrd"
,
numOfTable
);
int
target
=
index
->
SearchOne
(
"tag1"
,
"Hello Wolrd"
);
std
::
cout
<<
"Get Index: "
<<
target
<<
std
::
endl
;
...
...
@@ -847,8 +847,8 @@ TEST_F(IndexEnv2, testIndex_serarch_cache_and_tfile) {
}
index
->
PutOne
(
"tag1"
,
"Hello"
);
index
->
PutOne
(
"tag2"
,
"Test"
);
index
->
WriteMultiMillonData
(
"tag1"
,
"Hello"
,
5
*
10000
);
index
->
WriteMultiMillonData
(
"tag2"
,
"Test"
,
5
*
10000
);
index
->
WriteMultiMillonData
(
"tag1"
,
"Hello"
,
5
0
*
10000
);
index
->
WriteMultiMillonData
(
"tag2"
,
"Test"
,
5
0
*
10000
);
std
::
thread
threads
[
NUM_OF_THREAD
];
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录