Re: [v9.3] OAT_POST_ALTER object access hooks

From: Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PgHacker <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [v9.3] OAT_POST_ALTER object access hooks
Date: 2012-12-03 14:41:44
Message-ID: CADyhKSXaXx4cEmphVjkisd_VfVAqVw7oO9iyEPuMiKyTH2jsfw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/12/3 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Tue, Nov 20, 2012 at 8:43 AM, Kohei KaiGai <kaigai(at)kaigai(dot)gr(dot)jp> wrote:
>> I'd like to have catalog/objectaccess.c to wrap-up invocation of hooks, rather
>> than doing all the stuffs with macros. It allows to use local variables, unlike
>> macros; that has a risk of naming conflict with temporary variable for
>> ObjectAccessPostCreate.
>>
>> So, how about to have a following definition for example?
>>
>> void
>> InvokePostAlterHookArgs(Oid classId, Oid objectId, int subId,
>> Oid auxiliaryId, bool is_internal)
>> {
>> if (object_access_hook)
>> {
>> ObjectAccessPostAlter pa_arg;
>>
>> memset(&pa_arg, 0, sizeof(ObjectAccessPostAlter));
>> pa_arg.auxiliary_id = auxiliary_id;
>> pa_arg.is_internal = is_internal;
>> (*object_access_hook)(OAT_POST_ALTER,
>> classId, objectId, subId,
>> (void *) &pa_arg);
>> }
>> }
>>
>> and
>>
>> #define InvokePostAlterHook(classId, objectId, subId) \
>> InvokePostAlterHookArgs(classId, objectId, subId, InvalidOid, false)
>>
>> for most points to call.
>
> This has the disadvantage of incurring the overhead of a function call
> even if (as will typically be the case) there is no object access
> hook. I still prefer having the if (object_access_hook) test in the
> macro, though of course I have no problem with having the macro call
> a function if it's set.
>
OK, I'll adjust the macro definitions to reduce empty function calls.

Thanks,
--
KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-12-03 14:48:10 Re: [PATCH 11/14] Introduce wal decoding via catalog timetravel
Previous Message Steve Singer 2012-12-03 14:35:55 Re: [PATCH 11/14] Introduce wal decoding via catalog timetravel