Re: race condition in pgplsql call handler?

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: race condition in pgplsql call handler?
Date: 2007-05-11 13:39:50
Message-ID: 46447226.1020401@sun.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-05-11 13:51:25 Re: race condition in pgplsql call handler?
Previous Message Tom Lane 2007-05-11 13:04:19 Re: race condition in pgplsql call handler?