Re: xlog location arithmetic

Euler Taveira de Oliveira <euler@timbira.com>

From: Euler Taveira de Oliveira <euler@timbira.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Magnus Hagander <magnus@hagander.net>, Robert Haas <robertmhaas@gmail.com>, Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2012-02-07T17:29:16Z
Lists: pgsql-hackers

Attachments

On 26-01-2012 06:19, Fujii Masao wrote:

Thanks for your review. Comments below.

> When I compiled the source with xlogdiff.patch, I got the following warnings.
> 
> xlogfuncs.c:511:2: warning: format '%lX' expects argument of type
> 'long unsigned int *', but argument 3 has type 'uint64 *' [-Wformat]
> 
What is your compiler? I'm using gcc 4.6.2. I refactored the patch so I'm now
using XLogRecPtr and %X.

> postgres=# SELECT pg_xlog_location_diff('0/2000074', '0/2000074');
> ERROR:  xrecoff "2000074" is out of valid range, 0..A4A534C
> 
Ugh? I can't reproduce that. It seems to be related to long int used by the
prior version.

> Since pg_xlog_location_diff() can be executed during recovery,
> the above needs to be updated.
> 
Fixed.

>> While the output was int8 I could use
>> pg_size_pretty but now I couldn't. I attached another patch that implements
>> pg_size_pretty(numeric).
> 
I realized that it collides with the pg_size_pretty(int8) if we don't specify
a type. Hence, I decided to drop the pg_size_pretty(int8) in favor of
pg_size_pretty(numeric). It is slower than the former but it is not a
performance critical function.

> According to the above source code comment in pg_proc.h, ISTM
> pg_size_pretty() for numeric also needs to have its own DESCR().
> 
Fixed.

> According to "man strcat", the dest string must have enough space for
> the result.
> "buf" has enough space?
> 
Ops. Fixed.


-- 
   Euler Taveira de Oliveira - Timbira       http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento