diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-12-29 06:48:53 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-12-29 06:48:53 -0500 |
commit | 53dbc27c62d8e1b6c5253feba04a5094cb8fe046 (patch) | |
tree | b27563b69fa73dc4b7dc873bfc653bedc6ba1e05 /src/backend/access/transam/xlog.c | |
parent | 9b8aff8c192e2f313f90395d114c58a9ef84f97f (diff) | |
download | postgresql-53dbc27c62d8e1b6c5253feba04a5094cb8fe046.tar.gz postgresql-53dbc27c62d8e1b6c5253feba04a5094cb8fe046.zip |
Support unlogged tables.
The contents of an unlogged table are WAL-logged; thus, they are not
available on standby servers and are truncated whenever the database
system enters recovery. Indexes on unlogged tables are also unlogged.
Unlogged GiST indexes are not currently supported.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index bf62138bf86..1ec6f2f15ac 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -49,6 +49,7 @@ #include "storage/latch.h" #include "storage/pmsignal.h" #include "storage/procarray.h" +#include "storage/reinit.h" #include "storage/smgr.h" #include "storage/spin.h" #include "utils/builtins.h" @@ -5961,6 +5962,14 @@ StartupXLOG(void) CheckRequiredParameterValues(); /* + * We're in recovery, so unlogged relations relations may be trashed + * and must be reset. This should be done BEFORE allowing Hot + * Standby connections, so that read-only backends don't try to + * read whatever garbage is left over from before. + */ + ResetUnloggedRelations(UNLOGGED_RELATION_CLEANUP); + + /* * Initialize for Hot Standby, if enabled. We won't let backends in * yet, not until we've reached the min recovery point specified in * control file and we've established a recovery snapshot from a @@ -6414,6 +6423,14 @@ StartupXLOG(void) PreallocXlogFiles(EndOfLog); /* + * Reset initial contents of unlogged relations. This has to be done + * AFTER recovery is complete so that any unlogged relations created + * during recovery also get picked up. + */ + if (InRecovery) + ResetUnloggedRelations(UNLOGGED_RELATION_INIT); + + /* * Okay, we're officially UP. */ InRecovery = false; |