Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
banlex73 opened this issue Dec 13, 2020 · 3 comments
Assignees

Comments

@banlex73
Copy link

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
Copy link
Member

rjuju commented Dec 14, 2020

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 rjuju self-assigned this Dec 14, 2020
@banlex73
Copy link
Author

banlex73 commented Dec 14, 2020 via email

@rjuju
Copy link
Member

rjuju commented Dec 14, 2020

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

@rjuju rjuju closed this as completed Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants