mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
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.
This commit is contained in:
@ -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"
|
||||
@ -5960,6 +5961,14 @@ StartupXLOG(void)
|
||||
/* Check that the GUCs used to generate the WAL allow recovery */
|
||||
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
|
||||
@ -6413,6 +6422,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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user