[PATCH 09 of 10 stable] largefiles: servers should not verify hashes of local files on remote statlfile

Mads Kiilerich mads at kiilerich.com
Thu Jan 24 23:17:08 CST 2013


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1359090917 -3600
# Branch stable
# Node ID b8393fb225f2051c768d98acd11bdb531c9f95c6
# Parent  2c1f8cffefbbe3bd0502be34d7f718714a6e4a42
largefiles: servers should not verify hashes of local files on remote statlfile

Largefile hashes are checked by putlfile before being stored on the server. A
server should thus be able to keep its largefile store free of errors.
Verification should happen when running 'hg verify --large' locally on the
server. Rehashing every largefile on every remote stat is too expensive.

Issue3123 discussed related problems - and how they have been fixed.

diff --git a/hgext/largefiles/proto.py b/hgext/largefiles/proto.py
--- a/hgext/largefiles/proto.py
+++ b/hgext/largefiles/proto.py
@@ -63,18 +63,16 @@
     return wireproto.streamres(generator())
 
 def statlfile(repo, proto, sha):
-    '''Return '2\n' if the largefile is missing, '1\n' if it has a
-    mismatched checksum, or '0\n' if it is in good condition'''
+    '''Return '2\n' if the largefile is missing, '0\n' if it seems to be in
+    good condition.
+
+    The value 1 is reserved for mismatched checksum, but that is too expensive
+    to be verified on every stat and must be caught be running 'hg verify'
+    server side.'''
     filename = lfutil.findfile(repo, sha)
     if not filename:
         return '2\n'
-    fd = None
-    try:
-        fd = open(filename, 'rb')
-        return lfutil.hexsha1(fd) == sha and '0\n' or '1\n'
-    finally:
-        if fd:
-            fd.close()
+    return '0\n'
 
 def wirereposetup(ui, repo):
     class lfileswirerepository(repo.__class__):


More information about the Mercurial-devel mailing list