Re: [HACKERS] logical decoding of two-phase transactions

Поиск
Список
Период
Сортировка
От Petr Jelinek
Тема Re: [HACKERS] logical decoding of two-phase transactions
Дата
Msg-id 380de666-a30e-8f99-1fac-0002bce60a1d@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] logical decoding of two-phase transactions  (Nikhil Sontakke <nikhils@2ndquadrant.com>)
Список pgsql-hackers
Hi,

I think the difference between abort and abort prepared should be
explained better (I am not quite sure I get it myself).

> +      The required <function>abort_cb</function> callback is called whenever

Also, why is this one required when all the 2pc stuff is optional?

> +static void
> +DecodePrepare(LogicalDecodingContext *ctx, XLogRecordBuffer *buf,
> +              xl_xact_parsed_prepare * parsed)
> +{
> +    XLogRecPtr    origin_lsn = parsed->origin_lsn;
> +    TimestampTz commit_time = parsed->origin_timestamp;
> +    XLogRecPtr    origin_id = XLogRecGetOrigin(buf->record);
> +    TransactionId xid = parsed->twophase_xid;
> +    bool        skip;
> +
> +    Assert(parsed->dbId != InvalidOid);
> +    Assert(TransactionIdIsValid(parsed->twophase_xid));
> +
> +    /* Whether or not this PREPARE needs to be skipped. */
> +    skip = DecodeEndOfTxn(ctx, buf, parsed, xid);
> +
> +    FinalizeTxnDecoding(ctx, buf, parsed, xid, skip);

Given that DecodeEndOfTxn calls SnapBuildCommitTxn, won't this make the
catalog changes done by prepared transaction visible to other
transactions (which is undesirable as they should only be visible after
it's committed) ?

> +    if (unlikely(TransactionIdIsValid(CheckXidAlive) &&
> +        !(IsCatalogRelation(scan->rs_rd) ||
> +          RelationIsUsedAsCatalogTable(scan->rs_rd))))
> +        ereport(ERROR,
> +            (errcode(ERRCODE_INVALID_TRANSACTION_STATE),
> +             errmsg("improper heap_getnext call")));
> +
I think we should log the relation oid as well so that plugin developers
have easier time debugging this (for all variants of this).


-- 
  Petr Jelinek                  http://www.2ndQuadrant.com/
  PostgreSQL Development, 24x7 Support, Training & Services


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: House style for DocBook documentation?
Следующее
От: Nick B
Дата:
Сообщение: pg_basebackup, walreceiver and wal_sender_timeout