Browse Source

filer: avoid lazy fetch in pending metadata reconciliation

Use a local-only entry lookup during pending remote metadata reconciliation so cache misses do not trigger remote lazy fetches.

Made-with: Cursor
pull/8522/head
Peter 4 days ago
parent
commit
578305ad0d
  1. 9
      weed/filer/filer.go
  2. 2
      weed/filer/filer_delete_entry.go

9
weed/filer/filer.go

@ -363,7 +363,14 @@ var (
)
func (f *Filer) FindEntry(ctx context.Context, p util.FullPath) (entry *Entry, err error) {
return f.findEntry(ctx, p, true)
}
func (f *Filer) FindEntryLocal(ctx context.Context, p util.FullPath) (entry *Entry, err error) {
return f.findEntry(ctx, p, false)
}
func (f *Filer) findEntry(ctx context.Context, p util.FullPath, allowLazyFetch bool) (entry *Entry, err error) {
if string(p) == "/" {
return Root, nil
}
@ -382,7 +389,7 @@ func (f *Filer) FindEntry(ctx context.Context, p util.FullPath) (entry *Entry, e
}
}
if entry == nil && (err == nil || errors.Is(err, filer_pb.ErrNotFound)) {
if allowLazyFetch && entry == nil && (err == nil || errors.Is(err, filer_pb.ErrNotFound)) {
if lazy, lazyErr := f.maybeLazyFetchFromRemote(ctx, p); lazyErr != nil {
glog.V(1).InfofCtx(ctx, "FindEntry lazy fetch %s: %v", p, lazyErr)
} else if lazy != nil {

2
weed/filer/filer_delete_entry.go

@ -227,7 +227,7 @@ func (f *Filer) reconcilePendingRemoteMetadataDeletions(ctx context.Context) err
}
for _, pendingPath := range pendingPaths {
entry, findErr := f.FindEntry(ctx, pendingPath)
entry, findErr := f.FindEntryLocal(ctx, pendingPath)
if errors.Is(findErr, filer_pb.ErrNotFound) || entry == nil {
if clearErr := f.clearRemoteMetadataDeletionPending(ctx, pendingPath); clearErr != nil {
glog.Warningf("clear remote metadata deletion pending %s: %v", pendingPath, clearErr)

Loading…
Cancel
Save