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

Commitbbe3c06

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 parentfc4314a commitbbe3c06

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
@@ -4085,11 +4085,14 @@ identify_locking_dependencies(TocEntry *te)
40854085
return;
40864086

40874087
/*
4088-
* We assume the item requires exclusive lock on each TABLE DATA item
4089-
* listed among its dependencies. (This was originally a dependency on
4090-
* the TABLE, but fix_dependencies repointed it to the data item. Note
4091-
* that all the entry types we are interested in here are POST_DATA, so
4092-
* they will all have been changed this way.)
4088+
* We assume the entry requires exclusive lock on each TABLE or TABLE DATA
4089+
* item listed among its dependencies. Originally all of these would have
4090+
* been TABLE items, but repoint_table_dependencies would have repointed
4091+
* them to the TABLE DATA items if those are present (which they might not
4092+
* be, eg in a schema-only dump). Note that all of the entries we are
4093+
* processing here are POST_DATA; otherwise there might be a significant
4094+
* difference between a dependency on a table and a dependency on its
4095+
* data, so that closer analysis would be needed here.
40934096
*/
40944097
lockids= (DumpId*)malloc(te->nDeps*sizeof(DumpId));
40954098
nlockids=0;
@@ -4098,7 +4101,8 @@ identify_locking_dependencies(TocEntry *te)
40984101
DumpIddepid=te->dependencies[i];
40994102

41004103
if (depid <=maxDumpId&&tocsByDumpId[depid-1]&&
4101-
strcmp(tocsByDumpId[depid-1]->desc,"TABLE DATA")==0)
4104+
((strcmp(tocsByDumpId[depid-1]->desc,"TABLE DATA")==0)||
4105+
strcmp(tocsByDumpId[depid-1]->desc,"TABLE")==0))
41024106
lockids[nlockids++]=depid;
41034107
}
41044108

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp