Re: Attempt to consolidate reading of XLOG page

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Antonin Houska <ah(at)cybertec(dot)at>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Attempt to consolidate reading of XLOG page
Date: 2019-11-20 08:38:02
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Nov 18, 2019 at 09:29:03PM +0900, Michael Paquier wrote:
> Now, read() > pread() > read()+lseek(), and we don't actually need to
> seek into the file for all the cases where we read a WAL page. And on
> a platform which uses the fallback implementation, this increases the
> number of lseek() calls. I can see as you say that using it directly
> in the refactoring can simplify the code.

Putting this point aside, here is the error coming from
contrib/test_decoding/, and this is independent of Alvaro's changes:
+ERROR: invalid magic number 0000 in log segment
000000010000000000000001, offset 6905856

I don't think that this is just xlp_magic messed up, the full page
read is full of zeros. But that's just a guess.

Looking at the code, I am spotting one inconsistency in the way
seg->ws_off is compiled after doing the read on the new version
compared to the three others. read() would move the offset of the
file, but the code is forgetting to increment it by a amount of
readbytes. Isn't that incorrect?

A second thing is that wal_segment_open() definition is incorrect in
xlogutils.c, generating a warning. The opened fd is the returned
result, and not an argument of the routine.

I am switching the patch as waiting on author. Antonin, could you
look at those problems?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Khandekar 2019-11-20 08:48:08 Re: logical decoding : exceeded maxAllocatedDescs for .spill files
Previous Message Amit Khandekar 2019-11-20 08:32:33 Re: logical decoding : exceeded maxAllocatedDescs for .spill files