Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
milvus
提交
f3df1530
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,发现更多精彩内容 >>
提交
f3df1530
编写于
8月 29, 2019
作者:
G
groot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MS-331 Crate Table : when table exists, error code is META_FAILED
Former-commit-id: 5c59553557db4457ed93c695a592af5aa938f0c2
上级
6786109d
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
37 addition
and
17 deletion
+37
-17
cpp/CHANGELOG.md
cpp/CHANGELOG.md
+2
-0
cpp/src/db/Status.cpp
cpp/src/db/Status.cpp
+15
-0
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
+20
-17
未找到文件。
cpp/CHANGELOG.md
浏览文件 @
f3df1530
...
@@ -12,6 +12,8 @@ Please mark all change in change log and use the ticket from JIRA.
...
@@ -12,6 +12,8 @@ Please mark all change in change log and use the ticket from JIRA.
-
MS-413 - Create index failed and server exited
-
MS-413 - Create index failed and server exited
-
MS-427 - Describe index error after drop index
-
MS-427 - Describe index error after drop index
-
MS-432 - Search vectors params nprobe need to check max number
-
MS-432 - Search vectors params nprobe need to check max number
-
MS-431 - Search vectors params nprobe: 0/-1, expected result: raise exception
-
MS-331 - Crate Table : when table exists, error code is META_FAILED(code=15) rather than ILLEGAL TABLE NAME(code=9))
## Improvement
## Improvement
-
MS-327 - Clean code for milvus
-
MS-327 - Clean code for milvus
...
...
cpp/src/db/Status.cpp
浏览文件 @
f3df1530
...
@@ -48,6 +48,21 @@ std::string Status::ToString() const {
...
@@ -48,6 +48,21 @@ std::string Status::ToString() const {
case
kNotFound
:
case
kNotFound
:
type
=
"NotFound: "
;
type
=
"NotFound: "
;
break
;
break
;
case
kError
:
type
=
"Error: "
;
break
;
case
kInvalidDBPath
:
type
=
"InvalidDBPath: "
;
break
;
case
kGroupError
:
type
=
"GroupError: "
;
break
;
case
kDBTransactionError
:
type
=
"DBTransactionError: "
;
break
;
case
kAlreadyExist
:
type
=
"AlreadyExist: "
;
break
;
default:
default:
snprintf
(
tmp
,
sizeof
(
tmp
),
"Unkown code(%d): "
,
snprintf
(
tmp
,
sizeof
(
tmp
),
"Unkown code(%d): "
,
static_cast
<
int
>
(
code
()));
static_cast
<
int
>
(
code
()));
...
...
cpp/src/server/grpc_impl/GrpcRequestTask.cpp
浏览文件 @
f3df1530
...
@@ -153,7 +153,10 @@ CreateTableTask::OnExecute() {
...
@@ -153,7 +153,10 @@ CreateTableTask::OnExecute() {
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
CreateTable
(
table_info
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
CreateTable
(
table_info
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
//table could exist
//table could exist
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
if
(
stat
.
IsAlreadyExist
())
{
return
SetError
(
SERVER_INVALID_TABLE_NAME
,
stat
.
ToString
());
}
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
}
catch
(
std
::
exception
&
ex
)
{
}
catch
(
std
::
exception
&
ex
)
{
...
@@ -193,7 +196,7 @@ DescribeTableTask::OnExecute() {
...
@@ -193,7 +196,7 @@ DescribeTableTask::OnExecute() {
table_info
.
table_id_
=
table_name_
;
table_info
.
table_id_
=
table_name_
;
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
DescribeTable
(
table_info
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
DescribeTable
(
table_info
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
schema_
->
mutable_table_name
()
->
set_table_name
(
table_info
.
table_id_
);
schema_
->
mutable_table_name
()
->
set_table_name
(
table_info
.
table_id_
);
...
@@ -238,7 +241,7 @@ CreateIndexTask::OnExecute() {
...
@@ -238,7 +241,7 @@ CreateIndexTask::OnExecute() {
bool
has_table
=
false
;
bool
has_table
=
false
;
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
HasTable
(
table_name_
,
has_table
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
HasTable
(
table_name_
,
has_table
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
if
(
!
has_table
)
{
if
(
!
has_table
)
{
...
@@ -268,7 +271,7 @@ CreateIndexTask::OnExecute() {
...
@@ -268,7 +271,7 @@ CreateIndexTask::OnExecute() {
index
.
metric_type_
=
grpc_index
.
metric_type
();
index
.
metric_type_
=
grpc_index
.
metric_type
();
stat
=
DBWrapper
::
DB
()
->
CreateIndex
(
table_name_
,
index
);
stat
=
DBWrapper
::
DB
()
->
CreateIndex
(
table_name_
,
index
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
SERVER_BUILD_INDEX_ERROR
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
SERVER_BUILD_INDEX_ERROR
,
stat
.
ToString
());
}
}
rc
.
ElapseFromBegin
(
"totally cost"
);
rc
.
ElapseFromBegin
(
"totally cost"
);
...
@@ -306,7 +309,7 @@ HasTableTask::OnExecute() {
...
@@ -306,7 +309,7 @@ HasTableTask::OnExecute() {
//step 2: check table existence
//step 2: check table existence
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
HasTable
(
table_name_
,
has_table_
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
HasTable
(
table_name_
,
has_table_
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
rc
.
ElapseFromBegin
(
"totally cost"
);
rc
.
ElapseFromBegin
(
"totally cost"
);
...
@@ -348,7 +351,7 @@ DropTableTask::OnExecute() {
...
@@ -348,7 +351,7 @@ DropTableTask::OnExecute() {
if
(
stat
.
IsNotFound
())
{
if
(
stat
.
IsNotFound
())
{
return
SetError
(
SERVER_TABLE_NOT_EXIST
,
"Table "
+
table_name_
+
" not exists"
);
return
SetError
(
SERVER_TABLE_NOT_EXIST
,
"Table "
+
table_name_
+
" not exists"
);
}
else
{
}
else
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
}
}
...
@@ -358,7 +361,7 @@ DropTableTask::OnExecute() {
...
@@ -358,7 +361,7 @@ DropTableTask::OnExecute() {
std
::
vector
<
DB_DATE
>
dates
;
std
::
vector
<
DB_DATE
>
dates
;
stat
=
DBWrapper
::
DB
()
->
DeleteTable
(
table_name_
,
dates
);
stat
=
DBWrapper
::
DB
()
->
DeleteTable
(
table_name_
,
dates
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
rc
.
ElapseFromBegin
(
"total cost"
);
rc
.
ElapseFromBegin
(
"total cost"
);
...
@@ -386,7 +389,7 @@ ShowTablesTask::OnExecute() {
...
@@ -386,7 +389,7 @@ ShowTablesTask::OnExecute() {
std
::
vector
<
engine
::
meta
::
TableSchema
>
schema_array
;
std
::
vector
<
engine
::
meta
::
TableSchema
>
schema_array
;
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
AllTables
(
schema_array
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
AllTables
(
schema_array
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
for
(
auto
&
schema
:
schema_array
)
{
for
(
auto
&
schema
:
schema_array
)
{
...
@@ -448,7 +451,7 @@ InsertTask::OnExecute() {
...
@@ -448,7 +451,7 @@ InsertTask::OnExecute() {
return
SetError
(
SERVER_TABLE_NOT_EXIST
,
return
SetError
(
SERVER_TABLE_NOT_EXIST
,
"Table "
+
insert_param_
->
table_name
()
+
" not exists"
);
"Table "
+
insert_param_
->
table_name
()
+
" not exists"
);
}
else
{
}
else
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
}
}
...
@@ -588,7 +591,7 @@ SearchTask::OnExecute() {
...
@@ -588,7 +591,7 @@ SearchTask::OnExecute() {
if
(
stat
.
IsNotFound
())
{
if
(
stat
.
IsNotFound
())
{
return
SetError
(
SERVER_TABLE_NOT_EXIST
,
"Table "
+
table_name_
+
" not exists"
);
return
SetError
(
SERVER_TABLE_NOT_EXIST
,
"Table "
+
table_name_
+
" not exists"
);
}
else
{
}
else
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
}
}
...
@@ -667,7 +670,7 @@ SearchTask::OnExecute() {
...
@@ -667,7 +670,7 @@ SearchTask::OnExecute() {
rc
.
ElapseFromBegin
(
"search vectors from engine"
);
rc
.
ElapseFromBegin
(
"search vectors from engine"
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
if
(
results
.
empty
())
{
if
(
results
.
empty
())
{
...
@@ -742,7 +745,7 @@ CountTableTask::OnExecute() {
...
@@ -742,7 +745,7 @@ CountTableTask::OnExecute() {
uint64_t
row_count
=
0
;
uint64_t
row_count
=
0
;
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
GetTableRowCount
(
table_name_
,
row_count
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
GetTableRowCount
(
table_name_
,
row_count
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
row_count_
=
(
int64_t
)
row_count
;
row_count_
=
(
int64_t
)
row_count
;
...
@@ -818,7 +821,7 @@ DeleteByRangeTask::OnExecute() {
...
@@ -818,7 +821,7 @@ DeleteByRangeTask::OnExecute() {
if
(
stat
.
IsNotFound
())
{
if
(
stat
.
IsNotFound
())
{
return
SetError
(
SERVER_TABLE_NOT_EXIST
,
"Table "
+
table_name
+
" not exists"
);
return
SetError
(
SERVER_TABLE_NOT_EXIST
,
"Table "
+
table_name
+
" not exists"
);
}
else
{
}
else
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
}
}
...
@@ -844,7 +847,7 @@ DeleteByRangeTask::OnExecute() {
...
@@ -844,7 +847,7 @@ DeleteByRangeTask::OnExecute() {
#endif
#endif
engine
::
Status
status
=
DBWrapper
::
DB
()
->
DeleteTable
(
table_name
,
dates
);
engine
::
Status
status
=
DBWrapper
::
DB
()
->
DeleteTable
(
table_name
,
dates
);
if
(
!
status
.
ok
())
{
if
(
!
status
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
}
catch
(
std
::
exception
&
ex
)
{
}
catch
(
std
::
exception
&
ex
)
{
...
@@ -880,7 +883,7 @@ PreloadTableTask::OnExecute() {
...
@@ -880,7 +883,7 @@ PreloadTableTask::OnExecute() {
//step 2: check table existence
//step 2: check table existence
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
PreloadTable
(
table_name_
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
PreloadTable
(
table_name_
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
rc
.
ElapseFromBegin
(
"totally cost"
);
rc
.
ElapseFromBegin
(
"totally cost"
);
...
@@ -921,7 +924,7 @@ DescribeIndexTask::OnExecute() {
...
@@ -921,7 +924,7 @@ DescribeIndexTask::OnExecute() {
engine
::
TableIndex
index
;
engine
::
TableIndex
index
;
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
DescribeIndex
(
table_name_
,
index
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
DescribeIndex
(
table_name_
,
index
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
index_param_
->
mutable_table_name
()
->
set_table_name
(
table_name_
);
index_param_
->
mutable_table_name
()
->
set_table_name
(
table_name_
);
...
@@ -963,7 +966,7 @@ DropIndexTask::OnExecute() {
...
@@ -963,7 +966,7 @@ DropIndexTask::OnExecute() {
//step 2: check table existence
//step 2: check table existence
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
DropIndex
(
table_name_
);
engine
::
Status
stat
=
DBWrapper
::
DB
()
->
DropIndex
(
table_name_
);
if
(
!
stat
.
ok
())
{
if
(
!
stat
.
ok
())
{
return
SetError
(
DB_META_TRANSACTION_FAILED
,
"Engine failed: "
+
stat
.
ToString
());
return
SetError
(
DB_META_TRANSACTION_FAILED
,
stat
.
ToString
());
}
}
rc
.
ElapseFromBegin
(
"totally cost"
);
rc
.
ElapseFromBegin
(
"totally cost"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录