Re: Fix races conditions in DropRole() and GrantRole() - Mailing list pgsql-hackers

From surya poondla
Subject Re: Fix races conditions in DropRole() and GrantRole()
Date
Msg-id CAOVWO5ooRh++Nnn23UJDV3Pmnu8VORKhj8M4sZyE5XWbBHMcaw@mail.gmail.com
Whole thread
In response to Re: Fix races conditions in DropRole() and GrantRole()  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: Fix races conditions in DropRole() and GrantRole()
List pgsql-hackers
Hi Bertrand,

I reviewed the v4 patch, the OID-based error message and the CURRENT_USER
permutation both look good.

One minor note on the new permutation: it grants first and drops second, so
s1 already holds AccessShareLock on the member when s2's DROP arrives.
That exercises the lock/no-orphan path, but the DROP just waits and the recheck
never fails, so the "role with OID %u does not exist" branch itself still isn't covered.
If we reorder like the DROP commits before the GRANT i.e (s1 SET ROLE,
s2 DROP, then s1 GRANT ... TO CURRENT_USER) this would exercise that error path.
It is not essential, because the code there is now straightforward.

Otherwise this looks ready to me.

Regards,
Surya Poondla

pgsql-hackers by date:

Previous
From: Christoph Berg
Date:
Subject: Re: PG20 Minimum Dependency Thread
Next
From: Fujii Masao
Date:
Subject: Re: Restrict data checksums entries in pg_stat_io