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

Commitd1844c2

Browse files
committed
Fix identify_locking_dependencies for schema-only dumps.
Without this fix, parallel restore of a schema-only dump can deadlock,because when the dump is schema-only, the dependency will still bepointing at the TABLE item rather than the TABLE DATA item.Robert Haas and Tom Lane
1 parentdc58d94 commitd1844c2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4153,11 +4153,14 @@ identify_locking_dependencies(TocEntry *te)
41534153
return;
41544154

41554155
/*
4156-
* We assume the item requires exclusive lock on each TABLE DATA item
4157-
* listed among its dependencies. (This was originally a dependency on
4158-
* the TABLE, but fix_dependencies repointed it to the data item. Note
4159-
* that all the entry types we are interested in here are POST_DATA, so
4160-
* they will all have been changed this way.)
4156+
* We assume the entry requires exclusive lock on each TABLE or TABLE DATA
4157+
* item listed among its dependencies. Originally all of these would have
4158+
* been TABLE items, but repoint_table_dependencies would have repointed
4159+
* them to the TABLE DATA items if those are present (which they might not
4160+
* be, eg in a schema-only dump). Note that all of the entries we are
4161+
* processing here are POST_DATA; otherwise there might be a significant
4162+
* difference between a dependency on a table and a dependency on its
4163+
* data, so that closer analysis would be needed here.
41614164
*/
41624165
lockids= (DumpId*)malloc(te->nDeps*sizeof(DumpId));
41634166
nlockids=0;
@@ -4166,7 +4169,8 @@ identify_locking_dependencies(TocEntry *te)
41664169
DumpIddepid=te->dependencies[i];
41674170

41684171
if (depid <=maxDumpId&&tocsByDumpId[depid-1]&&
4169-
strcmp(tocsByDumpId[depid-1]->desc,"TABLE DATA")==0)
4172+
((strcmp(tocsByDumpId[depid-1]->desc,"TABLE DATA")==0)||
4173+
strcmp(tocsByDumpId[depid-1]->desc,"TABLE")==0))
41704174
lockids[nlockids++]=depid;
41714175
}
41724176

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp