Re: [HACKERS] Transactions involving multiple postgres foreign servers

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Antonin Houska <ah(at)cybertec(dot)at>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] Transactions involving multiple postgres foreign servers
Date: 2018-02-08 08:58:31
Message-ID: CAD21AoA5WbT93FxRdYAsLsVyUhouN1iGJ5UG87fymh1M4oLf-Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 8, 2018 at 3:11 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Jan 9, 2018 at 9:49 AM, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>>> If I understand correctly, XactLastRecEnd can be set by, for example,
>>> a HOT cleanup record, so that doesn't seem like a good thing to use.
>>
>> Yes, that's right.
>>
>>> Whether we need to use 2PC across remote nodes seems like it shouldn't
>>> depend on whether a local SELECT statement happened to do a HOT
>>> cleanup or not.
>>
>> So I think we need to check if the top transaction is invalid or not as well.
>
> Even if you check both, it doesn't sound like it really does what you
> want. Won't you still end up partially dependent on whether a HOT
> cleanup happened, if not in quite the same way as before? How about
> defining a new bit in MyXactFlags for XACT_FLAGS_WROTENONTEMPREL?
> Just have heap_insert, heap_update, and heap_delete do something like:
>
> if (RelationNeedsWAL(relation))
> MyXactFlags |= XACT_FLAGS_WROTENONTEMPREL;

Agreed.

>
> Overall, what's the status of this patch? Are we hung up on this
> issue only, or are there other things?

AFAIK there is no more technical issue in this patch so far other than
this issue. The patch has tests and docs, and includes all stuff to
support atomic commit to distributed transactions: the introducing
both the atomic commit ability to distributed transactions and some
corresponding FDW APIs, and having postgres_fdw support 2pc. I think
this patch needs to be reviewed, especially the functionality of
foreign transaction resolution which is re-designed before.

The previous patches doesn't apply cleanly to current HEAD and I've
fixed some issues. Attached latest patch set.

Regards,

--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachment Content-Type Size
0001-Keep-track-of-writing-on-non-temporary-relation_v15.patch application/octet-stream 1.9 KB
0002-Support-atomic-commit-involving-multiple-foreign-ser_v15.patch application/octet-stream 164.5 KB
0003-postgres_fdw-supports-atomic-distributed-transaction_v15.patch application/octet-stream 48.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2018-02-08 09:04:15 Re: [HACKERS] More stats about skipped vacuums
Previous Message Amit Langote 2018-02-08 07:55:33 Re: [HACKERS] path toward faster partition pruning