##// END OF EJS Templates
repair: migrate revlogs during upgrade...
repair: migrate revlogs during upgrade Our next step for in-place upgrade is to migrate store data. Revlogs are the biggest source of data within the store and a store is useless without them, so we implement their migration first. Our strategy for migrating revlogs is to walk the store and call `revlog.clone()` on each revlog. There are some minor complications. Because revlogs have different storage options (e.g. changelog has generaldelta and delta chains disabled), we need to obtain the correct class of revlog so inserted data is encoded properly for its type. Various attempts at implementing progress indicators that didn't lead to frustration from false "it's almost done" indicators were made. I initially used a single progress bar based on number of revlogs. However, this quickly churned through all filelogs, got to 99% then effectively froze at 99.99% when it got to the manifest. So I converted the progress bar to total revision count. This was a little bit better. But the manifest was still significantly slower than filelogs and it took forever to process the last few percent. I then tried both revision/chunk bytes and raw bytes as the denominator. This had the opposite effect: because so much data is in manifests, it would churn through filelogs without showing much progress. When it got to manifests, it would fill in 90+% of the progress bar. I finally gave up having a unified progress bar and instead implemented 3 progress bars: 1 for filelog revisions, 1 for manifest revisions, and 1 for changelog revisions. I added extra messages indicating the total number of revisions of each so users know there are more progress bars coming. I also added extra messages before and after each stage to give extra details about what is happening. Strictly speaking, this isn't necessary. But the numbers are impressive. For example, when converting a non-generaldelta mozilla-central repository, the messages you see are: migrating 2475593 total revisions (1833043 in filelogs, 321156 in manifests, 321394 in changelog) migrating 1.67 GB in store; 2508 GB tracked data migrating 267868 filelogs containing 1833043 revisions (1.09 GB in store; 57.3 GB tracked data) finished migrating 1833043 filelog revisions across 267868 filelogs; change in size: -415776 bytes migrating 1 manifests containing 321156 revisions (518 MB in store; 2451 GB tracked data) That "2508 GB" figure really blew me away. I had no clue that the raw tracked data in mozilla-central was that large. Granted, 2451 GB is in the manifest and "only" 57.3 GB is in filelogs. But still. It's worth noting that gratuitous loading of source revlogs in order to display numbers and progress bars does serve a purpose: it ensures we can open all source revlogs. We don't want to spend several minutes copying revlogs only to encounter a permissions error or similar later. As part of this commit, we also add swapping of the store directory to the upgrade function. After revlogs are converted, we move the old store into the backup directory then move the temporary repo's store into the old store's location. On well-behaved systems, this should be 2 atomic operations and the window of inconsistency show be very narrow. There are still a few improvements to be made to store copying and upgrading. But this commit gets the bulk of the work out of the way.

File last commit:

r29471:c4fc33c4 default
r30779:38aa1ca9 default
Show More
map
226 lines | 6.0 KiB | text/plain | TextLexer
Gregory Szorc
templates: add a stub template for json...
r24544 mimetype = 'application/json'
Laura Médioni
templates: add support for filerevision webcommand in json style
r29381 filerevision = '\{
"node": {node|json},
"path": {file|json},
"date": {date|json},
"desc": {desc|utf8|json},
"branch": {if(branch, branch%changesetbranch, "default"|json)},
"bookmarks": [{join(bookmarks%changelistentryname, ", ")}],
"tags": [{join(tags%changelistentryname, ", ")}],
"user": {author|utf8|json},
"parents": [{join(parent%changesetparent, ", ")}],
"phase": {phase|json},
"lines": [{join(text%lineentry, ", ")}]
}'
lineentry = '\{
"line": {line|json}
}'
Laura Médioni
templates: add support for search webcommand in json style
r29383 search = '\{
"node": {node|json},
"query": {query|json},
"entries": [{join(entries%searchentry, ", ")}]
}'
searchentry = '{changelistentry}'
Gregory Szorc
json: implement {shortlog} and {changelog} templates...
r24588 # changelog and shortlog are the same web API but with different
# number of entries.
changelog = changelist.tmpl
shortlog = changelist.tmpl
changelistentry = '\{
"node": {node|json},
"date": {date|json},
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "desc": {desc|utf8|json},
Laura Médioni
templates: add support for filelog webcommand in json style...
r29380 "branch": {if(branch, branch%changesetbranch, "default"|json)},
Gregory Szorc
json: implement {shortlog} and {changelog} templates...
r24588 "bookmarks": [{join(bookmarks%changelistentryname, ", ")}],
"tags": [{join(tags%changelistentryname, ", ")}],
av6
hgweb: add parents to json-log (issue5074)...
r28709 "user": {author|utf8|json},
Laura Médioni
templates: add support for filelog webcommand in json style...
r29380 "phase": {phase|json},
"parents": [{if(allparents, join(allparents%changesetparent, ", "),
join(parent%changesetparent, ", "))}]
Gregory Szorc
json: implement {shortlog} and {changelog} templates...
r24588 }'
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 changelistentryname = '{name|utf8|json}'
Gregory Szorc
json: implement {changeset} template...
r24563 changeset = '\{
"node": {node|json},
"date": {date|json},
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "desc": {desc|utf8|json},
Gregory Szorc
json: implement {changeset} template...
r24563 "branch": {if(branch, branch%changesetbranch, "default"|json)},
"bookmarks": [{join(changesetbookmark, ", ")}],
"tags": [{join(changesettag, ", ")}],
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "user": {author|utf8|json},
Gregory Szorc
hgweb: add phase to {changeset} template...
r24564 "parents": [{join(parent%changesetparent, ", ")}],
"phase": {phase|json}
Gregory Szorc
json: implement {changeset} template...
r24563 }'
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 changesetbranch = '{name|utf8|json}'
changesetbookmark = '{bookmark|utf8|json}'
changesettag = '{tag|utf8|json}'
Gregory Szorc
json: implement {changeset} template...
r24563 changesetparent = '{node|json}'
Gregory Szorc
json: implement {manifest} template...
r24589 manifest = '\{
"node": {node|json},
"abspath": {path|json},
"directories": [{join(dentries%direntry, ", ")}],
"files": [{join(fentries%fileentry, ", ")}],
"bookmarks": [{join(bookmarks%name, ", ")}],
"tags": [{join(tags%name, ", ")}]
}'
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 name = '{name|utf8|json}'
Gregory Szorc
json: implement {manifest} template...
r24589 direntry = '\{
"abspath": {path|json},
"basename": {basename|json},
"emptydirs": {emptydirs|json}
}'
fileentry = '\{
"abspath": {file|json},
"basename": {basename|json},
"date": {date|json},
"size": {size|json},
"flags": {permissions|json}
}'
Gregory Szorc
json: implement {tags} template...
r24545 tags = '\{
"node": {node|json},
"tags": [{join(entriesnotip%tagentry, ", ")}]
}'
tagentry = '\{
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "tag": {tag|utf8|json},
Gregory Szorc
json: implement {tags} template...
r24545 "node": {node|json},
"date": {date|json}
}'
Gregory Szorc
json: implement {bookmarks} template
r24546 bookmarks = '\{
"node": {node|json},
"bookmarks": [{join(entries%bookmarkentry, ", ")}]
}'
bookmarkentry = '\{
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "bookmark": {bookmark|utf8|json},
Gregory Szorc
json: implement {bookmarks} template
r24546 "node": {node|json},
"date": {date|json}
}'
Gregory Szorc
json: implement {branches} template
r24547 branches = '\{
"branches": [{join(entries%branchentry, ", ")}]
}'
branchentry = '\{
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "branch": {branch|utf8|json},
Gregory Szorc
json: implement {branches} template
r24547 "node": {node|json},
"date": {date|json},
"status": {status|json}
}'
Laura Médioni
templates: add support for summary webcommand in json style...
r29382 shortlogentry = '{changelistentry}'
summary = '\{
"node": {node|json},
"lastchange": {lastchange|json},
"bookmarks": [{join(bookmarks%bookmarkentry, ", ")}],
"branches": [{join(branches%branchentry, ", ")}],
"shortlog": [{join(shortlog%shortlogentry, ", ")}],
"tags": [{join(tags%tagentry, ", ")}],
Gregory Szorc
hgweb: expose list of per-repo labels to templates...
r29471 "archives": [{join(archives%archiveentry, ", ")}],
"labels": {labels|json}
Laura Médioni
templates: add support for summary webcommand in json style...
r29382 }'
archiveentry = '\{
"node": {node|json},
"extension": {extension|json},
av6
hgweb: add absolute urls for archives in json-summary
r29458 "type": {type|json},
"url": {"{urlbase}{url}archive/{node}{extension}"|json}
Laura Médioni
templates: add support for summary webcommand in json style...
r29382 }'
Gregory Szorc
json: implement {filediff} template...
r24713 filediff = '\{
"path": {file|json},
"node": {node|json},
"date": {date|json},
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "desc": {desc|utf8|json},
"author": {author|utf8|json},
Gregory Szorc
json: implement {filediff} template...
r24713 "parents": [{join(parent%changesetparent, ", ")}],
"children": [{join(child%changesetparent, ", ")}],
"diff": [{join(diff%diffblock, ", ")}]
}'
diffblock = '\{
"blockno": {blockno|json},
"lines": [{join(lines, ", ")}]
}'
difflineplus = '\{
"t": "+",
"n": {lineno|json},
"l": {line|json}
}'
difflineminus = '\{
"t": "-",
"n": {lineno|json},
"l": {line|json}
}'
difflineat = '\{
"t": "@",
"n": {lineno|json},
"l": {line|json}
}'
diffline = '\{
"t": "",
"n": {lineno|json},
"l": {line|json}
}'
Gregory Szorc
json: implement {comparison} template...
r24714 filecomparison = '\{
"path": {file|json},
"node": {node|json},
"date": {date|json},
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "desc": {desc|utf8|json},
"author": {author|utf8|json},
Gregory Szorc
json: implement {comparison} template...
r24714 "parents": [{join(parent%changesetparent, ", ")}],
"children": [{join(child%changesetparent, ", ")}],
"leftnode": {leftnode|json},
"rightnode": {rightnode|json},
"comparison": [{join(comparison, ", ")}]
}'
comparisonblock = '\{
"lines": [{join(lines, ", ")}]
}'
comparisonline = '\{
"t": {type|json},
"ln": {leftlineno|json},
"ll": {leftline|json},
"rn": {rightlineno|json},
"rl": {rightline|json}
}'
Gregory Szorc
json: implement {fileannotate} template
r24715 fileannotate = '\{
"abspath": {file|json},
"node": {node|json},
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "author": {author|utf8|json},
Gregory Szorc
json: implement {fileannotate} template
r24715 "date": {date|json},
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "desc": {desc|utf8|json},
Gregory Szorc
json: implement {fileannotate} template
r24715 "parents": [{join(parent%changesetparent, ", ")}],
"children": [{join(child%changesetparent, ", ")}],
"permissions": {permissions|json},
"annotate": [{join(annotate%fileannotation, ", ")}]
}'
fileannotation = '\{
"node": {node|json},
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "author": {author|utf8|json},
"desc": {desc|utf8|json},
Gregory Szorc
json: implement {fileannotate} template
r24715 "abspath": {file|json},
"targetline": {targetline|json},
"line": {line|json},
"lineno": {lineno|json},
"revdate": {revdate|json}
}'
Laura Médioni
templates: add support for filelog webcommand in json style...
r29380 filelog = '\{
"entries": [{join(entries%changelistentry, ", ")}]
}'
Gregory Szorc
templates: add a stub template for json...
r24544 graph = '"not yet implemented"'
Gregory Szorc
json: implement {helptopics} template
r24590 helptopics = '\{
"topics": [{join(topics%helptopicentry, ", ")}],
"earlycommands": [{join(earlycommands%helptopicentry, ", ")}],
"othercommands": [{join(othercommands%helptopicentry, ", ")}]
}'
helptopicentry = '\{
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "topic": {topic|utf8|json},
"summary": {summary|utf8|json}
Gregory Szorc
json: implement {helptopics} template
r24590 }'
Gregory Szorc
json: implement {help} template...
r24591 help = '\{
Yuya Nishihara
templatefilters: make json filter be byte-transparent (BC) (issue4926)...
r28212 "topic": {topic|utf8|json},
"rawdoc": {doc|utf8|json}
Gregory Szorc
json: implement {help} template...
r24591 }'
Gregory Szorc
templates: add a stub template for json...
r24544 filenodelink = ''
filenolink = ''
av6
hgweb: add index template to json/map...
r28268 index = '\{
"entries": [{join(entries%indexentry, ", ")}]
}'
indexentry = '\{
"name": {name|utf8|json},
"description": {description|utf8|json},
"contact": {contact|utf8|json},
Gregory Szorc
hgweb: expose list of per-repo labels to templates...
r29471 "lastchange": {lastchange|json},
"labels": {labels|json}
av6
hgweb: add index template to json/map...
r28268 }'