Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
f4672602
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,发现更多精彩内容 >>
未验证
提交
f4672602
编写于
10月 19, 2021
作者:
X
xige-16
提交者:
GitHub
10月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split large loadSegmentReq to multi small reqs (#10125)
Signed-off-by:
N
xige-16
<
xi.ge@zilliz.com
>
上级
2255fe0b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
105 addition
and
17 deletion
+105
-17
internal/querycoord/task.go
internal/querycoord/task.go
+57
-17
internal/querycoord/task_test.go
internal/querycoord/task_test.go
+48
-0
未找到文件。
internal/querycoord/task.go
浏览文件 @
f4672602
...
...
@@ -15,6 +15,7 @@ import (
"context"
"errors"
"fmt"
"reflect"
"sync"
"time"
...
...
@@ -1761,13 +1762,23 @@ func assignInternalTask(ctx context.Context,
log
.
Debug
(
"assignInternalTask: watch request to node"
,
zap
.
Any
(
"request map"
,
watchRequest2Nodes
),
zap
.
Int64
(
"collectionID"
,
collectionID
))
watchQueryChannelInfo
:=
make
(
map
[
int64
]
bool
)
node2Segments
:=
make
(
map
[
int64
]
*
querypb
.
LoadSegmentsRequest
)
node2Segments
:=
make
(
map
[
int64
][]
*
querypb
.
LoadSegmentsRequest
)
sizeCounts
:=
make
(
map
[
int64
]
int
)
for
index
,
nodeID
:=
range
segment2Nodes
{
if
_
,
ok
:=
node2Segments
[
nodeID
];
!
ok
{
node2Segments
[
nodeID
]
=
loadSegmentRequests
[
index
]
}
else
{
node2Segments
[
nodeID
]
.
Infos
=
append
(
node2Segments
[
nodeID
]
.
Infos
,
loadSegmentRequests
[
index
]
.
Infos
...
)
node2Segments
[
nodeID
]
=
make
([]
*
querypb
.
LoadSegmentsRequest
,
0
)
node2Segments
[
nodeID
]
=
append
(
node2Segments
[
nodeID
],
loadSegmentRequests
[
index
])
sizeCounts
[
nodeID
]
=
0
}
sizeOfReq
:=
getSizeOfLoadSegmentReq
(
loadSegmentRequests
[
index
])
if
sizeCounts
[
nodeID
]
+
sizeOfReq
>
2097152
{
node2Segments
[
nodeID
]
=
append
(
node2Segments
[
nodeID
],
loadSegmentRequests
[
index
])
sizeCounts
[
nodeID
]
=
0
}
lastReq
:=
node2Segments
[
nodeID
][
len
(
node2Segments
[
nodeID
])
-
1
]
lastReq
.
Infos
=
append
(
lastReq
.
Infos
,
loadSegmentRequests
[
index
]
.
Infos
...
)
sizeCounts
[
nodeID
]
+=
sizeOfReq
if
cluster
.
hasWatchedQueryChannel
(
parentTask
.
traceCtx
(),
nodeID
,
collectionID
)
{
watchQueryChannelInfo
[
nodeID
]
=
true
continue
...
...
@@ -1782,20 +1793,22 @@ func assignInternalTask(ctx context.Context,
watchQueryChannelInfo
[
nodeID
]
=
false
}
for
nodeID
,
loadSegmentsReq
:=
range
node2Segments
{
ctx
=
opentracing
.
ContextWithSpan
(
context
.
Background
(),
sp
)
loadSegmentsReq
.
NodeID
=
nodeID
baseTask
:=
newBaseTask
(
ctx
,
parentTask
.
getTriggerCondition
())
baseTask
.
setParentTask
(
parentTask
)
loadSegmentTask
:=
&
loadSegmentTask
{
baseTask
:
baseTask
,
LoadSegmentsRequest
:
loadSegmentsReq
,
meta
:
meta
,
cluster
:
cluster
,
excludeNodeIDs
:
[]
int64
{},
for
nodeID
,
loadSegmentsReqs
:=
range
node2Segments
{
for
_
,
req
:=
range
loadSegmentsReqs
{
ctx
=
opentracing
.
ContextWithSpan
(
context
.
Background
(),
sp
)
req
.
NodeID
=
nodeID
baseTask
:=
newBaseTask
(
ctx
,
parentTask
.
getTriggerCondition
())
baseTask
.
setParentTask
(
parentTask
)
loadSegmentTask
:=
&
loadSegmentTask
{
baseTask
:
baseTask
,
LoadSegmentsRequest
:
req
,
meta
:
meta
,
cluster
:
cluster
,
excludeNodeIDs
:
[]
int64
{},
}
parentTask
.
addChildTask
(
loadSegmentTask
)
log
.
Debug
(
"assignInternalTask: add a loadSegmentTask childTask"
,
zap
.
Any
(
"task"
,
loadSegmentTask
))
}
parentTask
.
addChildTask
(
loadSegmentTask
)
log
.
Debug
(
"assignInternalTask: add a loadSegmentTask childTask"
,
zap
.
Any
(
"task"
,
loadSegmentTask
))
}
for
index
,
nodeID
:=
range
watchRequest2Nodes
{
...
...
@@ -1846,3 +1859,30 @@ func assignInternalTask(ctx context.Context,
}
return
nil
}
func
getSizeOfLoadSegmentReq
(
req
*
querypb
.
LoadSegmentsRequest
)
int
{
var
totalSize
=
0
totalSize
+=
int
(
reflect
.
ValueOf
(
*
req
)
.
Type
()
.
Size
())
for
_
,
info
:=
range
req
.
Infos
{
totalSize
+=
int
(
reflect
.
ValueOf
(
*
info
)
.
Type
()
.
Size
())
for
_
,
FieldBinlog
:=
range
info
.
BinlogPaths
{
totalSize
+=
int
(
reflect
.
ValueOf
(
*
FieldBinlog
)
.
Type
()
.
Size
())
for
_
,
path
:=
range
FieldBinlog
.
Binlogs
{
totalSize
+=
len
(
path
)
}
}
}
totalSize
+=
len
(
req
.
Schema
.
Name
)
+
len
(
req
.
Schema
.
Description
)
+
int
(
reflect
.
ValueOf
(
*
req
.
Schema
)
.
Type
()
.
Size
())
for
_
,
fieldSchema
:=
range
req
.
Schema
.
Fields
{
totalSize
+=
len
(
fieldSchema
.
Name
)
+
len
(
fieldSchema
.
Description
)
+
int
(
reflect
.
ValueOf
(
*
fieldSchema
)
.
Type
()
.
Size
())
for
_
,
typeParam
:=
range
fieldSchema
.
TypeParams
{
totalSize
+=
len
(
typeParam
.
Key
)
+
len
(
typeParam
.
Value
)
}
for
_
,
indexParam
:=
range
fieldSchema
.
IndexParams
{
totalSize
+=
len
(
indexParam
.
Key
)
+
len
(
indexParam
.
Value
)
}
}
return
totalSize
}
internal/querycoord/task_test.go
浏览文件 @
f4672602
...
...
@@ -19,6 +19,7 @@ import (
"github.com/milvus-io/milvus/internal/proto/commonpb"
"github.com/milvus-io/milvus/internal/proto/datapb"
"github.com/milvus-io/milvus/internal/proto/querypb"
"github.com/milvus-io/milvus/internal/util/funcutil"
)
func
genLoadCollectionTask
(
ctx
context
.
Context
,
queryCoord
*
QueryCoord
)
*
loadCollectionTask
{
...
...
@@ -48,6 +49,7 @@ func genLoadPartitionTask(ctx context.Context, queryCoord *QueryCoord) *loadPart
},
CollectionID
:
defaultCollectionID
,
PartitionIDs
:
[]
UniqueID
{
defaultPartitionID
},
Schema
:
genCollectionSchema
(
defaultCollectionID
,
false
),
}
baseTask
:=
newBaseTask
(
ctx
,
querypb
.
TriggerCondition_grpcRequest
)
loadPartitionTask
:=
&
loadPartitionTask
{
...
...
@@ -653,3 +655,49 @@ func Test_RescheduleDmChannelsEndWithFail(t *testing.T) {
err
=
removeAllSession
()
assert
.
Nil
(
t
,
err
)
}
func
Test_assignInternalTask
(
t
*
testing
.
T
)
{
refreshParams
()
ctx
:=
context
.
Background
()
queryCoord
,
err
:=
startQueryCoord
(
ctx
)
assert
.
Nil
(
t
,
err
)
node1
,
err
:=
startQueryNodeServer
(
ctx
)
assert
.
Nil
(
t
,
err
)
waitQueryNodeOnline
(
queryCoord
.
cluster
,
node1
.
queryNodeID
)
schema
:=
genCollectionSchema
(
defaultCollectionID
,
false
)
loadCollectionTask
:=
genLoadCollectionTask
(
ctx
,
queryCoord
)
loadSegmentRequests
:=
make
([]
*
querypb
.
LoadSegmentsRequest
,
0
)
binlogs
:=
make
([]
*
datapb
.
FieldBinlog
,
0
)
binlogs
=
append
(
binlogs
,
&
datapb
.
FieldBinlog
{
FieldID
:
0
,
Binlogs
:
[]
string
{
funcutil
.
RandomString
(
1000
)},
})
for
id
:=
0
;
id
<
10000
;
id
++
{
segmentInfo
:=
&
querypb
.
SegmentLoadInfo
{
SegmentID
:
UniqueID
(
id
),
PartitionID
:
defaultPartitionID
,
CollectionID
:
defaultCollectionID
,
BinlogPaths
:
binlogs
,
}
req
:=
&
querypb
.
LoadSegmentsRequest
{
Base
:
&
commonpb
.
MsgBase
{
MsgType
:
commonpb
.
MsgType_LoadSegments
,
},
NodeID
:
node1
.
queryNodeID
,
Schema
:
schema
,
Infos
:
[]
*
querypb
.
SegmentLoadInfo
{
segmentInfo
},
}
loadSegmentRequests
=
append
(
loadSegmentRequests
,
req
)
}
err
=
assignInternalTask
(
queryCoord
.
loopCtx
,
defaultCollectionID
,
loadCollectionTask
,
queryCoord
.
meta
,
queryCoord
.
cluster
,
loadSegmentRequests
,
nil
,
false
)
assert
.
Nil
(
t
,
err
)
assert
.
NotEqual
(
t
,
1
,
len
(
loadCollectionTask
.
getChildTask
()))
queryCoord
.
Stop
()
err
=
removeAllSession
()
assert
.
Nil
(
t
,
err
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录