Re: What happens to transactions durring a pg_dump?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: What happens to transactions durring a pg_dump?
Дата
Msg-id 2754.1137891042@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: What happens to transactions durring a pg_dump?  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-admin
Bruno Wolff III <bruno@wolff.to> writes:
> I don't think that is precisely correct. I believe that the snapshot isn't
> set until the first query is made within the transaction.

Right.  Specifically, any statement *other* than those enumerated in
PortalRunUtility() will set the snapshot.  As of CVS tip (and for
several past releases IIRC), that code looks like:

    /*
     * Set snapshot if utility stmt needs one.    Most reliable way to do this
     * seems to be to enumerate those that do not need one; this is a short
     * list.  Transaction control, LOCK, and SET must *not* set a snapshot
     * since they need to be executable at the start of a serializable
     * transaction without freezing a snapshot.  By extension we allow SHOW
     * not to set a snapshot.  The other stmts listed are just efficiency
     * hacks.  Beware of listing anything that can modify the database --- if,
     * say, it has to update an index with expressions that invoke
     * user-defined functions, then it had better have a snapshot.
     */
    if (!(IsA(utilityStmt, TransactionStmt) ||
          IsA(utilityStmt, LockStmt) ||
          IsA(utilityStmt, VariableSetStmt) ||
          IsA(utilityStmt, VariableShowStmt) ||
          IsA(utilityStmt, VariableResetStmt) ||
          IsA(utilityStmt, ConstraintsSetStmt) ||
    /* efficiency hacks from here down */
          IsA(utilityStmt, FetchStmt) ||
          IsA(utilityStmt, ListenStmt) ||
          IsA(utilityStmt, NotifyStmt) ||
          IsA(utilityStmt, UnlistenStmt) ||
          IsA(utilityStmt, CheckPointStmt)))
        ActiveSnapshot = CopySnapshot(GetTransactionSnapshot());
    else
        ActiveSnapshot = NULL;


            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: PostgreSQL Lite Version
Следующее
От: "Ciprian Hodorogea"
Дата:
Сообщение: pg_dump - txt sql vs binary