Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e0e8b96

Browse files
committed
Change a few remaining calls of XLogArchivingActive() to use
XLogIsNeeded() instead, to determine if an otherwise non-logged operation needs to be logged in WAL for standby servers. Fujii Masao
1 parent e3f3683 commit e0e8b96

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/backend/commands/tablecmds.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.318 2010/01/22 16:40:18 rhaas Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.319 2010/01/28 07:31:42 heikki Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2998,15 +2998,16 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap)
29982998
* Prepare a BulkInsertState and options for heap_insert. Because
29992999
* we're building a new heap, we can skip WAL-logging and fsync it
30003000
* to disk at the end instead (unless WAL-logging is required for
3001-
* archiving). The FSM is empty too, so don't bother using it.
3001+
* archiving or streaming replication). The FSM is empty too,
3002+
* so don't bother using it.
30023003
*/
30033004
if (newrel)
30043005
{
30053006
mycid = GetCurrentCommandId(true);
30063007
bistate = GetBulkInsertState();
30073008

30083009
hi_options = HEAP_INSERT_SKIP_FSM;
3009-
if (!XLogArchivingActive())
3010+
if (!XLogIsNeeded())
30103011
hi_options |= HEAP_INSERT_SKIP_WAL;
30113012
}
30123013
else

src/backend/commands/vacuumlazy.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
*
3030
*
3131
* IDENTIFICATION
32-
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.127 2010/01/02 16:57:40 momjian Exp $
32+
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.128 2010/01/28 07:31:42 heikki Exp $
3333
*
3434
*-------------------------------------------------------------------------
3535
*/
@@ -288,7 +288,7 @@ vacuum_log_cleanup_info(Relation rel, LVRelStats *vacrelstats)
288288
* No need to log changes for temp tables, they do not contain
289289
* data visible on the standby server.
290290
*/
291-
if (rel->rd_istemp || !XLogArchivingActive())
291+
if (rel->rd_istemp || !XLogIsNeeded())
292292
return;
293293

294294
(void) log_heap_cleanup_info(rel->rd_node, vacrelstats->latestRemovedXid);

src/include/access/xlog.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.98 2010/01/20 19:43:40 heikki Exp $
9+
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.99 2010/01/28 07:31:42 heikki Exp $
1010
*/
1111
#ifndef XLOG_H
1212
#define XLOG_H
@@ -186,7 +186,6 @@ extern int MaxStandbyDelay;
186186

187187
#define XLogArchivingActive() (XLogArchiveMode)
188188
#define XLogArchiveCommandSet() (XLogArchiveCommand[0] != '\0')
189-
#define XLogStandbyInfoActive() (XLogRequestRecoveryConnections && XLogArchiveMode)
190189

191190
/*
192191
* This is in walsender.c, but declared here so that we don't need to include
@@ -200,6 +199,9 @@ extern int MaxWalSenders;
200199
*/
201200
#define XLogIsNeeded() (XLogArchivingActive() || (MaxWalSenders > 0))
202201

202+
/* Do we need to WAL-log information required only for Hot Standby? */
203+
#define XLogStandbyInfoActive() (XLogRequestRecoveryConnections && XLogIsNeeded())
204+
203205
#ifdef WAL_DEBUG
204206
extern bool XLOG_DEBUG;
205207
#endif

0 commit comments

Comments
 (0)