Bugfix: Removed global filestore flush #3492
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The memcache filestore delays writes in order to batch them. This can cause race conditions in some cases. In particular when creating a download export zip, the GUI tries to access the file immediately. However if the writes are still in flight then it will not be able to find it.
Previously this order was ensured by using FlushFilestore which is a global flush of all inflight writes. However, for memcache filestore on EFS this global flush is a performance killer since the filestore is locked for the duration of the flush. This appears as a deadlock where the entire process is blocked while an export is underway.
This PR improves things in a number of ways:
The flushes are gone in the background - ensuring the filestore is not locked too long.
We avoid calling the global FlushFilestore by installing appropriate completion functions in the export functions.
The TTL cache is updated to allow for overriding the expiry behavior. This makes it simpler to avoid expiring files that are still open.
Also this PR fixes a GUI issue where JSON parsing raises an exception for invalid data. Now the GUI handles it with a suitable default object.