Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f4389433
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看板
提交
f4389433
编写于
1月 07, 2022
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
index integrated into vnode meta
上级
72c4f4ef
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
66 addition
and
25 deletion
+66
-25
include/libs/index/index.h
include/libs/index/index.h
+6
-11
source/dnode/vnode/meta/CMakeLists.txt
source/dnode/vnode/meta/CMakeLists.txt
+2
-0
source/dnode/vnode/meta/src/metaIdx.c
source/dnode/vnode/meta/src/metaIdx.c
+46
-2
source/dnode/vnode/meta/src/metaTbUid.c
source/dnode/vnode/meta/src/metaTbUid.c
+3
-2
source/libs/index/src/index.c
source/libs/index/src/index.c
+5
-9
source/libs/index/src/index_tfile.c
source/libs/index/src/index_tfile.c
+4
-1
未找到文件。
include/libs/index/index.h
浏览文件 @
f4389433
...
...
@@ -76,25 +76,20 @@ void indexOptsDestroy(SIndexOpts* opts);
* @param:
*/
SIndexTerm
*
indexTermCreate
(
int64_t
suid
,
SIndexOperOnColumn
operType
,
uint8_t
colType
,
const
char
*
colName
,
int32_t
nColName
,
const
char
*
colVal
,
int32_t
nColVal
);
SIndexTerm
*
indexTermCreate
(
int64_t
suid
,
SIndexOperOnColumn
operType
,
uint8_t
colType
,
const
char
*
colName
,
int32_t
nColName
,
const
char
*
colVal
,
int32_t
nColVal
);
void
indexTermDestroy
(
SIndexTerm
*
p
);
/*
* init index
* init index
env
*
*/
int32_t
indexInit
();
void
indexInit
();
/*
* destory index
* destory index
env
*
*/
void
indexCleanUp
();
#ifdef __cplusplus
...
...
source/dnode/vnode/meta/CMakeLists.txt
浏览文件 @
f4389433
...
...
@@ -19,11 +19,13 @@ add_library(meta STATIC ${META_SRC})
target_include_directories
(
meta
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/dnode/vnode/meta"
PUBLIC
"
${
CMAKE_SOURCE_DIR
}
/include/libs/index"
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/inc"
)
target_link_libraries
(
meta
PUBLIC common
PUBLIC index
)
if
(
${
META_DB_IMPL
}
STREQUAL
"BDB"
)
...
...
source/dnode/vnode/meta/src/metaIdx.c
浏览文件 @
f4389433
...
...
@@ -13,9 +13,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "index.h"
#include "metaDef.h"
struct
SMetaIdx
{
#ifdef USE_INVERTED_INDEX
SIndex
*
pIdx
;
#endif
/* data */
};
...
...
@@ -43,6 +47,13 @@ int metaOpenIdx(SMeta *pMeta) {
rocksdb_options_destroy(options);
#endif
#ifdef USE_INVERTED_INDEX
SIndexOpts
opts
;
if
(
indexOpen
(
&
opts
,
pMeta
->
path
,
&
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
return
-
1
;
}
#endif
return
0
;
}
...
...
@@ -53,14 +64,47 @@ void metaCloseIdx(SMeta *pMeta) { /* TODO */
pMeta->pIdx = NULL;
}
#endif
#ifdef USE_INVERTED_INDEX
SIndexOpts
opts
;
if
(
indexClose
(
pMeta
->
pIdx
->
pIdx
)
!=
0
)
{
return
-
1
;
}
#endif
}
int
metaSaveTableToIdx
(
SMeta
*
pMeta
,
const
STbCfg
*
pTbOptions
)
{
int
metaSaveTableToIdx
(
SMeta
*
pMeta
,
const
STbCfg
*
pTbCfg
)
{
#ifdef USE_INVERTED_INDEX
if
(
pTbCfgs
-
type
==
META_CHILD_TABLE
)
{
char
buf
[
8
]
=
{
0
};
int16_t
colId
=
(
kvRowColIdx
(
pTbCfg
->
ctbCfg
.
pTag
))[
0
].
colId
;
sprintf
(
buf
,
"%d"
,
colId
);
// colname
char
*
pTagVal
=
(
char
*
)
tdGetKVRowValOfCol
(
pTbCfg
->
ctbCfg
.
pTag
,
(
kvRowColIdx
(
pTbCfg
->
ctbCfg
.
pTag
))[
0
].
colId
);
tb_uid_t
suid
=
pTbCfg
->
ctbCfg
.
suid
;
// super id
tb_uid_t
tuid
=
0
;
// child table uid
SIndexMultiTerm
*
terms
=
indexMultiTermCreate
();
SIndexTerm
*
term
=
indexTermCreate
(
suid
,
ADD_VALUE
,
TSDB_DATA_TYPE_BINARY
,
buf
,
strlen
(
buf
),
pTagVal
,
strlen
(
pTagVal
),
tuid
);
indexMultiTermAdd
(
terms
,
term
);
int
ret
=
indexPut
(
pMeta
->
pIdx
->
pIdx
,
terms
);
indexMultiTermDestroy
(
terms
);
return
ret
;
}
else
{
return
DB_DONOTINDEX
;
}
#endif
// TODO
return
0
;
}
int
metaRemoveTableFromIdx
(
SMeta
*
pMeta
,
tb_uid_t
uid
)
{
#ifdef USE_INVERTED_INDEX
#endif
// TODO
return
0
;
}
\ No newline at end of file
}
source/dnode/vnode/meta/src/metaTbUid.c
浏览文件 @
f4389433
...
...
@@ -22,9 +22,10 @@ int metaOpenUidGnrt(SMeta *pMeta) {
return
0
;
}
void
metaCloseUidGnrt
(
SMeta
*
pMeta
)
{
/* TODO */
}
void
metaCloseUidGnrt
(
SMeta
*
pMeta
)
{
/* TODO */
}
tb_uid_t
metaGenerateUid
(
SMeta
*
pMeta
)
{
// Generate a new table UID
return
++
(
pMeta
->
uidGnrt
.
nextUid
);
}
\ No newline at end of file
}
source/libs/index/src/index.c
浏览文件 @
f4389433
...
...
@@ -30,21 +30,17 @@
void
*
indexQhandle
=
NULL
;
int32_t
indexInit
()
{
void
indexInit
()
{
// refactor later
indexQhandle
=
taosInitScheduler
(
INDEX_QUEUE_SIZE
,
INDEX_NUM_OF_THREADS
,
"index"
);
return
indexQhandle
==
NULL
?
-
1
:
0
;
// do nothing
}
void
indexCleanUp
()
{
taosCleanUpScheduler
(
indexQhandle
);
}
static
int
uidCompare
(
const
void
*
a
,
const
void
*
b
)
{
// add more version compare
uint64_t
u1
=
*
(
uint64_t
*
)
a
;
uint64_t
u2
=
*
(
uint64_t
*
)
b
;
if
(
u1
==
u2
)
{
return
0
;
}
else
{
return
u1
<
u2
?
-
1
:
1
;
}
return
u1
-
u2
;
}
typedef
struct
SIdxColInfo
{
int
colId
;
// generated by index internal
...
...
@@ -61,7 +57,7 @@ static int indexMergeFinalResults(SArray* interResults, EIndexOperatorType oTyp
static
int
indexGenTFile
(
SIndex
*
index
,
IndexCache
*
cache
,
SArray
*
batch
);
int
indexOpen
(
SIndexOpts
*
opts
,
const
char
*
path
,
SIndex
**
index
)
{
//
pthread_once(&isInit, indexInit);
pthread_once
(
&
isInit
,
indexInit
);
SIndex
*
sIdx
=
calloc
(
1
,
sizeof
(
SIndex
));
if
(
sIdx
==
NULL
)
{
return
-
1
;
}
...
...
source/libs/index/src/index_tfile.c
浏览文件 @
f4389433
...
...
@@ -71,7 +71,10 @@ TFileCache* tfileCacheCreate(const char* path) {
}
TFileReader
*
reader
=
tfileReaderCreate
(
wc
);
if
(
reader
==
NULL
)
{
goto
End
;
}
if
(
reader
==
NULL
)
{
indexInfo
(
"skip invalid file: %s"
,
file
);
continue
;
}
TFileHeader
*
header
=
&
reader
->
header
;
ICacheKey
key
=
{.
suid
=
header
->
suid
,
.
colName
=
header
->
colName
,
.
nColName
=
strlen
(
header
->
colName
)};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录