Re: Problems running the WorkerSpi sample

From: <david(at)andl(dot)org>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problems running the WorkerSpi sample
Date: 2016-04-26 13:48:12
Message-ID: 003e01d19fc2$48bddfd0$da399f70$@andl.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Regards

David M Bennett FACS

_____

Andl - A New Database Language - 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2016-04-26 13:55:53 Re: truncate table getting blocked
Previous Message Johann Spies 2016-04-26 13:46:16 Re: 9.5: tsvector problem