D7885: nodemap: keep track of the docket for loaded data
Closed by commit rHG76a96e3a2bbb: nodemap: keep track of the docket for loaded data (authored by marmoute). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in state "Needs Review". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7885?vs=19897&id=20118 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7885/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7885 AFFECTED FILES mercurial/debugcommands.py mercurial/revlog.py mercurial/revlogutils/nodemap.py CHANGE DETAILS diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -41,7 +41,7 @@ docket = NodeMapDocket(pdata[offset : offset + uid_size]) filename = _rawdata_filepath(revlog, docket) -return revlog.opener.tryread(filename) +return docket, revlog.opener.tryread(filename) def setup_persistent_nodemap(tr, revlog): @@ -93,6 +93,7 @@ # store vfs with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp: fp.write(target_docket.serialize()) +revlog._nodemap_docket = target_docket # EXP-TODO: if the transaction abort, we should remove the new data and # reinstall the old one. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -455,6 +455,7 @@ self._maxchainlen = None self._deltabothparents = True self.index = None +self._nodemap_docket = None # Mapping of partial identifiers to full nodes. self._pcache = {} # Mapping of revision integer to full node. @@ -544,6 +545,9 @@ indexdata = b'' self._initempty = True try: +nodemap_data = nodemaputil.persisted_data(self) +if nodemap_data is not None: +self._nodemap_docket = nodemap_data[0] with self._indexfp() as f: if ( mmapindexthreshold is not None @@ -635,7 +639,7 @@ if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: -index.update_nodemap_data(nodemap_data) +index.update_nodemap_data(nodemap_data[1]) except (ValueError, IndexError): raise error.RevlogError( _(b"index %s is corrupted") % self.indexfile diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2113,13 +2113,17 @@ elif opts['dump_disk']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -ui.write(data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +ui.write(data) elif opts['check']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -return nodemap.check_data(ui, cl.index, data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +return nodemap.check_data(ui, cl.index, data) @command( To: marmoute, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7885: nodemap: keep track of the docket for loaded data
marmoute added a comment. marmoute updated this revision to Diff 19897. rebase to latest default REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7885?vs=19838&id=19897 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7885/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7885 AFFECTED FILES mercurial/debugcommands.py mercurial/revlog.py mercurial/revlogutils/nodemap.py CHANGE DETAILS diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -41,7 +41,7 @@ docket = NodeMapDocket(pdata[offset : offset + uid_size]) filename = _rawdata_filepath(revlog, docket) -return revlog.opener.tryread(filename) +return docket, revlog.opener.tryread(filename) def setup_persistent_nodemap(tr, revlog): @@ -93,6 +93,7 @@ # store vfs with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp: fp.write(target_docket.serialize()) +revlog._nodemap_docket = target_docket # EXP-TODO: if the transaction abort, we should remove the new data and # reinstall the old one. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -455,6 +455,7 @@ self._maxchainlen = None self._deltabothparents = True self.index = None +self._nodemap_docket = None # Mapping of partial identifiers to full nodes. self._pcache = {} # Mapping of revision integer to full node. @@ -544,6 +545,9 @@ indexdata = b'' self._initempty = True try: +nodemap_data = nodemaputil.persisted_data(self) +if nodemap_data is not None: +self._nodemap_docket = nodemap_data[0] with self._indexfp() as f: if ( mmapindexthreshold is not None @@ -635,7 +639,7 @@ if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: -index.update_nodemap_data(nodemap_data) +index.update_nodemap_data(nodemap_data[1]) except (ValueError, IndexError): raise error.RevlogError( _(b"index %s is corrupted") % self.indexfile diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2112,13 +2112,17 @@ elif opts['dump_disk']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -ui.write(data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +ui.write(data) elif opts['check']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -return nodemap.check_data(ui, cl.index, data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +return nodemap.check_data(ui, cl.index, data) @command( To: marmoute, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7885: nodemap: keep track of the docket for loaded data
marmoute added a comment. marmoute updated this revision to Diff 19838. small doc update on .#s[1] REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7885?vs=19794&id=19838 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7885/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7885 AFFECTED FILES mercurial/debugcommands.py mercurial/revlog.py mercurial/revlogutils/nodemap.py CHANGE DETAILS diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -41,7 +41,7 @@ docket = NodeMapDocket(pdata[offset : offset + uid_size]) filename = _rawdata_filepath(revlog, docket) -return revlog.opener.tryread(filename) +return docket, revlog.opener.tryread(filename) def setup_persistent_nodemap(tr, revlog): @@ -93,6 +93,7 @@ # store vfs with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp: fp.write(target_docket.serialize()) +revlog._nodemap_docket = target_docket # EXP-TODO: if the transaction abort, we should remove the new data and # reinstall the old one. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -455,6 +455,7 @@ self._maxchainlen = None self._deltabothparents = True self.index = None +self._nodemap_docket = None # Mapping of partial identifiers to full nodes. self._pcache = {} # Mapping of revision integer to full node. @@ -544,6 +545,9 @@ indexdata = b'' self._initempty = True try: +nodemap_data = nodemaputil.persisted_data(self) +if nodemap_data is not None: +self._nodemap_docket = nodemap_data[0] with self._indexfp() as f: if ( mmapindexthreshold is not None @@ -635,7 +639,7 @@ if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: -index.update_nodemap_data(nodemap_data) +index.update_nodemap_data(nodemap_data[1]) except (ValueError, IndexError): raise error.RevlogError( _(b"index %s is corrupted") % self.indexfile diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2112,13 +2112,17 @@ elif opts['dump_disk']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -ui.write(data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +ui.write(data) elif opts['check']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -return nodemap.check_data(ui, cl.index, data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +return nodemap.check_data(ui, cl.index, data) @command( To: marmoute, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7885: nodemap: keep track of the docket for loaded data
marmoute updated this revision to Diff 19794. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7885?vs=19766&id=19794 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7885/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7885 AFFECTED FILES mercurial/debugcommands.py mercurial/revlog.py mercurial/revlogutils/nodemap.py CHANGE DETAILS diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -41,7 +41,7 @@ docket = NodeMapDocket(pdata[offset : offset + uid_size]) filename = _rawdata_filepath(revlog, docket) -return revlog.opener.tryread(filename) +return docket, revlog.opener.tryread(filename) def setup_persistent_nodemap(tr, revlog): @@ -93,6 +93,7 @@ # store vfs with revlog.opener(revlog.nodemap_file, b'w', atomictemp=True) as fp: fp.write(target_docket.serialize()) +revlog._nodemap_docket = target_docket # EXP-TODO: if the transaction abort, we should remove the new data and # reinstall the old one. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -455,6 +455,7 @@ self._maxchainlen = None self._deltabothparents = True self.index = None +self._nodemap_docket = None # Mapping of partial identifiers to full nodes. self._pcache = {} # Mapping of revision integer to full node. @@ -544,6 +545,9 @@ indexdata = b'' self._initempty = True try: +nodemap_data = nodemaputil.persisted_data(self) +if nodemap_data is not None: +self._nodemap_docket = nodemap_data[0] with self._indexfp() as f: if ( mmapindexthreshold is not None @@ -635,7 +639,7 @@ if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: -index.update_nodemap_data(nodemap_data) +index.update_nodemap_data(nodemap_data[1]) except (ValueError, IndexError): raise error.RevlogError( _(b"index %s is corrupted") % self.indexfile diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2112,13 +2112,17 @@ elif opts['dump_disk']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -ui.write(data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +ui.write(data) elif opts['check']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -return nodemap.check_data(ui, cl.index, data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +return nodemap.check_data(ui, cl.index, data) @command( To: marmoute, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7885: nodemap: keep track of the docket for loaded data
marmoute updated this revision to Diff 19766. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7885?vs=19431&id=19766 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7885/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7885 AFFECTED FILES mercurial/debugcommands.py mercurial/revlog.py mercurial/revlogutils/nodemap.py CHANGE DETAILS diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -41,7 +41,7 @@ docket = NodeMapDocket(pdata[offset : offset + uid_size]) filename = _rawdata_filepath(revlog, docket) -return revlog.opener.tryread(filename) +return docket, revlog.opener.tryread(filename) def setup_persistent_nodemap(tr, revlog): @@ -93,6 +93,7 @@ # store vfs with revlog.opener(revlog.nodemap_file, 'w', atomictemp=True) as fp: fp.write(target_docket.serialize()) +revlog._nodemap_docket = target_docket # EXP-TODO: if the transaction abort, we should remove the new data and # reinstall the old one. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -455,6 +455,7 @@ self._maxchainlen = None self._deltabothparents = True self.index = None +self._nodemap_docket = None # Mapping of partial identifiers to full nodes. self._pcache = {} # Mapping of revision integer to full node. @@ -544,6 +545,9 @@ indexdata = b'' self._initempty = True try: +nodemap_data = nodemaputil.persisted_data(self) +if nodemap_data is not None: +self._nodemap_docket = nodemap_data[0] with self._indexfp() as f: if ( mmapindexthreshold is not None @@ -635,7 +639,7 @@ if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: -index.update_nodemap_data(nodemap_data) +index.update_nodemap_data(nodemap_data[1]) except (ValueError, IndexError): raise error.RevlogError( _(b"index %s is corrupted") % self.indexfile diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2112,13 +2112,17 @@ elif opts['dump_disk']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -ui.write(data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +ui.write(data) elif opts['check']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -return nodemap.check_data(ui, cl.index, data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +return nodemap.check_data(ui, cl.index, data) @command( To: marmoute, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7885: nodemap: keep track of the docket for loaded data
marmoute updated this revision to Diff 19431. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D7885?vs=19303&id=19431 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7885/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7885 AFFECTED FILES mercurial/debugcommands.py mercurial/revlog.py mercurial/revlogutils/nodemap.py CHANGE DETAILS diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -41,7 +41,7 @@ docket = NodeMapDocket(pdata[offset : offset + uid_size]) filename = _rawdata_filepath(revlog, docket) -return revlog.opener.tryread(filename) +return docket, revlog.opener.tryread(filename) def setup_persistent_nodemap(tr, revlog): @@ -93,6 +93,7 @@ # store vfs with revlog.opener(revlog.nodemap_file, 'w', atomictemp=True) as fp: fp.write(target_docket.serialize()) +revlog._nodemap_docket = target_docket # EXP-TODO: if the transaction abort, we should remove the new data and # reinstall the old one. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -455,6 +455,7 @@ self._maxchainlen = None self._deltabothparents = True self.index = None +self._nodemap_docket = None # Mapping of partial identifiers to full nodes. self._pcache = {} # Mapping of revision integer to full node. @@ -544,6 +545,9 @@ indexdata = b'' self._initempty = True try: +nodemap_data = nodemaputil.persisted_data(self) +if nodemap_data is not None: +self._nodemap_docket = nodemap_data[0] with self._indexfp() as f: if ( mmapindexthreshold is not None @@ -635,7 +639,7 @@ if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: -index.update_nodemap_data(nodemap_data) +index.update_nodemap_data(nodemap_data[1]) except (ValueError, IndexError): raise error.RevlogError( _(b"index %s is corrupted") % self.indexfile diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2106,13 +2106,17 @@ elif opts['dump_disk']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -ui.write(data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +ui.write(data) elif opts['check']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -return nodemap.check_data(ui, cl.index, data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +return nodemap.check_data(ui, cl.index, data) @command( To: marmoute, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D7885: nodemap: keep track of the docket for loaded data
marmoute created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY To perform incremental update of the on disk data, we need to keep tracks of some aspect of that data. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D7885 AFFECTED FILES mercurial/debugcommands.py mercurial/revlog.py mercurial/revlogutils/nodemap.py CHANGE DETAILS diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -41,7 +41,7 @@ docket = NodeMapDocket(pdata[offset : offset + uid_size]) filename = _rawdata_filepath(revlog, docket) -return revlog.opener.tryread(filename) +return docket, revlog.opener.tryread(filename) def setup_persistent_nodemap(tr, revlog): @@ -93,6 +93,7 @@ # store vfs with revlog.opener(revlog.nodemap_file, 'w', atomictemp=True) as fp: fp.write(target_docket.serialize()) +revlog._nodemap_docket = target_docket # EXP-TODO: if the transaction abort, we should remove the new data and # reinstall the old one. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -455,6 +455,7 @@ self._maxchainlen = None self._deltabothparents = True self.index = None +self._nodemap_docket = None # Mapping of partial identifiers to full nodes. self._pcache = {} # Mapping of revision integer to full node. @@ -544,6 +545,9 @@ indexdata = b'' self._initempty = True try: +nodemap_data = nodemaputil.persisted_data(self) +if nodemap_data is not None: +self._nodemap_docket = nodemap_data[0] with self._indexfp() as f: if ( mmapindexthreshold is not None @@ -635,7 +639,7 @@ if use_nodemap: nodemap_data = nodemaputil.persisted_data(self) if nodemap_data is not None: -index.update_nodemap_data(nodemap_data) +index.update_nodemap_data(nodemap_data[1]) except (ValueError, IndexError): raise error.RevlogError( _(b"index %s is corrupted") % self.indexfile diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2106,13 +2106,17 @@ elif args['dump_disk']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -ui.write(data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +ui.write(data) elif args['check']: unfi = repo.unfiltered() cl = unfi.changelog -data = nodemap.persisted_data(cl) -return nodemap.check_data(ui, cl.index, data) +nm_data = nodemap.persisted_data(cl) +if nm_data is not None: +docket, data = nm_data +return nodemap.check_data(ui, cl.index, data) @command( To: marmoute, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel