Commit 7dbb606
committed
Flush unlogged table's buffers when copying or moving databases.
CREATE DATABASE and ALTER DATABASE .. SET TABLESPACE copy the source
database directory on the filesystem level. To ensure the on disk
state is consistent they block out users of the affected database and
force a checkpoint to flush out all data to disk. Unfortunately, up to
now, that checkpoint didn't flush out dirty buffers from unlogged
relations.
That bug means there could be leftover dirty buffers in either the
template database, or the database in its old location. Leading to
problems when accessing relations in an inconsistent state; and to
possible problems during shutdown in the SET TABLESPACE case because
buffers belonging files that don't exist anymore are flushed.
This was reported in bug #10675 by Maxim Boguk.
Fix by Pavan Deolasee, modified somewhat by me. Reviewed by MauMau and
Fujii Masao.
Backpatch to 9.1 where unlogged tables were introduced.1 parent 83dc590 commit 7dbb606
File tree
4 files changed
+30
-21
lines changed- src
- backend
- access/transam
- commands
- storage/buffer
- include/access
4 files changed
+30
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7771 | 7771 | | |
7772 | 7772 | | |
7773 | 7773 | | |
7774 | | - | |
| 7774 | + | |
7775 | 7775 | | |
7776 | | - | |
| 7776 | + | |
7777 | 7777 | | |
7778 | 7778 | | |
7779 | 7779 | | |
| |||
7782 | 7782 | | |
7783 | 7783 | | |
7784 | 7784 | | |
7785 | | - | |
| 7785 | + | |
| 7786 | + | |
7786 | 7787 | | |
7787 | 7788 | | |
7788 | 7789 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
549 | 549 | | |
550 | 550 | | |
551 | 551 | | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
559 | 560 | | |
560 | | - | |
| 561 | + | |
| 562 | + | |
561 | 563 | | |
562 | 564 | | |
563 | 565 | | |
| |||
1138 | 1140 | | |
1139 | 1141 | | |
1140 | 1142 | | |
1141 | | - | |
1142 | | - | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1143 | 1146 | | |
1144 | 1147 | | |
1145 | 1148 | | |
1146 | 1149 | | |
1147 | 1150 | | |
1148 | 1151 | | |
1149 | 1152 | | |
1150 | | - | |
| 1153 | + | |
| 1154 | + | |
1151 | 1155 | | |
1152 | 1156 | | |
1153 | 1157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1493 | 1493 | | |
1494 | 1494 | | |
1495 | 1495 | | |
1496 | | - | |
1497 | | - | |
1498 | | - | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
1499 | 1500 | | |
1500 | 1501 | | |
1501 | 1502 | | |
| |||
1510 | 1511 | | |
1511 | 1512 | | |
1512 | 1513 | | |
1513 | | - | |
1514 | | - | |
1515 | | - | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
1516 | 1517 | | |
1517 | | - | |
| 1518 | + | |
| 1519 | + | |
1518 | 1520 | | |
1519 | 1521 | | |
1520 | 1522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
253 | 253 | | |
254 | 254 | | |
255 | 255 | | |
| 256 | + | |
| 257 | + | |
256 | 258 | | |
257 | 259 | | |
258 | 260 | | |
| |||
0 commit comments