diff options
author | pasko@chromium.org <pasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-24 23:46:51 +0000 |
---|---|---|
committer | pasko@chromium.org <pasko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-24 23:46:51 +0000 |
commit | d7c76d0f1c28fa3634986ffb6602d055835a72fa (patch) | |
tree | 2b2580061e6ca23ea9b7d40c19bc445ccd3b2d51 /tools | |
parent | 11d3c6552bad2d18f2d1d8d96ffbd523f06f95c7 (diff) | |
download | chromium_src-d7c76d0f1c28fa3634986ffb6602d055835a72fa.zip chromium_src-d7c76d0f1c28fa3634986ffb6602d055835a72fa.tar.gz chromium_src-d7c76d0f1c28fa3634986ffb6602d055835a72fa.tar.bz2 |
Simple Cache: Get mtime from the cache directory early
Currently the index is loaded asynchronously while the backend is already
initialized and is able to modify the cache directory. This may lead to index
file being considered stale without a real reason.
To overcome this problem we take the mtime of the directory early during backend
initialization and then compare it to the index freshness timestamp. The index
in memory will continue to be fresh since we update it with latest knowledge
from the backend.
This is the first step to add precision into index freshness, following steps
are:
* move the index file into a separate directory to make sure the rename()
operation itself does not make the index stale
* Save directory mtime to the index file itself to avoid missing updates while
the index is being written to the disk
* Read the last index modification time without loading the whole index
Some preparations were also made here for the next step: moving the index file
to a subdirectory. Mainly it is about moving some knowledge of cache directory
structure into the SimpleIndexFile and updating the tests accordingly. Hopefully
this won't make reviewing too complicated.
BUG=261618
Review URL: https://chromiumcodereview.appspot.com/19519010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213547 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index c351553..2e86f1d 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -12854,6 +12854,12 @@ other types of suffix sets. </summary> </histogram> +<histogram name="SimpleCache.IndexFileStateOnLoad" enum="SimpleIndexState"> + <summary> + The state the index file is at when an attempt is made to load from it. + </summary> +</histogram> + <histogram name="SimpleCache.IndexInitializationWaiters"> <summary> At the time of index initialization, the number of enqueued jobs awaiting @@ -12884,6 +12890,9 @@ other types of suffix sets. </histogram> <histogram name="SimpleCache.IndexStale" enum="BooleanStale"> + <obsolete> + Deprecated 07/2013, and replaced by IndexFileStateOnLoad. + </obsolete> <summary>For each index load, whether the index file was stale.</summary> </histogram> @@ -20453,6 +20462,13 @@ other types of suffix sets. <int value="4" label="Synchronous Write Failure"/> </enum> +<enum name="SimpleIndexState" type="int"> + <int value="0" label="Corrupt"/> + <int value="1" label="Stale"/> + <int value="2" label="Fresh"/> + <int value="3" label="Fresh index with cache updated since backend start"/> +</enum> + <enum name="SocketStreamConnectionType" type="int"> <int value="0" label="none"/> <int value="1" label="all connections"/> |