Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
milvus
milvus
提交
1decc1a4
M
milvus
项目概览
milvus
/
milvus
11 个月 前同步成功
通知
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 搜索 >>
提交
1decc1a4
编写于
11月 27, 2020
作者:
B
bigsheeper
提交者:
yefu.chen
11月 27, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add metaRootPath and kvRootPath
Signed-off-by:
N
bigsheeper
<
yihao.dai@zilliz.com
>
上级
c507abde
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
75 addition
and
35 deletion
+75
-35
configs/milvus.yaml
configs/milvus.yaml
+2
-0
internal/master/collection_task_test.go
internal/master/collection_task_test.go
+2
-1
internal/master/grpc_service_test.go
internal/master/grpc_service_test.go
+2
-1
internal/master/master.go
internal/master/master.go
+2
-2
internal/master/param_table.go
internal/master/param_table.go
+23
-5
internal/master/param_table_test.go
internal/master/param_table_test.go
+9
-3
internal/master/partition_task_test.go
internal/master/partition_task_test.go
+2
-1
internal/master/segment_manager_test.go
internal/master/segment_manager_test.go
+2
-1
internal/proxy/proxy_test.go
internal/proxy/proxy_test.go
+2
-2
internal/querynode/meta_service.go
internal/querynode/meta_service.go
+6
-6
internal/querynode/meta_service_test.go
internal/querynode/meta_service_test.go
+10
-10
internal/querynode/param_table.go
internal/querynode/param_table.go
+7
-3
internal/querynode/param_table_test.go
internal/querynode/param_table_test.go
+6
-0
未找到文件。
configs/milvus.yaml
浏览文件 @
1decc1a4
...
...
@@ -19,6 +19,8 @@ etcd:
address
:
localhost
port
:
2379
rootPath
:
by-dev
metaSubPath
:
meta
# metaRootPath = rootPath + '/' + metaSubPath
kvSubPath
:
kv
# kvRootPath = rootPath + '/' + kvSubPath
segThreshold
:
10000
pulsar
:
...
...
internal/master/collection_task_test.go
浏览文件 @
1decc1a4
...
...
@@ -33,7 +33,8 @@ func TestMaster_CollectionTask(t *testing.T) {
Port
:
Params
.
Port
,
EtcdAddress
:
Params
.
EtcdAddress
,
EtcdRootPath
:
"/test/root"
,
MetaRootPath
:
"/test/root/meta"
,
KvRootPath
:
"/test/root/kv"
,
PulsarAddress
:
Params
.
PulsarAddress
,
ProxyIDList
:
[]
typeutil
.
UniqueID
{
1
,
2
},
...
...
internal/master/grpc_service_test.go
浏览文件 @
1decc1a4
...
...
@@ -32,7 +32,8 @@ func TestMaster_CreateCollection(t *testing.T) {
Port
:
Params
.
Port
,
EtcdAddress
:
Params
.
EtcdAddress
,
EtcdRootPath
:
"/test/root"
,
MetaRootPath
:
"/test/root/meta"
,
KvRootPath
:
"/test/root/kv"
,
PulsarAddress
:
Params
.
PulsarAddress
,
ProxyIDList
:
[]
typeutil
.
UniqueID
{
1
,
2
},
...
...
internal/master/master.go
浏览文件 @
1decc1a4
...
...
@@ -82,8 +82,8 @@ func Init() {
func
CreateServer
(
ctx
context
.
Context
)
(
*
Master
,
error
)
{
//Init(etcdAddr, kvRootPath)
etcdAddress
:=
Params
.
EtcdAddress
metaRootPath
:=
Params
.
Etcd
RootPath
kvRootPath
:=
Params
.
Etcd
RootPath
metaRootPath
:=
Params
.
Meta
RootPath
kvRootPath
:=
Params
.
Kv
RootPath
pulsarAddr
:=
Params
.
PulsarAddress
etcdClient
,
err
:=
clientv3
.
New
(
clientv3
.
Config
{
Endpoints
:
[]
string
{
etcdAddress
}})
...
...
internal/master/param_table.go
浏览文件 @
1decc1a4
...
...
@@ -17,7 +17,8 @@ type ParamTable struct {
Port
int
EtcdAddress
string
EtcdRootPath
string
MetaRootPath
string
KvRootPath
string
PulsarAddress
string
// nodeID
...
...
@@ -75,7 +76,8 @@ func (p *ParamTable) Init() {
p
.
initPort
()
p
.
initEtcdAddress
()
p
.
initEtcdRootPath
()
p
.
initMetaRootPath
()
p
.
initKvRootPath
()
p
.
initPulsarAddress
()
p
.
initProxyIDList
()
...
...
@@ -138,12 +140,28 @@ func (p *ParamTable) initPulsarAddress() {
p
.
PulsarAddress
=
addr
}
func
(
p
*
ParamTable
)
init
Etcd
RootPath
()
{
path
,
err
:=
p
.
Load
(
"etcd.rootp
ath"
)
func
(
p
*
ParamTable
)
init
Meta
RootPath
()
{
rootPath
,
err
:=
p
.
Load
(
"etcd.rootP
ath"
)
if
err
!=
nil
{
panic
(
err
)
}
p
.
EtcdRootPath
=
path
subPath
,
err
:=
p
.
Load
(
"etcd.metaSubPath"
)
if
err
!=
nil
{
panic
(
err
)
}
p
.
MetaRootPath
=
rootPath
+
"/"
+
subPath
}
func
(
p
*
ParamTable
)
initKvRootPath
()
{
rootPath
,
err
:=
p
.
Load
(
"etcd.rootPath"
)
if
err
!=
nil
{
panic
(
err
)
}
subPath
,
err
:=
p
.
Load
(
"etcd.kvSubPath"
)
if
err
!=
nil
{
panic
(
err
)
}
p
.
KvRootPath
=
rootPath
+
"/"
+
subPath
}
func
(
p
*
ParamTable
)
initTopicNum
()
{
...
...
internal/master/param_table_test.go
浏览文件 @
1decc1a4
...
...
@@ -22,10 +22,16 @@ func TestParamTable_Port(t *testing.T) {
assert
.
Equal
(
t
,
port
,
53100
)
}
func
TestParamTable_
Etcd
RootPath
(
t
*
testing
.
T
)
{
func
TestParamTable_
Meta
RootPath
(
t
*
testing
.
T
)
{
Params
.
Init
()
addr
:=
Params
.
EtcdRootPath
assert
.
Equal
(
t
,
addr
,
"by-dev"
)
path
:=
Params
.
MetaRootPath
assert
.
Equal
(
t
,
path
,
"by-dev/meta"
)
}
func
TestParamTable_KVRootPath
(
t
*
testing
.
T
)
{
Params
.
Init
()
path
:=
Params
.
KvRootPath
assert
.
Equal
(
t
,
path
,
"by-dev/kv"
)
}
func
TestParamTable_TopicNum
(
t
*
testing
.
T
)
{
...
...
internal/master/partition_task_test.go
浏览文件 @
1decc1a4
...
...
@@ -35,7 +35,8 @@ func TestMaster_Partition(t *testing.T) {
Port
:
Params
.
Port
,
EtcdAddress
:
Params
.
EtcdAddress
,
EtcdRootPath
:
"/test/root"
,
MetaRootPath
:
"/test/root/meta"
,
KvRootPath
:
"/test/root/kv"
,
PulsarAddress
:
Params
.
PulsarAddress
,
ProxyIDList
:
[]
typeutil
.
UniqueID
{
1
,
2
},
...
...
internal/master/segment_manager_test.go
浏览文件 @
1decc1a4
...
...
@@ -236,7 +236,8 @@ func startupMaster() {
Port
:
Params
.
Port
,
EtcdAddress
:
Params
.
EtcdAddress
,
EtcdRootPath
:
rootPath
,
MetaRootPath
:
"/test/root/meta"
,
KvRootPath
:
"/test/root/kv"
,
PulsarAddress
:
Params
.
PulsarAddress
,
ProxyIDList
:
[]
typeutil
.
UniqueID
{
1
,
2
},
...
...
internal/proxy/proxy_test.go
浏览文件 @
1decc1a4
...
...
@@ -37,13 +37,13 @@ var testNum = 10
func
startMaster
(
ctx
context
.
Context
)
{
master
.
Init
()
etcdAddr
:=
master
.
Params
.
EtcdAddress
rootPath
:=
master
.
Params
.
Etcd
RootPath
metaRootPath
:=
master
.
Params
.
Meta
RootPath
etcdCli
,
err
:=
clientv3
.
New
(
clientv3
.
Config
{
Endpoints
:
[]
string
{
etcdAddr
}})
if
err
!=
nil
{
panic
(
err
)
}
_
,
err
=
etcdCli
.
Delete
(
context
.
TODO
(),
r
ootPath
,
clientv3
.
WithPrefix
())
_
,
err
=
etcdCli
.
Delete
(
context
.
TODO
(),
metaR
ootPath
,
clientv3
.
WithPrefix
())
if
err
!=
nil
{
panic
(
err
)
}
...
...
internal/querynode/meta_service.go
浏览文件 @
1decc1a4
...
...
@@ -31,7 +31,7 @@ type metaService struct {
func
newMetaService
(
ctx
context
.
Context
,
replica
*
collectionReplica
)
*
metaService
{
ETCDAddr
:=
Params
.
etcdAddress
()
ETCDRootPath
:=
Params
.
etcd
RootPath
()
MetaRootPath
:=
Params
.
meta
RootPath
()
cli
,
_
:=
clientv3
.
New
(
clientv3
.
Config
{
Endpoints
:
[]
string
{
ETCDAddr
},
...
...
@@ -40,7 +40,7 @@ func newMetaService(ctx context.Context, replica *collectionReplica) *metaServic
return
&
metaService
{
ctx
:
ctx
,
kvBase
:
kv
.
NewEtcdKV
(
cli
,
ETCD
RootPath
),
kvBase
:
kv
.
NewEtcdKV
(
cli
,
Meta
RootPath
),
replica
:
replica
,
}
}
...
...
@@ -71,21 +71,21 @@ func (mService *metaService) start() {
}
func
GetCollectionObjID
(
key
string
)
string
{
ETCDRootPath
:=
Params
.
etcd
RootPath
()
ETCDRootPath
:=
Params
.
meta
RootPath
()
prefix
:=
path
.
Join
(
ETCDRootPath
,
CollectionPrefix
)
+
"/"
return
strings
.
TrimPrefix
(
key
,
prefix
)
}
func
GetSegmentObjID
(
key
string
)
string
{
ETCDRootPath
:=
Params
.
etcd
RootPath
()
ETCDRootPath
:=
Params
.
meta
RootPath
()
prefix
:=
path
.
Join
(
ETCDRootPath
,
SegmentPrefix
)
+
"/"
return
strings
.
TrimPrefix
(
key
,
prefix
)
}
func
isCollectionObj
(
key
string
)
bool
{
ETCDRootPath
:=
Params
.
etcd
RootPath
()
ETCDRootPath
:=
Params
.
meta
RootPath
()
prefix
:=
path
.
Join
(
ETCDRootPath
,
CollectionPrefix
)
+
"/"
prefix
=
strings
.
TrimSpace
(
prefix
)
...
...
@@ -95,7 +95,7 @@ func isCollectionObj(key string) bool {
}
func
isSegmentObj
(
key
string
)
bool
{
ETCDRootPath
:=
Params
.
etcd
RootPath
()
ETCDRootPath
:=
Params
.
meta
RootPath
()
prefix
:=
path
.
Join
(
ETCDRootPath
,
SegmentPrefix
)
+
"/"
prefix
=
strings
.
TrimSpace
(
prefix
)
...
...
internal/querynode/meta_service_test.go
浏览文件 @
1decc1a4
...
...
@@ -64,24 +64,24 @@ func TestMetaService_getSegmentObjId(t *testing.T) {
}
func
TestMetaService_isCollectionObj
(
t
*
testing
.
T
)
{
var
key
=
"by-dev/collection/collection0"
var
key
=
"by-dev/
meta/
collection/collection0"
var
b1
=
isCollectionObj
(
key
)
assert
.
Equal
(
t
,
b1
,
true
)
key
=
"by-dev/segment/segment0"
key
=
"by-dev/
meta/
segment/segment0"
var
b2
=
isCollectionObj
(
key
)
assert
.
Equal
(
t
,
b2
,
false
)
}
func
TestMetaService_isSegmentObj
(
t
*
testing
.
T
)
{
var
key
=
"by-dev/segment/segment0"
var
key
=
"by-dev/
meta/
segment/segment0"
var
b1
=
isSegmentObj
(
key
)
assert
.
Equal
(
t
,
b1
,
true
)
key
=
"by-dev/collection/collection0"
key
=
"by-dev/
meta/
collection/collection0"
var
b2
=
isSegmentObj
(
key
)
assert
.
Equal
(
t
,
b2
,
false
)
...
...
@@ -295,7 +295,7 @@ func TestMetaService_processCreate(t *testing.T) {
node
:=
NewQueryNode
(
ctx
,
0
)
node
.
metaService
=
newMetaService
(
ctx
,
node
.
replica
)
key1
:=
"by-dev/collection/0"
key1
:=
"by-dev/
meta/
collection/0"
msg1
:=
`schema: <
name: "test"
fields: <
...
...
@@ -327,7 +327,7 @@ func TestMetaService_processCreate(t *testing.T) {
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
collection
.
ID
(),
UniqueID
(
0
))
key2
:=
"by-dev/segment/0"
key2
:=
"by-dev/
meta/
segment/0"
msg2
:=
`partition_tag: "default"
channel_start: 0
channel_end: 1
...
...
@@ -529,7 +529,7 @@ func TestMetaService_processModify(t *testing.T) {
node
:=
NewQueryNode
(
ctx
,
0
)
node
.
metaService
=
newMetaService
(
ctx
,
node
.
replica
)
key1
:=
"by-dev/collection/0"
key1
:=
"by-dev/
meta/
collection/0"
msg1
:=
`schema: <
name: "test"
fields: <
...
...
@@ -576,7 +576,7 @@ func TestMetaService_processModify(t *testing.T) {
hasPartition
=
(
*
node
.
replica
)
.
hasPartition
(
UniqueID
(
0
),
"p3"
)
assert
.
Equal
(
t
,
hasPartition
,
false
)
key2
:=
"by-dev/segment/0"
key2
:=
"by-dev/
meta/
segment/0"
msg2
:=
`partition_tag: "p1"
channel_start: 0
channel_end: 1
...
...
@@ -772,7 +772,7 @@ func TestMetaService_processDelete(t *testing.T) {
node
:=
NewQueryNode
(
ctx
,
0
)
node
.
metaService
=
newMetaService
(
ctx
,
node
.
replica
)
key1
:=
"by-dev/collection/0"
key1
:=
"by-dev/
meta/
collection/0"
msg1
:=
`schema: <
name: "test"
fields: <
...
...
@@ -804,7 +804,7 @@ func TestMetaService_processDelete(t *testing.T) {
assert
.
NoError
(
t
,
err
)
assert
.
Equal
(
t
,
collection
.
ID
(),
UniqueID
(
0
))
key2
:=
"by-dev/segment/0"
key2
:=
"by-dev/
meta/
segment/0"
msg2
:=
`partition_tag: "default"
channel_start: 0
channel_end: 1
...
...
internal/querynode/param_table.go
浏览文件 @
1decc1a4
...
...
@@ -199,12 +199,16 @@ func (p *ParamTable) etcdAddress() string {
return
etcdAddress
}
func
(
p
*
ParamTable
)
etcd
RootPath
()
string
{
etcdRootPath
,
err
:=
p
.
Load
(
"etcd.rootp
ath"
)
func
(
p
*
ParamTable
)
meta
RootPath
()
string
{
rootPath
,
err
:=
p
.
Load
(
"etcd.rootP
ath"
)
if
err
!=
nil
{
panic
(
err
)
}
return
etcdRootPath
subPath
,
err
:=
p
.
Load
(
"etcd.metaSubPath"
)
if
err
!=
nil
{
panic
(
err
)
}
return
rootPath
+
"/"
+
subPath
}
func
(
p
*
ParamTable
)
gracefulTime
()
int64
{
...
...
internal/querynode/param_table_test.go
浏览文件 @
1decc1a4
...
...
@@ -120,3 +120,9 @@ func TestParamTable_statsChannelName(t *testing.T) {
name
:=
Params
.
statsChannelName
()
assert
.
Equal
(
t
,
name
,
"query-node-stats"
)
}
func
TestParamTable_metaRootPath
(
t
*
testing
.
T
)
{
Params
.
Init
()
path
:=
Params
.
metaRootPath
()
assert
.
Equal
(
t
,
path
,
"by-dev/meta"
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录