• Tom Lane's avatar
    Remove unnecessary overhead in backend's large-object operations. · 7e0cce02
    Tom Lane authored
    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.
    7e0cce02
be-fsstubs.c 17.7 KB