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

Commitad43a41

Browse files
committed
initdb: When running CREATE DATABASE, use STRATEGY = WAL_COPY.
Dilip Kumar, reviewed by Andres Freund and by me.Discussion:http://postgr.es/m/20220330011757.wr544o5y5my7ssoa@alap3.anarazel.de
1 parentf3dd9fe commitad43a41

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

‎src/bin/initdb/initdb.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,10 +1860,15 @@ make_template0(FILE *cmdfd)
18601860
* objects in the old cluster, the problem scenario only exists if the OID
18611861
* that is in use in the old cluster is also used in the new cluster - and
18621862
* the new cluster should be the result of a fresh initdb.)
1863+
*
1864+
* We use "STRATEGY = file_copy" here because checkpoints during initdb
1865+
* are cheap. "STRATEGY = wal_log" would generate more WAL, which would
1866+
* be a little bit slower and make the new cluster a little bit bigger.
18631867
*/
18641868
staticconstchar*consttemplate0_setup[]= {
18651869
"CREATE DATABASE template0 IS_TEMPLATE = true ALLOW_CONNECTIONS = false OID = "
1866-
CppAsString2(Template0ObjectId)";\n\n",
1870+
CppAsString2(Template0ObjectId)
1871+
" STRATEGY = file_copy;\n\n",
18671872

18681873
/*
18691874
* template0 shouldn't have any collation-dependent objects, so unset
@@ -1906,9 +1911,12 @@ make_postgres(FILE *cmdfd)
19061911
{
19071912
constchar*const*line;
19081913

1909-
/* Assign a fixed OID to postgres, for the same reasons as template0 */
1914+
/*
1915+
* Just as we did for template0, and for the same reasons, assign a fixed
1916+
* OID to postgres and select the file_copy strategy.
1917+
*/
19101918
staticconstchar*constpostgres_setup[]= {
1911-
"CREATE DATABASE postgres OID = "CppAsString2(PostgresObjectId)";\n\n",
1919+
"CREATE DATABASE postgres OID = "CppAsString2(PostgresObjectId)" STRATEGY = file_copy;\n\n",
19121920
"COMMENT ON DATABASE postgres IS 'default administrative connection database';\n\n",
19131921
NULL
19141922
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp