Mercurial > hg
comparison hgext/journal.py @ 33923:e6d421566906
journal: do not use atomictemp (issue5338)
Writing journal files using `atomictemp` leads to quadratic performance that
could be problematic if automation runs many commands. Other logs like
blackbox does not use atomictemp, and journal logs are not critical for repo
correctness. So let's make them non-atomictemp.
Differential Revision: https://phab.mercurial-scm.org/D517
author | Jun Wu <quark@fb.com> |
---|---|
date | Thu, 24 Aug 2017 21:43:54 -0700 |
parents | 0407a51b9d8c |
children | 135edf120d76 |
comparison
equal
deleted
inserted
replaced
33922:1a6707b43d05 | 33923:e6d421566906 |
---|---|
340 | 340 |
341 def _write(self, vfs, entry): | 341 def _write(self, vfs, entry): |
342 with self.jlock(vfs): | 342 with self.jlock(vfs): |
343 version = None | 343 version = None |
344 # open file in amend mode to ensure it is created if missing | 344 # open file in amend mode to ensure it is created if missing |
345 with vfs('namejournal', mode='a+b', atomictemp=True) as f: | 345 with vfs('namejournal', mode='a+b') as f: |
346 f.seek(0, os.SEEK_SET) | 346 f.seek(0, os.SEEK_SET) |
347 # Read just enough bytes to get a version number (up to 2 | 347 # Read just enough bytes to get a version number (up to 2 |
348 # digits plus separator) | 348 # digits plus separator) |
349 version = f.read(3).partition('\0')[0] | 349 version = f.read(3).partition('\0')[0] |
350 if version and version != str(storageversion): | 350 if version and version != str(storageversion): |