Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5bf7a2

Browse files
committed
WAL-log the extension of a new empty MV heap which is being populated.
This page with no tuples is used to distinguish an MV containing azero-row resultset of its backing query from an MV which has notbeen populated by its backing query. Unless WAL-logged, recoveryand hot standby don't work correctly with what should be an emptybut scannable materialized view.Fixes bugs reported by Fujii Masao in testing MVs on hot standby.
1 parent5141603 commitc5bf7a2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎src/backend/commands/matview.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515
#include"postgres.h"
1616

17+
#include"access/heapam_xlog.h"
1718
#include"access/multixact.h"
1819
#include"access/relscan.h"
1920
#include"access/xact.h"
@@ -68,10 +69,15 @@ SetRelationIsScannable(Relation relation)
6869
Assert(relation->rd_rel->relkind==RELKIND_MATVIEW);
6970
Assert(relation->rd_isscannable== false);
7071

71-
RelationOpenSmgr(relation);
7272
page= (Page)palloc(BLCKSZ);
7373
PageInit(page,BLCKSZ,0);
74+
75+
if (RelationNeedsWAL(relation))
76+
log_newpage(&(relation->rd_node),MAIN_FORKNUM,0,page);
77+
78+
RelationOpenSmgr(relation);
7479
smgrextend(relation->rd_smgr,MAIN_FORKNUM,0, (char*)page, true);
80+
7581
pfree(page);
7682

7783
smgrimmedsync(relation->rd_smgr,MAIN_FORKNUM);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp