timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
16.8k stars 852 forks source link

[Bug]: live-migration - could not access file "wal2json" #7034

Closed TristisOris closed 1 week ago

TristisOris commented 2 weeks ago

What type of bug is this?

Unexpected error

What subsystems and features are affected?

Replication

What happened?

going to migrate tc db to new host, according to https://docs.timescale.com/migrate/latest/live-migration/live-migration-from-timescaledb/

preparations done, extra permissions granted (also missing at docs).

sudo -u postgres psql
ALTER USER user_name REPLICATION;

sudo -u postgres psql -X -d $SOURCE -c 'show old_snapshot_threshold'
sudo -u postgres psql -X -d $SOURCE -c 'alter system set old_snapshot_threshold=-1'
sudo -u postgres psql -X -d $SOURCE -c 'show wal_level'
sudo -u postgres psql -X -d $SOURCE -c 'alter system set wal_level=logical'

TimescaleDB version affected

2.15.2

PostgreSQL version used

16.3

What operating system did you use?

ubuntu 22

What installation method did you use?

Deb/Apt

What platform did you run on?

On prem/Self-hosted

Relevant log output and stack trace

2024-06-17T07:24:22.236 INFO: Creating snapshot ...
07:24:22.244 39917 INFO   Running pgcopydb version 0.14 from "/usr/local/bin/pgcopydb"
07:24:22.393 39917 ERROR  Failed to send CREATE_REPLICATION_SLOT command:
07:24:22.394 39917 ERROR  [SOURCE 39920] [58P01] ERROR:  could not access file "wal2json": No such file or directory
07:24:22.394 39917 ERROR  [SOURCE 39920] Context: CREATE_REPLICATION_SLOT "pgcopydb" LOGICAL "wal2json"
07:24:22.394 39917 ERROR  Failed to create a logical replication slot and export a snapshot, see above for details
2024-06-17T07:24:22.395 ERROR: Snapshot creation failed.
2024-06-17T07:24:22.396 ERROR: You may need to cleanup and retry the snapshot creation.

How can we reproduce the bug?

i'm dunno. maybe sometihing specific to my db.

docker run --rm -it --name live-migration-snapshot \
    -e PGCOPYDB_SOURCE_PGURI=$SOURCE \
    -e PGCOPYDB_TARGET_PGURI=$TARGET \
    --pid=host \
    -v ~/live-migration:/opt/timescale/ts_cdc \
    timescale/live-migration:latest snapshot
nikkhils commented 2 weeks ago

@TristisOris it looks like the error is:

could not access file "wal2json": No such file or directory

The wal2json logical decoding plugin seems to be missing on your setup.

TristisOris commented 2 weeks ago

i'm pretty sure yes. Documentation say nothing that i need it.

nikkhils commented 1 week ago

@TristisOris this is a pre-requisite on the SOURCE database. You need to install the plugin on the SOURCE database. https://github.com/eulerto/wal2json should provide ways to install it on your SOURCE setup.

TristisOris commented 1 week ago

got it. thanks.