Re: Label switcher function

From: KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: KaiGai Kohei <kaigai(at)kaigai(dot)gr(dot)jp>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Label switcher function
Date: 2010-12-07 09:14:08
Message-ID: 4CFDFAE0.4010301@ak.jp.nec.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for your reviewing.

The attached patch is a revised version.
I don't have any objections to your comments.

(2010/12/07 4:38), Robert Haas wrote:
> 2010/11/25 KaiGai Kohei<kaigai(at)ak(dot)jp(dot)nec(dot)com>:
>> The attached patch is a revised one.
>>
>> It provides two hooks; the one informs core PG whether the supplied
>> function needs to be hooked, or not. the other is an actual hook on
>> prepare, start, end and abort of function invocations.
>>
>> typedef bool (*needs_function_call_type)(Oid fn_oid);
>>
>> typedef void (*function_call_type)(FunctionCallEventType event,
>> FmgrInfo *flinfo, Datum *private);
>>
>> The hook prototype was a bit modified since the suggestion from
>> Robert. Because FmgrInfo structure contain OID of the function,
>> it might be redundant to deliver OID of the function individually.
>>
>> Rest of parts are revised according to the comment.
>>
>> I also fixed up source code comments which might become incorrect.
>
> FCET_PREPARE looks completely unnecessary to me. Any necessary
> one-time work can easily be done at FCET_START time, assuming that the
> private-data field is initialized to (Datum) 0.
>
It seems to me a reasonable assumption.
I revised the code, and modified source code comments to ensure
the private shall be initialized to (Datum) 0.

> I'm fairly certain that the following is not portable:
>
> + ObjectAddress object = { .classId = ProcedureRelationId,
> + .objectId = fn_oid,
> + .objectSubId = 0 };
>
Fixed.

> I'd suggest renaming needs_function_call_type and function_call_type
> to needs_fmgr_hook_type and fmgr_hook_type.
>
I also think the suggested names are better than before.

According to the renaming, FunctionCallEventType was also renamed to
FmgrHookEventType. Perhaps, it is a reasonable change.

Thanks,
--
KaiGai Kohei <kaigai(at)ak(dot)jp(dot)nec(dot)com>

Attachment Content-Type Size
pgsql-switcher-function.4.patch text/x-patch 14.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri Fontaine 2010-12-07 10:59:44 Re: pg_execute_from_file review
Previous Message Heikki Linnakangas 2010-12-07 08:42:22 Re: Hot Standby: too many KnownAssignedXids