Re: race condition in pgplsql call handler? - Mailing list pgsql-hackers

From Zdenek Kotala
Subject Re: race condition in pgplsql call handler?
Date
Msg-id 46447226.1020401@sun.com
Whole thread Raw
In response to Re: race condition in pgplsql call handler?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: race condition in pgplsql call handler?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: race condition in pgplsql call handler?
Next
From: Tom Lane
Date:
Subject: Re: race condition in pgplsql call handler?