Lists: | pgsql-committerspgsql-hackers |
---|
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 15:25:34 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Add hooks for session start and session end
These hooks can be used in loadable modules. A simple test module is
included.
Discussion: https://postgr.es/m/[email protected]
Fabrízio de Royes Mello and Yugo Nagata
Reviewed by Michael Paquier and Aleksandr Parfenov
Branch
------
master
Modified Files
--------------
src/backend/tcop/postgres.c | 6 +
src/backend/utils/init/postinit.c | 6 +
src/include/tcop/tcopprot.h | 7 ++
src/test/modules/Makefile | 1 +
src/test/modules/test_session_hooks/.gitignore | 4 +
src/test/modules/test_session_hooks/Makefile | 21 ++++
src/test/modules/test_session_hooks/README | 2 +
.../expected/test_session_hooks.out | 31 +++++
.../modules/test_session_hooks/session_hooks.conf | 2 +
.../test_session_hooks/sql/test_session_hooks.sql | 12 ++
.../test_session_hooks/test_session_hooks--1.0.sql | 4 +
.../test_session_hooks/test_session_hooks.c | 134 +++++++++++++++++++++
.../test_session_hooks/test_session_hooks.control | 3 +
13 files changed, 233 insertions(+)
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 16:50:11 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Add hooks for session start and session end
Buildfarm doesn't like this one bit :-(
regards, tom lane
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 18:03:45 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
On 11/15/2017 11:50 AM, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>> Add hooks for session start and session end
> Buildfarm doesn't like this one bit :-(
>
>
Strange, it worked when I tested. I'll look into it.
cheers
andrew
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 18:56:05 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 11/15/2017 11:50 AM, Tom Lane wrote:
>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>> Add hooks for session start and session end
>> Buildfarm doesn't like this one bit :-(
> Strange, it worked when I tested. I'll look into it.
Looks to me like the problem is that the test can only work in "check"
mode, not "installcheck" mode, because in the latter case you don't
get to do preloaded libraries.
regards, tom lane
From: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 19:17:26 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
On 11/15/2017 01:56 PM, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>> On 11/15/2017 11:50 AM, Tom Lane wrote:
>>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>>> Add hooks for session start and session end
>>> Buildfarm doesn't like this one bit :-(
>> Strange, it worked when I tested. I'll look into it.
> Looks to me like the problem is that the test can only work in "check"
> mode, not "installcheck" mode, because in the latter case you don't
> get to do preloaded libraries.
>
>
Yeah, that was my first instinct. But then how do the test_rls_hooks
tests succeed? They too have a shared_preload_library.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 21:11:13 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
On 11/15/2017 02:17 PM, Andrew Dunstan wrote:
>
> On 11/15/2017 01:56 PM, Tom Lane wrote:
>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>> On 11/15/2017 11:50 AM, Tom Lane wrote:
>>>> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>>>>> Add hooks for session start and session end
>>>> Buildfarm doesn't like this one bit :-(
>>> Strange, it worked when I tested. I'll look into it.
>> Looks to me like the problem is that the test can only work in "check"
>> mode, not "installcheck" mode, because in the latter case you don't
>> get to do preloaded libraries.
>>
>>
>
>
> Yeah, that was my first instinct. But then how do the test_rls_hooks
> tests succeed? They too have a shared_preload_library.
>
Aha, it does
LOAD 'test_rls_hooks';
at the start of its script. Of course we can't do that here.
Not sure what the best way to resolve this is. For now I'm inclined just
to override the installcheck target in the module's makefile and disable
it in vcregress.pl.
Maybe we need to shift from installcheck to check mode for these
modules. That would involve a buildfarm script change.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
Cc: | pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 21:30:44 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
> On 11/15/2017 02:17 PM, Andrew Dunstan wrote:
>> Yeah, that was my first instinct. But then how do the test_rls_hooks
>> tests succeed? They too have a shared_preload_library.
> Aha, it does
> LOAD 'test_rls_hooks';
> at the start of its script. Of course we can't do that here.
> Not sure what the best way to resolve this is. For now I'm inclined just
> to override the installcheck target in the module's makefile and disable
> it in vcregress.pl.
Yeah.
> Maybe we need to shift from installcheck to check mode for these
> modules. That would involve a buildfarm script change.
Seems like expending an awful lot of cycles in support of a rather trivial
feature.
regards, tom lane
From: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 21:53:17 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
On 11/15/2017 04:30 PM, Tom Lane wrote:
> Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
>> On 11/15/2017 02:17 PM, Andrew Dunstan wrote:
>>> Yeah, that was my first instinct. But then how do the test_rls_hooks
>>> tests succeed? They too have a shared_preload_library.
>> Aha, it does
>> LOAD 'test_rls_hooks';
>> at the start of its script. Of course we can't do that here.
>> Not sure what the best way to resolve this is. For now I'm inclined just
>> to override the installcheck target in the module's makefile and disable
>> it in vcregress.pl.
> Yeah.
>
>> Maybe we need to shift from installcheck to check mode for these
>> modules. That would involve a buildfarm script change.
> Seems like expending an awful lot of cycles in support of a rather trivial
> feature.
Possibly. At any rate I'm not going to do it immediately.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-15 22:07:33 |
Message-ID: | CAB7nPqTQQm0vs+BqXv+QRqUPhjPAYihb9NQwOrHG8dxvjMzhpg@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
On Thu, Nov 16, 2017 at 6:53 AM, Andrew Dunstan
<andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
> On 11/15/2017 04:30 PM, Tom Lane wrote:
>> Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
>>> On 11/15/2017 02:17 PM, Andrew Dunstan wrote:
>>>> Yeah, that was my first instinct. But then how do the test_rls_hooks
>>>> tests succeed? They too have a shared_preload_library.
>>> Aha, it does
>>> LOAD 'test_rls_hooks';
>>> at the start of its script. Of course we can't do that here.
>>> Not sure what the best way to resolve this is. For now I'm inclined just
>>> to override the installcheck target in the module's makefile and disable
>>> it in vcregress.pl.
>> Yeah.
>>
>>> Maybe we need to shift from installcheck to check mode for these
>>> modules. That would involve a buildfarm script change.
>> Seems like expending an awful lot of cycles in support of a rather trivial
>> feature.
>
> Possibly. At any rate I'm not going to do it immediately.
So why not just nuking it from the core code? The test module is
basically dead code now, and has been useful during review to check
that the positions of the hooks are adapted to run SQL queries at
session start and end. I don't mind to include it in my own set of
plugins on github instead.
--
Michael
From: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-16 01:26:35 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
On 11/15/2017 05:07 PM, Michael Paquier wrote:
> On Thu, Nov 16, 2017 at 6:53 AM, Andrew Dunstan
> <andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
>> On 11/15/2017 04:30 PM, Tom Lane wrote:
>>> Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
>>>> On 11/15/2017 02:17 PM, Andrew Dunstan wrote:
>>>>> Yeah, that was my first instinct. But then how do the test_rls_hooks
>>>>> tests succeed? They too have a shared_preload_library.
>>>> Aha, it does
>>>> LOAD 'test_rls_hooks';
>>>> at the start of its script. Of course we can't do that here.
>>>> Not sure what the best way to resolve this is. For now I'm inclined just
>>>> to override the installcheck target in the module's makefile and disable
>>>> it in vcregress.pl.
>>> Yeah.
>>>
>>>> Maybe we need to shift from installcheck to check mode for these
>>>> modules. That would involve a buildfarm script change.
>>> Seems like expending an awful lot of cycles in support of a rather trivial
>>> feature.
>> Possibly. At any rate I'm not going to do it immediately.
> So why not just nuking it from the core code? The test module is
> basically dead code now, and has been useful during review to check
> that the positions of the hooks are adapted to run SQL queries at
> session start and end. I don't mind to include it in my own set of
> plugins on github instead.
It's not dead at all. "make check" works just fine. It would be possible
to create a trivial buildfarm module to run that if we wanted to.
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-committers(at)postgresql(dot)org |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-16 12:18:23 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
Greetings,
* Andrew Dunstan (andrew(dot)dunstan(at)2ndquadrant(dot)com) wrote:
> On 11/15/2017 04:30 PM, Tom Lane wrote:
> > Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
> >> Maybe we need to shift from installcheck to check mode for these
> >> modules. That would involve a buildfarm script change.
> > Seems like expending an awful lot of cycles in support of a rather trivial
> > feature.
>
> Possibly. At any rate I'm not going to do it immediately.
This is something that's bitten us a few times with various test
modules, so I don't think that effort would be wasted.
Thanks!
Stephen
From: | Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-16 17:00:31 |
Message-ID: | CAFcNs+oOevy-ghcswRU2Rd5wWWaMV0kYAo9Xhp3M-HuKXPgmFg@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
On Wed, Nov 15, 2017 at 11:26 PM, Andrew Dunstan <
andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
>
>
> On 11/15/2017 05:07 PM, Michael Paquier wrote:
> > On Thu, Nov 16, 2017 at 6:53 AM, Andrew Dunstan
> > <andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
> >> On 11/15/2017 04:30 PM, Tom Lane wrote:
> >>> Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
> >>>> On 11/15/2017 02:17 PM, Andrew Dunstan wrote:
> >>>>> Yeah, that was my first instinct. But then how do the test_rls_hooks
> >>>>> tests succeed? They too have a shared_preload_library.
> >>>> Aha, it does
> >>>> LOAD 'test_rls_hooks';
> >>>> at the start of its script. Of course we can't do that here.
> >>>> Not sure what the best way to resolve this is. For now I'm inclined
just
> >>>> to override the installcheck target in the module's makefile and
disable
> >>>> it in vcregress.pl.
> >>> Yeah.
> >>>
> >>>> Maybe we need to shift from installcheck to check mode for these
> >>>> modules. That would involve a buildfarm script change.
> >>> Seems like expending an awful lot of cycles in support of a rather
trivial
> >>> feature.
> >> Possibly. At any rate I'm not going to do it immediately.
> > So why not just nuking it from the core code? The test module is
> > basically dead code now, and has been useful during review to check
> > that the positions of the hooks are adapted to run SQL queries at
> > session start and end. I don't mind to include it in my own set of
> > plugins on github instead.
>
>
> It's not dead at all. "make check" works just fine. It would be possible
> to create a trivial buildfarm module to run that if we wanted to.
>
Hi Mr.,
Sorry for disturbing you, but the patch status was changed for "Waiting on
author" [1]. It's an accidental change?
Regards,
[1] https://commitfest.postgresql.org/15/1318/
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello
From: | Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com> |
---|---|
To: | Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pgsql: Add hooks for session start and session end |
Date: | 2017-11-16 17:11:43 |
Message-ID: | CAFcNs+qOejBuZ69wCODBOKF9wCR29q1N9qFOEhnno-mzMeySVQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-committers pgsql-hackers |
On Thu, Nov 16, 2017 at 3:00 PM, Fabrízio de Royes Mello <
fabriziomello(at)gmail(dot)com> wrote:
>
>
>
> On Wed, Nov 15, 2017 at 11:26 PM, Andrew Dunstan <
andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
> >
> >
> > On 11/15/2017 05:07 PM, Michael Paquier wrote:
> > > On Thu, Nov 16, 2017 at 6:53 AM, Andrew Dunstan
> > > <andrew(dot)dunstan(at)2ndquadrant(dot)com> wrote:
> > >> On 11/15/2017 04:30 PM, Tom Lane wrote:
> > >>> Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
> > >>>> On 11/15/2017 02:17 PM, Andrew Dunstan wrote:
> > >>>>> Yeah, that was my first instinct. But then how do the
test_rls_hooks
> > >>>>> tests succeed? They too have a shared_preload_library.
> > >>>> Aha, it does
> > >>>> LOAD 'test_rls_hooks';
> > >>>> at the start of its script. Of course we can't do that here.
> > >>>> Not sure what the best way to resolve this is. For now I'm
inclined just
> > >>>> to override the installcheck target in the module's makefile and
disable
> > >>>> it in vcregress.pl.
> > >>> Yeah.
> > >>>
> > >>>> Maybe we need to shift from installcheck to check mode for these
> > >>>> modules. That would involve a buildfarm script change.
> > >>> Seems like expending an awful lot of cycles in support of a rather
trivial
> > >>> feature.
> > >> Possibly. At any rate I'm not going to do it immediately.
> > > So why not just nuking it from the core code? The test module is
> > > basically dead code now, and has been useful during review to check
> > > that the positions of the hooks are adapted to run SQL queries at
> > > session start and end. I don't mind to include it in my own set of
> > > plugins on github instead.
> >
> >
> > It's not dead at all. "make check" works just fine. It would be possible
> > to create a trivial buildfarm module to run that if we wanted to.
> >
>
> Hi Mr.,
>
> Sorry for disturbing you, but the patch status was changed for "Waiting
on author" [1]. It's an accidental change?
>
> Regards,
>
> [1] https://commitfest.postgresql.org/15/1318/
>
Sorry, by the noise... now I've saw all problems related and the commit was
reverted... I'll look into it.
Regards,
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello