Re: %d in log_line_prefix doesn't work for bg/autovacuum workers

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Christoph Berg <cb(at)df7cb(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: %d in log_line_prefix doesn't work for bg/autovacuum workers
Date: 2014-05-17 21:50:25
Message-ID: 20140517215025.GF4484@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2014-05-17 23:35:43 +0200, Christoph Berg wrote:
> They want to pg_terminate_backend() the sessions on db_old anyway, but
> to get that point, you need to be able to rename the db. The
> alternative would be to disallow connections to the db (for which
> there is no real nice way), kill existing connections, do the
> renaming, and then reenable connections. That's much more effort,
> though.

There should really be a way to set datallowcon... But anyway, you can
set the connection limit to 0, that should mostly work?

> Fwiw, this wasn't the first time I've heard of that idea, it also
> doesn't sound too far-fetched for me. I guess people usually go "damn,
> I can't rename active dbs, let's try something else" instead of
> complaining on the mailing lists in that case.

Hm.

> > > We also looked into the confused-client problem, but
> > > current_database() reports the new name correctly, and hence figured
> > > there shouldn't be any problem with this approach, despite it
> > > obviously being slightly out of spec because of the dependency on
> > > running on a SR slave.
> >
> > At the very least log_line_prefix's %d will log the wrong thing.
>
> I guess if you are doing database renames, you can live with that,
> especially if you are doing the renames only for the purpose of
> putting an updated db in place, and then throwing away the old db
> quickly.

I don't know. If you switch databases around, for example, and sessions
on both report the original database name things really get confusing.

Greetings,

Andres Freund

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2014-05-17 22:04:42 Re: Allowing join removals for more join types
Previous Message Andres Freund 2014-05-17 21:45:50 Re: buildfarm: strange OOM failures on markhor (running CLOBBER_CACHE_RECURSIVELY)