Browse Source

fix

pull/7485/head
Roman Tamarov 2 weeks ago
parent
commit
8455c7ec7b
  1. 2
      weed/filer/abstract_sql/abstract_sql_store.go
  2. 6
      weed/filer/elastic/v7/elastic_store.go
  3. 8
      weed/filer/tikv/tikv_store.go

2
weed/filer/abstract_sql/abstract_sql_store.go

@ -342,7 +342,7 @@ func (store *AbstractSqlStore) ListDirectoryPrefixedEntries(ctx context.Context,
} }
func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) { func (store *AbstractSqlStore) ListDirectoryEntries(ctx context.Context, dirPath util.FullPath, startFileName string, includeStartFile bool, limit int64, eachEntryFunc filer.ListEachEntryFunc) (lastFileName string, err error) {
return store.ListDirectoryPrefixedEntries(ctx, dirPath, startFileName, includeStartFile, limit, "", nil)
return store.ListDirectoryPrefixedEntries(ctx, dirPath, startFileName, includeStartFile, limit, "", eachEntryFunc)
} }
func (store *AbstractSqlStore) Shutdown() { func (store *AbstractSqlStore) Shutdown() {

6
weed/filer/elastic/v7/elastic_store.go

@ -198,12 +198,12 @@ func (store *ElasticStore) deleteEntry(ctx context.Context, index, id string) (e
} }
func (store *ElasticStore) DeleteFolderChildren(ctx context.Context, fullpath weed_util.FullPath) (err error) { func (store *ElasticStore) DeleteFolderChildren(ctx context.Context, fullpath weed_util.FullPath) (err error) {
_, err = store.ListDirectoryEntries(ctx, fullpath, "", false, math.MaxInt32, func(entry *filer.Entry) bool {
_, err = store.ListDirectoryEntries(ctx, fullpath, "", false, math.MaxInt32, func(entry *filer.Entry) (bool, error) {
if err := store.DeleteEntry(ctx, entry.FullPath); err != nil { if err := store.DeleteEntry(ctx, entry.FullPath); err != nil {
glog.ErrorfCtx(ctx, "elastic delete %s: %v.", entry.FullPath, err) glog.ErrorfCtx(ctx, "elastic delete %s: %v.", entry.FullPath, err)
return false
return false, err
} }
return true
return true, nil
}) })
return return
} }

8
weed/filer/tikv/tikv_store.go

@ -291,7 +291,13 @@ func (store *TikvStore) ListDirectoryPrefixedEntries(ctx context.Context, dirPat
break break
} }
if err := iter.Next(); !resEachEntryFunc || err != nil {
nextErr := iter.Next()
if nextErr != nil {
err = nextErr
break
}
if !resEachEntryFunc {
break break
} }
} }

Loading…
Cancel
Save