Re: RecoveryInProgress() has critical side effects

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Andres Freund <andres(at)anarazel(dot)de>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, amul sul <sulamul(at)gmail(dot)com>
Subject: Re: RecoveryInProgress() has critical side effects
Date: 2021-12-01 15:38:27
Message-ID: CA+TgmobKiqR66XV4zB5Kb=wJ3PKN4J_FTvkGxqOET20T_vB8hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 20, 2021 at 3:22 PM Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> But here's yet another idea: We could initialize RedoRecPtr and
> doPageWrites in InitXLogInsert(). It would seem like a pretty natural
> place for it.

I considered that, but it seemed like an abstraction violation to me,
because that code is part of xloginsert.c, which is mostly concerned
with assembly of write-ahead log records, not the associated
shared-memory state. Also, I don't think there's any guarantee that
the state in shared memory is initialized at the time we call that
function, so we might just be copying uninitialized memory into other
uninitialized memory.

> PS. typo in patch v2: s/prepard/prepared/

Thanks, fixed.

--
Robert Haas
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v3-0001-Remove-InitXLOGAccess.patch application/octet-stream 8.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-12-01 15:40:19 Re: Non-decimal integer literals
Previous Message Robert Haas 2021-12-01 15:01:08 Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd