Skip to content

Commit

Permalink
Do not delete cache entries that shouldn't be deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Oct 8, 2024
1 parent 2808eca commit fa20c83
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pkg/storage/fs/posix/lookup/store_idcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,23 @@ func (c *StoreIDCache) Delete(_ context.Context, spaceID, nodeID string) error {

// DeleteByPath removes an entry from the cache
func (c *StoreIDCache) DeleteByPath(ctx context.Context, path string) error {
spaceID, nodeID, ok := c.GetByPath(ctx, path)
if !ok {
appctx.GetLogger(ctx).Error().Str("record", path).Msg("could not get spaceID and nodeID from cache")
} else {
err := c.cache.Delete(reverseCacheKey(path))
if err != nil {
appctx.GetLogger(ctx).Error().Err(err).Str("record", path).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not get spaceID and nodeID from cache")
}

err = c.cache.Delete(cacheKey(spaceID, nodeID))
if err != nil {
appctx.GetLogger(ctx).Error().Err(err).Str("record", path).Str("spaceID", spaceID).Str("nodeID", nodeID).Msg("could not get spaceID and nodeID from cache")
}
}

list, err := c.cache.List(
microstore.ListPrefix(reverseCacheKey(path)),
microstore.ListPrefix(reverseCacheKey(path) + "/"),
)
if err != nil {
return err
Expand Down

0 comments on commit fa20c83

Please sign in to comment.