On Mon, Feb 29, 2016 at 3:04 PM, Julien Rouhaud <julien.rouh...@dalibo.com> wrote: > > On 04/06/2015 22:10, Guillaume Lelarge wrote: > > 2015-01-05 17:44 GMT+01:00 Guillaume Lelarge <guilla...@lelarge.info > > <mailto:guilla...@lelarge.info>>: > > > > 2015-01-05 17:40 GMT+01:00 Robert Haas <robertmh...@gmail.com > > <mailto:robertmh...@gmail.com>>: > > > > On Wed, Dec 31, 2014 at 12:46 PM, Tom Lane <t...@sss.pgh.pa.us > > <mailto:t...@sss.pgh.pa.us>> wrote: > > > I'd be all right with putting the data structure declarations in a file > > > named something like autovacuum_private.h, especially if it carried an > > > annotation that "if you depend on this, don't be surprised if we break > > > your code in future". > > > > Works for me. I am not in general surprised when we do things that > > break my code, or anyway, the code that I'm responsible for > > maintaining. But I think it makes sense to segregate this into a > > separate header file so that we are clear that it is only > > exposed for > > the benefit of extension authors, not so that other things in > > the core > > system can touch it. > > > > > > I'm fine with that too. I'll try to find some time to work on that. > > > > > > So I took a look at this this week. I discovered, with the help of a > > coworker, that I can already use the AutoVacuumShmem pointer and read > > the struct. Unfortunately, it doesn't give me as much details as I would > > have liked. The list of databases and tables aren't in shared memory. > > They are local to the process that uses them. Putting them in shared > > memory (if at all possible) would imply a much bigger patch than I was > > willing to write right now. > > > > Thanks anyway for the help. > > > > > > Sorry to revive such an old thread. > > I think some hooks in the autovacuum could be enough to have good > insight without exposing private structure. >
Interesting idea... > Please find attached a patch that adds some hooks to the autovacuum, and > as an example a quick proof of concept extension that use them and allow > to see what are the autovacuum worker todo list, skipped tables and so on. > > I'm not really sure about which information should be provided, so I'm > open to any suggestion to improve this. > I have a look at the patch and it's compile without warning and without regression. But something goes wrong when installing the extension: fabrizio@bagual:~/Downloads/pg_stat_autovacuum $ pg_config BINDIR = /data/home/fabrizio/pgsql/bin DOCDIR = /data/home/fabrizio/pgsql/share/doc HTMLDIR = /data/home/fabrizio/pgsql/share/doc INCLUDEDIR = /data/home/fabrizio/pgsql/include PKGINCLUDEDIR = /data/home/fabrizio/pgsql/include INCLUDEDIR-SERVER = /data/home/fabrizio/pgsql/include/server LIBDIR = /data/home/fabrizio/pgsql/lib PKGLIBDIR = /data/home/fabrizio/pgsql/lib LOCALEDIR = /data/home/fabrizio/pgsql/share/locale MANDIR = /data/home/fabrizio/pgsql/share/man SHAREDIR = /data/home/fabrizio/pgsql/share SYSCONFDIR = /data/home/fabrizio/pgsql/etc PGXS = /data/home/fabrizio/pgsql/lib/pgxs/src/makefiles/pgxs.mk CONFIGURE = '--prefix=/home/fabrizio/pgsql' '--enable-cassert' '--enable-coverage' '--enable-tap-tests' '--enable-depend' CC = gcc CPPFLAGS = -DFRONTEND -D_GNU_SOURCE CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -fprofile-arcs -ftest-coverage CFLAGS_SL = -fpic LDFLAGS = -L../../src/common -Wl,--as-needed -Wl,-rpath,'/home/fabrizio/pgsql/lib',--enable-new-dtags LDFLAGS_EX = LDFLAGS_SL = LIBS = -lpgcommon -lpgport -lz -lreadline -lrt -lcrypt -ldl -lm VERSION = PostgreSQL 9.6devel fabrizio@bagual:~/Downloads/pg_stat_autovacuum $ make USE_PGXS=1 install /bin/mkdir -p '/data/home/fabrizio/pgsql/lib' /bin/mkdir -p '/data/home/fabrizio/pgsql/share/extension' /bin/mkdir -p '/data/home/fabrizio/pgsql/share/extension' /bin/mkdir -p '/data/home/fabrizio/pgsql/share/doc/extension' /usr/bin/install -c -m 755 pg_stat_autovacuum.so '/data/home/fabrizio/pgsql/lib/pg_stat_autovacuum.so' /usr/bin/install -c -m 644 .//pg_stat_autovacuum.control '/data/home/fabrizio/pgsql/share/extension/' /usr/bin/install -c -m 644 .//pg_stat_autovacuum--0.0.1.sql '/data/home/fabrizio/pgsql/share/extension/' /usr/bin/install -c -m 644 '/data/home/fabrizio/pgsql/share/doc/extension/' /usr/bin/install: missing destination file operand after ‘/data/home/fabrizio/pgsql/share/doc/extension/’ Try '/usr/bin/install --help' for more information. make: *** [install] Error 1 Regards, -- Fabrízio de Royes Mello Consultoria/Coaching PostgreSQL >> Timbira: http://www.timbira.com.br >> Blog: http://fabriziomello.github.io >> Linkedin: http://br.linkedin.com/in/fabriziomello >> Twitter: http://twitter.com/fabriziomello >> Github: http://github.com/fabriziomello