|
13 | 13 | * |
14 | 14 | * |
15 | 15 | * IDENTIFICATION |
16 | | - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.225 2009/06/11 14:48:55 momjian Exp $ |
| 16 | + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.226 2009/09/01 02:54:51 alvherre Exp $ |
17 | 17 | * |
18 | 18 | *------------------------------------------------------------------------- |
19 | 19 | */ |
|
49 | 49 | #include "storage/smgr.h" |
50 | 50 | #include "utils/acl.h" |
51 | 51 | #include "utils/builtins.h" |
52 | | -#include "utils/flatfiles.h" |
53 | 52 | #include "utils/fmgroids.h" |
54 | 53 | #include "utils/guc.h" |
55 | 54 | #include "utils/lsyscache.h" |
@@ -691,19 +690,17 @@ createdb(const CreatedbStmt *stmt) |
691 | 690 | RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); |
692 | 691 |
|
693 | 692 | /* |
694 | | - * Close pg_database, but keep lock till commit (this is important to |
695 | | - * prevent any risk of deadlock failure while updating flat file) |
| 693 | + * Close pg_database, but keep lock till commit. |
696 | 694 | */ |
697 | 695 | heap_close(pg_database_rel, NoLock); |
698 | 696 |
|
699 | 697 | /* |
700 | | - * Set flag to update flat database file at commit. Note: this also |
701 | | - * forces synchronous commit, which minimizes the window between |
| 698 | + * Force synchronous commit, thus minimizing the window between |
702 | 699 | * creation of the database files and commital of the transaction. If |
703 | 700 | * we crash before committing, we'll have a DB that's taking up disk |
704 | 701 | * space but is not in pg_database, which is not good. |
705 | 702 | */ |
706 | | - database_file_update_needed(); |
| 703 | + ForceSyncCommit(); |
707 | 704 | } |
708 | 705 | PG_END_ENSURE_ERROR_CLEANUP(createdb_failure_callback, |
709 | 706 | PointerGetDatum(&fparms)); |
@@ -862,19 +859,17 @@ dropdb(const char *dbname, bool missing_ok) |
862 | 859 | remove_dbtablespaces(db_id); |
863 | 860 |
|
864 | 861 | /* |
865 | | - * Close pg_database, but keep lock till commit (this is important to |
866 | | - * prevent any risk of deadlock failure while updating flat file) |
| 862 | + * Close pg_database, but keep lock till commit. |
867 | 863 | */ |
868 | 864 | heap_close(pgdbrel, NoLock); |
869 | 865 |
|
870 | 866 | /* |
871 | | - * Set flag to update flat database file at commit. Note: this also |
872 | | - * forces synchronous commit, which minimizes the window between removal |
| 867 | + * Force synchronous commit, thus minimizing the window between removal |
873 | 868 | * of the database files and commital of the transaction. If we crash |
874 | 869 | * before committing, we'll have a DB that's gone on disk but still there |
875 | 870 | * according to pg_database, which is not good. |
876 | 871 | */ |
877 | | - database_file_update_needed(); |
| 872 | + ForceSyncCommit(); |
878 | 873 | } |
879 | 874 |
|
880 | 875 |
|
@@ -957,15 +952,9 @@ RenameDatabase(const char *oldname, const char *newname) |
957 | 952 | CatalogUpdateIndexes(rel, newtup); |
958 | 953 |
|
959 | 954 | /* |
960 | | - * Close pg_database, but keep lock till commit (this is important to |
961 | | - * prevent any risk of deadlock failure while updating flat file) |
| 955 | + * Close pg_database, but keep lock till commit. |
962 | 956 | */ |
963 | 957 | heap_close(rel, NoLock); |
964 | | - |
965 | | - /* |
966 | | - * Set flag to update flat database file at commit. |
967 | | - */ |
968 | | - database_file_update_needed(); |
969 | 958 | } |
970 | 959 |
|
971 | 960 |
|
@@ -1212,17 +1201,15 @@ movedb(const char *dbname, const char *tblspcname) |
1212 | 1201 | RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT); |
1213 | 1202 |
|
1214 | 1203 | /* |
1215 | | - * Set flag to update flat database file at commit. Note: this also |
1216 | | - * forces synchronous commit, which minimizes the window between |
| 1204 | + * Force synchronous commit, thus minimizing the window between |
1217 | 1205 | * copying the database files and commital of the transaction. If we |
1218 | 1206 | * crash before committing, we'll leave an orphaned set of files on |
1219 | 1207 | * disk, which is not fatal but not good either. |
1220 | 1208 | */ |
1221 | | - database_file_update_needed(); |
| 1209 | + ForceSyncCommit(); |
1222 | 1210 |
|
1223 | 1211 | /* |
1224 | | - * Close pg_database, but keep lock till commit (this is important to |
1225 | | - * prevent any risk of deadlock failure while updating flat file) |
| 1212 | + * Close pg_database, but keep lock till commit. |
1226 | 1213 | */ |
1227 | 1214 | heap_close(pgdbrel, NoLock); |
1228 | 1215 | } |
@@ -1401,11 +1388,6 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel) |
1401 | 1388 |
|
1402 | 1389 | /* Close pg_database, but keep lock till commit */ |
1403 | 1390 | heap_close(rel, NoLock); |
1404 | | - |
1405 | | - /* |
1406 | | - * We don't bother updating the flat file since the existing options for |
1407 | | - * ALTER DATABASE don't affect it. |
1408 | | - */ |
1409 | 1391 | } |
1410 | 1392 |
|
1411 | 1393 |
|
@@ -1494,11 +1476,6 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) |
1494 | 1476 |
|
1495 | 1477 | /* Close pg_database, but keep lock till commit */ |
1496 | 1478 | heap_close(rel, NoLock); |
1497 | | - |
1498 | | - /* |
1499 | | - * We don't bother updating the flat file since ALTER DATABASE SET doesn't |
1500 | | - * affect it. |
1501 | | - */ |
1502 | 1479 | } |
1503 | 1480 |
|
1504 | 1481 |
|
@@ -1608,11 +1585,6 @@ AlterDatabaseOwner(const char *dbname, Oid newOwnerId) |
1608 | 1585 |
|
1609 | 1586 | /* Close pg_database, but keep lock till commit */ |
1610 | 1587 | heap_close(rel, NoLock); |
1611 | | - |
1612 | | - /* |
1613 | | - * We don't bother updating the flat file since ALTER DATABASE OWNER |
1614 | | - * doesn't affect it. |
1615 | | - */ |
1616 | 1588 | } |
1617 | 1589 |
|
1618 | 1590 |
|
|
0 commit comments