Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not invalidate filemetadata cache early #4049

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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