##// END OF EJS Templates
nodemap: keep track of the docket for loaded data...
marmoute -
r44804:76a96e3a default
parent child Browse files
Show More
@@ -2113,13 +2113,17 b' def debugnodemap(ui, repo, **opts):'
2113 2113 elif opts['dump_disk']:
2114 2114 unfi = repo.unfiltered()
2115 2115 cl = unfi.changelog
2116 data = nodemap.persisted_data(cl)
2117 ui.write(data)
2116 nm_data = nodemap.persisted_data(cl)
2117 if nm_data is not None:
2118 docket, data = nm_data
2119 ui.write(data)
2118 2120 elif opts['check']:
2119 2121 unfi = repo.unfiltered()
2120 2122 cl = unfi.changelog
2121 data = nodemap.persisted_data(cl)
2122 return nodemap.check_data(ui, cl.index, data)
2123 nm_data = nodemap.persisted_data(cl)
2124 if nm_data is not None:
2125 docket, data = nm_data
2126 return nodemap.check_data(ui, cl.index, data)
2123 2127
2124 2128
2125 2129 @command(
@@ -455,6 +455,7 b' class revlog(object):'
455 455 self._maxchainlen = None
456 456 self._deltabothparents = True
457 457 self.index = None
458 self._nodemap_docket = None
458 459 # Mapping of partial identifiers to full nodes.
459 460 self._pcache = {}
460 461 # Mapping of revision integer to full node.
@@ -544,6 +545,9 b' class revlog(object):'
544 545 indexdata = b''
545 546 self._initempty = True
546 547 try:
548 nodemap_data = nodemaputil.persisted_data(self)
549 if nodemap_data is not None:
550 self._nodemap_docket = nodemap_data[0]
547 551 with self._indexfp() as f:
548 552 if (
549 553 mmapindexthreshold is not None
@@ -635,7 +639,7 b' class revlog(object):'
635 639 if use_nodemap:
636 640 nodemap_data = nodemaputil.persisted_data(self)
637 641 if nodemap_data is not None:
638 index.update_nodemap_data(nodemap_data)
642 index.update_nodemap_data(nodemap_data[1])
639 643 except (ValueError, IndexError):
640 644 raise error.RevlogError(
641 645 _(b"index %s is corrupted") % self.indexfile
@@ -41,7 +41,7 b' def persisted_data(revlog):'
41 41 docket = NodeMapDocket(pdata[offset : offset + uid_size])
42 42
43 43 filename = _rawdata_filepath(revlog, docket)
44 return revlog.opener.tryread(filename)
44 return docket, revlog.opener.tryread(filename)
45 45
46 46
47 47 def setup_persistent_nodemap(tr, revlog):
@@ -93,6 +93,7 b' def _persist_nodemap(tr, revlog):'
93 93 # store vfs
94 94 with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp:
95 95 fp.write(target_docket.serialize())
96 revlog._nodemap_docket = target_docket
96 97 # EXP-TODO: if the transaction abort, we should remove the new data and
97 98 # reinstall the old one.
98 99
General Comments 0
You need to be logged in to leave comments. Login now