forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9c08aea
committed
Add new block-by-block strategy for CREATE DATABASE.
Because this strategy logs changes on a block-by-block basis, itavoids the need to checkpoint before and after the operation.However, because it logs each changed block individually, it mightgenerate a lot of extra write-ahead logging if the template databaseis large. Therefore, the older strategy remains available via a newSTRATEGY parameter to CREATE DATABASE, and a corresponding --strategyoption to createdb.Somewhat controversially, this patch assembles the list of relationsto be copied to the new database by reading the pg_class relation ofthe template database. Cross-database access like this isn't normallypossible, but it can be made to work here because there can't be anyconnections to the database being copied, nor can it contain anyin-doubt transactions. Even so, we have to use lower-level interfacesthan normal, since the table scan and relcache interfaces will notwork for a database to which we're not connected. The advantage ofthis approach is that we do not need to rely on the filesystem todetermine what ought to be copied, but instead on PostgreSQL's ownknowledge of the database structure. This avoids, for example,copying stray files that happen to be located in the source databasedirectory.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, KyotaroHoriguchi, Tomas Vondra, Andrew Dunstan, Álvaro Herrera, and others.Discussion:http://postgr.es/m/CA+TgmoYtcdxBjLh31DLxUXHxFVMPGzrU5_T=CYCvRyFHywSBUQ@mail.gmail.com1 parentbf902c1 commit9c08aea
File tree
28 files changed
+1081
-157
lines changed- contrib/bloom
- doc/src/sgml
- ref
- src
- backend
- access
- heap
- nbtree
- rmgrdesc
- transam
- catalog
- commands
- storage
- buffer
- lmgr
- utils
- activity
- cache
- bin
- pg_rewind
- psql
- scripts
- t
- include
- catalog
- commands
- storage
- utils
- tools/pgindent
28 files changed
+1081
-157
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
173 | 173 |
| |
174 | 174 |
| |
175 | 175 |
| |
176 |
| - | |
| 176 | + | |
177 | 177 |
| |
178 | 178 |
| |
179 | 179 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1502 | 1502 |
| |
1503 | 1503 |
| |
1504 | 1504 |
| |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
1505 | 1509 |
| |
1506 | 1510 |
| |
1507 | 1511 |
| |
|
Lines changed: 22 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
25 | 25 |
| |
26 | 26 |
| |
27 | 27 |
| |
| 28 | + | |
28 | 29 |
| |
29 | 30 |
| |
30 | 31 |
| |
| |||
118 | 119 |
| |
119 | 120 |
| |
120 | 121 |
| |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
121 | 143 |
| |
122 | 144 |
| |
123 | 145 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
177 | 177 |
| |
178 | 178 |
| |
179 | 179 |
| |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
180 | 191 |
| |
181 | 192 |
| |
182 | 193 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
593 | 593 |
| |
594 | 594 |
| |
595 | 595 |
| |
596 |
| - | |
| 596 | + | |
597 | 597 |
| |
598 | 598 |
| |
599 | 599 |
| |
600 | 600 |
| |
601 | 601 |
| |
602 | 602 |
| |
603 | 603 |
| |
604 |
| - | |
| 604 | + | |
605 | 605 |
| |
606 | 606 |
| |
607 | 607 |
| |
| |||
645 | 645 |
| |
646 | 646 |
| |
647 | 647 |
| |
648 |
| - | |
| 648 | + | |
649 | 649 |
| |
650 | 650 |
| |
651 | 651 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
161 | 161 |
| |
162 | 162 |
| |
163 | 163 |
| |
164 |
| - | |
| 164 | + | |
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
|
Lines changed: 16 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
27 |
| - | |
| 27 | + | |
28 | 28 |
| |
29 |
| - | |
| 29 | + | |
| 30 | + | |
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
34 | 35 |
| |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
35 | 44 |
| |
36 | 45 |
| |
37 | 46 |
| |
| |||
51 | 60 |
| |
52 | 61 |
| |
53 | 62 |
| |
54 |
| - | |
55 |
| - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
56 | 68 |
| |
57 | 69 |
| |
58 | 70 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
484 | 484 |
| |
485 | 485 |
| |
486 | 486 |
| |
487 |
| - | |
| 487 | + | |
488 | 488 |
| |
489 | 489 |
| |
490 | 490 |
| |
| |||
509 | 509 |
| |
510 | 510 |
| |
511 | 511 |
| |
512 |
| - | |
| 512 | + | |
513 | 513 |
| |
514 | 514 |
| |
515 | 515 |
| |
| |||
519 | 519 |
| |
520 | 520 |
| |
521 | 521 |
| |
522 |
| - | |
| 522 | + | |
523 | 523 |
| |
524 | 524 |
| |
525 | 525 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
387 | 387 |
| |
388 | 388 |
| |
389 | 389 |
| |
390 |
| - | |
| 390 | + | |
391 | 391 |
| |
392 | 392 |
| |
393 | 393 |
| |
|
Lines changed: 22 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
112 | 112 |
| |
113 | 113 |
| |
114 | 114 |
| |
115 |
| - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
116 | 118 |
| |
117 | 119 |
| |
118 |
| - | |
| 120 | + | |
| 121 | + | |
119 | 122 |
| |
120 |
| - | |
121 | 123 |
| |
122 | 124 |
| |
123 | 125 |
| |
| |||
149 | 151 |
| |
150 | 152 |
| |
151 | 153 |
| |
152 |
| - | |
153 |
| - | |
154 |
| - | |
155 |
| - | |
156 |
| - | |
157 |
| - | |
158 |
| - | |
159 |
| - | |
160 |
| - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
161 | 171 |
| |
162 | 172 |
| |
163 | 173 |
| |
|
0 commit comments
Comments
(0)