Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Chapman Flack <chap(at)anastigmatix(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility
Date: 2018-03-18 23:28:05
Message-ID: 21C25ED8-4ED8-4AD4-B551-3E3987ECB18F@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 18 Mar 2018, at 22:54, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:
>
> On 03/18/18 16:56, Daniel Gustafsson wrote:
>> sorry about that. Now we know that the proposed test fails without the patch
>> applied and clears with it, that was at least an interesting side effect =)
>
> It was, and it got me looking at the test, and even though it does detect
> the difference between patch-applied and patch-not-applied, I sort of wonder
> if it does what it claims to. It seems to me that unpack('N8192', ...)
> would want to return 8192 32-bit ints (in array context), but really only
> be able to return 2048 of them (because it's only got 8192 bytes to unpack),
> and then being used in scalar context, it only returns the first one anyway,
> so the test only hinges on whether the first four bytes of the block are
> zero or not. Which turns out to be enough to catch a non-zeroed header. :)

Good point, thats what I get for hacking without enough coffee.

> What would you think about replacing the last two lines with just
>
> ok($bytes =~ /\A\x00*+\z/, 'make sure wal segment is zeroed’);

It seems expensive to regex over BLCKSZ, but it’s probably the safest option
and it’s not a performance critical codepath. Feel free to whack the test
patch over the head with the above diff.

cheers ./daniel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-03-18 23:30:33 Re: ECPG installcheck tests fail if PGDATABASE is set
Previous Message Andres Freund 2018-03-18 23:09:58 Re: ECPG installcheck tests fail if PGDATABASE is set