##// 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 elif opts['dump_disk']:
2113 elif opts['dump_disk']:
2114 unfi = repo.unfiltered()
2114 unfi = repo.unfiltered()
2115 cl = unfi.changelog
2115 cl = unfi.changelog
2116 data = nodemap.persisted_data(cl)
2116 nm_data = nodemap.persisted_data(cl)
2117 ui.write(data)
2117 if nm_data is not None:
2118 docket, data = nm_data
2119 ui.write(data)
2118 elif opts['check']:
2120 elif opts['check']:
2119 unfi = repo.unfiltered()
2121 unfi = repo.unfiltered()
2120 cl = unfi.changelog
2122 cl = unfi.changelog
2121 data = nodemap.persisted_data(cl)
2123 nm_data = nodemap.persisted_data(cl)
2122 return nodemap.check_data(ui, cl.index, data)
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 @command(
2129 @command(
@@ -455,6 +455,7 b' class revlog(object):'
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.
@@ -544,6 +545,9 b' class revlog(object):'
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
@@ -635,7 +639,7 b' class revlog(object):'
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
@@ -41,7 +41,7 b' def persisted_data(revlog):'
41 docket = NodeMapDocket(pdata[offset : offset + uid_size])
41 docket = NodeMapDocket(pdata[offset : offset + uid_size])
42
42
43 filename = _rawdata_filepath(revlog, docket)
43 filename = _rawdata_filepath(revlog, docket)
44 return revlog.opener.tryread(filename)
44 return docket, revlog.opener.tryread(filename)
45
45
46
46
47 def setup_persistent_nodemap(tr, revlog):
47 def setup_persistent_nodemap(tr, revlog):
@@ -93,6 +93,7 b' def _persist_nodemap(tr, revlog):'
93 # store vfs
93 # store vfs
94 with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp:
94 with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp:
95 fp.write(target_docket.serialize())
95 fp.write(target_docket.serialize())
96 revlog._nodemap_docket = target_docket
96 # EXP-TODO: if the transaction abort, we should remove the new data and
97 # EXP-TODO: if the transaction abort, we should remove the new data and
97 # reinstall the old one.
98 # reinstall the old one.
98
99
General Comments 0
You need to be logged in to leave comments. Login now