revlog: make _chunkcache access atomic
With this and related fixes, 'hg serve' survived 100000 hits with
siege.
--- a/mercurial/revlog.py Mon Jun 09 10:34:21 2014 -0700
+++ b/mercurial/revlog.py Fri Jun 13 14:16:03 2014 -0500
@@ -919,8 +919,13 @@
# preload the cache
try:
- self._chunkraw(revs[0], revs[-1])
- offset, data = self._chunkcache
+ while 1:
+ # ensure that the cache doesn't change out from under us
+ _cache = self._chunkcache
+ self._chunkraw(revs[0], revs[-1])
+ if _cache == self._chunkcache:
+ break
+ offset, data = _cache
except OverflowError:
# issue4215 - we can't cache a run of chunks greater than
# 2G on Windows