Rename IndexRootPath to IndexStorageRootPath (#11236)

IndexRootPath is index file's blob storage prefix.
But the name is confusing with the MetaRootPath, which is prefix of etcd.

This PR changes the IndexRootPath to IndexStorageRootPath to
elimilate the confusion.

Signed-off-by: yangxuan <xuan.yang@zilliz.com>
This commit is contained in:
XuanYang-cn 2021-11-05 11:45:00 +08:00 committed by GitHub
parent 60848029e1
commit 35e8779bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 21 deletions

View File

@ -628,7 +628,7 @@ func (i *IndexCoord) recycleUnusedIndexFiles() {
log.Debug("IndexCoord recycleUnusedIndexFiles", zap.Int("Need recycle tasks num", len(metas))) log.Debug("IndexCoord recycleUnusedIndexFiles", zap.Int("Need recycle tasks num", len(metas)))
for _, meta := range metas { for _, meta := range metas {
if meta.indexMeta.MarkDeleted { if meta.indexMeta.MarkDeleted {
unusedIndexFilePathPrefix := Params.IndexRootPath + "/" + strconv.Itoa(int(meta.indexMeta.IndexBuildID)) unusedIndexFilePathPrefix := Params.IndexStorageRootPath + "/" + strconv.Itoa(int(meta.indexMeta.IndexBuildID))
log.Debug("IndexCoord recycleUnusedIndexFiles", log.Debug("IndexCoord recycleUnusedIndexFiles",
zap.Int64("Recycle the index files for deleted index with indexBuildID", meta.indexMeta.IndexBuildID)) zap.Int64("Recycle the index files for deleted index with indexBuildID", meta.indexMeta.IndexBuildID))
if err := i.kv.RemoveWithPrefix(unusedIndexFilePathPrefix); err != nil { if err := i.kv.RemoveWithPrefix(unusedIndexFilePathPrefix); err != nil {
@ -642,7 +642,7 @@ func (i *IndexCoord) recycleUnusedIndexFiles() {
log.Debug("IndexCoord recycleUnusedIndexFiles", log.Debug("IndexCoord recycleUnusedIndexFiles",
zap.Int64("Recycle the low version index files of the index with indexBuildID", meta.indexMeta.IndexBuildID)) zap.Int64("Recycle the low version index files of the index with indexBuildID", meta.indexMeta.IndexBuildID))
for j := 1; j < int(meta.indexMeta.Version); j++ { for j := 1; j < int(meta.indexMeta.Version); j++ {
unusedIndexFilePathPrefix := Params.IndexRootPath + "/" + strconv.Itoa(int(meta.indexMeta.IndexBuildID)) + "/" + strconv.Itoa(j) unusedIndexFilePathPrefix := Params.IndexStorageRootPath + "/" + strconv.Itoa(int(meta.indexMeta.IndexBuildID)) + "/" + strconv.Itoa(j)
if err := i.kv.RemoveWithPrefix(unusedIndexFilePathPrefix); err != nil { if err := i.kv.RemoveWithPrefix(unusedIndexFilePathPrefix); err != nil {
log.Error("IndexCoord recycleUnusedIndexFiles Remove index files failed", log.Error("IndexCoord recycleUnusedIndexFiles Remove index files failed",
zap.Bool("MarkDeleted", false), zap.Error(err)) zap.Bool("MarkDeleted", false), zap.Error(err))

View File

@ -33,10 +33,10 @@ type ParamTable struct {
Address string Address string
Port int Port int
EtcdEndpoints []string EtcdEndpoints []string
KvRootPath string KvRootPath string
MetaRootPath string MetaRootPath string
IndexRootPath string IndexStorageRootPath string
MinIOAddress string MinIOAddress string
MinIOAccessKeyID string MinIOAccessKeyID string
@ -69,7 +69,7 @@ func (pt *ParamTable) Init() {
pt.initMinIOSecretAccessKey() pt.initMinIOSecretAccessKey()
pt.initMinIOUseSSL() pt.initMinIOUseSSL()
pt.initMinioBucketName() pt.initMinioBucketName()
pt.initIndexRootPath() pt.initIndexStorageRootPath()
pt.initRoleName() pt.initRoleName()
} }
@ -162,13 +162,13 @@ func (pt *ParamTable) initMinioBucketName() {
pt.MinioBucketName = bucketName pt.MinioBucketName = bucketName
} }
// initIndexRootPath initializes the root path of index files. // initIndexStorageRootPath initializes the root path of index files.
func (pt *ParamTable) initIndexRootPath() { func (pt *ParamTable) initIndexStorageRootPath() {
rootPath, err := pt.Load("minio.rootPath") rootPath, err := pt.Load("minio.rootPath")
if err != nil { if err != nil {
panic(err) panic(err)
} }
pt.IndexRootPath = path.Join(rootPath, "index_files") pt.IndexStorageRootPath = path.Join(rootPath, "index_files")
} }
func (pt *ParamTable) initRoleName() { func (pt *ParamTable) initRoleName() {

View File

@ -74,8 +74,8 @@ func TestParamTable(t *testing.T) {
t.Logf("UpdatedTime: %v", Params.UpdatedTime) t.Logf("UpdatedTime: %v", Params.UpdatedTime)
}) })
t.Run("initIndexRootPath", func(t *testing.T) { t.Run("initIndexStorageRootPath", func(t *testing.T) {
t.Logf("IndexRootPath: %v", Params.IndexRootPath) t.Logf("IndexStorageRootPath: %v", Params.IndexStorageRootPath)
}) })
} }

View File

@ -40,9 +40,9 @@ type ParamTable struct {
NodeID int64 NodeID int64
Alias string Alias string
EtcdEndpoints []string EtcdEndpoints []string
MetaRootPath string MetaRootPath string
IndexRootPath string IndexStorageRootPath string
MinIOAddress string MinIOAddress string
MinIOAccessKeyID string MinIOAccessKeyID string
@ -91,7 +91,7 @@ func (pt *ParamTable) initParams() {
pt.initMinioBucketName() pt.initMinioBucketName()
pt.initEtcdEndpoints() pt.initEtcdEndpoints()
pt.initMetaRootPath() pt.initMetaRootPath()
pt.initIndexRootPath() pt.initIndexStorageRootPath()
pt.initRoleName() pt.initRoleName()
pt.initKnowhereSimdType() pt.initKnowhereSimdType()
} }
@ -151,12 +151,12 @@ func (pt *ParamTable) initMetaRootPath() {
pt.MetaRootPath = path.Join(rootPath, subPath) pt.MetaRootPath = path.Join(rootPath, subPath)
} }
func (pt *ParamTable) initIndexRootPath() { func (pt *ParamTable) initIndexStorageRootPath() {
rootPath, err := pt.Load("minio.rootPath") rootPath, err := pt.Load("minio.rootPath")
if err != nil { if err != nil {
panic(err) panic(err)
} }
pt.IndexRootPath = path.Join(rootPath, "index_files") pt.IndexStorageRootPath = path.Join(rootPath, "index_files")
} }
func (pt *ParamTable) initMinioBucketName() { func (pt *ParamTable) initMinioBucketName() {

View File

@ -87,8 +87,8 @@ func TestParamTable(t *testing.T) {
t.Logf("UpdatedTime: %v", Params.UpdatedTime) t.Logf("UpdatedTime: %v", Params.UpdatedTime)
}) })
t.Run("IndexRootPath", func(t *testing.T) { t.Run("IndexStorageRootPath", func(t *testing.T) {
t.Logf("IndexRootPath: %v", Params.IndexRootPath) t.Logf("IndexStorageRootPath: %v", Params.IndexStorageRootPath)
}) })
} }

View File

@ -412,7 +412,7 @@ func (it *IndexBuildTask) Execute(ctx context.Context) error {
getSavePathByKey := func(key string) string { getSavePathByKey := func(key string) string {
return path.Join(Params.IndexRootPath, strconv.Itoa(int(it.req.IndexBuildID)), strconv.Itoa(int(it.req.Version)), return path.Join(Params.IndexStorageRootPath, strconv.Itoa(int(it.req.IndexBuildID)), strconv.Itoa(int(it.req.Version)),
strconv.Itoa(int(partitionID)), strconv.Itoa(int(segmentID)), key) strconv.Itoa(int(partitionID)), strconv.Itoa(int(segmentID)), key)
} }
saveBlob := func(path string, value []byte) error { saveBlob := func(path string, value []byte) error {