Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
7b9f0bb5
milvus
项目概览
BaiXuePrincess
/
milvus
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7b9f0bb5
编写于
8月 01, 2019
作者:
G
groot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-251 Build/Merge background thread error handling
Former-commit-id: 656bab49591815e7e6a3698ecaa3284cf1534c74
上级
20b8fd33
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
49 addition
and
9 deletion
+49
-9
cpp/src/db/DBImpl.cpp
cpp/src/db/DBImpl.cpp
+2
-1
cpp/src/db/DBMetaImpl.cpp
cpp/src/db/DBMetaImpl.cpp
+38
-5
cpp/src/db/MetaTypes.h
cpp/src/db/MetaTypes.h
+2
-0
cpp/src/db/MySQLMetaImpl.cpp
cpp/src/db/MySQLMetaImpl.cpp
+6
-2
cpp/src/db/Utils.cpp
cpp/src/db/Utils.cpp
+1
-1
未找到文件。
cpp/src/db/DBImpl.cpp
浏览文件 @
7b9f0bb5
...
...
@@ -362,6 +362,7 @@ Status DBImpl::MergeFiles(const std::string& table_id, const meta::DateT& date,
meta
::
TableFileSchema
table_file
;
table_file
.
table_id_
=
table_id
;
table_file
.
date_
=
date
;
table_file
.
file_type_
=
meta
::
TableFileSchema
::
NEW_MERGE
;
Status
status
=
meta_ptr_
->
CreateTableFile
(
table_file
);
if
(
!
status
.
ok
())
{
...
...
@@ -522,7 +523,7 @@ Status DBImpl::BuildIndex(const meta::TableFileSchema& file) {
meta
::
TableFileSchema
table_file
;
table_file
.
table_id_
=
file
.
table_id_
;
table_file
.
date_
=
file
.
date_
;
table_file
.
file_type_
=
meta
::
TableFileSchema
::
INDEX
;
//for multi-db-path, distribute index file averagely to each path
table_file
.
file_type_
=
meta
::
TableFileSchema
::
NEW_
INDEX
;
//for multi-db-path, distribute index file averagely to each path
Status
status
=
meta_ptr_
->
CreateTableFile
(
table_file
);
if
(
!
status
.
ok
())
{
ENGINE_LOG_ERROR
<<
"Failed to create table: "
<<
status
.
ToString
();
...
...
cpp/src/db/DBMetaImpl.cpp
浏览文件 @
7b9f0bb5
...
...
@@ -302,19 +302,49 @@ Status DBMetaImpl::DescribeTable(TableSchema &table_schema) {
Status
DBMetaImpl
::
HasNonIndexFiles
(
const
std
::
string
&
table_id
,
bool
&
has
)
{
has
=
false
;
try
{
auto
selected
=
ConnectorPtr
->
select
(
columns
(
&
TableFileSchema
::
id_
),
auto
selected
=
ConnectorPtr
->
select
(
columns
(
&
TableFileSchema
::
id_
,
&
TableFileSchema
::
file_type_
),
where
((
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
RAW
or
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
NEW
or
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
NEW_MERGE
or
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
NEW_INDEX
or
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
TO_INDEX
)
and
c
(
&
TableFileSchema
::
table_id_
)
==
table_id
));
if
(
selected
.
size
()
>=
1
)
{
has
=
true
;
}
else
{
has
=
false
;
int
raw_count
=
0
,
new_count
=
0
,
new_merge_count
=
0
,
new_index_count
=
0
,
to_index_count
=
0
;
for
(
auto
&
file
:
selected
)
{
switch
(
std
::
get
<
1
>
(
file
))
{
case
(
int
)
TableFileSchema
::
RAW
:
raw_count
++
;
break
;
case
(
int
)
TableFileSchema
::
NEW
:
new_count
++
;
break
;
case
(
int
)
TableFileSchema
::
NEW_MERGE
:
new_merge_count
++
;
break
;
case
(
int
)
TableFileSchema
::
NEW_INDEX
:
new_index_count
++
;
break
;
case
(
int
)
TableFileSchema
::
TO_INDEX
:
to_index_count
++
;
break
;
default:
break
;
}
}
ENGINE_LOG_DEBUG
<<
"Table "
<<
table_id
<<
" currently has raw files:"
<<
raw_count
<<
" new files:"
<<
new_count
<<
" new_merge files:"
<<
new_merge_count
<<
" new_index files:"
<<
new_index_count
<<
" to_index files:"
<<
to_index_count
;
}
}
catch
(
std
::
exception
&
e
)
{
...
...
@@ -389,7 +419,6 @@ Status DBMetaImpl::CreateTableFile(TableFileSchema &file_schema) {
MetricCollector
metric
;
NextFileId
(
file_schema
.
file_id_
);
file_schema
.
file_type_
=
TableFileSchema
::
NEW
;
file_schema
.
dimension_
=
table_schema
.
dimension_
;
file_schema
.
size_
=
0
;
file_schema
.
created_on_
=
utils
::
GetMicroSecTimeStamp
();
...
...
@@ -958,7 +987,11 @@ Status DBMetaImpl::CleanUp() {
std
::
lock_guard
<
std
::
mutex
>
meta_lock
(
meta_mutex_
);
auto
files
=
ConnectorPtr
->
select
(
columns
(
&
TableFileSchema
::
id_
),
where
(
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
NEW
));
where
(
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
NEW
or
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
NEW_INDEX
or
c
(
&
TableFileSchema
::
file_type_
)
==
(
int
)
TableFileSchema
::
NEW_MERGE
));
auto
commited
=
ConnectorPtr
->
transaction
([
&
]()
mutable
{
for
(
auto
&
file
:
files
)
{
...
...
cpp/src/db/MetaTypes.h
浏览文件 @
7b9f0bb5
...
...
@@ -43,6 +43,8 @@ struct TableFileSchema {
TO_INDEX
,
INDEX
,
TO_DELETE
,
NEW_MERGE
,
NEW_INDEX
,
}
FILE_TYPE
;
size_t
id_
=
0
;
...
...
cpp/src/db/MySQLMetaImpl.cpp
浏览文件 @
7b9f0bb5
...
...
@@ -404,6 +404,8 @@ Status MySQLMetaImpl::HasNonIndexFiles(const std::string &table_id, bool &has) {
"WHERE table_id = "
<<
quote
<<
table_id
<<
" AND "
<<
"(file_type = "
<<
std
::
to_string
(
TableFileSchema
::
RAW
)
<<
" OR "
<<
"file_type = "
<<
std
::
to_string
(
TableFileSchema
::
NEW
)
<<
" OR "
<<
"file_type = "
<<
std
::
to_string
(
TableFileSchema
::
NEW_MERGE
)
<<
" OR "
<<
"file_type = "
<<
std
::
to_string
(
TableFileSchema
::
NEW_INDEX
)
<<
" OR "
<<
"file_type = "
<<
std
::
to_string
(
TableFileSchema
::
TO_INDEX
)
<<
")) "
<<
"AS "
<<
quote
<<
"check"
<<
";"
;
...
...
@@ -706,7 +708,6 @@ Status MySQLMetaImpl::CreateTableFile(TableFileSchema &file_schema) {
MetricCollector
metric
;
NextFileId
(
file_schema
.
file_id_
);
file_schema
.
file_type_
=
TableFileSchema
::
NEW
;
file_schema
.
dimension_
=
table_schema
.
dimension_
;
file_schema
.
size_
=
0
;
file_schema
.
created_on_
=
utils
::
GetMicroSecTimeStamp
();
...
...
@@ -1701,7 +1702,10 @@ Status MySQLMetaImpl::CleanUp() {
if
(
!
res
.
empty
())
{
ENGINE_LOG_DEBUG
<<
"Remove table file type as NEW"
;
cleanUpQuery
<<
"DELETE FROM TableFiles WHERE file_type = "
<<
std
::
to_string
(
TableFileSchema
::
NEW
)
<<
";"
;
cleanUpQuery
<<
"DELETE FROM TableFiles WHERE file_type IN ("
<<
std
::
to_string
(
TableFileSchema
::
NEW
)
<<
","
<<
std
::
to_string
(
TableFileSchema
::
NEW_MERGE
)
<<
","
<<
std
::
to_string
(
TableFileSchema
::
NEW_INDEX
)
<<
");"
;
ENGINE_LOG_DEBUG
<<
"MySQLMetaImpl::CleanUp: "
<<
cleanUpQuery
.
str
();
...
...
cpp/src/db/Utils.cpp
浏览文件 @
7b9f0bb5
...
...
@@ -34,7 +34,7 @@ std::string GetTableFileParentFolder(const DBMetaOptions& options, const meta::T
std
::
string
target_path
=
options
.
path
;
uint64_t
index
=
0
;
if
(
meta
::
TableFileSchema
::
INDEX
==
table_file
.
file_type_
)
{
if
(
meta
::
TableFileSchema
::
NEW_
INDEX
==
table_file
.
file_type_
)
{
// index file is large file and to be persisted permanently
// we need to distribute index files to each db_path averagely
// round robin according to a file counter
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录