Re: [HACKERS] WAL logging problem in 9.4.3?

From: Noah Misch <noah(at)leadboat(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: robertmhaas(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org, 9erthalion6(at)gmail(dot)com, andrew(dot)dunstan(at)2ndquadrant(dot)com, hlinnaka(at)iki(dot)fi, michael(at)paquier(dot)xyz
Subject: Re: [HACKERS] WAL logging problem in 9.4.3?
Date: 2020-02-19 07:44:52
Message-ID: 20200219074452.GA4006615@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I think attached v35nm is ready for commit to master. Would anyone like to
talk me out of back-patching this? I would not enjoy back-patching it, but
it's hard to justify lack of back-patch for a data-loss bug.

Notable changes since v34:

- Separate a few freestanding fixes into their own patches.

On Mon, Jan 27, 2020 at 07:28:31PM +0900, Kyotaro Horiguchi wrote:
> --- a/src/backend/catalog/storage.c
> +++ b/src/backend/catalog/storage.c
> @@ -388,13 +388,7 @@ RelationPreTruncate(Relation rel)
> /* Record largest maybe-unsynced block of files under tracking */
> pending = hash_search(pendingSyncHash, &(rel->rd_smgr->smgr_rnode.node),
> HASH_FIND, NULL);
> - if (pending)
> - {
> - BlockNumber nblocks = smgrnblocks(rel->rd_smgr, MAIN_FORKNUM);
> -
> - if (pending->max_truncated < nblocks)
> - pending->max_truncated = nblocks;
> - }
> + pending->is_truncated = true;

- Fix this crashing when "pending" is NULL, as it is in this test case:

begin;
create temp table t ();
create table t2 (); -- cause pendingSyncHash to exist
truncate t;
rollback;

- Fix the "deleted while still in use" problem that Thomas Munro reported, by
removing the heap_create() change. Restoring the saved rd_createSubid had
made obsolete the heap_create() change. check-world now passes with
wal_level=minimal and CLOBBER_CACHE_ALWAYS.

- Set rd_droppedSubid in RelationForgetRelation(), not
RelationClearRelation(). RelationForgetRelation() knows it is processing a
drop, but RelationClearRelation() could only infer that from circumstantial
evidence. This seems more future-proof to me.

- When reusing an index build, instead of storing the dropped relid in the
IndexStmt and opening the dropped relcache entry in ATExecAddIndex(), store
the subid fields in the IndexStmt. This is less code, and I felt
RelationIdGetRelationCache() invited misuse.

Attachment Content-Type Size
createsubid-cosmetics-v35nm.patch text/plain 2.4 KB
toast_get_valid_index-lock-v35nm.patch text/plain 1.9 KB
log_newpage_range-args-v35nm.patch text/plain 1.7 KB
skip-wal-v35nm.patch text/plain 115.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-02-19 07:48:45 Re: Print physical file path when checksum check fails
Previous Message Kirill Bychik 2020-02-19 07:27:50 Re: WAL usage calculation patch