PL instrumentation plugin support (i.e. PL/pgSQL debugger infrastructure)

From: "korryd(at)enterprisedb(dot)com" <korryd(at)enterprisedb(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: PL instrumentation plugin support (i.e. PL/pgSQL debugger infrastructure)
Date: 2006-07-28 09:44:19
Message-ID: 1154079859.7099.28.camel@sakai.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

The attached patch adds support for loadable instrumentation plugins for
procedural languages (as discussed at the anniversary summit). It also
adds plugin support to the PL/pgSQL language handler.

We are using this plugin mechanism to load the PL/pgSQL debugger on
demand (the debugger is not part of this patch, the patch is just the
infrastructure that we need to load various instrumentation plugins).
We will also post some sample plugins (a PL/pgSQL profiler and a simple
tracer), probably at the edb-debugger pgFoundry project site so you can
see how to use the plugin mechanism.

A couple of notes: to use a plugin, you must define a custom GUC
variable that specifies the name of the shared-object that implements
the plugin. For example, to use the PL/pgSQL profiler (which is
implement in $libdir/plugin_profiler.so), you would add the following to
postgresql.conf

custom_variable_classes = 'plpgsql'

plpgsql.plugin = 'plugin_profiler'

The plpgsql.plugin variable is treated as an SUSET variable so you must
be a superuser to change plugins.

Also, we define a helper function (in fmgr.c) named load_pl_plugin()
that a language handler can use to load a plugin. The plugin requires
the name of the GUC variable (plplgsql.plugin, pljava.plugin,
plperl.pluhgN, etc.) and a pointer to a language-specific struct that
the plugin fills in with a set of function pointers (presumably, the
language handler will call those functions at appropriate points in
time).

-- Korry

Attachment Content-Type Size
plugin.patch text/x-patch 15.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-07-28 10:41:48 [Fwd: RE: Build farm on Windows]
Previous Message ITAGAKI Takahiro 2006-07-28 09:25:42 LWLock statistics collector (was: CSStorm occurred again by postgreSQL8.2)

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-07-28 13:19:13 Re: [HACKERS] putting CHECK_FOR_INTERRUPTS in qsort_comparetup()
Previous Message ITAGAKI Takahiro 2006-07-28 09:25:42 LWLock statistics collector (was: CSStorm occurred again by postgreSQL8.2)