revlog: deal with chunk ranges over 2G on Windows (
issue4215)
Python uses a C long (32 bits on Windows 64) rather than an ssize_t in
read(), and thus has a 2G size limit. Work around this by falling back
to reading one chunk at a time on overflow. This approximately doubles
our headroom until we run back into the size limit on single reads.
--- a/mercurial/revlog.py Thu Apr 03 20:35:56 2014 -0500
+++ b/mercurial/revlog.py Mon Apr 07 14:18:10 2014 -0500
@@ -909,8 +909,13 @@
ladd = l.append
# preload the cache
- self._chunkraw(revs[0], revs[-1])
- offset, data = self._chunkcache
+ try:
+ self._chunkraw(revs[0], revs[-1])
+ offset, data = self._chunkcache
+ except OverflowError:
+ # issue4215 - we can't cache a run of chunks greater than
+ # 2G on Windows
+ return [self._chunk(rev) for rev in revs]
for rev in revs:
chunkstart = start(rev)