Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
46650833
M
milvus
项目概览
milvus
/
milvus
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
46650833
编写于
9月 30, 2020
作者:
F
FluorineDog
提交者:
yefu.chen
9月 30, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable backtrace for better debugging
Signed-off-by:
N
FluorineDog
<
guilin.gou@zilliz.com
>
上级
998e7504
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
78 addition
and
17 deletion
+78
-17
core/src/dog_segment/CMakeLists.txt
core/src/dog_segment/CMakeLists.txt
+4
-1
core/src/dog_segment/EasyAssert.cpp
core/src/dog_segment/EasyAssert.cpp
+26
-0
core/src/dog_segment/EasyAssert.h
core/src/dog_segment/EasyAssert.h
+5
-10
core/src/dog_segment/SegmentDefs.h
core/src/dog_segment/SegmentDefs.h
+1
-3
core/src/dog_segment/SegmentNaive.cpp
core/src/dog_segment/SegmentNaive.cpp
+0
-3
core/unittest/test_dog_segment.cpp
core/unittest/test_dog_segment.cpp
+42
-0
未找到文件。
core/src/dog_segment/CMakeLists.txt
浏览文件 @
46650833
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../pb PB_SRC_FILES
)
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/../pb PB_SRC_FILES
)
# add_definitions(-DBOOST_STACKTRACE_USE_ADDR2LINE)
set
(
DOG_SEGMENT_FILES
set
(
DOG_SEGMENT_FILES
SegmentNaive.cpp
SegmentNaive.cpp
IndexMeta.cpp
IndexMeta.cpp
...
@@ -9,6 +10,7 @@ set(DOG_SEGMENT_FILES
...
@@ -9,6 +10,7 @@ set(DOG_SEGMENT_FILES
collection_c.cpp
collection_c.cpp
partition_c.cpp
partition_c.cpp
segment_c.cpp
segment_c.cpp
EasyAssert.cpp
${
PB_SRC_FILES
}
${
PB_SRC_FILES
}
)
)
add_library
(
milvus_dog_segment SHARED
add_library
(
milvus_dog_segment SHARED
...
@@ -18,4 +20,5 @@ add_library(milvus_dog_segment SHARED
...
@@ -18,4 +20,5 @@ add_library(milvus_dog_segment SHARED
#add_dependencies( segment sqlite mysqlpp )
#add_dependencies( segment sqlite mysqlpp )
target_link_libraries
(
milvus_dog_segment tbb utils pthread knowhere log libprotobuf
)
target_link_libraries
(
milvus_dog_segment tbb utils pthread knowhere log libprotobuf dl backtrace
)
core/src/dog_segment/EasyAssert.cpp
0 → 100644
浏览文件 @
46650833
#include <iostream>
#include "EasyAssert.h"
// #define BOOST_STACKTRACE_USE_ADDR2LINE
#define BOOST_STACKTRACE_USE_BACKTRACE
#include <boost/stacktrace.hpp>
namespace
milvus
::
impl
{
void
EasyAssertInfo
(
bool
value
,
std
::
string_view
expr_str
,
std
::
string_view
filename
,
int
lineno
,
std
::
string_view
extra_info
)
{
if
(
!
value
)
{
std
::
string
info
;
info
+=
"Assert
\"
"
+
std
::
string
(
expr_str
)
+
"
\"
"
;
info
+=
" at "
+
std
::
string
(
filename
)
+
":"
+
std
::
to_string
(
lineno
)
+
"
\n
"
;
if
(
!
extra_info
.
empty
())
{
info
+=
" => "
+
std
::
string
(
extra_info
);
}
auto
fuck
=
boost
::
stacktrace
::
stacktrace
();
std
::
cout
<<
fuck
;
// std::string s = fuck;
// info += ;
throw
std
::
runtime_error
(
info
);
}
}
}
\ No newline at end of file
core/src/dog_segment/EasyAssert.h
浏览文件 @
46650833
#pragma once
#pragma once
#include <string_view>
#include <string_view>
#include <stdio.h>
#include <stdlib.h>
/* Paste this on the file you want to debug. */
namespace
milvus
::
impl
{
namespace
milvus
::
impl
{
inline
void
EasyAssertInfo
(
bool
value
,
std
::
string_view
expr_str
,
std
::
string_view
filename
,
int
lineno
,
void
EasyAssertInfo
(
bool
value
,
std
::
string_view
expr_str
,
std
::
string_view
filename
,
int
lineno
,
std
::
string_view
extra_info
)
{
std
::
string_view
extra_info
);
if
(
!
value
)
{
std
::
string
info
;
info
+=
"Assert
\"
"
+
std
::
string
(
expr_str
)
+
"
\"
"
;
info
+=
" at "
+
std
::
string
(
filename
)
+
":"
+
std
::
to_string
(
lineno
);
info
+=
" => "
+
std
::
string
(
extra_info
);
throw
std
::
runtime_error
(
info
);
}
}
}
}
#define AssertInfo(expr, info) impl::EasyAssertInfo(bool(expr), #expr, __FILE__, __LINE__, (info))
#define AssertInfo(expr, info) impl::EasyAssertInfo(bool(expr), #expr, __FILE__, __LINE__, (info))
...
...
core/src/dog_segment/SegmentDefs.h
浏览文件 @
46650833
...
@@ -171,9 +171,7 @@ class Schema {
...
@@ -171,9 +171,7 @@ class Schema {
const
FieldMeta
&
const
FieldMeta
&
operator
[](
const
std
::
string
&
field_name
)
const
{
operator
[](
const
std
::
string
&
field_name
)
const
{
auto
offset_iter
=
offsets_
.
find
(
field_name
);
auto
offset_iter
=
offsets_
.
find
(
field_name
);
if
(
offset_iter
==
offsets_
.
end
())
{
AssertInfo
(
offset_iter
!=
offsets_
.
end
(),
"Cannot found field_name: "
+
field_name
);
throw
std
::
runtime_error
(
"Cannot found field_name: "
+
field_name
);
}
auto
offset
=
offset_iter
->
second
;
auto
offset
=
offset_iter
->
second
;
return
(
*
this
)[
offset
];
return
(
*
this
)[
offset
];
}
}
...
...
core/src/dog_segment/SegmentNaive.cpp
浏览文件 @
46650833
...
@@ -96,9 +96,6 @@ auto SegmentNaive::get_deleted_bitmap(int64_t del_barrier, Timestamp query_times
...
@@ -96,9 +96,6 @@ auto SegmentNaive::get_deleted_bitmap(int64_t del_barrier, Timestamp query_times
if
(
offset
>=
insert_barrier
)
{
if
(
offset
>=
insert_barrier
)
{
continue
;
continue
;
}
}
if
(
offset
>=
insert_barrier
)
{
continue
;
}
if
(
record_
.
timestamps_
[
offset
]
<
query_timestamp
)
{
if
(
record_
.
timestamps_
[
offset
]
<
query_timestamp
)
{
Assert
(
offset
<
insert_barrier
);
Assert
(
offset
<
insert_barrier
);
the_offset
=
std
::
max
(
the_offset
,
offset
);
the_offset
=
std
::
max
(
the_offset
,
offset
);
...
...
core/unittest/test_dog_segment.cpp
浏览文件 @
46650833
...
@@ -24,6 +24,34 @@ using std::cin;
...
@@ -24,6 +24,34 @@ using std::cin;
using
std
::
cout
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
endl
;
namespace
{
auto
generate_data
(
int
N
)
{
std
::
vector
<
char
>
raw_data
;
std
::
vector
<
uint64_t
>
timestamps
;
std
::
vector
<
int64_t
>
uids
;
std
::
default_random_engine
er
(
42
);
std
::
normal_distribution
<>
distribution
(
0.0
,
1.0
);
std
::
default_random_engine
ei
(
42
);
for
(
int
i
=
0
;
i
<
N
;
++
i
)
{
uids
.
push_back
(
10
*
N
+
i
);
timestamps
.
push_back
(
0
);
// append vec
float
vec
[
16
];
for
(
auto
&
x
:
vec
)
{
x
=
distribution
(
er
);
}
raw_data
.
insert
(
raw_data
.
end
(),
(
const
char
*
)
std
::
begin
(
vec
),
(
const
char
*
)
std
::
end
(
vec
));
int
age
=
ei
()
%
100
;
raw_data
.
insert
(
raw_data
.
end
(),
(
const
char
*
)
&
age
,
((
const
char
*
)
&
age
)
+
sizeof
(
age
));
}
return
std
::
make_tuple
(
raw_data
,
timestamps
,
uids
);
}
}
// namespace
TEST
(
DogSegmentTest
,
TestABI
)
{
TEST
(
DogSegmentTest
,
TestABI
)
{
using
namespace
milvus
::
engine
;
using
namespace
milvus
::
engine
;
...
@@ -32,6 +60,20 @@ TEST(DogSegmentTest, TestABI) {
...
@@ -32,6 +60,20 @@ TEST(DogSegmentTest, TestABI) {
assert
(
true
);
assert
(
true
);
}
}
TEST
(
DogSegmentTest
,
NormalDistributionTest
)
{
using
namespace
milvus
::
dog_segment
;
using
namespace
milvus
::
engine
;
auto
schema
=
std
::
make_shared
<
Schema
>
();
schema
->
AddField
(
"fakevec"
,
DataType
::
VECTOR_FLOAT
,
16
);
schema
->
AddField
(
"age"
,
DataType
::
INT32
);
int
N
=
1000
*
1000
;
auto
[
raw_data
,
timestamps
,
uids
]
=
generate_data
(
N
);
auto
segment
=
CreateSegment
(
schema
);
segment
->
PreInsert
(
N
);
segment
->
PreDelete
(
N
);
}
TEST
(
DogSegmentTest
,
MockTest
)
{
TEST
(
DogSegmentTest
,
MockTest
)
{
using
namespace
milvus
::
dog_segment
;
using
namespace
milvus
::
dog_segment
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录