Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorRobert Haas2022-03-29 15:31:43 +0000
committerRobert Haas2022-03-29 15:48:36 +0000
commit9c08aea6a3090a396be334cc58c511edab05776a (patch)
treec15e6e9fa45a18173a5bbd67ff4a4c889e616cde /src/tools
parentbf902c13930c268388644100663f2998868b6e85 (diff)
Add new block-by-block strategy for CREATE DATABASE.
Because this strategy logs changes on a block-by-block basis, it avoids the need to checkpoint before and after the operation. However, because it logs each changed block individually, it might generate a lot of extra write-ahead logging if the template database is large. Therefore, the older strategy remains available via a new STRATEGY parameter to CREATE DATABASE, and a corresponding --strategy option to createdb. Somewhat controversially, this patch assembles the list of relations to be copied to the new database by reading the pg_class relation of the template database. Cross-database access like this isn't normally possible, but it can be made to work here because there can't be any connections to the database being copied, nor can it contain any in-doubt transactions. Even so, we have to use lower-level interfaces than normal, since the table scan and relcache interfaces will not work for a database to which we're not connected. The advantage of this approach is that we do not need to rely on the filesystem to determine what ought to be copied, but instead on PostgreSQL's own knowledge of the database structure. This avoids, for example, copying stray files that happen to be located in the source database directory. Dilip Kumar, with a fairly large number of cosmetic changes by me. Reviewed and tested by Ashutosh Sharma, Andres Freund, John Naylor, Greg Nancarrow, Neha Sharma. Additional feedback from Bruce Momjian, Heikki Linnakangas, Julien Rouhaud, Adam Brusselback, Kyotaro Horiguchi, Tomas Vondra, Andrew Dunstan, Álvaro Herrera, and others. Discussion: http://postgr.es/m/CA+TgmoYtcdxBjLh31DLxUXHxFVMPGzrU5_T=CYCvRyFHywSBUQ@mail.gmail.com
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/pgindent/typedefs.list5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index 410c9f6b0d1..6b77cc64ef4 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -461,6 +461,8 @@ CoverPos
CreateAmStmt
CreateCastStmt
CreateConversionStmt
+CreateDBRelInfo
+CreateDBStrategy
CreateDomainStmt
CreateEnumStmt
CreateEventTrigStmt
@@ -3705,7 +3707,8 @@ xl_btree_update
xl_btree_vacuum
xl_clog_truncate
xl_commit_ts_truncate
-xl_dbase_create_rec
+xl_dbase_create_file_copy_rec
+xl_dbase_create_wal_log_rec
xl_dbase_drop_rec
xl_end_of_recovery
xl_hash_add_ovfl_page