Bug 25628 - client should cache negative results
Summary: client should cache negative results
Status: RESOLVED FIXED
Alias: None
Product: elfutils
Classification: Unclassified
Component: debuginfod (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Alice Zhang
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-03 16:09 UTC by Aaron Merey
Modified: 2021-05-06 21:21 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aaron Merey 2020-03-03 16:09:21 UTC
When a query for a file fails the client should save this information in the cache, possibly as an empty file with the usual name. This can save time by allowing for skipping queries that are likely to fail.
Comment 1 Frank Ch. Eigler 2020-03-03 16:23:54 UTC
debuginfod misses are pretty quick tho - maybe it's harmless?  If these are to be cached, they shouldn't be cached too long, as the data could appear later.
Comment 2 Aaron Merey 2020-03-03 20:30:46 UTC
(In reply to Frank Ch. Eigler from comment #1)
> debuginfod misses are pretty quick tho - maybe it's harmless?  If these are
> to be cached, they shouldn't be cached too long, as the data could appear
> later.

Some delay is noticeable when doing multiple queries over a short time. Usually harmless but I think control over this may improve user experience. Another config file could be added to the top level of the cache to control how long to wait until querying the server again for these files. If we are worried about missing server updates then a default of 0 may be appropriate.
Comment 3 Frank Ch. Eigler 2021-03-18 16:58:55 UTC
Suggest implementing this via:
- map a 404 result code to an empty 000-permission file in the debuginfod client cache
- when querying for a buildid, if the cache includes such a 000-permission file, check its fstat
- if the fstat mtime is older than the configuration parameter from the file .cache/cache_miss_s, then unlink the 000 file and proceed with a new query
- if the fstat mtime is newer, then the 000 file is fresh, so return a 404/ENOENT equivalent to the debuginfod client application
- a good default for cache_miss_s could be 600 (10 minutes)
Comment 4 Frank Ch. Eigler 2021-05-06 21:21:24 UTC
commit 5f72c51a7e5c02be833d78c8412a8083f2212dcf 
Author: Alice Zhang via Elfutils-devel <elfutils-devel@sourceware.org>
Date:   Tue May 4 16:25:59 2021 -0400

    debuginfod: debuginfod client should cache negative results.
    
    Add debuginfod_config_cache for reading and writing to cache
    configuration files, make use of the function within
    debuginfod_clean_cache and debuginfod_query_server.