vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? Zdenek ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| |||
| 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. (Hint: what it actually means by "function" is "the plpgsql function cache entry I just found or built".) regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| 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 ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly |
| ||||
| Zdenek Kotala <Zdenek.Kotala@Sun.COM> writes: > Tom Lane wrote: >> 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? Right. Once a function cache entry is set up, it exists unchanged until no longer in use, no matter what happens to the underlying pg_proc row. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings |
| Thread Tools | |
| Display Modes | |
|
|