Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
0399c2b5
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
261
Star
22476
Fork
2472
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0399c2b5
编写于
9月 03, 2019
作者:
S
starlord
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code
Former-commit-id: cc73d87afb3ce7671f4103c06553562d63eaaf17
上级
4452de49
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
56 addition
and
98 deletion
+56
-98
cpp/src/db/DB.cpp
cpp/src/db/DB.cpp
+0
-22
cpp/src/db/DB.h
cpp/src/db/DB.h
+5
-6
cpp/src/db/DBImpl.h
cpp/src/db/DBImpl.h
+1
-2
cpp/src/metrics/Metrics.h
cpp/src/metrics/Metrics.h
+48
-66
cpp/src/server/DBWrapper.cpp
cpp/src/server/DBWrapper.cpp
+2
-2
未找到文件。
cpp/src/db/DB.cpp
已删除
100644 → 0
浏览文件 @
4452de49
/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#include "DBImpl.h"
#include "Factories.h"
namespace
zilliz
{
namespace
milvus
{
namespace
engine
{
DB
::~
DB
()
=
default
;
void
DB
::
Open
(
const
Options
&
options
,
DB
**
dbptr
)
{
*
dbptr
=
DBFactory
::
Build
(
options
);
}
}
// namespace engine
}
// namespace milvus
}
// namespace zilliz
cpp/src/db/DB.h
浏览文件 @
0399c2b5
...
...
@@ -20,7 +20,11 @@ class Env;
class
DB
{
public:
static
void
Open
(
const
Options
&
options
,
DB
**
dbptr
);
DB
()
=
default
;
DB
(
const
DB
&
)
=
delete
;
DB
&
operator
=
(
const
DB
&
)
=
delete
;
virtual
~
DB
()
=
default
;
virtual
Status
Start
()
=
0
;
virtual
Status
Stop
()
=
0
;
...
...
@@ -55,11 +59,6 @@ public:
virtual
Status
DropAll
()
=
0
;
DB
()
=
default
;
DB
(
const
DB
&
)
=
delete
;
DB
&
operator
=
(
const
DB
&
)
=
delete
;
virtual
~
DB
()
=
0
;
};
// DB
}
// namespace engine
...
...
cpp/src/db/DBImpl.h
浏览文件 @
0399c2b5
...
...
@@ -35,6 +35,7 @@ class DBImpl : public DB {
using
MetaPtr
=
meta
::
Meta
::
Ptr
;
explicit
DBImpl
(
const
Options
&
options
);
~
DBImpl
();
Status
Start
()
override
;
Status
Stop
()
override
;
...
...
@@ -91,8 +92,6 @@ class DBImpl : public DB {
Status
DropIndex
(
const
std
::
string
&
table_id
)
override
;
~
DBImpl
()
override
;
private:
Status
QueryAsync
(
const
std
::
string
&
table_id
,
const
meta
::
TableFilesSchema
&
files
,
...
...
cpp/src/metrics/Metrics.h
浏览文件 @
0399c2b5
...
...
@@ -29,17 +29,34 @@ class Metrics {
private:
static
MetricsBase
&
CreateMetricsCollector
();
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectMetricsBase
{
protected:
CollectMetricsBase
()
{
start_time_
=
METRICS_NOW_TIME
;
}
virtual
~
CollectMetricsBase
()
=
default
;
double
TimeFromBegine
()
{
auto
end_time
=
METRICS_NOW_TIME
;
return
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
}
protected:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
};
class
CollectInsertMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectInsertMetrics
:
CollectMetricsBase
{
public:
CollectInsertMetrics
(
size_t
n
,
engine
::
Status
&
status
)
:
n_
(
n
),
status_
(
status
)
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectInsertMetrics
()
{
if
(
n_
>
0
)
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
double
avg_time
=
total_time
/
n_
;
for
(
int
i
=
0
;
i
<
n_
;
++
i
)
{
Metrics
::
GetInstance
().
AddVectorsDurationHistogramOberve
(
avg_time
);
...
...
@@ -57,22 +74,19 @@ public:
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
size_t
n_
;
engine
::
Status
&
status_
;
};
class
CollectQueryMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectQueryMetrics
:
CollectMetricsBase
{
public:
CollectQueryMetrics
(
size_t
nq
)
:
nq_
(
nq
)
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectQueryMetrics
()
{
if
(
nq_
>
0
)
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
for
(
int
i
=
0
;
i
<
nq_
;
++
i
)
{
server
::
Metrics
::
GetInstance
().
QueryResponseSummaryObserve
(
total_time
);
}
...
...
@@ -83,112 +97,90 @@ public:
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
size_t
nq_
;
};
class
CollectMergeFilesMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectMergeFilesMetrics
:
CollectMetricsBase
{
public:
CollectMergeFilesMetrics
()
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectMergeFilesMetrics
()
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
server
::
Metrics
::
GetInstance
().
MemTableMergeDurationSecondsHistogramObserve
(
total_time
);
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
};
class
CollectBuildIndexMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectBuildIndexMetrics
:
CollectMetricsBase
{
public:
CollectBuildIndexMetrics
()
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectBuildIndexMetrics
()
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
server
::
Metrics
::
GetInstance
().
BuildIndexDurationSecondsHistogramObserve
(
total_time
);
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
};
class
CollectExecutionEngineMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectExecutionEngineMetrics
:
CollectMetricsBase
{
public:
CollectExecutionEngineMetrics
(
double
physical_size
)
:
physical_size_
(
physical_size
)
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectExecutionEngineMetrics
()
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
server
::
Metrics
::
GetInstance
().
FaissDiskLoadDurationSecondsHistogramObserve
(
total_time
);
server
::
Metrics
::
GetInstance
().
FaissDiskLoadSizeBytesHistogramObserve
(
physical_size_
);
server
::
Metrics
::
GetInstance
().
FaissDiskLoadIOSpeedGaugeSet
(
physical_size_
/
double
(
total_time
));
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
double
physical_size_
;
};
class
CollectSerializeMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectSerializeMetrics
:
CollectMetricsBase
{
public:
CollectSerializeMetrics
(
size_t
size
)
:
size_
(
size
)
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectSerializeMetrics
()
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
server
::
Metrics
::
GetInstance
().
DiskStoreIOSpeedGaugeSet
((
double
)
size_
/
total_time
);
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
size_t
size_
;
};
class
CollectAddMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectAddMetrics
:
CollectMetricsBase
{
public:
CollectAddMetrics
(
size_t
n
,
uint16_t
dimension
)
:
n_
(
n
),
dimension_
(
dimension
)
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectAddMetrics
()
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
server
::
Metrics
::
GetInstance
().
AddVectorsPerSecondGaugeSet
(
static_cast
<
int
>
(
n_
),
static_cast
<
int
>
(
dimension_
),
total_time
);
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
size_t
n_
;
uint16_t
dimension_
;
};
class
CollectDurationMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectDurationMetrics
:
CollectMetricsBase
{
public:
CollectDurationMetrics
(
int
index_type
)
:
index_type_
(
index_type
)
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectDurationMetrics
()
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
switch
(
index_type_
)
{
case
engine
::
meta
::
TableFileSchema
::
RAW
:
{
server
::
Metrics
::
GetInstance
().
SearchRawDataDurationSecondsHistogramObserve
(
total_time
);
...
...
@@ -205,20 +197,17 @@ public:
}
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
int
index_type_
;
};
class
CollectSearchTaskMetrics
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
CollectSearchTaskMetrics
:
CollectMetricsBase
{
public:
CollectSearchTaskMetrics
(
int
index_type
)
:
index_type_
(
index_type
)
{
start_time_
=
METRICS_NOW_TIME
;
}
~
CollectSearchTaskMetrics
()
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
switch
(
index_type_
)
{
case
engine
::
meta
::
TableFileSchema
::
RAW
:
{
server
::
Metrics
::
GetInstance
().
SearchRawDataDurationSecondsHistogramObserve
(
total_time
);
...
...
@@ -236,27 +225,20 @@ public:
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
int
index_type_
;
};
class
MetricCollector
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class
MetricCollector
:
CollectMetricsBase
{
public:
MetricCollector
()
{
server
::
Metrics
::
GetInstance
().
MetaAccessTotalIncrement
();
start_time_
=
METRICS_NOW_TIME
;
}
~
MetricCollector
()
{
auto
end_time
=
METRICS_NOW_TIME
;
auto
total_time
=
METRICS_MICROSECONDS
(
start_time_
,
end_time
);
auto
total_time
=
TimeFromBegine
();
server
::
Metrics
::
GetInstance
().
MetaAccessDurationSecondsHistogramObserve
(
total_time
);
}
private:
using
TIME_POINT
=
std
::
chrono
::
system_clock
::
time_point
;
TIME_POINT
start_time_
;
};
...
...
cpp/src/server/DBWrapper.cpp
浏览文件 @
0399c2b5
...
...
@@ -6,6 +6,7 @@
#include "DBWrapper.h"
#include "ServerConfig.h"
#include "db/Factories.h"
#include "utils/CommonUtil.h"
#include "utils/Log.h"
#include "utils/StringHelpFunctions.h"
...
...
@@ -95,8 +96,7 @@ ServerError DBWrapper::StartService() {
//create db instance
std
::
string
msg
=
opt
.
meta
.
path
;
try
{
engine
::
DB
*
db
=
nullptr
;
zilliz
::
milvus
::
engine
::
DB
::
Open
(
opt
,
&
db
);
engine
::
DB
*
db
=
engine
::
DBFactory
::
Build
(
opt
);
db_
.
reset
(
db
);
}
catch
(
std
::
exception
&
ex
)
{
msg
=
ex
.
what
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录