comparison mercurial/revlog.py @ 44366:76a96e3a2bbb

nodemap: keep track of the docket for loaded data To perform incremental update of the on disk data, we need to keep tracks of some aspect of that data. Differential Revision: https://phab.mercurial-scm.org/D7885
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Jan 2020 15:49:45 +0100
parents 671f9479af0e
children e41a164db7a9
comparison
equal deleted inserted replaced
44365:72c15641c8b4 44366:76a96e3a2bbb
453 # How much data to read and cache into the raw revlog data cache. 453 # How much data to read and cache into the raw revlog data cache.
454 self._chunkcachesize = 65536 454 self._chunkcachesize = 65536
455 self._maxchainlen = None 455 self._maxchainlen = None
456 self._deltabothparents = True 456 self._deltabothparents = True
457 self.index = None 457 self.index = None
458 self._nodemap_docket = None
458 # Mapping of partial identifiers to full nodes. 459 # Mapping of partial identifiers to full nodes.
459 self._pcache = {} 460 self._pcache = {}
460 # Mapping of revision integer to full node. 461 # Mapping of revision integer to full node.
461 self._compengine = b'zlib' 462 self._compengine = b'zlib'
462 self._compengineopts = {} 463 self._compengineopts = {}
542 ) 543 )
543 544
544 indexdata = b'' 545 indexdata = b''
545 self._initempty = True 546 self._initempty = True
546 try: 547 try:
548 nodemap_data = nodemaputil.persisted_data(self)
549 if nodemap_data is not None:
550 self._nodemap_docket = nodemap_data[0]
547 with self._indexfp() as f: 551 with self._indexfp() as f:
548 if ( 552 if (
549 mmapindexthreshold is not None 553 mmapindexthreshold is not None
550 and self.opener.fstat(f).st_size >= mmapindexthreshold 554 and self.opener.fstat(f).st_size >= mmapindexthreshold
551 ): 555 ):
633 and util.safehasattr(index, 'update_nodemap_data') 637 and util.safehasattr(index, 'update_nodemap_data')
634 ) 638 )
635 if use_nodemap: 639 if use_nodemap:
636 nodemap_data = nodemaputil.persisted_data(self) 640 nodemap_data = nodemaputil.persisted_data(self)
637 if nodemap_data is not None: 641 if nodemap_data is not None:
638 index.update_nodemap_data(nodemap_data) 642 index.update_nodemap_data(nodemap_data[1])
639 except (ValueError, IndexError): 643 except (ValueError, IndexError):
640 raise error.RevlogError( 644 raise error.RevlogError(
641 _(b"index %s is corrupted") % self.indexfile 645 _(b"index %s is corrupted") % self.indexfile
642 ) 646 )
643 self.index, self._chunkcache = d 647 self.index, self._chunkcache = d