Using XLogFileNameP in critical section

From: Masahiko Sawada <masahiko(dot)sawada(at)2ndquadrant(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Using XLogFileNameP in critical section
Date: 2019-11-29 17:44:58
Message-ID: CA+fd4k5gC9H4uoWMLg9K_QfNrnkkdEw+-AFveob9YX7z8JnKTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I encountered that the assertion error is reported instead of a proper
PANIC message when failed to fsync WAL. The cause is that there are
multiple places where we call XLogFileNameP function that calls palloc
during critical section, for example XLogWrite function.

TRAP: FailedAssertion("CritSectionCount == 0 ||
(context)->allowInCritSection", File: "mcxt.c", Line: 956)

As far as I can see there are five places we need to fix.I've attached a patch.

Regards,

--
Masahiko Sawada http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
fix_XLogFileNameP.patch application/x-patch 3.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2019-11-29 18:01:39 Make autovacuum sort tables in descending order of xid_age
Previous Message Amit Langote 2019-11-29 17:26:18 Re: pgbench -i progress output on terminal