mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Move the responsibility of writing a "unlogged WAL operation" record from
heap_sync() to the callers, because heap_sync() is sometimes called even if the operation itself is WAL-logged. This eliminates the bogus unlogged records from CLUSTER that Simon Riggs reported, patch by Fujii Masao.
This commit is contained in:
@ -96,7 +96,7 @@
|
||||
* Portions Copyright (c) 1994-5, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.19 2010/01/02 16:57:35 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/rewriteheap.c,v 1.20 2010/02/03 10:01:29 heikki Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -278,6 +278,15 @@ end_heap_rewrite(RewriteState state)
|
||||
(char *) state->rs_buffer, true);
|
||||
}
|
||||
|
||||
/* Write an XLOG UNLOGGED record if WAL-logging was skipped */
|
||||
if (!state->rs_use_wal && !state->rs_new_rel->rd_istemp)
|
||||
{
|
||||
char reason[NAMEDATALEN + 30];
|
||||
snprintf(reason, sizeof(reason), "heap rewrite on \"%s\"",
|
||||
RelationGetRelationName(state->rs_new_rel));
|
||||
XLogReportUnloggedStatement(reason);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the rel isn't temp, must fsync before commit. We use heap_sync to
|
||||
* ensure that the toast table gets fsync'd too.
|
||||
|
Reference in New Issue
Block a user