timescaledb-backup icon indicating copy to clipboard operation
timescaledb-backup copied to clipboard

ts-restore didnt restore indexes on table

Open pstefanowski opened this issue 4 years ago • 2 comments

Hi Our backup strategy is using pg_dumpall for all databases (including these which use timescaledb). Recently found this repo and want to change for using ts-dump and ts-restore. Acidently found that ts-restore didn't restore indexes.

To reproduce:

  • add db and table: https://docs.timescale.com/timescaledb/latest/getting-started/create-hypertable/#chunks-and-hypertables
  • add data https://docs.timescale.com/timescaledb/latest/getting-started/add-data/#accessing-the-dataset
  • add additional index: CREATE INDEX weather_metrics_snow_1h_mm_idx ON public.weather_metrics USING btree (snow_1h_mm, snow_3h_mm); - [test_timescaledb] - select * from pg_indexes where indexname ilike 'weather_metrics%' - should be 2 items
  • ts-dump --db-URI=postgresql://postgres:postgres@localhost:5432/test_timescaledb --dump-dir=/home/user/timescaledb/test_timescaledb --verbose --jobs=12
  • create test_timescaledb_copy db
  • ts-restore --db-URI=postgresql://postgres:postgres@localhost:5432/test_timescaledb_copy --dump-dir=/home/user/timescaledb/test_timescaledb --verbose --jobs=12 - [test_timescaledb_copy] - select * from pg_indexes where indexname ilike 'weather_metrics%' - 0 items
  1. Should I be worry about missing indexes if I change to ts-dump/ts-restore?
  2. If I stay with pg_dumpall there should be some pitfalls for restoring backup?

Thanks for answer

pstefanowski avatar Aug 10 '21 14:08 pstefanowski

I am also having the same issue. The backup didn't restored the default indexes created when running create_hypertable. Why there are some items skipped in restore? I am seeing all indexes skipped in ts-restore command output. Anyone found solution to recreate missing default indexes?

markandpathak avatar Sep 24 '21 07:09 markandpathak

We can confirm this. Even on the same machine.

Steps to reproduce:

ts-dump --db-URI=postgresql://postgres:pass@localhost/db --dump-dir=/backups/db_backup

psql -U postgres -h localhost -d postgres -c "CREATE DATABASE db;"

ts-restore --db-URI=postgresql://postgres:pass@localhost/db_restore --dump-dir=/backups/db_backup

Some indexes, triggers etc. are missing - but not all!

Environment

Postgre 13 Timescale extension 2.4.2 Unix (Ubuntu 20.04 LTS)

kdaveid avatar Oct 11 '21 12:10 kdaveid