From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Noah Misch <noah(at)leadboat(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Wrong usage of RelationNeedsWAL |
Date: | 2021-01-15 21:30:54 |
Message-ID: | 20210115213054.c5wc3dogjx55jz6x@alap3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2021-01-13 16:07:05 +0900, Kyotaro Horiguchi wrote:
> Commit c6b92041d3 changed the definition of RelationNeedsWAL().
>
> -#define RelationNeedsWAL(relation) \
> - ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
> +#define RelationNeedsWAL(relation) \
> + ((relation)->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT && \
> + (XLogIsNeeded() || \
> + (relation->rd_createSubid == InvalidSubTransactionId && \
> + relation->rd_firstRelfilenodeSubid == InvalidSubTransactionId)))
>
> On the other hand I found this usage.
>
> plancat.c:128 get_relation_info()
> > /* Temporary and unlogged relations are inaccessible during recovery. */
> > if (!RelationNeedsWAL(relation) && RecoveryInProgress())
> > ereport(ERROR,
> > (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> > errmsg("cannot access temporary or unlogged relations during recovery")));
>
> It works as expected accidentally, but the meaning is off.
> WAL-skipping optmization is irrelevant to the condition for the error.
>
> I found five misues in the tree. Please find the attached.
Noah?
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2021-01-15 21:42:09 | Re: WIP: document the hook system |
Previous Message | Robert Haas | 2021-01-15 21:23:22 | Re: Key management with tests |