]> granicus.if.org Git - postgresql/commit
Remove unnecessary overhead in backend's large-object operations.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 9 Oct 2012 20:38:00 +0000 (16:38 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 9 Oct 2012 20:38:00 +0000 (16:38 -0400)
commit7e0cce0265921dca2e8ea9485c194465a7e19703
tree1732f2188c3fac94fbccda894bb78e2268b36f96
parent2d8c81ac867d919b7d11120b01a6a327fef6a2ef
Remove unnecessary overhead in backend's large-object operations.

Do read/write permissions checks at most once per large object descriptor,
not once per lo_read or lo_write call as before.  The repeated tests were
quite useless in the read case since the snapshot-based tests were
guaranteed to produce the same answer every time.  In the write case,
the extra tests could in principle detect revocation of write privileges
after a series of writes has started --- but there's a race condition there
anyway, since we'd check privileges before performing and certainly before
committing the write.  So there's no real advantage to checking every
single time, and we might as well redefine it as "only check the first
time".

On the same reasoning, remove the LargeObjectExists checks in inv_write
and inv_truncate.  We already checked existence when the descriptor was
opened, and checking again doesn't provide any real increment of safety
that would justify the cost.
src/backend/libpq/be-fsstubs.c
src/backend/storage/large_object/inv_api.c
src/include/storage/large_object.h