Re: Transactions involving multiple postgres foreign servers, take 2

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: tsunakawa(dot)takay(at)fujitsu(dot)com
Cc: sawada(dot)mshk(at)gmail(dot)com, ikedamsh(at)oss(dot)nttdata(dot)com, zyu(at)yugabyte(dot)com, ibrar(dot)ahmad(at)gmail(dot)com, masao(dot)fujii(at)oss(dot)nttdata(dot)com, masahiko(dot)sawada(at)2ndquadrant(dot)com, ashutosh(dot)bapat(dot)oss(at)gmail(dot)com, amit(dot)kapila16(at)gmail(dot)com, m(dot)usama(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org, sulamul(at)gmail(dot)com, alvherre(at)2ndquadrant(dot)com, thomas(dot)munro(at)gmail(dot)com, ildar(at)adjust(dot)com, horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp, chris(dot)travers(at)adjust(dot)com, robertmhaas(at)gmail(dot)com, ishii(at)sraoss(dot)co(dot)jp
Subject: Re: Transactions involving multiple postgres foreign servers, take 2
Date: 2021-06-08 08:09:58
Message-ID: 20210608.170958.105249341385152946.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(I have caught up here. Sorry in advance for possible pointless
discussion by me..)

At Tue, 8 Jun 2021 00:47:08 +0000, "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com> wrote in
> From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
> > I think we should not reinterpret the severity of the error and lower
> > it. Especially, in this case, any kind of errors can be thrown. It
> > could be such a serious error that FDW developer wants to report to
> > the client. Do we lower even PANIC to a lower severity such as
> > WARNING? That's definitely a bad idea. If we don’t lower PANIC whereas
> > lowering ERROR (and FATAL) to WARNING, why do we regard only them as
> > non-error?
>
> Why does the client have to know the error on a remote server, whereas the global transaction itself is destined to commit?

I think the discussion is based the behavior that any process that is
responsible for finishing the 2pc-commit continue retrying remote
commits until all of the remote-commits succeed.

Maybe in most cases the errors duing remote-prepared-commit could be
retry-able but as Sawada-san says I'm also not sure it's always the
case. On the other hand, it could be said that we have no other way
than retrying the remote-commits if we want to get over, say, instant
network failures automatically. It is somewhat similar to
WAL-restoration that continues complaining for recovery_commands
failure without exiting.

> FYI, the tx_commit() in the X/Open TX interface and the UserTransaction.commit() in JTA don't return such an error, IIRC. Do TX_FAIL and SystemException serve such a purpose? I don't feel like that.

I'm not sure about how JTA works in detail, but doesn't
UserTransaction.commit() return HeuristicMixedExcpetion when some of
relevant updates have been committed but other not? Isn't it the same
state with the case where some of the remote servers failed on
remote-commit while others are succeeded? (I guess that
UserTransaction.commit() would throw RollbackException if
remote-prepare has been failed for any of the remotes.)

> [Tuxedo manual (Japanese)]
> https://docs.oracle.com/cd/F25597_01/document/products/tuxedo/tux80j/atmi/rf3c91.htm
>
>
> [JTA]
> public interface javax.transaction.UserTransaction
> public void commit()
> throws RollbackException, HeuristicMixedException,
> HeuristicRollbackException, SecurityException,
> IllegalStateException, SystemException
>
> Throws: RollbackException
> Thrown to indicate that the transaction has been rolled back rather than committed.
>
> Throws: HeuristicMixedException
> Thrown to indicate that a heuristic decision was made and that some relevant updates have been
> committed while others have been rolled back.
>
> Throws: HeuristicRollbackException
> Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled
> back.
>
> Throws: SecurityException
> Thrown to indicate that the thread is not allowed to commit the transaction.
>
> Throws: IllegalStateException
> Thrown if the current thread is not associated with a transaction.
>
> Throws: SystemException
> Thrown if the transaction manager encounters an unexpected error condition.
>
>
> Regards
> Takayuki Tsunakawa

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-06-08 08:11:51 Re: Transactions involving multiple postgres foreign servers, take 2
Previous Message osumi.takamichi@fujitsu.com 2021-06-08 08:03:59 RE: locking [user] catalog tables vs 2pc vs logical rep