Skip to content

Commit

Permalink
do not invalidate filemetadata cache early (#4049)
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic authored Jul 7, 2023
1 parent 2727f60 commit d629240
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Do not invalidate filemetadata cache early

We can postpone overwriting the cache until the metadata has ben written to disk. This prevents other requests trying to read metadata from having to wait for a readlock for the metadata file.

https://github.com/cs3org/reva/pull/4049
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,8 @@ func (b MessagePackBackend) saveAttributes(ctx context.Context, path string, set
return err
}

// Invalidate cache early
_, subspan := tracer.Start(ctx, "metaCache.RemoveMetadata")
_ = b.metaCache.RemoveMetadata(b.cacheKey(path))
subspan.End()

// Read current state
_, subspan = tracer.Start(ctx, "os.ReadFile")
_, subspan := tracer.Start(ctx, "os.ReadFile")
var msgBytes []byte
msgBytes, err = os.ReadFile(metaPath)
subspan.End()
Expand Down

0 comments on commit d629240

Please sign in to comment.