Re: Problems running the WorkerSpi sample

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: david(at)andl(dot)org
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problems running the WorkerSpi sample
Date: 2016-04-26 14:27:41
Message-ID: CAFj8pRDOkrcCGyHAQuD5Jd7o0qDZsPF+gaEVO4t5xcWbccCd4Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2016-04-26 15:48 GMT+02:00 <david(at)andl(dot)org>:

> Solved. The sample can indeed be loaded at startup (although it emits some
> strange LOG messages).
>
>
>
> But to load it dynamically requires this SQL:
>
>
>
> CREATE OR REPLACE FUNCTION worker_spi_launch(i INT) RETURNS INT
>
> AS '<filename>' LANGUAGE C;
>
> SELECT * FROM worker_spi_launch(<arg>);
>
>
>
> It would be helpful to add this to the documentation. From this point on,
> it looks pretty straightforward, but getting here was not easy.
>
>
>
> I’m still wondering how to do a clean restart of the server without
> pg_ctl. Restarting the service is a bit brutal.
>

server, service are equivalent for Postgres. There are not any difference.

Regards

Pavel

>
>
> Regards
>
> David M Bennett FACS
> *------------------------------*
>
> *Andl - A New Database Language - andl.org <http://andl.org>*
>
>
>
>
>
> *From:* pgsql-general-owner(at)postgresql(dot)org [mailto:
> pgsql-general-owner(at)postgresql(dot)org] *On Behalf Of *david(at)andl(dot)org
> *Sent:* Tuesday, 26 April 2016 4:04 PM
> *To:* pgsql-general(at)postgresql(dot)org
> *Subject:* [GENERAL] Problems running the WorkerSpi sample
>
>
>
> I’ve been trying to get the WorkerSpi sample working on a Windows
> installation, VS 2015, x64. So far, the following problems.
>
>
>
> 1. Does not compile OOB. Added the following lines.
>
> PGDLLEXPORT void _PG_init(void);
>
> PGDLLEXPORT Datum worker_spi_launch(PG_FUNCTION_ARGS);
>
> PGDLLEXPORT void worker_spi_main(Datum);
>
> 2. Two warnings about int usage. Ignored.
>
> 3. Documentation is a bit light on, but copying the control file
> into the right folder makes the extension visible.
>
> 4. Extension installs but does nothing. No log messages. No schema.
> No table.
>
> The variable worker_spi.naptime appears in pg_settings but
> worker_spi.total_workers does not.
>
> 5. Extension uninstalls without error, but does not release the DLL.
>
> 6. Tried to restart server with pg_ctl but it does nothing. No
> error, no log message, nada. [Is this a known problem with Windows?]
>
> 7. Restarted server using Task Manager. And so back to the
> beginning and try again.
>
>
>
> The worker_spi.c code contains this sequence:
>
>
>
> DefineCustomIntVariable("worker_spi.naptime",
>
> "Duration between each check (in
> seconds).",
>
> <omitted>
>
> if (!process_shared_preload_libraries_in_progress)
>
> return;
>
> DefineCustomIntVariable("worker_spi.total_workers",
>
> "Number of workers.",
>
>
>
> From this I deduce that process_shared_preload_libraries_in_progress was
> false. So this appears to be an extension that must be preloaded. That does
> not seem to be documented anywhere.
>
>
>
> It would be helpful to get some suggestions about what changes would be
> needed to allow it to be loaded on demand.
>
>
>
> Regards
>
> David M Bennett FACS
> *------------------------------*
>
> *Andl - A New Database Language - andl.org <http://andl.org>*
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Cal Heldenbrand 2016-04-26 15:20:48 Re: psql color hostname prompt
Previous Message Adrian Klaver 2016-04-26 14:22:58 Re: Does frequent update of a row affects performance