Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
c9e825aa
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,发现更多精彩内容 >>
提交
c9e825aa
编写于
10月 09, 2019
作者:
Y
Yu Kun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code format
Former-commit-id: be5723f04c7378ab89db9ade5148778ab4ca6cec
上级
4d66e9be
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
36 addition
and
38 deletion
+36
-38
cpp/src/db/DBImpl.cpp
cpp/src/db/DBImpl.cpp
+22
-23
cpp/src/db/engine/ExecutionEngineImpl.h
cpp/src/db/engine/ExecutionEngineImpl.h
+1
-1
cpp/src/scheduler/job/BuildIndexJob.cpp
cpp/src/scheduler/job/BuildIndexJob.cpp
+3
-6
cpp/src/scheduler/job/BuildIndexJob.h
cpp/src/scheduler/job/BuildIndexJob.h
+2
-2
cpp/src/scheduler/task/BuildIndexTask.cpp
cpp/src/scheduler/task/BuildIndexTask.cpp
+7
-5
cpp/src/scheduler/task/BuildIndexTask.h
cpp/src/scheduler/task/BuildIndexTask.h
+0
-1
cpp/unittest/metrics/utils.cpp
cpp/unittest/metrics/utils.cpp
+1
-0
未找到文件。
cpp/src/db/DBImpl.cpp
浏览文件 @
c9e825aa
...
...
@@ -898,34 +898,33 @@ DBImpl::BackgroundBuildIndex() {
meta_ptr_
->
FilesToIndex
(
to_index_files
);
Status
status
;
//
scheduler::BuildIndexJobPtr
//
job = std::make_shared<scheduler::BuildIndexJob>(0, meta_ptr_, options_);
scheduler
::
BuildIndexJobPtr
job
=
std
::
make_shared
<
scheduler
::
BuildIndexJob
>
(
0
,
meta_ptr_
,
options_
);
// step 2: put build index task to scheduler
// for (auto &file : to_index_files) {
// scheduler::TableFileSchemaPtr file_ptr = std::make_shared<meta::TableFileSchema>(file);
// job->AddToIndexFiles(file_ptr);
// }
// scheduler::JobMgrInst::GetInstance()->Put(job);
// job->WaitBuildIndexFinish();
// if (!job->GetStatus().ok()) {
// Status status = job->GetStatus();
// ENGINE_LOG_ERROR << "Building index failed: " << status.ToString();
// }
for
(
auto
&
file
:
to_index_files
)
{
std
::
cout
<<
"get to index file"
<<
std
::
endl
;
status
=
BuildIndex
(
file
);
if
(
!
status
.
ok
())
{
ENGINE_LOG_ERROR
<<
"Building index for "
<<
file
.
id_
<<
" failed: "
<<
status
.
ToString
();
}
if
(
shutting_down_
.
load
(
std
::
memory_order_acquire
))
{
ENGINE_LOG_DEBUG
<<
"Server will shutdown, skip build index action"
;
break
;
}
scheduler
::
TableFileSchemaPtr
file_ptr
=
std
::
make_shared
<
meta
::
TableFileSchema
>
(
file
);
job
->
AddToIndexFiles
(
file_ptr
);
}
scheduler
::
JobMgrInst
::
GetInstance
()
->
Put
(
job
);
job
->
WaitBuildIndexFinish
();
if
(
!
job
->
GetStatus
().
ok
())
{
Status
status
=
job
->
GetStatus
();
ENGINE_LOG_ERROR
<<
"Building index failed: "
<<
status
.
ToString
();
}
// for (auto &file : to_index_files) {
// status = BuildIndex(file);
// if (!status.ok()) {
// ENGINE_LOG_ERROR << "Building index for " << file.id_ << " failed: " << status.ToString();
// }
//
// if (shutting_down_.load(std::memory_order_acquire)) {
// ENGINE_LOG_DEBUG << "Server will shutdown, skip build index action";
// break;
// }
// }
ENGINE_LOG_TRACE
<<
"Background build index thread exit"
;
}
...
...
cpp/src/db/engine/ExecutionEngineImpl.h
浏览文件 @
c9e825aa
...
...
@@ -59,7 +59,7 @@ class ExecutionEngineImpl : public ExecutionEngine {
CopyToGpu
(
uint64_t
device_id
)
override
;
Status
CopyToIndexFileToGpu
(
uint64_t
device_id
)
override
;
CopyToIndexFileToGpu
(
uint64_t
device_id
)
override
;
Status
CopyToCpu
()
override
;
...
...
cpp/src/scheduler/job/BuildIndexJob.cpp
浏览文件 @
c9e825aa
...
...
@@ -15,16 +15,14 @@
// specific language governing permissions and limitations
// under the License.
#include "BuildIndexJob.h"
#include "utils/Log.h"
#include "BuildIndexJob.h"
namespace
milvus
{
namespace
scheduler
{
BuildIndexJob
::
BuildIndexJob
(
JobId
id
,
engine
::
meta
::
MetaPtr
meta_ptr
,
engine
::
DBOptions
options
)
:
Job
(
id
,
JobType
::
BUILD
),
meta_ptr_
(
std
::
move
(
meta_ptr
)),
options_
(
std
::
move
(
options
))
{
}
bool
...
...
@@ -54,6 +52,5 @@ BuildIndexJob::BuildIndexDone(size_t to_index_id) {
SERVER_LOG_DEBUG
<<
"BuildIndexJob "
<<
id
()
<<
" finish index file: "
<<
to_index_id
;
}
}
}
\ No newline at end of file
}
// namespace scheduler
}
// namespace milvus
cpp/src/scheduler/job/BuildIndexJob.h
浏览文件 @
c9e825aa
...
...
@@ -87,5 +87,5 @@ class BuildIndexJob : public Job {
using
BuildIndexJobPtr
=
std
::
shared_ptr
<
BuildIndexJob
>
;
}
}
}
// namespace scheduler
}
// namespace milvus
cpp/src/scheduler/task/BuildIndexTask.cpp
浏览文件 @
c9e825aa
...
...
@@ -26,6 +26,7 @@
#include <thread>
#include <utility>
namespace
milvus
{
namespace
scheduler
{
...
...
@@ -61,7 +62,7 @@ XBuildIndexTask::Load(milvus::scheduler::LoadType type, uint8_t device_id) {
error_msg
=
"Wrong load type"
;
stat
=
Status
(
SERVER_UNEXPECTED_ERROR
,
error_msg
);
}
}
catch
(
std
::
exception
&
ex
)
{
}
catch
(
std
::
exception
&
ex
)
{
// typical error: out of disk space or permition denied
error_msg
=
"Failed to load to_index file: "
+
std
::
string
(
ex
.
what
());
stat
=
Status
(
SERVER_UNEXPECTED_ERROR
,
error_msg
);
...
...
@@ -69,7 +70,7 @@ XBuildIndexTask::Load(milvus::scheduler::LoadType type, uint8_t device_id) {
if
(
!
stat
.
ok
())
{
Status
s
;
if
(
stat
.
ToString
().
find
(
"out of memory"
)
!=
std
::
string
::
npos
)
{
if
(
stat
.
ToString
().
find
(
"out of memory"
)
!=
std
::
string
::
npos
)
{
error_msg
=
"out of memory: "
+
type_str
;
s
=
Status
(
SERVER_UNEXPECTED_ERROR
,
error_msg
);
}
else
{
...
...
@@ -108,7 +109,7 @@ XBuildIndexTask::Execute() {
if
(
auto
job
=
job_
.
lock
())
{
auto
build_index_job
=
std
::
static_pointer_cast
<
scheduler
::
BuildIndexJob
>
(
job
);
std
::
string
location
=
file_
->
location_
;
EngineType
engine_type
=
(
EngineType
)
file_
->
engine_type_
;
EngineType
engine_type
=
(
EngineType
)
file_
->
engine_type_
;
std
::
shared_ptr
<
engine
::
ExecutionEngine
>
index
;
// step 2: create table file
...
...
@@ -116,7 +117,7 @@ XBuildIndexTask::Execute() {
table_file
.
table_id_
=
file_
->
table_id_
;
table_file
.
date_
=
file_
->
date_
;
table_file
.
file_type_
=
engine
::
meta
::
TableFileSchema
::
NEW_INDEX
;
// for multi-db-path, distribute index file averagely to each path
engine
::
meta
::
TableFileSchema
::
NEW_INDEX
;
engine
::
meta
::
MetaPtr
meta_ptr
=
build_index_job
->
meta
();
Status
status
=
build_index_job
->
meta
()
->
CreateTableFile
(
table_file
);
...
...
@@ -204,7 +205,8 @@ XBuildIndexTask::Execute() {
table_file
.
file_type_
=
engine
::
meta
::
TableFileSchema
::
TO_DELETE
;
status
=
meta_ptr
->
UpdateTableFile
(
table_file
);
ENGINE_LOG_DEBUG
<<
"Failed to up date file to index, mark file: "
<<
table_file
.
file_id_
<<
" to to_delete"
;
ENGINE_LOG_DEBUG
<<
"Failed to up date file to index, mark file: "
<<
table_file
.
file_id_
<<
" to to_delete"
;
}
build_index_job
->
BuildIndexDone
(
to_index_id_
);
...
...
cpp/src/scheduler/task/BuildIndexTask.h
浏览文件 @
c9e825aa
...
...
@@ -41,7 +41,6 @@ class XBuildIndexTask : public Task {
size_t
to_index_id_
=
0
;
int
to_index_type_
=
0
;
ExecutionEnginePtr
to_index_engine_
=
nullptr
;
};
}
// namespace scheduler
...
...
cpp/unittest/metrics/utils.cpp
浏览文件 @
c9e825aa
...
...
@@ -66,6 +66,7 @@ ms::engine::DBOptions MetricTest::GetOptions() {
}
void
MetricTest
::
SetUp
()
{
boost
::
filesystem
::
remove_all
(
"/tmp/milvus_test"
);
InitLog
();
auto
options
=
GetOptions
();
db_
=
ms
::
engine
::
DBFactory
::
Build
(
options
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录