From bd696486c9593627c681f5b23282b919c7a50d64 Mon Sep 17 00:00:00 2001 From: "zhenshan.cao" Date: Tue, 22 Sep 2020 15:07:56 +0800 Subject: [PATCH] Fix etcd path bug Signed-off-by: zhenshan.cao --- reader/read_node/meta.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/reader/read_node/meta.go b/reader/read_node/meta.go index b2ff16488f..3cfee81dc0 100644 --- a/reader/read_node/meta.go +++ b/reader/read_node/meta.go @@ -3,6 +3,7 @@ package reader import ( "context" "fmt" + "path" "reflect" "strconv" "strings" @@ -22,17 +23,17 @@ const ( ) func GetCollectionObjId(key string) string { - prefix := conf.Config.Etcd.Rootpath + CollectonPrefix + prefix := path.Join(conf.Config.Etcd.Rootpath, CollectonPrefix) + "/" return strings.TrimPrefix(key, prefix) } func GetSegmentObjId(key string) string { - prefix := conf.Config.Etcd.Rootpath + SegmentPrefix + prefix := path.Join(conf.Config.Etcd.Rootpath, SegmentPrefix) + "/" return strings.TrimPrefix(key, prefix) } func isCollectionObj(key string) bool { - prefix := conf.Config.Etcd.Rootpath + CollectonPrefix + prefix := path.Join(conf.Config.Etcd.Rootpath, CollectonPrefix) + "/" prefix = strings.TrimSpace(prefix) println("prefix is :$", prefix) index := strings.Index(key, prefix) @@ -41,7 +42,7 @@ func isCollectionObj(key string) bool { } func isSegmentObj(key string) bool { - prefix := conf.Config.Etcd.Rootpath + SegmentPrefix + prefix := path.Join(conf.Config.Etcd.Rootpath, SegmentPrefix) + "/" prefix = strings.TrimSpace(prefix) index := strings.Index(key, prefix) return index == 0