Command counter increment vs updating an active snapshot

From: Ozgun Erdogan <ozgune(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Command counter increment vs updating an active snapshot
Date: 2012-04-03 14:23:43
Message-ID: CANrodTQ-iOsPACHd5eR3UUGEFPvSGJdT+fzMkMF-FdpQbjLhJQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I'm looking into Postgres' internals, and had two quick questions that
are related to each other.

(1) What's the difference between advancing the command counter and
updating an active snapshot? For example, I see that DefineRelation()
increments the command counter, but explain.c / copy.c explicitly
calls UpdateActiveSnapshotCommandId(). Is that because the latter call
intends to make its changes visible to other concurrent processes?

(2) The following change in pquery.c asserts that, if more than one
utility statement exists in portal statements, they all have to be
Notify statements.

https://github.com/postgres/postgres/commit/c0b00760365c74308e9e0719c993eadfbcd090c2#diff-6

When I modify the code so that one statement in portal->stmts gets
translated into four separate statements that all depend on each other
(one planned, two utility, and another planned statement) and remove
the assertion, all four statements still run fine.

Looking into the code, I understand this isn't the expected behavior
in terms of snapshot handling. In what scenarios can I expect our code
to break?

Thanks,

Ozgun.

Browse pgsql-general by date

  From Date Subject
Next Message leaf_yxj 2012-04-03 14:24:24 Re: Please help me to take a look of the erros in my functions. Thanks.
Previous Message Adrian Klaver 2012-04-03 14:09:04 Re: Re: Please help me to take a look of the erros in my functions. Thanks.