Invalidate mount meta cache more aggressively

This commit is contained in:
nivekuil 2021-08-28 04:22:19 -07:00
parent 65a29ad42a
commit 8c523d50ad

View file

@ -39,14 +39,10 @@ func SubscribeMetaEvents(mc *MetaCache, selfSignature int32, client filer_pb.Fil
err := mc.AtomicUpdateEntryFromFiler(context.Background(), oldPath, newEntry) err := mc.AtomicUpdateEntryFromFiler(context.Background(), oldPath, newEntry)
if err == nil { if err == nil {
if message.OldEntry != nil && message.NewEntry != nil { if message.OldEntry != nil && message.NewEntry != nil {
if message.OldEntry.Name == message.NewEntry.Name { oldKey := util.NewFullPath(resp.Directory, message.OldEntry.Name)
// no need to invalidate mc.invalidateFunc(oldKey)
} else { newKey := util.NewFullPath(dir, message.NewEntry.Name)
oldKey := util.NewFullPath(resp.Directory, message.OldEntry.Name) mc.invalidateFunc(newKey)
mc.invalidateFunc(oldKey)
newKey := util.NewFullPath(dir, message.NewEntry.Name)
mc.invalidateFunc(newKey)
}
} else if message.OldEntry == nil && message.NewEntry != nil { } else if message.OldEntry == nil && message.NewEntry != nil {
// no need to invaalidate // no need to invaalidate
} else if message.OldEntry != nil && message.NewEntry == nil { } else if message.OldEntry != nil && message.NewEntry == nil {