Re: Speedup twophase transactions

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Speedup twophase transactions
Date: 2016-01-12 06:41:29
Message-ID: CAB7nPqT0YaEXdvf9s4cJ3ZkZ+oFdn-t8Z0dBQsCm-GvuF42M-g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 12, 2016 at 3:35 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Tue, Jan 12, 2016 at 4:57 AM, Simon Riggs <simon(at)2ndquadrant(dot)com> wrote:
>> Performance tests for me show that the patch is effective; my results match
>> Jesper's roughly in relative numbers.
>>
>> My robustness review is that the approach and implementation are safe.
>>
>> It's clear there are various additional tuning opportunities, but the
>> objective of the current patch to improve performance is very, very clearly
>> met, so I'm aiming to commit *this* patch soon.
>
> - /* initialize LSN to 0 (start of WAL) */
> - gxact->prepare_lsn = 0;
> + /* initialize LSN to InvalidXLogRecPtr */
> + gxact->prepare_start_lsn = InvalidXLogRecPtr;
> + gxact->prepare_end_lsn = InvalidXLogRecPtr;
>
> I think that it would be better to explicitly initialize gxact->ondisk
> to false here.
>
> + xlogreader = XLogReaderAllocate(&logical_read_local_xlog_page, NULL);
> + if (!xlogreader)
> + ereport(ERROR,
> + (errcode(ERRCODE_OUT_OF_MEMORY),
> + errmsg("out of memory"),
> + errdetail("Failed while allocating an
> XLog reading processor.")));
> Depending on something that is part of logical decoding to decode WAL
> is not a good idea. If you want to move on with this approach, you
> should have a dedicated function. Even better, it would be nice to
> come up with a generic function used by both 2PC and logical decoding.

+ if (log_checkpoints && n > 0)
+ ereport(LOG,
+ (errmsg("%u two-phase state files were written "
+ "for long-running
prepared transactions",
+ n)));
This would be better as an independent change. That looks useful for
debugging, and I guess that's why you added it.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marisa Emerson 2016-01-12 07:27:41 Re: Proposal: BSD Authentication support
Previous Message Michael Paquier 2016-01-12 06:35:55 Re: Speedup twophase transactions