pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pchan@contigo.com
To: pgsql-bugs@postgresql.org
Subject: BUG #8404: JDBC block hot standby replication?
Date: Wed, 28 Aug 2013 00:30:44 +0000
Message-ID: <E1VETem-0003i8-Rs@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      8404
Logged by:          Pius Chan
Email address:      pchan@contigo.com
PostgreSQL version: 9.1.9
Operating system:   Linux version 2.6.32-279.14.1.el6.x86_64
Description:        

When investigating an "out of memory" issue in hot standby, it is found that
JDBC can block the application of replicated transaction log to hot standby.
The set up of the test is as follows:


Set up:
=======
Set up a master db cluster and hot standby db cluster using async streaming
replication. On master database server, create a database TEST. Implement a
cron job which on every minute:
- drop table if exists heartbeat;
- create table heartbeat (timenow timestamp);
- insert into heartbeat values (now());
- this is to ensure transaction entry is generated at least every minute.


Test 1 - psql does not block replication
========================================
- on hot standy db server, start a psql session (session 1), then submit the
following:
psql> begin;
psql> select now();
..... idle


- start another psql session on hot standby db server and run the following
SQLs to monitor the replication delay:


select current_timestamp, pg_last_xact_replay_timestamp(),
current_timestamp-pg_last_xact_replay_timestamp() as replication_delay,
pg_last_xlog_receive_location();


Result: it is found that session 1 does
not block replication.




Test 2 - JDBC can block replication
====================================
- write a Java test program to connect to hot standby TEST database
- in the test program, submit the following SQLs:
 
  begin;
  select now();
  then sleep for 2 minutes


- on hot standby db server, start another psql session and monitor the
replication delay with the same SQL.


Results: it is found that during the 2 minutes sleeping time,
pg_last_xlog_receive_location is advancing but pg_last_xact_replay_timestamp
is stuck. The result of "select * from heartbeat" does not change.


Is that a bug in JDBC driver?



-- 
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 (4+ messages)  latest in thread

Message-ID: <E1VETem-0003i8-Rs@wrigleys.postgresql.org>
Permalink:  ../E1VETem-0003i8-Rs@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1VETem-0003i8-Rs@wrigleys.postgresql.org

 · 

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: pchan@contigo.com
  Subject: Re: BUG #8404: JDBC block hot standby replication?
  In-Reply-To: <E1VETem-0003i8-Rs@wrigleys.postgresql.org>
  References: <E1VETem-0003i8-Rs@wrigleys.postgresql.org>

* 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