pgsql: In walsender, don't sleep if there's outstanding WAL waiting to
Log Message:
-----------
In walsender, don't sleep if there's outstanding WAL waiting to be sent,
otherwise we effectively rate-limit the streaming as pointed out by
Simon Riggs. Also, send the WAL in smaller chunks, to respond to signals
more promptly.
Modified Files:
--------------
pgsql/src/backend/replication:
walsender.c (r1.20 -> r1.21)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/replication/walsender.c?r1=1.20&r2=1.21)
Hi,
On Thu, May 27, 2010 at 7:21 AM, Heikki Linnakangas
<heikki@postgresql.org> wrote:
Log Message:
-----------
In walsender, don't sleep if there's outstanding WAL waiting to be sent,
otherwise we effectively rate-limit the streaming as pointed out by
Simon Riggs. Also, send the WAL in smaller chunks, to respond to signals
more promptly.Modified Files:
--------------
pgsql/src/backend/replication:
walsender.c (r1.20 -> r1.21)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/replication/walsender.c?r1=1.20&r2=1.21)
This commit seems to have introduced the bug that walsender exits
before sending all the WAL up to shutdown checkpoint record when
smart shutdown is requested.
The attached patch fixes the bug and a tiny typo.
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
On Mon, May 31, 2010 at 7:03 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
Hi,
On Thu, May 27, 2010 at 7:21 AM, Heikki Linnakangas
<heikki@postgresql.org> wrote:Log Message:
-----------
In walsender, don't sleep if there's outstanding WAL waiting to be sent,
otherwise we effectively rate-limit the streaming as pointed out by
Simon Riggs. Also, send the WAL in smaller chunks, to respond to signals
more promptly.Modified Files:
--------------
pgsql/src/backend/replication:
walsender.c (r1.20 -> r1.21)
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/replication/walsender.c?r1=1.20&r2=1.21)This commit seems to have introduced the bug that walsender exits
before sending all the WAL up to shutdown checkpoint record when
smart shutdown is requested.The attached patch fixes the bug and a tiny typo.
Sorry. I forgot to attach the patch..
Regards,
--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachments:
send_xlog_upto_shutdown_ckpt_v1.patchapplication/octet-stream; name=send_xlog_upto_shutdown_ckpt_v1.patchDownload
*** a/src/backend/replication/walsender.c
--- b/src/backend/replication/walsender.c
***************
*** 394,401 **** WalSndLoop(void)
*/
if (ready_to_stop)
{
! XLogSend(&output_message, &caughtup);
! shutdown_requested = true;
}
/* Normal exit from the walsender is here */
--- 394,403 ----
*/
if (ready_to_stop)
{
! if (!XLogSend(&output_message, &caughtup))
! goto eof;
! if (caughtup)
! shutdown_requested = true;
}
/* Normal exit from the walsender is here */
***************
*** 458,464 **** eof:
static void
InitWalSnd(void)
{
- /* use volatile pointer to prevent code rearrangement */
int i;
/*
--- 460,465 ----
***************
*** 474,479 **** InitWalSnd(void)
--- 475,481 ----
*/
for (i = 0; i < max_wal_senders; i++)
{
+ /* use volatile pointer to prevent code rearrangement */
volatile WalSnd *walsnd = &WalSndCtl->walsnds[i];
SpinLockAcquire(&walsnd->mutex);
On 31/05/10 13:20, Fujii Masao wrote:
On Mon, May 31, 2010 at 7:03 PM, Fujii Masao<masao.fujii@gmail.com> wrote:
This commit seems to have introduced the bug that walsender exits
before sending all the WAL up to shutdown checkpoint record when
smart shutdown is requested.The attached patch fixes the bug and a tiny typo.
Sorry. I forgot to attach the patch..
Thanks, committed.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com