Wiederherstellungsproblem: Relation "theme_fields" existiert nicht

Vielen Dank für die Hilfe!

Ich habe ein neues Backup vom noch voll funktionsfähigen alten Produktionsserver erstellt.

Sowohl Docker als auch Discourse vom neueren Stage-Server wurden entfernt. Anschließend wurden Docker und Discourse gemäß den offiziellen Anweisungen neu installiert. Danach habe ich die Wiederherstellungsanweisungen über die Kommandozeile befolgt.

Das Backup wurde mit docker-engine 17.05.0~ce-0~debian-stretch erstellt und soll mit docker-ce-cli 5:19.03.9~3-0~debian-buster wiederhergestellt werden. Dies führt auch zu einer neueren PostgreSQL-Version (alt: 10; neu: 12).

Ist es ein legitimer Ansatz, ein veraltetes Docker/PostgreSQL-Backup zu erstellen und versucht, es auf einer aktuellen Docker/Discourse-Installation wiederherzustellen?

Diesmal erhalte ich einen anderen Fehler.

ERROR:  could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL:  Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
EXCEPTION: psql failed: DETAIL:  Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.

Vollständiges Log:

root@whonix-app:/var/www/discourse# discourse restore whonix-forum-2020-05-25-065253-v20200506044956.tar.gz
Starting restore: whonix-forum-2020-05-25-065253-v20200506044956.tar.gz
[STARTED]
'system' has started the restore!
Marking restore as running...
Making sure /var/www/discourse/tmp/restores/default/2020-05-25-132224 exists...
Copying archive to tmp directory...
Unzipping archive, this may take a while...
Extracting dump file...
Validating metadata...
  Current version: 20200524181959
  Restored version: 20200506044956
Enabling readonly mode...
Pausing sidekiq...
Waiting up to 60 seconds for Sidekiq to finish running jobs...
Creating missing functions in the discourse_functions schema...
Restoring dump file... (this may take a while)
[cut]
ALTER TABLE
[cut lots of duplicate ALTER TABLE lines]
ALTER TABLE
CREATE INDEX
[cut lots of duplicate CREATE INDEX lines]
CREATE INDEX
ERROR:  could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL:  Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
EXCEPTION: psql failed: DETAIL:  Key (path, incoming_domain_id)=(/wiki/Tor_Browser, 3) is duplicated.
/var/www/discourse/lib/backup_restore/database_restorer.rb:95:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:49:in `run'
script/discourse:143:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
script/discourse:284:in `<top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2020-05-25-132224' directory...
Unpausing sidekiq...
Disabling readonly mode...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.
root@whonix-app:/var/www/discourse#

Ich frage mich, wie das möglich ist, da mein alter Produktions-Server noch voll funktionsfähig ist. Und es ist das zweite Backup, das ich versuche.

PostgreSQL 10 oder PostgreSQL 12?


EDIT:

root@whonix-app:/var/www/discourse# rails c
[1] pry(main)> IncomingReferer.where(path: "/wiki/Tor_Browser")
=> [#<IncomingReferer:0x0000561cba422f48
  id: 11361,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 3>]
[2] pry(main)> 

EDIT2:

[6] pry(main)> IncomingReferer.where("path LIKE '%/wiki/Tor_Browser%'")
=> [#<IncomingReferer:0x0000561cc08882a8
  id: 19,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b3f48
  id: 67,
  path: "/wiki/Tor_Browser/Download_Confirmation_Screen",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b3e08
  id: 331,
  path: "/wiki/Tor_Browser/Internal_Updater",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b3cf0
  id: 489,
  path: "/wiki/Tor_Browser",

<page break> --- Drücke Enter, um fortzufahren ( q<enter> zum Abbrechen ) --- <page break>

  incoming_domain_id: 113>,
 #<IncomingReferer:0x0000561cc08b3bb0
  id: 2957,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 617>,
 #<IncomingReferer:0x0000561cc08b3a70
  id: 4052,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 617>,
 #<IncomingReferer:0x0000561cc08b38e0
  id: 4196,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 1513>,
 #<IncomingReferer:0x0000561cc08b37f0
  id: 4220,

<page break> --- Drücke Enter, um fortzufahren ( q<enter> zum Abbrechen ) --- <page break>

  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 1513>,
 #<IncomingReferer:0x0000561cc08b3700
  id: 4307,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 1552>,
 #<IncomingReferer:0x0000561cc08b34a8
  id: 4346,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 1552>,
 #<IncomingReferer:0x0000561cc08b3318
  id: 8713,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b3188

<page break> --- Drücke Enter, um fortzufahren ( q<enter> zum Abbrechen ) --- <page break>

  id: 9746,
  path: "/wiki/Tor_Browser_without_Tor",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b2f08
  id: 10248,
  path: "/wiki/Tor_Browser_without_Tor",
  incoming_domain_id: 113>,
 #<IncomingReferer:0x0000561cc08b2cb0
  id: 11361,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 3>,
 #<IncomingReferer:0x0000561cc08b2bc0
  id: 11754,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 113>,

<page break> --- Drücke Enter, um fortzufahren ( q<enter> zum Abbrechen ) --- <page break>

 #<IncomingReferer:0x0000561cc08b2ad0
  id: 12094,
  path: "/wiki/Tor_Browser/Advanced_Users",
  incoming_domain_id: 4560>,
 #<IncomingReferer:0x0000561cc08b28f0
  id: 12892,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 4559>,
 #<IncomingReferer:0x0000561cc08b25f8
  id: 13038,
  path: "/wiki/Tor_Browser",
  incoming_domain_id: 4560>]
[7] pry(main)> 
[8] pry(main)>