mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-11-24 02:59:13 +08:00
bug fixed to filer store elastic deleteEntry (#5988)
This commit is contained in:
parent
ff3d46637d
commit
d8e18a8eb7
@ -159,8 +159,16 @@ func (store *ElasticStore) FindEntry(ctx context.Context, fullpath weed_util.Ful
|
|||||||
func (store *ElasticStore) DeleteEntry(ctx context.Context, fullpath weed_util.FullPath) (err error) {
|
func (store *ElasticStore) DeleteEntry(ctx context.Context, fullpath weed_util.FullPath) (err error) {
|
||||||
index := getIndex(fullpath, false)
|
index := getIndex(fullpath, false)
|
||||||
id := weed_util.Md5String([]byte(fullpath))
|
id := weed_util.Md5String([]byte(fullpath))
|
||||||
if strings.Count(string(fullpath), "/") == 1 {
|
strFullpath := string(fullpath)
|
||||||
return store.deleteIndex(ctx, index)
|
|
||||||
|
// A top-level subdirectory refers to an Elasticsearch index.
|
||||||
|
// If we delete an entry at the top level, we should attempt to delete the corresponding Elasticsearch index.
|
||||||
|
if strings.Count(strFullpath, "/") == 1 {
|
||||||
|
entry, err2 := store.FindEntry(ctx, fullpath)
|
||||||
|
if err2 == nil && entry.IsDirectory() {
|
||||||
|
bucketIndex := indexPrefix + strFullpath[1:]
|
||||||
|
store.deleteIndex(ctx, bucketIndex)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return store.deleteEntry(ctx, index, id)
|
return store.deleteEntry(ctx, index, id)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user