Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
1fff8d2c
M
milvus
项目概览
milvus
/
milvus
10 个月 前同步成功
通知
260
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
1fff8d2c
编写于
8月 03, 2023
作者:
X
XuanYang-cn
提交者:
GitHub
8月 03, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix restore redrop enormous dup collections (#26029)
Signed-off-by:
N
yangxuan
<
xuan.yang@zilliz.com
>
上级
d9074bcb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
116 addition
and
15 deletion
+116
-15
internal/rootcoord/root_coord.go
internal/rootcoord/root_coord.go
+14
-15
internal/rootcoord/root_coord_test.go
internal/rootcoord/root_coord_test.go
+102
-0
未找到文件。
internal/rootcoord/root_coord.go
浏览文件 @
1fff8d2c
...
...
@@ -591,13 +591,12 @@ func (c *Core) restore(ctx context.Context) error {
return
err
}
for
_
,
coll
:=
range
colls
{
for
_
,
part
:=
range
coll
.
Partitions
{
ts
,
err
:=
c
.
tsoAllocator
.
GenerateTSO
(
1
)
if
err
!=
nil
{
return
err
}
if
coll
.
Available
()
{
ts
,
err
:=
c
.
tsoAllocator
.
GenerateTSO
(
1
)
if
err
!=
nil
{
return
err
}
if
coll
.
Available
()
{
for
_
,
part
:=
range
coll
.
Partitions
{
switch
part
.
State
{
case
pb
.
PartitionState_PartitionDropping
:
go
c
.
garbageCollector
.
ReDropPartition
(
coll
.
DBID
,
coll
.
PhysicalChannelNames
,
part
.
Clone
(),
ts
)
...
...
@@ -605,14 +604,14 @@ func (c *Core) restore(ctx context.Context) error {
go
c
.
garbageCollector
.
RemoveCreatingPartition
(
coll
.
DBID
,
part
.
Clone
(),
ts
)
default
:
}
}
else
{
switch
coll
.
Stat
e
{
case
pb
.
CollectionState_CollectionDropping
:
go
c
.
garbageCollector
.
ReDropCollection
(
coll
.
Clone
(),
ts
)
case
pb
.
CollectionState_CollectionCreating
:
go
c
.
garbageCollector
.
RemoveCreatingCollection
(
coll
.
Clone
())
default
:
}
}
}
els
e
{
switch
coll
.
State
{
case
pb
.
CollectionState_CollectionDropping
:
go
c
.
garbageCollector
.
ReDropCollection
(
coll
.
Clone
(),
ts
)
case
pb
.
CollectionState_CollectionCreating
:
go
c
.
garbageCollector
.
RemoveCreatingCollection
(
coll
.
Clone
())
default
:
}
}
}
...
...
internal/rootcoord/root_coord_test.go
浏览文件 @
1fff8d2c
...
...
@@ -29,6 +29,7 @@ import (
"github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/suite"
"github.com/milvus-io/milvus-proto/go-api/v2/commonpb"
"github.com/milvus-io/milvus-proto/go-api/v2/milvuspb"
...
...
@@ -40,6 +41,7 @@ import (
"github.com/milvus-io/milvus/internal/proto/internalpb"
"github.com/milvus-io/milvus/internal/proto/proxypb"
"github.com/milvus-io/milvus/internal/proto/rootcoordpb"
mockrootcoord
"github.com/milvus-io/milvus/internal/rootcoord/mocks"
"github.com/milvus-io/milvus/internal/util/dependency"
"github.com/milvus-io/milvus/internal/util/importutil"
"github.com/milvus-io/milvus/internal/util/sessionutil"
...
...
@@ -1756,3 +1758,103 @@ func TestCore_Stop(t *testing.T) {
assert
.
Equal
(
t
,
commonpb
.
StateCode_Abnormal
,
code
)
})
}
type
RootCoordSuite
struct
{
suite
.
Suite
}
func
(
s
*
RootCoordSuite
)
TestRestore
()
{
meta
:=
mockrootcoord
.
NewIMetaTable
(
s
.
T
())
gc
:=
mockrootcoord
.
NewGarbageCollector
(
s
.
T
())
finishCh
:=
make
(
chan
struct
{},
4
)
gc
.
EXPECT
()
.
ReDropPartition
(
mock
.
Anything
,
mock
.
Anything
,
mock
.
Anything
,
mock
.
Anything
)
.
Once
()
.
Run
(
func
(
args
mock
.
Arguments
)
{
finishCh
<-
struct
{}{}
})
gc
.
EXPECT
()
.
RemoveCreatingPartition
(
mock
.
Anything
,
mock
.
Anything
,
mock
.
Anything
)
.
Once
()
.
Run
(
func
(
args
mock
.
Arguments
)
{
finishCh
<-
struct
{}{}
})
gc
.
EXPECT
()
.
ReDropCollection
(
mock
.
Anything
,
mock
.
Anything
)
.
Once
()
.
Run
(
func
(
args
mock
.
Arguments
)
{
finishCh
<-
struct
{}{}
})
gc
.
EXPECT
()
.
RemoveCreatingCollection
(
mock
.
Anything
)
.
Once
()
.
Run
(
func
(
args
mock
.
Arguments
)
{
finishCh
<-
struct
{}{}
})
meta
.
EXPECT
()
.
ListDatabases
(
mock
.
Anything
,
mock
.
Anything
)
.
Return
([]
*
model
.
Database
{
{
Name
:
"available_colls_db"
},
{
Name
:
"not_available_colls_db"
}},
nil
)
meta
.
EXPECT
()
.
ListCollections
(
mock
.
Anything
,
"available_colls_db"
,
mock
.
Anything
,
false
)
.
Return
([]
*
model
.
Collection
{
{
DBID
:
1
,
State
:
etcdpb
.
CollectionState_CollectionCreated
,
// available collection
PhysicalChannelNames
:
[]
string
{
"ch1"
},
Partitions
:
[]
*
model
.
Partition
{
{
State
:
etcdpb
.
PartitionState_PartitionDropping
},
{
State
:
etcdpb
.
PartitionState_PartitionCreating
},
{
State
:
etcdpb
.
PartitionState_PartitionDropped
},
// ignored
},
},
},
nil
)
meta
.
EXPECT
()
.
ListCollections
(
mock
.
Anything
,
"not_available_colls_db"
,
mock
.
Anything
,
false
)
.
Return
([]
*
model
.
Collection
{
{
DBID
:
1
,
State
:
etcdpb
.
CollectionState_CollectionDropping
,
// not available collection
PhysicalChannelNames
:
[]
string
{
"ch1"
},
Partitions
:
[]
*
model
.
Partition
{
{
State
:
etcdpb
.
PartitionState_PartitionDropping
},
{
State
:
etcdpb
.
PartitionState_PartitionCreating
},
{
State
:
etcdpb
.
PartitionState_PartitionDropped
},
},
},
{
DBID
:
1
,
State
:
etcdpb
.
CollectionState_CollectionCreating
,
// not available collection
PhysicalChannelNames
:
[]
string
{
"ch1"
},
Partitions
:
[]
*
model
.
Partition
{
{
State
:
etcdpb
.
PartitionState_PartitionDropping
},
{
State
:
etcdpb
.
PartitionState_PartitionCreating
},
{
State
:
etcdpb
.
PartitionState_PartitionDropped
},
},
},
{
DBID
:
1
,
State
:
etcdpb
.
CollectionState_CollectionDropped
,
// ignored
PhysicalChannelNames
:
[]
string
{
"ch1"
},
Partitions
:
[]
*
model
.
Partition
{
{
State
:
etcdpb
.
PartitionState_PartitionDropping
},
{
State
:
etcdpb
.
PartitionState_PartitionCreating
},
{
State
:
etcdpb
.
PartitionState_PartitionDropped
},
},
},
},
nil
)
// ticker := newTickerWithMockNormalStream()
tsoAllocator
:=
newMockTsoAllocator
()
tsoAllocator
.
GenerateTSOF
=
func
(
count
uint32
)
(
uint64
,
error
)
{
return
100
,
nil
}
core
:=
newTestCore
(
withGarbageCollector
(
gc
),
// withTtSynchronizer(ticker),
withTsoAllocator
(
tsoAllocator
),
// withValidProxyManager(),
withMeta
(
meta
))
core
.
restore
(
context
.
Background
())
for
i
:=
0
;
i
<
4
;
i
++
{
<-
finishCh
}
}
func
TestRootCoordSuite
(
t
*
testing
.
T
)
{
suite
.
Run
(
t
,
new
(
RootCoordSuite
))
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录