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

Re: Streaming replication and unfit messages

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Streaming replication and unfit messages
Date: 2010-02-18 11:14:15
Message-ID: 4B7D2107.5090500@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Fujii Masao wrote:
>    * The received byte is stored in *c. Returns 1 if a byte was read, 0 if
> !  * if no data was available, or EOF if trouble.
> 
> Typo. 'if' is repeated.
> 
> 
> + 				ereport(COMMERROR,
> + 						(errcode_for_socket_access(),
> + 						 errmsg("could not receive data from client: %m")));
> + 				return EOF;
> 
> We should use "r = EOF" instead of "return EOF" as well as other cases?

Yep.

> In WalSndHandshake(), when pq_getbyte() returns EOF, the COMMERROR message
> "unexpected EOF on standby connection" is emitted doubly. How about removing
> first COMMERROR message?

Yep.

>   	r = pq_getbyte_if_available(&firstchar);
>   	if (r < 0)
>   	{
> ! 		/* unexpected error */
>   		ereport(COMMERROR,
> ! 				(errcode(ERRCODE_PROTOCOL_VIOLATION),
> ! 				 errmsg("unexpected EOF on standby connection")));
> ! 		proc_exit(0);
>   	}
> 
> Since pq_getbyte_if_available() returns EOF if trouble, "r == EOF" should
> be used instead of "r < 0"?

Yep.

Committed with all those fixes.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

In response to

pgsql-hackers by date

Next:From: Magnus HaganderDate: 2010-02-18 11:14:50
Subject: Re: Streaming replication on win32, still broken
Previous:From: Fujii MasaoDate: 2010-02-18 10:39:26
Subject: Re: Streaming replication on win32, still broken

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