Re: Sync Rep: First Thoughts on Code

From: Mark Mielke <mark(at)mark(dot)mielke(dot)cc>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: Markus Wanner <markus(at)bluegap(dot)ch>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, aidan(at)highrise(dot)ca, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Sync Rep: First Thoughts on Code
Date: 2008-12-14 23:53:01
Message-ID: 49459C5D.20506@mark.mielke.cc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas wrote:
> Mark Mielke wrote:
>> FYI: I haven't been able to prove this. Multiple sessions running on
>> my dual-core CPU seem to be able to see the latest commits before
>> they begin executing. Am I wrong about this? Does PostgreSQL provide
>> a intentional guarantee that a commit from one session that completes
>> immediately followed by a query from another session will always find
>> the commit effect visible (provide the transaction isolation level
>> doesn't get in the way)?
> Yes. PostgreSQL does guarantee that, and I would expect any other DBMS
> to do the same.

Where does the expectation come from? I don't recall ever reading it in
the documentation, and unless the session processes are contending over
the integers (using some sort of synchronization primitive) in memory
that represent the "latest visible commit" on every single select, I'm
wondering how it is accomplished? If they are contending over these
integers, doesn't that represent a scaling limitation, in the sense that
on a 32-core machine, they're going to be fighting with each other to
get the latest version of these shared integers into the CPU for
processing? Maybe it's such a small penalty that we don't care? :-)

I was never instilled with the logic that 'commit in one session
guarantees visibility of the effects in another session'. But, as I say
above, I wasn't able to make PostgreSQL "fail" in this regard. So maybe
I have no clue what I am talking about? :-)

If you happen to know where the code or documentation makes this
promise, feel free to point it out. I'd like to review the code. If you
don't know - don't worry about it, I'll find it later...

Cheers,
mark

--
Mark Mielke <mark(at)mielke(dot)cc>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2008-12-15 00:21:51 Re: Sync Rep: First Thoughts on Code
Previous Message Ron Mayer 2008-12-14 22:00:48 Re: Sync Rep: First Thoughts on Code