##// END OF EJS Templates
upgrade: implement partial upgrade for upgrading persistent-nodemap...
Pulkit Goyal -
r47199:98e39f04 default
parent child Browse files
Show More
@@ -128,15 +128,20 b' def update_persistent_nodemap(revlog):'
128 notr._postclose[k](None)
128 notr._postclose[k](None)
129
129
130
130
131 def persist_nodemap(tr, revlog, pending=False):
131 def persist_nodemap(tr, revlog, pending=False, force=False):
132 """Write nodemap data on disk for a given revlog"""
132 """Write nodemap data on disk for a given revlog"""
133 if getattr(revlog, 'filteredrevs', ()):
133 if getattr(revlog, 'filteredrevs', ()):
134 raise error.ProgrammingError(
134 raise error.ProgrammingError(
135 "cannot persist nodemap of a filtered changelog"
135 "cannot persist nodemap of a filtered changelog"
136 )
136 )
137 if revlog.nodemap_file is None:
137 if revlog.nodemap_file is None:
138 msg = "calling persist nodemap on a revlog without the feature enabled"
138 if force:
139 raise error.ProgrammingError(msg)
139 revlog.nodemap_file = get_nodemap_file(
140 revlog.opener, revlog.indexfile
141 )
142 else:
143 msg = "calling persist nodemap on a revlog without the feature enabled"
144 raise error.ProgrammingError(msg)
140
145
141 can_incremental = util.safehasattr(revlog.index, "nodemap_data_incremental")
146 can_incremental = util.safehasattr(revlog.index, "nodemap_data_incremental")
142 ondisk_docket = revlog._nodemap_docket
147 ondisk_docket = revlog._nodemap_docket
@@ -24,6 +24,7 b' from .. import ('
24 util,
24 util,
25 vfs as vfsmod,
25 vfs as vfsmod,
26 )
26 )
27 from ..revlogutils import nodemap
27
28
28
29
29 def _revlogfrompath(repo, path):
30 def _revlogfrompath(repo, path):
@@ -452,6 +453,22 b' def upgrade(ui, srcrepo, dstrepo, upgrad'
452 if upgrade_op.requirements_only:
453 if upgrade_op.requirements_only:
453 ui.status(_(b'upgrading repository requirements\n'))
454 ui.status(_(b'upgrading repository requirements\n'))
454 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
455 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
456 # if there is only one action and that is persistent nodemap upgrade
457 # directly write the nodemap file and update requirements instead of going
458 # through the whole cloning process
459 elif (
460 len(upgrade_op.upgrade_actions) == 1
461 and b'persistent-nodemap' in upgrade_op._upgrade_actions_names
462 and not upgrade_op.removed_actions
463 ):
464 ui.status(
465 _(b'upgrading repository to use persistent nodemap feature\n')
466 )
467 with srcrepo.transaction(b'upgrade') as tr:
468 unfi = srcrepo.unfiltered()
469 cl = unfi.changelog
470 nodemap.persist_nodemap(tr, cl, force=True)
471 scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
455 else:
472 else:
456 with dstrepo.transaction(b'upgrade') as tr:
473 with dstrepo.transaction(b'upgrade') as tr:
457 _clonerevlogs(
474 _clonerevlogs(
@@ -636,28 +636,11 b' upgrading'
636 repository locked and read-only
636 repository locked and read-only
637 creating temporary repository to stage upgraded data: $TESTTMP/test-repo/.hg/upgrade.* (glob)
637 creating temporary repository to stage upgraded data: $TESTTMP/test-repo/.hg/upgrade.* (glob)
638 (it is safe to interrupt this process any time before data migration completes)
638 (it is safe to interrupt this process any time before data migration completes)
639 migrating 15018 total revisions (5006 in filelogs, 5006 in manifests, 5006 in changelog)
639 upgrading repository to use persistent nodemap feature
640 migrating 1.74 MB in store; 569 MB tracked data
641 migrating 5004 filelogs containing 5006 revisions (346 KB in store; 28.2 KB tracked data)
642 finished migrating 5006 filelog revisions across 5004 filelogs; change in size: 0 bytes
643 migrating 1 manifests containing 5006 revisions (765 KB in store; 569 MB tracked data)
644 finished migrating 5006 manifest revisions across 1 manifests; change in size: 0 bytes
645 migrating changelog containing 5006 revisions (673 KB in store; 363 KB tracked data)
646 finished migrating 5006 changelog revisions; change in size: 0 bytes
647 finished migrating 15018 total revisions; total change in store size: 0 bytes
648 copying phaseroots
649 data fully upgraded in a temporary repository
650 marking source repository as being upgraded; clients will be unable to read from repository
651 starting in-place swap of repository data
652 replacing store...
653 store replacement complete; repository was inconsistent for *s (glob)
654 finalizing requirements file and making repository readable again
655 removing temporary repository $TESTTMP/test-repo/.hg/upgrade.* (glob)
640 removing temporary repository $TESTTMP/test-repo/.hg/upgrade.* (glob)
656 $ ls -1 .hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)'
641 $ ls -1 .hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)'
657 00changelog-*.nd (glob)
642 00changelog-*.nd (glob)
658 00changelog.n
643 00changelog.n
659 00manifest-*.nd (glob)
660 00manifest.n
661
644
662 $ hg debugnodemap --metadata
645 $ hg debugnodemap --metadata
663 uid: * (glob)
646 uid: * (glob)
General Comments 0
You need to be logged in to leave comments. Login now