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

Commit97aa524

Browse files
committed
Make pg_restore's identify_locking_dependencies() more bulletproof.
This function had a blacklist of dump object types that it believedneeded exclusive lock ... but we hadn't maintained that, so that itwas missing ROW SECURITY, POLICY, and INDEX ATTACH items, all ofwhich need (or should be treated as needing) exclusive lock.Since the same oversight seems likely in future, let's reverse thesense of the test so that the code has a whitelist of safe objecttypes; better to wrongly assume a command can't be run in parallelthan the opposite. Currently the only POST_DATA object type that'ssafe is CREATE INDEX ... and that list hasn't changed in a long time.Back-patch to 9.5 where RLS came in.Discussion:https://postgr.es/m/11450.1535483506@sss.pgh.pa.us
1 parent639bdbb commit97aa524

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4514,16 +4514,24 @@ identify_locking_dependencies(ArchiveHandle *AH, TocEntry *te)
45144514
intnlockids;
45154515
inti;
45164516

4517+
/*
4518+
* We only care about this for POST_DATA items. PRE_DATA items are not
4519+
* run in parallel, and DATA items are all independent by assumption.
4520+
*/
4521+
if (te->section!=SECTION_POST_DATA)
4522+
return;
4523+
45174524
/* Quick exit if no dependencies at all */
45184525
if (te->nDeps==0)
45194526
return;
45204527

4521-
/* Exit if this entry doesn't need exclusive lock on other objects */
4522-
if (!(strcmp(te->desc,"CONSTRAINT")==0||
4523-
strcmp(te->desc,"CHECK CONSTRAINT")==0||
4524-
strcmp(te->desc,"FK CONSTRAINT")==0||
4525-
strcmp(te->desc,"RULE")==0||
4526-
strcmp(te->desc,"TRIGGER")==0))
4528+
/*
4529+
* Most POST_DATA items are ALTER TABLEs or some moral equivalent of that,
4530+
* and hence require exclusive lock. However, we know that CREATE INDEX
4531+
* does not. (Maybe someday index-creating CONSTRAINTs will fall in that
4532+
* category too ... but today is not that day.)
4533+
*/
4534+
if (strcmp(te->desc,"INDEX")==0)
45274535
return;
45284536

45294537
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp