Re: [HACKERS] Bug of pg_receivexlog -v

2014-08-02 Thread Fujii Masao
On Fri, Aug 1, 2014 at 8:35 PM, Fujii Masao masao.fu...@gmail.com wrote:
 Hi,

 In 9.2, pg_receivexlog -v has emitted the messages as follows at the
 end of each WAL file.

 pg_receivexlog: finished segment at 0/200 (timeline 1)
 pg_receivexlog: finished segment at 0/300 (timeline 1)
 pg_receivexlog: finished segment at 0/400 (timeline 1)

 But, while reviewing the pg_receivexlog patch written by Furuya, I
 found that 0b63291 had
 broken this feature, and then now pg_receivexlog -v doesn't emit such
 messages at all.
 Attached patch fixes this problem. This needs to be back-patched to 9.3.

Applied.

Regards,

-- 
Fujii Masao


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Bug of pg_receivexlog -v

2014-08-02 Thread Fujii Masao
On Sat, Aug 2, 2014 at 1:47 AM, Fujii Masao masao.fu...@gmail.com wrote:
 On Fri, Aug 1, 2014 at 8:35 PM, Fujii Masao masao.fu...@gmail.com wrote:
 Hi,

 In 9.2, pg_receivexlog -v has emitted the messages as follows at the
 end of each WAL file.

 pg_receivexlog: finished segment at 0/200 (timeline 1)
 pg_receivexlog: finished segment at 0/300 (timeline 1)
 pg_receivexlog: finished segment at 0/400 (timeline 1)

 But, while reviewing the pg_receivexlog patch written by Furuya, I
 found that 0b63291 had
 broken this feature, and then now pg_receivexlog -v doesn't emit such
 messages at all.
 Attached patch fixes this problem. This needs to be back-patched to 9.3.

 I found another problem on pg_receivexlog, which can cause the leak of
 PGresult. The leak is small and rare, but it's better to fix that.
 Patch attached.

Applied.

Regards,

-- 
Fujii Masao


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Bug of pg_receivexlog -v

2014-08-01 Thread Fujii Masao
Hi,

In 9.2, pg_receivexlog -v has emitted the messages as follows at the
end of each WAL file.

pg_receivexlog: finished segment at 0/200 (timeline 1)
pg_receivexlog: finished segment at 0/300 (timeline 1)
pg_receivexlog: finished segment at 0/400 (timeline 1)

But, while reviewing the pg_receivexlog patch written by Furuya, I
found that 0b63291 had
broken this feature, and then now pg_receivexlog -v doesn't emit such
messages at all.
Attached patch fixes this problem. This needs to be back-patched to 9.3.

Regards,

-- 
Fujii Masao
*** a/src/bin/pg_basebackup/receivelog.c
--- b/src/bin/pg_basebackup/receivelog.c
***
*** 991,997  HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
  
  	xlogoff = 0;
  
! 	if (still_sending  stream_stop(blockpos, timeline, false))
  	{
  		if (PQputCopyEnd(conn, NULL) = 0 || PQflush(conn))
  		{
--- 991,997 
  
  	xlogoff = 0;
  
! 	if (still_sending  stream_stop(blockpos, timeline, true))
  	{
  		if (PQputCopyEnd(conn, NULL) = 0 || PQflush(conn))
  		{

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Bug of pg_receivexlog -v

2014-08-01 Thread Fujii Masao
On Fri, Aug 1, 2014 at 8:35 PM, Fujii Masao masao.fu...@gmail.com wrote:
 Hi,

 In 9.2, pg_receivexlog -v has emitted the messages as follows at the
 end of each WAL file.

 pg_receivexlog: finished segment at 0/200 (timeline 1)
 pg_receivexlog: finished segment at 0/300 (timeline 1)
 pg_receivexlog: finished segment at 0/400 (timeline 1)

 But, while reviewing the pg_receivexlog patch written by Furuya, I
 found that 0b63291 had
 broken this feature, and then now pg_receivexlog -v doesn't emit such
 messages at all.
 Attached patch fixes this problem. This needs to be back-patched to 9.3.

I found another problem on pg_receivexlog, which can cause the leak of
PGresult. The leak is small and rare, but it's better to fix that.
Patch attached.

Regards,

-- 
Fujii Masao
*** a/src/bin/pg_basebackup/receivelog.c
--- b/src/bin/pg_basebackup/receivelog.c
***
*** 628,633  ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
--- 628,634 
  fprintf(stderr,
     _(%s: unexpected termination of replication stream: %s),
  		progname, PQresultErrorMessage(res));
+ PQclear(res);
  goto error;
  			}
  			PQclear(res);
***
*** 642,647  ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
--- 643,650 
  		}
  		else if (PQresultStatus(res) == PGRES_COMMAND_OK)
  		{
+ 			PQclear(res);
+ 
  			/*
  			 * End of replication (ie. controlled shut down of the server).
  			 *
***
*** 663,668  ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
--- 666,672 
  			fprintf(stderr,
  	_(%s: unexpected termination of replication stream: %s),
  	progname, PQresultErrorMessage(res));
+ 			PQclear(res);
  			goto error;
  		}
  	}

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers