pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zdenek Kotala <Zdenek.Kotala@Sun.COM>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: race condition in pgplsql call handler?
Date: Fri, 11 May 2007 15:39:50 +0200
Message-ID: <46447226.1020401@sun.com> (raw)
In-Reply-To: <17475.1178888659@sss.pgh.pa.us>
References: <464427E9.6030101@sun.com>
	<17475.1178888659@sss.pgh.pa.us>

Tom Lane wrote:
> Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes:
>> I'm looking into PG/PLSql code and following code in 
>> plpgsql_call_handler looks strange:
> 
>>          /* Find or compile the function */
>>          func = plpgsql_compile(fcinfo, false);
> 
>>          /* Mark the function as busy, so it can't be deleted from under 
>> us */
>>          func->use_count++;
> 
> 
>> I don't have deep knowledge about this part of code. But what happen if 
>> in parallel execution "func" will be deleted between these two lines?
> 
> This is not a race condition because the backend is single-threaded.

I see. Each backend has own function cache and use_count is for handle 
recursion usage. Are my assumption correct?

		thanks Zdenek



view thread (4+ messages)  latest in thread

Message-ID: <46447226.1020401@sun.com>
Permalink:  ../46447226.1020401@sun.com/
Also on:    postgresql.org/message-id/46447226.1020401@sun.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: Zdenek.Kotala@Sun.COM, tgl@sss.pgh.pa.us
  Subject: Re: race condition in pgplsql call handler?
  In-Reply-To: <46447226.1020401@sun.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox