Re: [PATCH] lazy relations delete

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: m(dot)orlov(at)postgrespro(dot)ru, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] lazy relations delete
Date: 2020-01-08 04:56:52
Message-ID: CA+hUKGKXm3jX-Wi0f2dMDGnNURp=9z+iOs9bQ+XypAnUyrENYQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 8, 2020 at 5:20 PM Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> wrote:
> Relfilenode can be reused right after commit. There can be a case
> where readers of the resued relfilenode see the pages from already
> removed files left on shared buffers. On the other hand newly
> allocated buffers for the reused relfilenode are not flushed out until
> the lazy invalidate machinery actually frees the "garbage" buffers and
> it leads to a broken database after a crash. But finally the
> machinery trashes away the buffers involving the correct ones at
> execution time.

The relfilenode can't be reused until the next checkpoint, can it?
The truncated file remains in the file system, specifically to prevent
anyone from reusing the relfilenode. See the comment for mdunlink().
There may be other problems with the idea, but wouldn't the zombie
buffers be harmless, if they are invalidated before
SyncPostCheckpoint() unlinks the underlying files (and you never try
to flush them)?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2020-01-08 06:01:17 Re: parallel vacuum options/syntax
Previous Message Kyotaro Horiguchi 2020-01-08 04:18:33 Re: [PATCH] lazy relations delete