Re: Sharing more infrastructure between walsenders and regular backends (was Re: Switching timeline over streaming replication)

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Amit Kapila <amit(dot)kapila(at)huawei(dot)com>
Subject: Re: Sharing more infrastructure between walsenders and regular backends (was Re: Switching timeline over streaming replication)
Date: 2012-10-04 21:45:12
Message-ID: 201210042345.14727.andres@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thursday, October 04, 2012 10:58:53 PM Tom Lane wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)com> writes:
> > On 4 October 2012 17:23, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
wrote:
> >> Perhaps we could make walsenders even more like regular backends than
> >> what I was proposing, so that the replication commands are parsed and
> >> executed just like regular utility commands. However, that'd require
> >> some transaction support in walsender, for starters, which seems messy.
> >> It might become sensible in the future if the replication command set
> >> gets even more complicated, but it doesn't seem like a good idea at the
> >> moment.
> >
> > It's come up a few times now that people want to run a few queries
> > either before or after running a base backup. ...
> > Andres suggested to me the other day we make walsender more like
> > regular backends. At the time I wasn't sure I agreed, but reading this
> > it looks like a sensible way to go.
I only went that way after youve disliked my other suggestions ;)

> That was what I was thinking too, but on reflection there's at least one
> huge problem: how could we run queries without being connected to a
> specific database? Which walsender isn't.
I had quite some problems with that too. For now I've hacked walsender to
connect to the database specified in the connection, not sure whether thats the
way to go. Seems to work so far.

I wanted to start a thread about this anyway, but as it came up here...

The reason "we" (as in logical rep) need a database in the current approach is
that we need to access the catalog (in a timetraveling fashion) to know how to
decode the data in the wal... The patch I sent two weeks ago does the decoding
from inside a normal backend but that was just because I couldn't make
walsender work inside a database in time...

Greetings,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-10-04 21:58:16 Re: Support for REINDEX CONCURRENTLY
Previous Message Tom Lane 2012-10-04 20:58:53 Re: Sharing more infrastructure between walsenders and regular backends (was Re: Switching timeline over streaming replication)