Re: pgsql: Allow background workers to bypass datallowconn

2018-04-05 Thread Magnus Hagander
On Thu, Apr 5, 2018 at 7:11 PM, Teodor Sigaev  wrote:

> Something goes wrong
>
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crak
> e&dt=2018-04-05 17%3A07%3A19
>
> Apr 05 13:09:08 /home/bf/bfr/root/HEAD/pgsql.b
> uild/../pgsql/src/test/modules/worker_spi/worker_spi.c: In function
> ‘worker_spi_main’:
> Apr 05 13:09:08 /home/bf/bfr/root/HEAD/pgsql.b
> uild/../pgsql/src/test/modules/worker_spi/worker_spi.c:182:2: error: too
> few arguments to function ‘BackgroundWorkerInitializeConnection’
> Apr 05 13:09:08   BackgroundWorkerInitializeConnection("postgres", NULL);
> Apr 05 13:09:08   ^~~~
> Apr 05 13:09:08 In file included from /home/bf/bfr/root/HEAD/pgsql.b
> uild/../pgsql/src/test/modules/worker_spi/worker_spi.c:27:0:
> Apr 05 13:09:08 /home/bf/bfr/root/HEAD/pgsql.b
> uild/../pgsql/src/include/postmaster/bgworker.h:143:13: note: declared
> here
> Apr 05 13:09:08  extern void BackgroundWorkerInitializeConnection(const
> char *dbname, const char *username, uint32 flags);
> Apr 05 13:09:08  ^~~~
> Apr 05 13:09:08 : recipe for target 'worker_spi.o' failed
>
>
Gah, I didn't run those tests.

Thanks, fix pushed.

-- 
 Magnus Hagander
 Me: https://www.hagander.net/ 
 Work: https://www.redpill-linpro.com/ 


Re: pgsql: Allow background workers to bypass datallowconn

2018-04-05 Thread Teodor Sigaev

Something goes wrong

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=crake&dt=2018-04-05 
17%3A07%3A19


Apr 05 13:09:08 
/home/bf/bfr/root/HEAD/pgsql.build/../pgsql/src/test/modules/worker_spi/worker_spi.c: 
In function ‘worker_spi_main’:
Apr 05 13:09:08 
/home/bf/bfr/root/HEAD/pgsql.build/../pgsql/src/test/modules/worker_spi/worker_spi.c:182:2: 
error: too few arguments to function ‘BackgroundWorkerInitializeConnection’

Apr 05 13:09:08   BackgroundWorkerInitializeConnection("postgres", NULL);
Apr 05 13:09:08   ^~~~
Apr 05 13:09:08 In file included from 
/home/bf/bfr/root/HEAD/pgsql.build/../pgsql/src/test/modules/worker_spi/worker_spi.c:27:0:
Apr 05 13:09:08 
/home/bf/bfr/root/HEAD/pgsql.build/../pgsql/src/include/postmaster/bgworker.h:143:13: 
note: declared here
Apr 05 13:09:08  extern void BackgroundWorkerInitializeConnection(const char 
*dbname, const char *username, uint32 flags);

Apr 05 13:09:08  ^~~~
Apr 05 13:09:08 : recipe for target 'worker_spi.o' failed

Magnus Hagander wrote:

Allow background workers to bypass datallowconn

THis adds a "flags" field to the BackgroundWorkerInitializeConnection()
and BackgroundWorkerInitializeConnectionByOid(). For now only one flag,
BGWORKER_BYPASS_ALLOWCONN, is defined, which allows the worker to ignore
datallowconn.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/eed1ce72e1593d3e8b7461d7744808d4d6bf402b

Modified Files
--
contrib/pg_prewarm/autoprewarm.c   |  2 +-
src/backend/access/transam/parallel.c  |  3 ++-
src/backend/bootstrap/bootstrap.c  |  2 +-
src/backend/postmaster/autovacuum.c|  4 ++--
src/backend/postmaster/postmaster.c|  8 
src/backend/replication/logical/launcher.c |  2 +-
src/backend/replication/logical/worker.c   |  3 ++-
src/backend/tcop/postgres.c|  2 +-
src/backend/utils/init/postinit.c  | 10 +-
src/include/miscadmin.h|  2 +-
src/include/postmaster/bgworker.h  |  7 +--
11 files changed, 25 insertions(+), 20 deletions(-)



--
Teodor Sigaev   E-mail: teo...@sigaev.ru
   WWW: http://www.sigaev.ru/