Re: Error with index on unlogged table - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Error with index on unlogged table
Date
Msg-id 20151203210943.GA28762@awork2.anarazel.de
Whole thread Raw
In response to Re: Error with index on unlogged table  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: Error with index on unlogged table
List pgsql-hackers
Hi,

On 2015-11-20 16:11:15 +0900, Michael Paquier wrote:
> diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
> index cc845d2..4883697 100644
> --- a/src/backend/access/transam/xlog.c
> +++ b/src/backend/access/transam/xlog.c
> @@ -9503,6 +9503,14 @@ xlog_redo(XLogRecPtr lsn, XLogRecord *record)
>          data += sizeof(BkpBlock);
>  
>          RestoreBackupBlockContents(lsn, bkpb, data, false, false);
> +
> +        if (bkpb.fork == INIT_FORKNUM)
> +        {
> +            SMgrRelation srel;
> +            srel = smgropen(bkpb.node, InvalidBackendId);
> +            smgrimmedsync(srel, INIT_FORKNUM);
> +            smgrclose(srel);
> +        }
>      }
>      else if (info == XLOG_BACKUP_END)
>      {

A smgrwrite() instead of a smgrimmedsync() should be sufficient here.

- Andres



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_hba_lookup function to get all matching pg_hba.conf entries
Next
From: Andres Freund
Date:
Subject: Re: Error with index on unlogged table