Skip site navigation (1) Skip section navigation (2)

Re: Re: Hot Standby query cancellation and Streaming Replication integration

From: Joachim Wieland <joe(at)mcknight(dot)de>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: Hot Standby query cancellation and Streaming Replication integration
Date: 2010-02-28 21:42:00
Message-ID: dc7b844e1002281342j3ff45bf0q56c148fb980947e3@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sun, Feb 28, 2010 at 8:47 PM, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> 1) Automated retry of cancelled queries on the slave.  I have no idea
> how hard this would be to implement, but it makes the difference between
> writing lots of exception-handling code for slave connections
> (unacceptable) to just slow response times on the slave (acceptable).

We're not only canceling queries, we are effectively canceling
transactions. It seems quite impossible to repeat all queries from a
transaction that has started in the past. One query might be or
include the result of a previous query and as the data we see now has
changed since then, the client might now want to execute a different
query when it gets a different result out of a previous query...

And even if it was possible, how often would you retry? You still have
no guarantee that your query succeeds the second time. I'd claim that
if a query failed once, chances are even higher that it fails again
than that it succeeds the second time. Moreover if you continue to
repeat the query and if queries come in at a certain rate, you need to
process more and more queries on the slave which will not really help
other queries to finish in time nor will it be beneficial for the
throughput of the system as a whole...


I fully agree with what you say about user expectations: We need to
assume that many programs are not prepared for failures of "simple"
read-only queries because in the past they have always worked...


> Another thing to keep in mind in these discussions is the
> inexpensiveness of servers today.  This means that, if slaves have poor
> performance, that's OK; one can always spin up more slaves.  But if each
> slave imposes a large burden on the master, then that limits your
> scalability.

The burden of the xmin-publication feature is not the number of
slaves, it's just the longest running queries on whatever slave they
are. So your argument applies to both cases... To minimize the burden
on the master, get additional slaves so that you can run your most
expensive queries in a shorter time :-)


Joachim

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-02-28 21:46:53
Subject: Re: remove contrib/xml2
Previous:From: Andrew DunstanDate: 2010-02-28 21:06:40
Subject: Re: contrib/xml2 pfree bug

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group