[pgpool-hackers: 147] Re: Do we need to rephrase the precondition for load-balancing?

Gurjeet Singh singh.gurjeet at gmail.com
Thu Nov 1 06:06:52 JST 2012


On Fri, Oct 26, 2012 at 10:27 PM, Tatsuo Ishii <ishii at postgresql.org> wrote:

> >> On Fri, Oct 26, 2012 at 6:00 AM, Tatsuo Ishii <ishii at postgresql.org>
> wrote:
> >>
> >>> Sorry for late reply.
> >>>
> >>> > Hi,
> >>> >
> >>> >     The docs [1] say that one of the preconditions for
> load-balancing is
> >>> > that
> >>> >
> >>> >     > The query must not be in an explicitly declared transaction
> (i.e.
> >>> not
> >>> > in a BEGIN ~ END block)
> >>>
> >>> Yeah, the doc is outdated in this regard.
> >>>
> >>> >     But I see that this is not a strict statement. I extracted a
> specific
> >>> > backend process' log lines (generated using log_per_node_statement),
> and
> >>> I
> >>> > could see that on line 6, the SELECT query was load-balanced to a
> replica
> >>> > (node id 2) and the next INSERT statement was correctly sent to the
> >>> master.
> >>> > But any SELECT after that INSERT was not sent to the replica, and
> only to
> >>> > the master.
> >>> >
> >>> >     So can we say that load balancing _does_ occur in an explicitly
> >>> > declared transaction, but as soon as a DML operation is perfored, any
> >>> > subsequent SELECT queries will be sent only to master.
> >>>
> >>> Yes, that is expected behavior if you are using streaming replication
> >>> mode. The reason why SELECTs are sent to master after DML issued is,
> >>> standby cannot see the modified rows.
> >>>
> >>
> >> Can we expect doc changes, or I should probably file a bug-report
> against
> >> documentation so that it gets taken care of in due process.
> >
> > I will propose doc changes.
>
> Included is the patch I promised. There are more to fix than what
> discussed though. If you are comfortable with this, I will commit.
>

Looks good to me.

Best regards,
-- 
Gurjeet Singh

http://gurjeet.singh.im/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20121031/ed653493/attachment.html>


More information about the pgpool-hackers mailing list