Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8a504a3

Browse files
committed
Make pg_dump emit more accurate dependency information.
While pg_dump has included dependency information in archive-format outputever since 7.3, it never made any large effort to ensure that thatinformation was actually useful. In particular, in common situations wheredependency chains include objects that aren't separately emitted in thedump, the dependencies shown for objects that were emitted would referencethe dump IDs of these un-dumped objects, leaving no clue about which otherobjects the visible objects indirectly depend on. So far, parallelpg_restore has managed to avoid tripping over this misfeature, but onlyby dint of some crude hacks like not trusting dependency information inthe pre-data section of the archive.It seems prudent to do something about this before it rises up to bite us,so instead of emitting the "raw" dependencies of each dumped object,recursively search for its actual dependencies among the subset of objectsthat are being dumped.Back-patch to 9.2, since that code hasn't yet diverged materially fromHEAD. At some point we might need to back-patch further, but right nowthere are no known cases where this is actively necessary. (The one knowncase, bug #6699, is fixed in a different way by my previous patch.) Sincethis patch depends on 9.2 changes that made TOC entries be marked beforeoutput commences as to whether they'll be dumped, back-patching furtherwould require additional surgery; and as of now there's no evidence thatit's worth the risk.
1 parenta1ef01f commit8a504a3

File tree

2 files changed

+182
-42
lines changed

2 files changed

+182
-42
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3498,9 +3498,14 @@ restore_toc_entries_parallel(ArchiveHandle *AH)
34983498
* Do all the early stuff in a single connection in the parent. There's no
34993499
* great point in running it in parallel, in fact it will actually run
35003500
* faster in a single connection because we avoid all the connection and
3501-
* setup overhead.Also, pg_dump is not currently very good about showing
3502-
* all the dependencies of SECTION_PRE_DATA items, so we do not risk
3503-
* trying to process them out-of-order.
3501+
* setup overhead. Also, pre-9.2 pg_dump versions were not very good
3502+
* about showing all the dependencies of SECTION_PRE_DATA items, so we do
3503+
* not risk trying to process them out-of-order.
3504+
*
3505+
* Note: as of 9.2, it should be guaranteed that all PRE_DATA items appear
3506+
* before DATA items, and all DATA items before POST_DATA items. That is
3507+
* not certain to be true in older archives, though, so this loop is coded
3508+
* to not assume it.
35043509
*/
35053510
skipped_some= false;
35063511
for (next_work_item=AH->toc->next;next_work_item!=AH->toc;next_work_item=next_work_item->next)
@@ -4162,8 +4167,9 @@ fix_dependencies(ArchiveHandle *AH)
41624167

41634168
/*
41644169
* Count the incoming dependencies for each item. Also, it is possible
4165-
* that the dependencies list items that are not in the archive at all.
4166-
* Subtract such items from the depCounts.
4170+
* that the dependencies list items that are not in the archive at all
4171+
* (that should not happen in 9.2 and later, but is highly likely in
4172+
* older archives). Subtract such items from the depCounts.
41674173
*/
41684174
for (te=AH->toc->next;te!=AH->toc;te=te->next)
41694175
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp