Skip to content

Conversation

@floren
Copy link
Contributor

@floren floren commented Aug 18, 2021

The siphon will now stop writing to its internal buffer once the size of the buffer
exceeds the maximum cache size. Because we write until we exceed the max cache size,
we're safe to attempt the cache update even if the buffer only contains partial data,
because it's still over the limit & will be rejected.

The siphon will now stop writing to its internal buffer once the size of the buffer
exceeds the maximum cache size. Because we write until we *exceed* the max cache size,
we're safe to attempt the cache update even if the buffer only contains partial data,
because it's still over the limit & will be rejected.
@peterbourgon
Copy link
Owner

Would it be smarter to check both d.CacheSizeMax and fi.Size in readWithRLock, and only create and use the siphon if the file size could conceivably fit in the cache?

@moraouf11
Copy link

@peterbourgon can't we combine both approaches ?
the approach in the PR is good as it saves the memory even if the memory metadata is not accurate or writes was done during the read , while your suggestion can save doing the work to begin with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants