-
Notifications
You must be signed in to change notification settings - Fork 903
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
pg_dump/pg_restore does not work without more manual steps #1409
Comments
Hi @dhyun-obsec If you could please fill out the github issue as requested, so we can provide help? Not enough information to actually understand your problem. Also, please see these instructions if you haven't already: |
Sorry, I had used the template but for some reason I must have been on a different browser tab when I submitted. I updated the original post with all of the information. |
One other thing to note: although the restore works with specifying the |
I'm having the same problem trying to run pg_dump/pg_restore. I googled for the first error I saw from pg_restore and this was the only hit on google :-) I also asked about this on the TimescaleDB Slack, and there's an ongoing thread there now. Here's my system details:
So what I'm trying to do is move my data from one timescaledb instance running postgres 9.6.13 to another running postgres 11.5 (both using timescaledb extension 1.4.1). I got the error shown in the original post, followed by a bunch related to check constraints in my data. None of my tables now any of their rows were restored, save for a single (non-hyper) table. I'm not sure if the different postgres versions matter here, since the original post doesn't have this complication, yet still encounters the problem. Let me know if there's any further information you need from me, or if there's anything else you need me to try. Thanks... |
@mfreed This is still listed as |
When restoring a database, people would encounter errors if the restore happened after telemetry has run. This is because a 'exported_uuid' field would then exist and people would encounter a "duplicate key value" when the restore tried to overwrite it. We fix this by moving this metadata to a different key in pre_restore and trying to move it back in post_restore. If the restore create an exported_uuid, that restored value is used and the moved version is simply deleted We also remove the error redirection in restore so that errors will show up in tests in the future. Fixes timescale#1409.
When restoring a database, people would encounter errors if the restore happened after telemetry has run. This is because a 'exported_uuid' field would then exist and people would encounter a "duplicate key value" when the restore tried to overwrite it. We fix this by moving this metadata to a different key in pre_restore and trying to move it back in post_restore. If the restore create an exported_uuid, that restored value is used and the moved version is simply deleted We also remove the error redirection in restore so that errors will show up in tests in the future. Fixes timescale#1409.
When restoring a database, people would encounter errors if the restore happened after telemetry has run. This is because a 'exported_uuid' field would then exist and people would encounter a "duplicate key value" when the restore tried to overwrite it. We fix this by moving this metadata to a different key in pre_restore and trying to move it back in post_restore. If the restore create an exported_uuid, that restored value is used and the moved version is simply deleted We also remove the error redirection in restore so that errors will show up in tests in the future. Fixes timescale#1409.
When restoring a database, people would encounter errors if the restore happened after telemetry has run. This is because a 'exported_uuid' field would then exist and people would encounter a "duplicate key value" when the restore tried to overwrite it. We fix this by moving this metadata to a different key in pre_restore and trying to move it back in post_restore. If the restore create an exported_uuid, that restored value is used and the moved version is simply deleted We also remove the error redirection in restore so that errors will show up in tests in the future. Fixes timescale#1409.
When restoring a database, people would encounter errors if the restore happened after telemetry has run. This is because a 'exported_uuid' field would then exist and people would encounter a "duplicate key value" when the restore tried to overwrite it. We fix this by moving this metadata to a different key in pre_restore and trying to move it back in post_restore. If the restore create an exported_uuid, that restored value is used and the moved version is simply deleted We also remove the error redirection in restore so that errors will show up in tests in the future. Fixes timescale#1409.
When restoring a database, people would encounter errors if the restore happened after telemetry has run. This is because a 'exported_uuid' field would then exist and people would encounter a "duplicate key value" when the restore tried to overwrite it. We fix this by moving this metadata to a different key in pre_restore and trying to move it back in post_restore. If the restore create an exported_uuid, that restored value is used and the moved version is simply deleted We also remove the error redirection in restore so that errors will show up in tests in the future. Fixes timescale#1409.
When restoring a database, people would encounter errors if the restore happened after telemetry has run. This is because a 'exported_uuid' field would then exist and people would encounter a "duplicate key value" when the restore tried to overwrite it. We fix this by moving this metadata to a different key in pre_restore and trying to move it back in post_restore. If the restore create an exported_uuid, that restored value is used and the moved version is simply deleted We also remove the error redirection in restore so that errors will show up in tests in the future. Fixes #1409.
I encountered this error now when trying to restore a Looks like it could be somehow related to TimescaleDb. It was working fine before, but after adding some more continuous aggregate views and changing column structure the error started appearing.
VersionsDump host: TimescaleDB docker, PostgreSQL 12.7 on x86_64-pc-linux-musl, compiled by gcc (Alpine 10.3.1_git20210424) 10.3.1 20210424, 64-bit, Timescaledb v2.3.1 CommandsMy dumping command: pg_dump -U postgres --format custom --verbose --create dex_ohlcv > dump.bin My restore command: pg_restore --verbose -U postgres -d $DBNAME --exit-on-error --format=custom dump.bin I will investigate further, but probably going to take some time. |
Also getting the same error as @miohtama, using Docker. Same error with both Errors when running
After using
|
@nwittwer after making sure that the pre- and post See For the reference, here is my shell script to restore any dump in TimescaleDB docker: #!/bin/sh
set -e
set -x
DBNAME="my_little_timescaledb"
CONTAINER_NAME=timescaledb
DUMP_SOURCE=dumps/source_dump.bin
DUMP_AT_DOCKER=`basename $DUMP_SOURCE`
docker exec $CONTAINER_NAME dropdb --if-exists -U postgres $DBNAME
docker exec $CONTAINER_NAME createdb -U postgres $DBNAME
docker cp $DUMP_SOURCE $CONTAINER_NAME:./$DUMP_AT_DOCKER
# Needed on Github CI as pg_check does not tell the real database up to date state
# pg_restore: error: connection to database "..." failed: FATAL: the database system is starting up
sleep 4
docker exec $CONTAINER_NAME psql -U postgres -d $DBNAME -c "SELECT timescaledb_pre_restore();"
docker exec $CONTAINER_NAME pg_restore --verbose -U postgres -d $DBNAME --exit-on-error --format=custom $DUMP_AT_DOCKER
docker exec $CONTAINER_NAME psql -U postgres -d $DBNAME -c "SELECT timescaledb_post_restore();" |
Relevant system information:
OS: [e.g. Ubuntu 16.04, Windows 10 x64, etc]
Ubuntu 18.04
PostgreSQL version (output of
postgres --version
): [e.g. 10.5, 9.6.10]10.10
TimescaleDB version (output of
\dx
inpsql
): [e.g. 1.0.0]1.4.1
Installation method: [e.g., "using Docker", "apt install", "source"]
Source
Describe the bug
In following the steps outlined in this document (https://docs.timescale.com/latest/using-timescaledb/backup), the
pg_restore
throws the following error:To Reproduce
Steps to reproduce the behavior:
test
database, a schema, a single hypertable with one row using the following queries:pg_dump
to create a dump file using the following command:test
database and runpg_restore
using the following command:pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 3025; 0 17963 TABLE DATA metadata postgres
pg_restore: [archiver (db)] COPY failed for table "metadata": ERROR: duplicate key value violates unique constraint "metadata_pkey"
DETAIL: Key (key)=(exported_uuid) already exists.
The text was updated successfully, but these errors were encountered: