pgsql: Remove unnecessary overhead in backend's large-object operations - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Remove unnecessary overhead in backend's large-object operations
Date
Msg-id E1TLgZ7-0000Zh-Fw@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/7e0cce0265921dca2e8ea9485c194465a7e19703

Modified Files
--------------
src/backend/libpq/be-fsstubs.c             |  133 +++++++++++++++------------
src/backend/storage/large_object/inv_api.c |   30 +------
src/include/storage/large_object.h         |   14 ++-
3 files changed, 88 insertions(+), 89 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: Fix thinko in previous commit
Next
From: Tom Lane
Date:
Subject: pgsql: Fix PGXS support for building loadable modules on AIX.