Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
e8f759c2
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,发现更多精彩内容 >>
未验证
提交
e8f759c2
编写于
4月 19, 2020
作者:
B
bigbraver
提交者:
GitHub
4月 19, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code optimize (#1986)
Signed-off-by:
N
bigbraver
<
bigbraver@qq.com
>
上级
25b6efc8
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
20 addition
and
24 deletion
+20
-24
core/src/db/Constants.h
core/src/db/Constants.h
+5
-9
core/src/db/DBImpl.cpp
core/src/db/DBImpl.cpp
+2
-2
core/src/db/Options.h
core/src/db/Options.h
+1
-1
core/src/db/insert/MemManagerImpl.cpp
core/src/db/insert/MemManagerImpl.cpp
+1
-1
core/src/db/meta/MetaTypes.h
core/src/db/meta/MetaTypes.h
+1
-1
core/src/db/meta/MySQLMetaImpl.cpp
core/src/db/meta/MySQLMetaImpl.cpp
+1
-1
core/src/db/meta/SqliteMetaImpl.cpp
core/src/db/meta/SqliteMetaImpl.cpp
+1
-1
core/unittest/db/test_db.cpp
core/unittest/db/test_db.cpp
+2
-2
core/unittest/db/test_db_mysql.cpp
core/unittest/db/test_db_mysql.cpp
+2
-2
core/unittest/db/test_delete.cpp
core/unittest/db/test_delete.cpp
+1
-1
core/unittest/db/test_meta.cpp
core/unittest/db/test_meta.cpp
+1
-1
core/unittest/db/test_meta_mysql.cpp
core/unittest/db/test_meta_mysql.cpp
+2
-2
未找到文件。
core/src/db/Constants.h
浏览文件 @
e8f759c2
...
...
@@ -16,18 +16,14 @@
namespace
milvus
{
namespace
engine
{
constexpr
uint64_t
K
=
1024UL
;
constexpr
uint64_t
M
=
K
*
K
;
constexpr
uint64_t
G
=
K
*
M
;
constexpr
uint64_t
T
=
K
*
G
;
constexpr
int64_t
KB
=
1LL
<<
10
;
constexpr
int64_t
MB
=
1LL
<<
20
;
constexpr
int64_t
GB
=
1LL
<<
30
;
constexpr
int64_t
TB
=
1LL
<<
40
;
constexpr
uint64_t
MAX_TABLE_FILE_MEM
=
128
*
M
;
constexpr
int64_t
MAX_TABLE_FILE_MEM
=
128
*
MB
;
constexpr
int
FLOAT_TYPE_SIZE
=
sizeof
(
float
);
static
constexpr
uint64_t
ONE_KB
=
K
;
static
constexpr
uint64_t
ONE_MB
=
ONE_KB
*
ONE_KB
;
static
constexpr
uint64_t
ONE_GB
=
ONE_KB
*
ONE_MB
;
}
// namespace engine
}
// namespace milvus
core/src/db/DBImpl.cpp
浏览文件 @
e8f759c2
...
...
@@ -204,7 +204,7 @@ DBImpl::CreateCollection(meta::CollectionSchema& collection_schema) {
}
meta
::
CollectionSchema
temp_schema
=
collection_schema
;
temp_schema
.
index_file_size_
*=
ONE_
MB
;
// store as MB
temp_schema
.
index_file_size_
*=
MB
;
// store as MB
if
(
options_
.
wal_enable_
)
{
temp_schema
.
flush_lsn_
=
wal_mgr_
->
CreateCollection
(
collection_schema
.
collection_id_
);
}
...
...
@@ -257,7 +257,7 @@ DBImpl::DescribeCollection(meta::CollectionSchema& collection_schema) {
}
auto
stat
=
meta_ptr_
->
DescribeCollection
(
collection_schema
);
collection_schema
.
index_file_size_
/=
ONE_
MB
;
// return as MB
collection_schema
.
index_file_size_
/=
MB
;
// return as MB
return
stat
;
}
...
...
core/src/db/Options.h
浏览文件 @
e8f759c2
...
...
@@ -68,7 +68,7 @@ struct DBOptions {
DBMetaOptions
meta_
;
int
mode_
=
MODE
::
SINGLE
;
size_t
insert_buffer_size_
=
4
*
ONE_
GB
;
size_t
insert_buffer_size_
=
4
*
GB
;
bool
insert_cache_immediately_
=
false
;
int64_t
auto_flush_interval_
=
1
;
...
...
core/src/db/insert/MemManagerImpl.cpp
浏览文件 @
e8f759c2
...
...
@@ -319,7 +319,7 @@ MemManagerImpl::GetMaxLSN(const MemList& tables) {
void
MemManagerImpl
::
OnInsertBufferSizeChanged
(
int64_t
value
)
{
options_
.
insert_buffer_size_
=
value
*
ONE_
GB
;
options_
.
insert_buffer_size_
=
value
*
GB
;
}
}
// namespace engine
...
...
core/src/db/meta/MetaTypes.h
浏览文件 @
e8f759c2
...
...
@@ -27,7 +27,7 @@ namespace meta {
constexpr
int32_t
DEFAULT_ENGINE_TYPE
=
(
int
)
EngineType
::
FAISS_IDMAP
;
constexpr
int32_t
DEFAULT_NLIST
=
16384
;
constexpr
int32_t
DEFAULT_METRIC_TYPE
=
(
int
)
MetricType
::
L2
;
constexpr
int32_t
DEFAULT_INDEX_FILE_SIZE
=
ONE_
GB
;
constexpr
int32_t
DEFAULT_INDEX_FILE_SIZE
=
GB
;
constexpr
char
CURRENT_VERSION
[]
=
MILVUS_VERSION
;
constexpr
int64_t
FLAG_MASK_NO_USERID
=
0x1
;
...
...
core/src/db/meta/MySQLMetaImpl.cpp
浏览文件 @
e8f759c2
...
...
@@ -2073,7 +2073,7 @@ MySQLMetaImpl::Archive() {
uint64_t
sum
=
0
;
Size
(
sum
);
auto
to_delete
=
(
sum
-
limit
*
G
);
auto
to_delete
=
(
sum
-
limit
*
G
B
);
DiscardFiles
(
to_delete
);
LOG_ENGINE_DEBUG_
<<
"Archive files to free disk"
;
...
...
core/src/db/meta/SqliteMetaImpl.cpp
浏览文件 @
e8f759c2
...
...
@@ -1461,7 +1461,7 @@ SqliteMetaImpl::Archive() {
uint64_t
sum
=
0
;
Size
(
sum
);
int64_t
to_delete
=
(
int64_t
)
sum
-
limit
*
G
;
int64_t
to_delete
=
(
int64_t
)
sum
-
limit
*
G
B
;
DiscardFiles
(
to_delete
);
LOG_ENGINE_DEBUG_
<<
"Archive files to free disk"
;
...
...
core/unittest/db/test_db.cpp
浏览文件 @
e8f759c2
...
...
@@ -200,7 +200,7 @@ TEST_F(DBTest, DB_TEST) {
std
::
vector
<
std
::
string
>
tags
;
stat
=
db_
->
Query
(
dummy_context_
,
COLLECTION_NAME
,
tags
,
k
,
json_params
,
qxb
,
result_ids
,
result_distances
);
ss
<<
"Search "
<<
j
<<
" With Size "
<<
count
/
milvus
::
engine
::
M
<<
" M
"
;
ss
<<
"Search "
<<
j
<<
" With Size "
<<
count
/
milvus
::
engine
::
M
B
<<
" MB
"
;
STOP_TIMER
(
ss
.
str
());
ASSERT_TRUE
(
stat
.
ok
());
...
...
@@ -946,7 +946,7 @@ TEST_F(DBTest2, ARHIVE_DISK_CHECK) {
db_
->
Size
(
size
);
LOG
(
DEBUG
)
<<
"size="
<<
size
;
ASSERT_LE
(
size
,
1
*
milvus
::
engine
::
G
);
ASSERT_LE
(
size
,
1
*
milvus
::
engine
::
G
B
);
}
TEST_F
(
DBTest2
,
DELETE_TEST
)
{
...
...
core/unittest/db/test_db_mysql.cpp
浏览文件 @
e8f759c2
...
...
@@ -92,7 +92,7 @@ TEST_F(MySqlDBTest, DB_TEST) {
std
::
vector
<
std
::
string
>
tags
;
stat
=
db_
->
Query
(
dummy_context_
,
COLLECTION_NAME
,
tags
,
k
,
json_params
,
qxb
,
result_ids
,
result_distances
);
ss
<<
"Search "
<<
j
<<
" With Size "
<<
count
/
milvus
::
engine
::
M
<<
" M
"
;
ss
<<
"Search "
<<
j
<<
" With Size "
<<
count
/
milvus
::
engine
::
M
B
<<
" MB
"
;
STOP_TIMER
(
ss
.
str
());
ASSERT_TRUE
(
stat
.
ok
());
...
...
@@ -250,7 +250,7 @@ TEST_F(MySqlDBTest, ARHIVE_DISK_CHECK) {
db_
->
Size
(
size
);
LOG
(
DEBUG
)
<<
"size="
<<
size
;
ASSERT_LE
(
size
,
1
*
milvus
::
engine
::
G
);
ASSERT_LE
(
size
,
1
*
milvus
::
engine
::
G
B
);
FIU_ENABLE_FIU
(
"MySQLMetaImpl.Size.null_connection"
);
stat
=
db_
->
Size
(
size
);
...
...
core/unittest/db/test_delete.cpp
浏览文件 @
e8f759c2
...
...
@@ -740,7 +740,7 @@ TEST_F(CompactTest, compact_basic) {
TEST_F
(
CompactTest
,
compact_with_index
)
{
milvus
::
engine
::
meta
::
CollectionSchema
collection_info
=
BuildCollectionSchema
();
collection_info
.
index_file_size_
=
milvus
::
engine
::
ONE_
KB
;
collection_info
.
index_file_size_
=
milvus
::
engine
::
KB
;
collection_info
.
engine_type_
=
(
int32_t
)
milvus
::
engine
::
EngineType
::
FAISS_IVFSQ8
;
auto
stat
=
db_
->
CreateCollection
(
collection_info
);
...
...
core/unittest/db/test_meta.cpp
浏览文件 @
e8f759c2
...
...
@@ -506,7 +506,7 @@ TEST_F(MetaTest, ARCHIVE_TEST_DISK) {
for
(
auto
i
=
0
;
i
<
cnt
;
++
i
)
{
status
=
impl
.
CreateCollectionFile
(
table_file
);
table_file
.
file_type_
=
milvus
::
engine
::
meta
::
SegmentSchema
::
NEW
;
table_file
.
file_size_
=
each_size
*
milvus
::
engine
::
G
;
table_file
.
file_size_
=
each_size
*
milvus
::
engine
::
G
B
;
status
=
impl
.
UpdateCollectionFile
(
table_file
);
files
.
push_back
(
table_file
);
ids
.
push_back
(
table_file
.
id_
);
...
...
core/unittest/db/test_meta_mysql.cpp
浏览文件 @
e8f759c2
...
...
@@ -446,7 +446,7 @@ TEST_F(MySqlMetaTest, ARCHIVE_TEST_DISK) {
for
(
auto
i
=
0
;
i
<
cnt
;
++
i
)
{
status
=
impl
.
CreateCollectionFile
(
table_file
);
table_file
.
file_type_
=
milvus
::
engine
::
meta
::
SegmentSchema
::
NEW
;
table_file
.
file_size_
=
each_size
*
milvus
::
engine
::
G
;
table_file
.
file_size_
=
each_size
*
milvus
::
engine
::
G
B
;
status
=
impl
.
UpdateCollectionFile
(
table_file
);
files
.
push_back
(
table_file
);
ids
.
push_back
(
table_file
.
id_
);
...
...
@@ -618,7 +618,7 @@ TEST_F(MySqlMetaTest, COLLECTION_FILES_TEST) {
ASSERT_EQ
(
status
.
code
(),
milvus
::
DB_NOT_FOUND
);
table_file
.
file_type_
=
milvus
::
engine
::
meta
::
SegmentSchema
::
RAW
;
table_file
.
file_size_
=
milvus
::
engine
::
ONE_
GB
+
1
;
table_file
.
file_size_
=
milvus
::
engine
::
GB
+
1
;
status
=
impl_
->
UpdateCollectionFile
(
table_file
);
ASSERT_TRUE
(
status
.
ok
());
#if 0
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录