Function to get a txn's replication origin

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Function to get a txn's replication origin
Дата
Msg-id CAMsr+YG_oF1694esChGSCJvrvLk9n9HbJvV0NYuS5c3ciuv_xQ@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
Hi all

During the committs / replorigin split, the function to query the replication origin of a transaction from user space was lost.

A function to do so is utterly trivial, e.g.

Datum
pg_get_xact_replication_origin(PG_FUNCTION_ARGS)
{   
    TransactionId xid = PG_GETARG_TRANSACTIONID(0);
    TimestampTz ts;
    RepOriginId nodeid;
    
    if (TransactionIdGetCommitTsData(xid, &ts, &nodeid))
        PG_RETURN_INT32((int32)nodeid);
    else
        PG_RETURN_NULL();
}

... but it probably makes more sense to extend pg_xact_commit_timestamp with support for returning the origin too.

pg_xact_commit_timestamp() is a scalar function so I don't want to extend it directly because that'll upset existing callers.

pg_xact_commit_timestamp_origin()

(unsure if a "with" or "and" is appropriate or too long).

Attached. Also add 'roident' to pg_last_committed_xact() to make the info available there too. It was already record-returning so I'm not overly concerned about adding a column.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
Вложения

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

Предыдущее
От: Pavan Deolasee
Дата:
Сообщение: Re: PATCH: Exclude unlogged tables from base backups
Следующее
От: Dmitry Ivanov
Дата:
Сообщение: Re: new function for tsquery creartion