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

Commit68d977a

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 parent062780e commit68d977a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

‎src/bin/pg_dump/common.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ getSchemaData(int *numTablesPtr)
105105
write_msg(NULL,"reading schemas\n");
106106
getNamespaces(&numNamespaces);
107107

108+
/*
109+
* getTables should be done as soon as possible, so as to minimize the
110+
* window between starting our transaction and acquiring per-table locks.
111+
* However, we have to do getNamespaces first because the tables get
112+
* linked to their containing namespaces during getTables.
113+
*/
114+
if (g_verbose)
115+
write_msg(NULL,"reading user-defined tables\n");
116+
tblinfo=getTables(&numTables);
117+
tblinfoindex=buildIndexArray(tblinfo,numTables,sizeof(TableInfo));
118+
108119
if (g_verbose)
109120
write_msg(NULL,"reading extensions\n");
110121
extinfo=getExtensions(&numExtensions);
@@ -183,11 +194,6 @@ getSchemaData(int *numTablesPtr)
183194
write_msg(NULL,"reading type casts\n");
184195
getCasts(&numCasts);
185196

186-
if (g_verbose)
187-
write_msg(NULL,"reading user-defined tables\n");
188-
tblinfo=getTables(&numTables);
189-
tblinfoindex=buildIndexArray(tblinfo,numTables,sizeof(TableInfo));
190-
191197
if (g_verbose)
192198
write_msg(NULL,"reading table inheritance information\n");
193199
inhinfo=getInherits(&numInherits);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp