1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Write a WAL record whenever we perform an operation without WAL-logging

that would've been WAL-logged if archiving was enabled. If we encounter
such records in archive recovery anyway, we know that some data is
missing from the log. A WARNING is emitted in that case.

Original patch by Fujii Masao, with changes by me.
This commit is contained in:
Heikki Linnakangas
2010-01-20 19:43:40 +00:00
parent 47ce95a7b9
commit 09b115f706
7 changed files with 100 additions and 7 deletions

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.193 2010/01/15 09:19:01 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.194 2010/01/20 19:43:40 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@ -821,6 +821,18 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
*/
use_wal = XLogIsNeeded() && !NewHeap->rd_istemp;
/*
* Write an XLOG UNLOGGED record if WAL-logging was skipped because
* WAL archiving is not enabled.
*/
if (!use_wal && !NewHeap->rd_istemp)
{
char reason[NAMEDATALEN + 20];
snprintf(reason, sizeof(reason), "CLUSTER on \"%s\"",
RelationGetRelationName(NewHeap));
XLogReportUnloggedStatement(reason);
}
/* use_wal off requires rd_targblock be initially invalid */
Assert(NewHeap->rd_targblock == InvalidBlockNumber);