Page MenuHomeSoftware Heritage

Reinstall pg_logical after postgres 10 upgrade
Closed, MigratedEdits Locked

Description

The postgresql 10 in-place upgrade of the replica database broke pg_logical; Time to reinstall it.

Event Timeline

On prado:

create extension pglogical;
select pglogical.create_node(node_name := 'prado', dsn := 'host=prado.internal.softwareheritage.org port=5433 dbname=softwareheritage');
select pglogical.replication_set_add_table('default', 'content', true);

On somerset:

sudo -u postgres env LC_ALL=C.UTF-8 pg_createcluster 10 replica -D /srv/softwareheritage/postgres/10/replica
-- as user postgres
\i swh-storage/sql/swh-init.sql
create extension pglogical;
select pglogical.create_node(node_name := 'somerset', dsn := 'host=somerset.internal.softwareheritage.org port=5434 dbname=softwareheritage');
select pglogical.create_subscription(subscription_name := 'somerset', provider_dsn := 'host=prado.internal.softwareheritage.org port=5433 dbname=softwareheritage user=postgres');

-- as user swhstorage
\i swh-storage/sql/swh-enums.sql
\i swh-storage/sql/swh-schema.sql
\i swh-storage/sql/swh-func.sql

The replication is now functional, indexes have been recreated, and the frontend now points to the new database.

Please shout if some query is too slow, as there might be some missing indexes.