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

Commit6c320b8

Browse files
committed
Obtain table locks as soon as practical during pg_dump.
For some reason, when we (I) added table lock acquisition to pg_dump,we didn't think about making it happen as soon as possible after thestart of the transaction. What with subsequent additions, there wasactually quite a lot going on before we got around to that; which sortof defeats the purpose. Rearrange the order of calls in dumpSchema()to close the risk window as much as we easily can. Back-patch to allsupported branches.
1 parent199d449 commit6c320b8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎src/bin/pg_dump/common.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,16 @@ getSchemaData(int *numTablesPtr)
9191
write_msg(NULL,"reading schemas\n");
9292
nsinfo=getNamespaces(&numNamespaces);
9393

94+
/*
95+
* getTables should be done as soon as possible, so as to minimize the
96+
* window between starting our transaction and acquiring per-table locks.
97+
* However, we have to do getNamespaces first because the tables get
98+
* linked to their containing namespaces during getTables.
99+
*/
100+
if (g_verbose)
101+
write_msg(NULL,"reading user-defined tables\n");
102+
tblinfo=getTables(&numTables);
103+
94104
if (g_verbose)
95105
write_msg(NULL,"reading user-defined functions\n");
96106
funinfo=getFuncs(&numFuncs);
@@ -121,10 +131,6 @@ getSchemaData(int *numTablesPtr)
121131
write_msg(NULL,"reading user-defined conversions\n");
122132
convinfo=getConversions(&numConversions);
123133

124-
if (g_verbose)
125-
write_msg(NULL,"reading user-defined tables\n");
126-
tblinfo=getTables(&numTables);
127-
128134
if (g_verbose)
129135
write_msg(NULL,"reading table inheritance information\n");
130136
inhinfo=getInherits(&numInherits);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp