Unlogged tables and BufferSync()

Started by Heikki Linnakangasabout 14 years ago2 messages
#1Heikki Linnakangas
heikki.linnakangas@enterprisedb.com

In BufferSync(), we have this:

/*
* Unless this is a shutdown checkpoint, we write only permanent, dirty
* buffers. But at shutdown time, we write all dirty buffers.
*/
if (!(flags & CHECKPOINT_IS_SHUTDOWN))
flags |= BM_PERMANENT;

That seems bogus to me. We're mixing CHECKPOINT_* flags and buffer BM_*
flags in the same variable. Furthermore, we only use that flags variable
to pass it down to CheckpointWriteDelay(), which only pays attention to
CHECKPOINT_IMMEDIATE flag. The intention was probably to do "mask |=
BM_PERMANENT" ?

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

#2Robert Haas
robertmhaas@gmail.com
In reply to: Heikki Linnakangas (#1)
Re: Unlogged tables and BufferSync()

On Fri, Jan 6, 2012 at 7:52 AM, Heikki Linnakangas
<heikki.linnakangas@enterprisedb.com> wrote:

In BufferSync(), we have this:

       /*
        * Unless this is a shutdown checkpoint, we write only permanent,
dirty
        * buffers.  But at shutdown time, we write all dirty buffers.
        */
       if (!(flags & CHECKPOINT_IS_SHUTDOWN))
               flags |= BM_PERMANENT;

That seems bogus to me. We're mixing CHECKPOINT_* flags and buffer BM_*
flags in the same variable. Furthermore, we only use that flags variable to
pass it down to CheckpointWriteDelay(), which only pays attention to
CHECKPOINT_IMMEDIATE flag. The intention was probably to do "mask |=
BM_PERMANENT" ?

Ouch. Yeah, that's a bug, will fix.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company