Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-12 Thread Thomas Munro
On Fri, Jul 13, 2018 at 6:52 AM, Tom Lane wrote: > Thomas Munro writes: >> I suppose the call to AcceptInvalidationMessages() could go at the end >> of ClientAuthentication(). That'd be closer to the code that creates >> the negative entry and immediately after the code that might modify >> the

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-12 Thread Tom Lane
Thomas Munro writes: > On Thu, Jul 5, 2018 at 9:35 AM, Tom Lane wrote: >> That seems like a *really* ad-hoc place to put it. Why should it be >> there, and not (say) somewhere inside InitializeSessionUserId, or maybe >> (also?) inside PerformAuthentication? Why do the existing call sites for >>

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-05 Thread Thomas Munro
On Fri, Jul 6, 2018 at 1:50 AM, Stephen Frost wrote: > What if we (optionally, of course) had an always-running background > worker which connects to AD and streams down the changes happening by > using AD's Change Notification system: > > https://docs.microsoft.com/en-us/windows/desktop/AD/change

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-05 Thread Stephen Frost
Greetings Thomas, * Thomas Munro (thomas.mu...@enterprisedb.com) wrote: > Many people use custom scripts, ldap2pg or other similar tools to > synchronise or manage their PostgreSQL roles from an LDAP server. While I don't have any particular opinion on the proposed patch, I wanted to share a thou

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-05 Thread Thomas Munro
On Thu, Jul 5, 2018 at 9:35 AM, Tom Lane wrote: > Thomas Munro writes: >> PerformAuthentication(MyProcPort); >> + AcceptInvalidationMessages(); >> InitializeSessionUserId(username, useroid); > > That seems like a *really* ad-hoc place to put it. Why

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-04 Thread Tom Lane
Thomas Munro writes: > I'd like to do this to postinit.c: > PerformAuthentication(MyProcPort); > + AcceptInvalidationMessages(); > InitializeSessionUserId(username, useroid); > Any objections? That seems like a *really* ad-hoc place to put it. Why

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-04 Thread Thomas Munro
On Wed, Jul 4, 2018 at 4:35 PM, Michael Paquier wrote: > I wanted to comment on that this morning but forgot as my mind was > driven away by another problem. What if you used the Julien-Rouhaud's > method of a custom script with only ";" used as query and -c? This > won't run any queries, and wi

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-03 Thread Michael Paquier
On Wed, Jul 04, 2018 at 04:25:18PM +1200, Thomas Munro wrote: > Yeah, using "pgbench -c 8 -j 8 -T 60 --connect -S -M prepared > postgres" I wasn't able to measure a significant difference on my > laptop. The performance was equally terrible, at around 940 TPS +/- > 10 including connection time. A

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-03 Thread Andres Freund
On 2018-07-04 16:25:18 +1200, Thomas Munro wrote: > @@ -745,6 +746,7 @@ InitPostgres(const char *in_dbname, Oid dboid, const char > *username, > /* normal multiuser case */ > Assert(MyProcPort != NULL); > PerformAuthentication(MyProcPort); > +

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-03 Thread Thomas Munro
On Wed, Jul 4, 2018 at 12:10 PM, Andres Freund wrote: > On 2018-07-03 19:44:21 -0400, Alvaro Herrera wrote: >> On 2018-Jul-04, Thomas Munro wrote: >> > PerformAuthentication(MyProcPort); >> > + AcceptInvalidationMessages(); >> > InitializeSessionUserId

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-03 Thread Andres Freund
Hi, On 2018-07-03 19:44:21 -0400, Alvaro Herrera wrote: > On 2018-Jul-04, Thomas Munro wrote: > > > Hello hackers, > > > > I'd like to do this to postinit.c: > > > > PerformAuthentication(MyProcPort); > > + AcceptInvalidationMessages(); > > Initiali

Re: Cache invalidation after authentication (on-the-fly role creation)

2018-07-03 Thread Alvaro Herrera
On 2018-Jul-04, Thomas Munro wrote: > Hello hackers, > > I'd like to do this to postinit.c: > > PerformAuthentication(MyProcPort); > + AcceptInvalidationMessages(); > InitializeSessionUserId(username, useroid); > > Any objections? Is there a measur

Cache invalidation after authentication (on-the-fly role creation)

2018-07-03 Thread Thomas Munro
Hello hackers, I'd like to do this to postinit.c: PerformAuthentication(MyProcPort); + AcceptInvalidationMessages(); InitializeSessionUserId(username, useroid); Any objections? Motivation: Many people use custom scripts, ldap2pg or other similar to