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

Commit3142a88

Browse files
committed
WAL-log the creation of the init fork of unlogged indexes.
We create a file, so we better WAL-log it. In practice, all thebuilt-in index AMs and all extensions that I'm aware of write ametapage to the init fork, which is WAL-logged, and replay of themetapage implicitly creates the fork too. But if ambuildempty() didn'twrite any page, we would miss it.This can be seen with dummy_index_am. Set up replication, create a'dummy_index_am' index on an unlogged table, and look at the filescreated in the replica: the init fork is not created on thereplica. Dummy_index_am doesn't do anything with the relation files,however, so it doesn't lead to any user-visible errors.Backpatch to all supported versions.Reviewed-by: Robert HaasDiscussion:https://www.postgresql.org/message-id/6e5bbc08-cdfc-b2b3-9e23-1a914b9850a9%40iki.fi
1 parent69a674a commit3142a88

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎src/backend/catalog/index.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include"catalog/pg_trigger.h"
5555
#include"catalog/pg_type.h"
5656
#include"catalog/storage.h"
57+
#include"catalog/storage_xlog.h"
5758
#include"commands/event_trigger.h"
5859
#include"commands/progress.h"
5960
#include"commands/tablecmds.h"
@@ -3044,6 +3045,7 @@ index_build(Relation heapRelation,
30443045
!smgrexists(RelationGetSmgr(indexRelation),INIT_FORKNUM))
30453046
{
30463047
smgrcreate(RelationGetSmgr(indexRelation),INIT_FORKNUM, false);
3048+
log_smgrcreate(&indexRelation->rd_locator,INIT_FORKNUM);
30473049
indexRelation->rd_indam->ambuildempty(indexRelation);
30483050
}
30493051

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp