pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: David G Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Re: BUG #10329: Could not read block 0 in file "base/56100265/57047884": read only 0 of 8192 bytes
Date: Thu, 11 Sep 2014 21:25:00 +0200
Message-ID: <20140911192500.GE17294@awork2.anarazel.de> (raw)
In-Reply-To: <22393.1410461893@sss.pgh.pa.us>
References: <20140516144825.GL25053@momjian.us>
	<CAKFQuwaQQBG-gOmFB8XEebY1jpadu0Y-m7i9wJQFaQbGpy-+hw@mail.gmail.com>
	<20140906150743.GC20146@momjian.us>
	<20140907014245.GJ14037@eldon.alvh.no-ip.org>
	<20140908134502.GB13690@momjian.us>
	<5411DAF9.4040003@kaltenbrunner.cc>
	<20140911172923.GC15099@alap3.anarazel.de>
	<20140911174137.GI16199@momjian.us>
	<20140911174637.GD15099@alap3.anarazel.de>
	<22393.1410461893@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2014-09-11 14:58:13 -0400, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > On 2014-09-11 13:41:37 -0400, Bruce Momjian wrote:
> >> And practically, how would we implement this for upgrades?  Would we have
> >> pg_dump emit UNLOGGED for any hash creation command?
> 
> > That seems like an almost trivial problem in comparison to the actual
> > difficulty of implementing UNLOGGED indexed on LOGGED tables.
> 
> Yeah, we'd need to somehow mark such indexes as INVALID during crash
> recovery, which sounds pretty messy.  We've stayed away from the whole
> idea of automatically-applied catalog updates during recovery, for
> good reasons.

Right. There were some ideas floating around, but nothing agreed upon.

I think we can stay away from doing anything *during* recovery, because
surely nothing UNLOGGED will ever be usable during it. So we should just
skip unlogged indexes during planning/executing, the same as !indisvalid/!indisready indexes
are skipped during planning/DML.

But obviously there has to be some way to mark them as invalid at the
end of recovery. I don't think we want to do a disk access during
planning to see if there's some special file system marker marking a
relation as reset everytime a unlogged index is involed in a plan.
There's enough ugly ways to deal with that, but a acceptable one ...

> > Yes, I
> > think forbidding unlogged hash tables + teaching pg_dump a heuristic to
> > treat any < 9.x hash index as unlogged would be ok.
> 
> My own opinion, if we had the infrastructure, is that "CREATE INDEX
> ... USING hash" should result in (1) automatically adding the UNLOGGED
> attribute and (2) issuing a NOTICE or WARNING stating that we've done so.
> Throwing an error, when we do not do so today, is just being a nag.
> This approach also eliminates the need to do anything special in pg_dump,
> which is a good thing since we have no way to retroactively fix existing
> dump files.

I think that might be less pain in the short term, but will bite us
*and* our users afterwards.  For one, it really really isn't the same
thing to have a unlogged index as a logged index. Any user using
UNLOGGED indexes will need a explicit way to trigger rebuilding them
after a crash-restart. They're not served well by us automatically
hiding that fact from them.  For another I think we at some point we're
going to get hash indexes that are logged and then we'll have to
uninstall that heuristic which will just confuse users agin.

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (30+ messages)

Message-ID: <20140911192500.GE17294@awork2.anarazel.de>
Permalink:  ../20140911192500.GE17294@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20140911192500.GE17294@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@2ndquadrant.com, tgl@sss.pgh.pa.us, bruce@momjian.us, stefan@kaltenbrunner.cc, alvherre@2ndquadrant.com, david.g.johnston@gmail.com
  Subject: Re: BUG #10329: Could not read block 0 in file "base/56100265/57047884": read only 0 of 8192 bytes
  In-Reply-To: <20140911192500.GE17294@awork2.anarazel.de>
  References: <20140516144825.GL25053@momjian.us> <CAKFQuwaQQBG-gOmFB8XEebY1jpadu0Y-m7i9wJQFaQbGpy-+hw@mail.gmail.com> <20140906150743.GC20146@momjian.us> <20140907014245.GJ14037@eldon.alvh.no-ip.org> <20140908134502.GB13690@momjian.us> <5411DAF9.4040003@kaltenbrunner.cc> <20140911172923.GC15099@alap3.anarazel.de> <20140911174137.GI16199@momjian.us> <20140911174637.GD15099@alap3.anarazel.de> <22393.1410461893@sss.pgh.pa.us> <20140911192500.GE17294@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox