Re: race condition in pgplsql call handler?

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

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.

(Hint: what it actually means by "function" is "the plpgsql function
cache entry I just found or built".)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zdenek Kotala 2007-05-11 13:39:50 Re: race condition in pgplsql call handler?
Previous Message Heikki Linnakangas 2007-05-11 11:41:36 Re: Logging checkpoints and other slowdown causes