powa-team/pg_stat_kcache

Cannot update either create extension on PG12.5 on CentOS "could not find function "pg_stat_kcache_2_2"

banlex73 opened this issue · 3 comments

Hello
Where: Postgres 12.5 on CentOS7
What: Getting error when running ALTER EXTENSION UPDATE either CREATE EXTENTION
could not find function "pg_stat_kcache_2_2" in file "/usr/pgsql-12/lib/pg_stat_kcache.so"
How I installed it:
as root
git clone https://github.com/powa-team/pg_stat_kcache.git
cd pg_stat_kcache
make
_```
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -I. -I./ -I/usr/pgsql-12/include/server -I/usr/pgsql-12/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -c -o pg_stat_kcache.o pg_stat_kcache.c
gcc -std=gnu99 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC -shared -o pg_stat_kcache.so pg_stat_kcache.o -L/usr/pgsql-12/lib -Wl,--as-needed -L/usr/lib64/llvm5.0/lib -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-12/lib',--enable-new-dtags
/opt/rh/llvm-toolset-7/root/usr/bin/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2 -I. -I./ -I/usr/pgsql-12/include/server -I/usr/pgsql-12/include/internal -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include -flto=thin -emit-llvm -c -o pg_stat_kcache.bc pg_stat_kcache.c

**make install**
`_/bin/mkdir -p '/usr/pgsql-12/lib'
/bin/mkdir -p '/usr/pgsql-12/share/extension'
/bin/mkdir -p '/usr/pgsql-12/share/extension'
/bin/install -c -m 755  pg_stat_kcache.so '/usr/pgsql-12/lib/pg_stat_kcache.so'
/bin/install -c -m 644 .//pg_stat_kcache.control '/usr/pgsql-12/share/extension/'
/bin/install -c -m 644 .//pg_stat_kcache--2.1.1.sql .//pg_stat_kcache--2.2.0.sql .//pg_stat_kcache--2.1.2--2.1.3.sql .//pg_stat_kcache--2.1.0.sql .//pg_stat_kcache--2.1.1--2.1.2.sql .//pg_stat_kcache--2.1.0--2.1.1.sql .//pg_stat_kcache--2.1.3--2.2.0.sql .//pg_stat_kcache--2.1.2.sql .//pg_stat_kcache--2.1.3.sql  '/usr/pgsql-12/share/extension/'
/bin/mkdir -p '/usr/pgsql-12/lib/bitcode/pg_stat_kcache'
/bin/mkdir -p '/usr/pgsql-12/lib/bitcode'/pg_stat_kcache/
/bin/install -c -m 644 pg_stat_kcache.bc '/usr/pgsql-12/lib/bitcode'/pg_stat_kcache/./
cd '/usr/pgsql-12/lib/bitcode' && /usr/lib64/llvm5.0/bin/llvm-lto -thinlto -thinlto-action=thinlink -o pg_stat_kcache.index.bc pg_stat_kcache/pg_stat_kcache.bc_`

su - postgres -c "psql -dpowa -c 'create extension pg_stat_kcache'"
**ERROR:  could not find function "pg_stat_kcache_2_2" in file "/usr/pgsql-12/lib/pg_stat_kcache.so"**

Same error when I was trying to **alter extension pg_stat_kcache update;**
`ERROR:  could not find function "pg_stat_kcache_2_2" in file "/usr/pgsql-12/lib/pg_stat_kcache.so"
powa=# select * from pg_available_extensions where name ='pg_stat_kcache';

      name      | default_version | installed_version |           comment
----------------+-----------------+-------------------+-----------------------------
 pg_stat_kcache | 2.2.0           | 2.1.3             | Kernel statistics gathering
(1 row)`

Please advice if I can provide anything else.

Thank you in advance
Andriy
rjuju commented

Hello,

The pg_stat_kcache_2_2 function is new to version 2.2, and is there to avoid a crash when trying to update the extension without restarting the server first to have the new shared library loaded, which is what you just tried.

A simple restart of the postgres server should allow you to perform the update.

rjuju commented

Good news! I'll add some documentation to specify that a postgres restart can be required (usually for a minor version change).