comparison mercurial/localrepo.py @ 44826:35b255e474d9 stable

dirstate: make sure the dirstate is loaded before the changelog (issue6303) Before this change, it was possible for the changelog to be loaded before the dirstate. If a transaction happens betwen the changelog and dirstate reading, the dirstate can up end poitning toward a revision not existing in the (olded) changelog. This lead to a warning. With this revision, we preload the dirstate parent before reading the changelog. This has a negligible performance impact on performance for all case we are tracking. Differential Revision: https://phab.mercurial-scm.org/D8528
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 11 May 2020 13:08:02 +0200
parents 1b8fd4af3318
children fd3b94f1712d
comparison
equal deleted inserted replaced
44825:18e36ff8b414 44826:35b255e474d9
1448 def obsstore(self): 1448 def obsstore(self):
1449 return obsolete.makestore(self.ui, self) 1449 return obsolete.makestore(self.ui, self)
1450 1450
1451 @storecache(b'00changelog.i') 1451 @storecache(b'00changelog.i')
1452 def changelog(self): 1452 def changelog(self):
1453 # load dirstate before changelog to avoid race see issue6303
1454 self.dirstate.prefetch_parents()
1453 return self.store.changelog(txnutil.mayhavepending(self.root)) 1455 return self.store.changelog(txnutil.mayhavepending(self.root))
1454 1456
1455 @storecache(b'00manifest.i') 1457 @storecache(b'00manifest.i')
1456 def manifestlog(self): 1458 def manifestlog(self):
1457 return self.store.manifestlog(self, self._storenarrowmatch) 1459 return self.store.manifestlog(self, self._storenarrowmatch)