Restore problem: relation "theme_fields" does not exist

@tgxworld, I think this is in your wheelhouse.
Trying to restore a backup from Discourse 2.1.0.beta5 - https://github.com/discourse/discourse version 8da2d8df3d5f7196f1c267b8a664597a725241ac or "Discourse 2.1.0.beta5 - https://github.com/discourse/discourse version bed34b52b51ab903bcb7854cc1efb2bf4107ddfb" to f4ae53d52b70a6577a60388f3550f168a4706b5f

I get

# discourse restore mineral-rights-forum-2018-08-23-033241-v20180812150839.tar.gz
bundler: failed to load command: script/discourse (script/discourse)
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "theme_fields" does not exist
LINE 8:                WHERE a.attrelid = '"theme_fields"'::regclass
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
                     c.collname, col_description(a.attrelid, a.attnum) AS comment
                FROM pg_attribute a
                LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                LEFT JOIN pg_type t ON a.atttypid = t.oid
                LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
               WHERE a.attrelid = '"theme_fields"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

I tried restoring a backup from Beta 4 and it fails the same way, so I think it’s a problem with the current Discourse restoring, not the way that backups are created.

EDIT: It looks like the first time that I restore it works, but if I restore again, it fails. I’ve not yet tested this on more than one database.

Going to have to ship this into the Support category, there could be some sort of bug here, but we need a proper repro that works consistently.

Can you consistently make this fail?

저도 지금 이 문제를 겪고 있습니다.

제가 수행한 작업:

2.5.0.beta4 버전의 discourse로 백업을 수행했습니다.

root 권한으로

git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
cp /var/production-backup/var/discourse/containers/app.yml /var/discourse/containers/
mkdir -p /var/discourse/shared/standalone/backups/default/
cp /var/production-backup/var/discourse/shared/standalone/backups/default/whonix-forum-2020-05-21-132423-v20200506044956.tar.gz /var/discourse/shared/standalone/backups/default/
./launcher enter app
discourse enable_restore
discourse restore whonix-forum-2020-05-21-132423-v20200506044956.tar.gz

결과:

root@host-app:/var/www/discourse# discourse restore whonix-forum-2020-05-21-132423-v20200506044956.tar.gz
bundler: failed to load command: script/discourse (script/discourse)
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation "theme_fields" does not exist
LINE 8:  WHERE a.attrelid = '"theme_fields"'::regclass
                            ^

  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.1/lib/patches/db/pg.rb:110:in `exec'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rack-mini-profiler-2.0.1/lib/patches/db/pg.rb:110:in `async_exec'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `block (2 levels) in query'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `block in query'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:721:in `block in log'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:712:in `log'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `query'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:820:in `column_definitions'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/schema_cache.rb:76:in `columns'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/connection_adapters/schema_cache.rb:82:in `columns_hash'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/model_schema.rb:488:in `load_schema!'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/attributes.rb:247:in `load_schema!'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/attribute_decorators.rb:50:in `load_schema!'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/model_schema.rb:478:in `block in load_schema'
  /usr/local/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/model_schema.rb:475:in `load_schema'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/model_schema.rb:352:in `columns_hash'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/dynamic_matchers.rb:60:in `block in valid?'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/dynamic_matchers.rb:60:in `all?'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/dynamic_matchers.rb:60:in `valid?'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/dynamic_matchers.rb:11:in `respond_to_missing?'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/scoping/named.rb:209:in `respond_to?'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/scoping/named.rb:209:in `valid_scope_name?'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3/lib/active_record/scoping/named.rb:187:in `scope'
  /var/www/discourse/app/models/theme_field.rb:8:in `<class:ThemeField>'
  /var/www/discourse/app/models/theme_field.rb:3:in `<top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:16:in `require'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:16:in `require'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `const_get'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `block (2 levels) in eager_load'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:723:in `block in ls'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `foreach'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `ls'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:376:in `block in eager_load'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `synchronize'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `eager_load'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:483:in `each'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:483:in `eager_load_all'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3/lib/rails/application/finisher.rb:122:in `block in <module:Finisher>'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3/lib/rails/initializable.rb:32:in `instance_exec'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3/lib/rails/initializable.rb:32:in `run'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3/lib/rails/initializable.rb:61:in `block in run_initializers'
  /usr/local/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
  /usr/local/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
  /usr/local/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
  /usr/local/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
  /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each'
  /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `call'
  /usr/local/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
  /usr/local/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
  /usr/local/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3/lib/rails/initializable.rb:60:in `run_initializers'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3/lib/rails/application.rb:363:in `initialize!'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3/lib/rails/railtie.rb:190:in `public_send'
  /var/www/discourse/vendor/bundle/ruby/2.6.0/gems/railties-6.0.3/lib/rails/railtie.rb:190:in `method_missing'
  /var/www/discourse/config/environment.rb:7:in `<top (required)>'
  script/discourse:264:in `require'
  script/discourse:264:in `load_rails'
  script/discourse:119: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)>'
root@host-app:/var/www/discourse#

두 번 발생했습니다. 여기서 어떻게 진행해야 할지 모르겠습니다.

UI를 통해 복원할 수 있나요?

아니요.

> [2020-05-22 12:11:36] 'Patrick' has started the restore!
> [2020-05-22 12:11:36] Marking restore as running...
> [2020-05-22 12:11:36] Making sure /var/www/discourse/tmp/restores/default/2020-05-22-121136 exists...
> [2020-05-22 12:11:36] Copying archive to tmp directory...
> [2020-05-22 12:11:40] Unzipping archive, this may take a while...
> [2020-05-22 12:11:47] Extracting dump file...
> [2020-05-22 12:11:58] Validating metadata...
> [2020-05-22 12:11:58]   Current version: 20200522004855
> [2020-05-22 12:11:58]   Restored version: 20200506044956
> [2020-05-22 12:11:58] Enabling readonly mode...
> [2020-05-22 12:11:58] Pausing sidekiq...
> [2020-05-22 12:11:58] Waiting up to 60 seconds for Sidekiq to finish running jobs...
> [2020-05-22 12:12:06] Creating missing functions in the discourse_functions schema...

그 후 몇 시간이 지나도 아무런 변화가 없었습니다.

페이지를 새로고침했습니다.

Oops

The software powering this discussion forum encountered an unexpected problem. We apologize for the inconvenience.

Detailed information about the error was logged, and an automatic notification generated. We’ll take a look at it.

No further action is necessary. However, if the error condition persists, you can provide additional detail, including steps to reproduce the error, by posting a discussion topic in the site’s feedback category.

root@whonix:/var/discourse# ./launcher logs app
> run-parts: executing /etc/runit/1.d/00-ensure-links
> run-parts: executing /etc/runit/1.d/00-fix-var-logs
> run-parts: executing /etc/runit/1.d/anacron
> run-parts: executing /etc/runit/1.d/cleanup-pids
> Cleaning stale PID files
> run-parts: executing /etc/runit/1.d/copy-env
> Started runsvdir, PID is 38
> ok: run: redis: (pid 52) 0s
> ok: run: postgres: (pid 51) 0s
> chgrp: invalid group: ‘syslog’
> rsyslogd: imklog: cannot open kernel log (/proc/kmsg): Operation not permitted.
> rsyslogd: activation of module imklog failed [v8.1901.0 try https://www.rsyslog.com/e/2145 ]
> supervisor pid: 47 unicorn pid: 77
> root@whonix:/var/discourse# 
`root@whonix:/var/discourse# ./launcher enter app`

가능합니다.

root@whonix-app:/var/www/discourse#

tail shared/standalone/log/rails/production.log
Unexpected error in Message Bus : PG::UndefinedTable: ERROR:  relation "user_auth_tokens" does not exist
LINE 1: SELECT "user_auth_tokens".* FROM "user_auth_tokens" WHERE ((...
                                         ^

Job exception: PG::UndefinedTable: ERROR:  relation "application_requests" does not exist
LINE 1: SELECT "application_requests"."id" FROM "application_request...

백업에 문제가 있는 것 같습니다.

로컬에서 압축을 풀어서 PG 데이터베이스에 로드할 수 있을까요? gzip 파일에는 두 개의 파일이 포함되어 있습니다… PG 백업 파일 1개와 uploads 디렉터리 1개입니다.

도와주셔서 감사합니다!

아직도 완전히 정상적으로 작동하는 기존 프로덕션 서버에서 새로운 백업을 생성했습니다.

새로운 스테이지 서버에서 docker와 discourse를 모두 삭제했습니다. 공식 지침에 따라 docker와 discourse를 다시 설치한 후, 명령줄 복원 지침을 따랐습니다.

백업은 docker-engine 17.05.0~ce-0~debian-stretch로 생성되었고, docker-ce-cli 5:19.03.9~3-0~debian-buster로 복원하려고 했습니다. 이로 인해 더 새로운 postgres 버전이 사용됩니다. (구버전: 10; 신버전: 12)

구버전의 docker/postgres로 백업한 것을 최신 버전의 docker/discourse 설치 환경에서 복원하려는 접근 방식이 적절한 방법일까요?

이번에는 다른 오류가 발생합니다.

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.

전체 로그:

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/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.6.0/gems/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.6.0/gems/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/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#

제 기존 프로덕션 discourse 서버가 여전히 완전히 정상적으로 작동하고 있기 때문에 어떻게 이런 일이 가능한지 궁금합니다. 그리고 두 번째로 시도하는 백업이기도 합니다.

Postgres 10을 사용할까요, 아니면 postgres 12를 사용할까요?


수정:

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)> 

수정2:

[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> --- Press enter to continue ( q<enter> to break ) --- <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> --- Press enter to continue ( q<enter> to break ) --- <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> --- Press enter to continue ( q<enter> to break ) --- <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> --- Press enter to continue ( q<enter> to break ) --- <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)>

네, 이 방법은 지원됩니다.

→ Corrupt indexes in PG12, how do I fix?

새로 설치한 Discourse에서도 OP와 동일한 “theme_fields” 관련 오류가 발생하고 있습니다.

E, [2020-06-04T16:32:44.492756 #2024] ERROR -- : PG::UndefinedTable: ERROR:  relation "theme_fields" does not exist
LINE 8:  WHERE a.attrelid = '"theme_fields"'::regclass
                            ^
 (ActiveRecord::StatementInvalid)
/app/.global/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:110:in `exec'
/app/.global/gems/rack-mini-profiler-2.0.2/lib/patches/db/pg.rb:110:in `async_exec'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `block (2 levels) in query'
/app/.global/gems/activesupport-6.0.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/app/.global/gems/activesupport-6.0.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/app/.global/gems/activesupport-6.0.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `block in query'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:718:in `block (2 levels) in log'
/opt/ruby/2.6/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:717:in `block in log'
/app/.global/gems/activesupport-6.0.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:708:in `log'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `query'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:817:in `column_definitions'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/schema_cache.rb:76:in `columns'
/app/.global/gems/activerecord-6.0.1/lib/active_record/connection_adapters/schema_cache.rb:82:in `columns_hash'
/app/.global/gems/activerecord-6.0.1/lib/active_record/model_schema.rb:490:in `load_schema!'
/app/.global/gems/activerecord-6.0.1/lib/active_record/attributes.rb:247:in `load_schema!'
/app/.global/gems/activerecord-6.0.1/lib/active_record/attribute_decorators.rb:51:in `load_schema!'
/app/.global/gems/activerecord-6.0.1/lib/active_record/model_schema.rb:480:in `block in load_schema'
/opt/ruby/2.6/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
/app/.global/gems/activerecord-6.0.1/lib/active_record/model_schema.rb:477:in `load_schema'
/app/.global/gems/activerecord-6.0.1/lib/active_record/model_schema.rb:352:in `columns_hash'
/app/.global/gems/activerecord-6.0.1/lib/active_record/dynamic_matchers.rb:60:in `block in valid?'
/app/.global/gems/activerecord-6.0.1/lib/active_record/dynamic_matchers.rb:60:in `all?'
/app/.global/gems/activerecord-6.0.1/lib/active_record/dynamic_matchers.rb:60:in `valid?'
/app/.global/gems/activerecord-6.0.1/lib/active_record/dynamic_matchers.rb:11:in `respond_to_missing?'
/app/.global/gems/activerecord-6.0.1/lib/active_record/scoping/named.rb:209:in `respond_to?'
/app/.global/gems/activerecord-6.0.1/lib/active_record/scoping/named.rb:209:in `valid_scope_name?'
/app/.global/gems/activerecord-6.0.1/lib/active_record/scoping/named.rb:186:in `scope'
/app/app/models/theme_field.rb:8:in `<class:ThemeField>'
/app/app/models/theme_field.rb:3:in `<top (required)>'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:16:in `require'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:16:in `require'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `const_get'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:381:in `block (2 levels) in eager_load'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:723:in `block in ls'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `foreach'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:720:in `ls'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:376:in `block in eager_load'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `synchronize'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:368:in `eager_load'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:483:in `each'
/app/.global/gems/zeitwerk-2.3.0/lib/zeitwerk/loader.rb:483:in `eager_load_all'
/app/.global/gems/railties-6.0.1/lib/rails/application/finisher.rb:122:in `block in <module:Finisher>'
/app/.global/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `instance_exec'
/app/.global/gems/railties-6.0.1/lib/rails/initializable.rb:32:in `run'
/app/.global/gems/railties-6.0.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
/opt/ruby/2.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
/app/.global/gems/railties-6.0.1/lib/rails/initializable.rb:60:in `run_initializers'
/app/.global/gems/railties-6.0.1/lib/rails/application.rb:363:in `initialize!'
/app/.global/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `public_send'
/app/.global/gems/railties-6.0.1/lib/rails/railtie.rb:190:in `method_missing'
/app/config/environment.rb:7:in `<top (required)>'

이 오류가 애플리케이션 로그에 여러 번 반복해서 출력되고 있습니다. 무엇이 이를 유발하는지 명확하지 않습니다. PostgreSQL 9.6을 사용 중인데, 이것이 관련이 있을지 궁금합니다.

최신 버전의 Discourse를 실행 중인가요? 아주 오래된 버전의 Discourse에서 업그레이드한 경우인가요?

이것은 이전 설치 이력이 전혀 없는 Discourse 2.4의 완전히 새로운 신규 설치입니다.

Postgres 12로 업그레이드해 보기도 했는데, 로그에 여전히 오류가 표시됩니다.