Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
e245ba87
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,发现更多精彩内容 >>
未验证
提交
e245ba87
编写于
11月 25, 2021
作者:
B
bigsheeper
提交者:
GitHub
11月 25, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add excluded segments for dropped segemnts (#12247)
Signed-off-by:
N
bigsheeper
<
yihao.dai@zilliz.com
>
上级
66954ec1
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
239 addition
and
180 deletion
+239
-180
internal/datacoord/handler.go
internal/datacoord/handler.go
+2
-2
internal/datacoord/server_test.go
internal/datacoord/server_test.go
+2
-1
internal/datanode/flow_graph_dd_node.go
internal/datanode/flow_graph_dd_node.go
+3
-3
internal/datanode/flow_graph_dd_node_test.go
internal/datanode/flow_graph_dd_node_test.go
+12
-6
internal/proto/data_coord.proto
internal/proto/data_coord.proto
+1
-1
internal/proto/datapb/data_coord.pb.go
internal/proto/datapb/data_coord.pb.go
+167
-167
internal/querynode/task.go
internal/querynode/task.go
+20
-0
internal/querynode/task_test.go
internal/querynode/task_test.go
+32
-0
未找到文件。
internal/datacoord/handler.go
浏览文件 @
e245ba87
...
@@ -39,7 +39,7 @@ func (h *ServerHandler) GetVChanPositions(channel string, collectionID UniqueID,
...
@@ -39,7 +39,7 @@ func (h *ServerHandler) GetVChanPositions(channel string, collectionID UniqueID,
)
)
var
flushed
[]
*
datapb
.
SegmentInfo
var
flushed
[]
*
datapb
.
SegmentInfo
var
unflushed
[]
*
datapb
.
SegmentInfo
var
unflushed
[]
*
datapb
.
SegmentInfo
var
dropped
[]
UniqueID
var
dropped
[]
*
datapb
.
SegmentInfo
var
seekPosition
*
internalpb
.
MsgPosition
var
seekPosition
*
internalpb
.
MsgPosition
for
_
,
s
:=
range
segments
{
for
_
,
s
:=
range
segments
{
if
(
partitionID
>
allPartitionID
&&
s
.
PartitionID
!=
partitionID
)
||
if
(
partitionID
>
allPartitionID
&&
s
.
PartitionID
!=
partitionID
)
||
...
@@ -48,7 +48,7 @@ func (h *ServerHandler) GetVChanPositions(channel string, collectionID UniqueID,
...
@@ -48,7 +48,7 @@ func (h *ServerHandler) GetVChanPositions(channel string, collectionID UniqueID,
}
}
if
s
.
GetState
()
==
commonpb
.
SegmentState_Dropped
{
if
s
.
GetState
()
==
commonpb
.
SegmentState_Dropped
{
dropped
=
append
(
dropped
,
s
.
GetID
(
))
dropped
=
append
(
dropped
,
trimSegmentInfo
(
s
.
SegmentInfo
))
continue
continue
}
}
...
...
internal/datacoord/server_test.go
浏览文件 @
e245ba87
...
@@ -1433,7 +1433,8 @@ func TestGetRecoveryInfo(t *testing.T) {
...
@@ -1433,7 +1433,8 @@ func TestGetRecoveryInfo(t *testing.T) {
assert
.
EqualValues
(
t
,
1
,
len
(
resp
.
GetChannels
()))
assert
.
EqualValues
(
t
,
1
,
len
(
resp
.
GetChannels
()))
assert
.
NotNil
(
t
,
resp
.
GetChannels
()[
0
]
.
SeekPosition
)
assert
.
NotNil
(
t
,
resp
.
GetChannels
()[
0
]
.
SeekPosition
)
assert
.
NotEqual
(
t
,
0
,
resp
.
GetChannels
()[
0
]
.
GetSeekPosition
()
.
GetTimestamp
())
assert
.
NotEqual
(
t
,
0
,
resp
.
GetChannels
()[
0
]
.
GetSeekPosition
()
.
GetTimestamp
())
assert
.
ElementsMatch
(
t
,
[]
int64
{
8
},
resp
.
GetChannels
()[
0
]
.
GetDroppedSegments
())
assert
.
Len
(
t
,
resp
.
GetChannels
()[
0
]
.
GetDroppedSegments
(),
1
)
assert
.
Equal
(
t
,
UniqueID
(
8
),
resp
.
GetChannels
()[
0
]
.
GetDroppedSegments
()[
0
]
.
GetID
())
})
})
t
.
Run
(
"with closed server"
,
func
(
t
*
testing
.
T
)
{
t
.
Run
(
"with closed server"
,
func
(
t
*
testing
.
T
)
{
...
...
internal/datanode/flow_graph_dd_node.go
浏览文件 @
e245ba87
...
@@ -58,7 +58,7 @@ type ddNode struct {
...
@@ -58,7 +58,7 @@ type ddNode struct {
segID2SegInfo
sync
.
Map
// segment ID to *SegmentInfo
segID2SegInfo
sync
.
Map
// segment ID to *SegmentInfo
flushedSegments
[]
*
datapb
.
SegmentInfo
flushedSegments
[]
*
datapb
.
SegmentInfo
droppedSegments
[]
UniqueID
droppedSegments
[]
*
datapb
.
SegmentInfo
vchannelName
string
vchannelName
string
deltaMsgStream
msgstream
.
MsgStream
deltaMsgStream
msgstream
.
MsgStream
...
@@ -199,8 +199,8 @@ func (ddn *ddNode) isFlushed(segmentID UniqueID) bool {
...
@@ -199,8 +199,8 @@ func (ddn *ddNode) isFlushed(segmentID UniqueID) bool {
}
}
func
(
ddn
*
ddNode
)
isDropped
(
segID
UniqueID
)
bool
{
func
(
ddn
*
ddNode
)
isDropped
(
segID
UniqueID
)
bool
{
for
_
,
sID
:=
range
ddn
.
droppedSegments
{
for
_
,
droppedSegment
:=
range
ddn
.
droppedSegments
{
if
sID
==
segID
{
if
droppedSegment
.
GetID
()
==
segID
{
return
true
return
true
}
}
}
}
...
...
internal/datanode/flow_graph_dd_node_test.go
浏览文件 @
e245ba87
...
@@ -382,23 +382,29 @@ func TestFlowGraph_DDNode_isFlushed(te *testing.T) {
...
@@ -382,23 +382,29 @@ func TestFlowGraph_DDNode_isFlushed(te *testing.T) {
}
}
func
TestFlowGraph_DDNode_isDropped
(
te
*
testing
.
T
)
{
func
TestFlowGraph_DDNode_isDropped
(
te
*
testing
.
T
)
{
genSegmentInfoByID
:=
func
(
segmentID
UniqueID
)
*
datapb
.
SegmentInfo
{
return
&
datapb
.
SegmentInfo
{
ID
:
segmentID
,
}
}
tests
:=
[]
struct
{
tests
:=
[]
struct
{
indroppedSegment
[]
UniqueID
indroppedSegment
[]
*
datapb
.
SegmentInfo
inSeg
UniqueID
inSeg
UniqueID
expectedOut
bool
expectedOut
bool
description
string
description
string
}{
}{
{[]
UniqueID
{
1
,
2
,
3
},
1
,
true
,
{[]
*
datapb
.
SegmentInfo
{
genSegmentInfoByID
(
1
),
genSegmentInfoByID
(
2
),
genSegmentInfoByID
(
3
)
},
1
,
true
,
"Input seg 1 in droppedSegs{1, 2, 3}"
},
"Input seg 1 in droppedSegs{1, 2, 3}"
},
{[]
UniqueID
{
1
,
2
,
3
},
2
,
true
,
{[]
*
datapb
.
SegmentInfo
{
genSegmentInfoByID
(
1
),
genSegmentInfoByID
(
2
),
genSegmentInfoByID
(
3
)
},
2
,
true
,
"Input seg 2 in droppedSegs{1, 2, 3}"
},
"Input seg 2 in droppedSegs{1, 2, 3}"
},
{[]
UniqueID
{
1
,
2
,
3
},
3
,
true
,
{[]
*
datapb
.
SegmentInfo
{
genSegmentInfoByID
(
1
),
genSegmentInfoByID
(
2
),
genSegmentInfoByID
(
3
)
},
3
,
true
,
"Input seg 3 in droppedSegs{1, 2, 3}"
},
"Input seg 3 in droppedSegs{1, 2, 3}"
},
{[]
UniqueID
{
1
,
2
,
3
},
4
,
false
,
{[]
*
datapb
.
SegmentInfo
{
genSegmentInfoByID
(
1
),
genSegmentInfoByID
(
2
),
genSegmentInfoByID
(
3
)
},
4
,
false
,
"Input seg 4 not in droppedSegs{1, 2, 3}"
},
"Input seg 4 not in droppedSegs{1, 2, 3}"
},
{[]
UniqueID
{},
5
,
false
,
{[]
*
datapb
.
SegmentInfo
{},
5
,
false
,
"Input seg 5, no droppedSegs {}"
},
"Input seg 5, no droppedSegs {}"
},
}
}
...
...
internal/proto/data_coord.proto
浏览文件 @
e245ba87
...
@@ -167,7 +167,7 @@ message VchannelInfo {
...
@@ -167,7 +167,7 @@ message VchannelInfo {
internal.MsgPosition
seek_position
=
3
;
internal.MsgPosition
seek_position
=
3
;
repeated
SegmentInfo
unflushedSegments
=
4
;
repeated
SegmentInfo
unflushedSegments
=
4
;
repeated
SegmentInfo
flushedSegments
=
5
;
repeated
SegmentInfo
flushedSegments
=
5
;
repeated
int64
dropped_segments
=
6
;
repeated
SegmentInfo
dropped_segments
=
6
;
}
}
message
WatchDmChannelsRequest
{
message
WatchDmChannelsRequest
{
...
...
internal/proto/datapb/data_coord.pb.go
浏览文件 @
e245ba87
此差异已折叠。
点击以展开。
internal/querynode/task.go
浏览文件 @
e245ba87
...
@@ -249,6 +249,26 @@ func (w *watchDmChannelsTask) Execute(ctx context.Context) error {
...
@@ -249,6 +249,26 @@ func (w *watchDmChannelsTask) Execute(ctx context.Context) error {
zap
.
Any
(
"flushedCheckPointInfos"
,
flushedCheckPointInfos
),
zap
.
Any
(
"flushedCheckPointInfos"
,
flushedCheckPointInfos
),
)
)
// add excluded segments for dropped segments,
// dropped segments with later check point than seekPosition should be filtered out.
droppedCheckPointInfos
:=
make
([]
*
datapb
.
SegmentInfo
,
0
)
for
_
,
info
:=
range
w
.
req
.
Infos
{
for
_
,
droppedSegment
:=
range
info
.
DroppedSegments
{
for
_
,
position
:=
range
toSeekChannels
{
if
droppedSegment
!=
nil
&&
droppedSegment
.
DmlPosition
.
ChannelName
==
position
.
ChannelName
&&
droppedSegment
.
DmlPosition
.
Timestamp
>
position
.
Timestamp
{
droppedCheckPointInfos
=
append
(
droppedCheckPointInfos
,
droppedSegment
)
}
}
}
}
w
.
node
.
streaming
.
replica
.
addExcludedSegments
(
collectionID
,
droppedCheckPointInfos
)
log
.
Debug
(
"watchDMChannel, add check points info for dropped segments done"
,
zap
.
Any
(
"collectionID"
,
collectionID
),
zap
.
Any
(
"droppedCheckPointInfos"
,
droppedCheckPointInfos
),
)
// create tSafe
// create tSafe
for
_
,
channel
:=
range
vChannels
{
for
_
,
channel
:=
range
vChannels
{
w
.
node
.
tSafeReplica
.
addTSafe
(
channel
)
w
.
node
.
tSafeReplica
.
addTSafe
(
channel
)
...
...
internal/querynode/task_test.go
浏览文件 @
e245ba87
...
@@ -178,6 +178,38 @@ func TestTask_watchDmChannelsTask(t *testing.T) {
...
@@ -178,6 +178,38 @@ func TestTask_watchDmChannelsTask(t *testing.T) {
err
=
task
.
Execute
(
ctx
)
err
=
task
.
Execute
(
ctx
)
assert
.
NoError
(
t
,
err
)
assert
.
NoError
(
t
,
err
)
})
})
t
.
Run
(
"test add excluded segment for dropped segment"
,
func
(
t
*
testing
.
T
)
{
node
,
err
:=
genSimpleQueryNode
(
ctx
)
assert
.
NoError
(
t
,
err
)
task
:=
watchDmChannelsTask
{
req
:
genWatchDMChannelsRequest
(),
node
:
node
,
}
tmpChannel
:=
defaultVChannel
+
"_1"
task
.
req
.
Infos
=
[]
*
datapb
.
VchannelInfo
{
{
CollectionID
:
defaultCollectionID
,
ChannelName
:
defaultVChannel
,
SeekPosition
:
&
msgstream
.
MsgPosition
{
ChannelName
:
tmpChannel
,
Timestamp
:
0
,
MsgID
:
[]
byte
{
1
,
2
,
3
},
},
DroppedSegments
:
[]
*
datapb
.
SegmentInfo
{
{
DmlPosition
:
&
internalpb
.
MsgPosition
{
ChannelName
:
tmpChannel
,
Timestamp
:
typeutil
.
MaxTimestamp
,
},
},
},
},
}
err
=
task
.
Execute
(
ctx
)
assert
.
NoError
(
t
,
err
)
})
}
}
func
TestTask_loadSegmentsTask
(
t
*
testing
.
T
)
{
func
TestTask_loadSegmentsTask
(
t
*
testing
.
T
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录