将旧数据库导入到最新版本

问:如果我有一个 Discourse 安装的旧数据库,v2.0 导出 - 导入 2.9 - 会失败吗?还是导入过程中有内置的转换过程可以成功导入?

A: PostgreSQL 13 更新

2 个赞

啊,谢谢,这似乎奏效了,只是现在重建应用程序时引导失败了。
似乎存在一个“discourse 数据库已存在:类型错误”以及引导警告中的 ruby/gems 错误。

我已经阅读了一些错误。

作为背景,这个 2.2b4 版本(PG10)是用于从另一个旧式论坛平台导入的原始导入设置和构建——据我所知,自那时以来它没有进行任何更新或更改。

我的看法是,解决方案可能是在某个地方注释掉一些仅用于原始迁移/导入的行——您通常会在哪里找到此类自定义设置?

注意:我已经删除或注释掉了 app.yml 中的插件、lets’ encrypt 和 2.2b4 版本行。

您需要提供您的文件才能获得真正的帮助。如果您看到类似以下的内容:

  apt get

或者关于修改 Gemfile 的内容,这些都应该被移除。

我可能会做的(假设数据库升级已成功)是重命名您的 app.yml 文件并运行 discourse-setup(假设您当前的文件数据位于 shared/standalone 中)。您可以将您的文件与 samples/standalone.yml 进行比较。

1 个赞

太好了,谢谢你的指点。我会试试 rm app.yml 看看会发生什么。

你说文件是指 terminal 中的错误,还是 app.yml 或其他文件?

额外信息 - 我正在创建一个用于学习和解决问题的 droplet,以便更好地理解如何维护,同时还能安心地进行删除。也就是说,我不是在/并且删除了一个实时论坛 :wink:

昨天我离开时,我突然想到我应该检查一下导入器说明,了解它的设置方式,看看是否有残留,但你关于 app.yml 的建议可能会绕过这种曲折。 :sweat_smile:

Ok, tried all that - spun up new droplet,

  • :white_check_mark: updates OS/Docker
  • :white_check_mark: stopped container
  • :white_check_mark: rm app.yml
  • :white_check_mark: discourse-setup = upgraded PG10
  • :x: rebuild FAILED bootstrap (looks identical to yesterday’s error messages.)

The errors that I can see:

1) ERROR: database “discourse” already exists

2022-05-20 10:35:29.889 UTC [42] LOG: database system is ready to accept connections
I, [2022-05-20T10:35:34.789986 #1] INFO – :
I, [2022-05-20T10:35:34.790259 #1] INFO – : > su postgres -c ‘createdb discourse’ || true
2022-05-20 10:35:34.839 UTC [55] postgres@postgres ERROR: database “discourse” already exists
2022-05-20 10:35:34.839 UTC [55] postgres@postgres STATEMENT: CREATE DATABASE discourse;
createdb: error: database creation failed: ERROR: database “discourse” already exists

2) “index_poll_options_on_poll_id_and_digest”

I, [2022-05-20T10:29:54.464874 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'

2022-05-20 10:29:58.275 UTC [664] discourse@discourse ERROR: duplicate key value violates unique constraint **"index_poll_options_on_poll_id_and_digest"**

2022-05-20 10:29:58.275 UTC [664] discourse@discourse DETAIL: Key (poll_id, digest)=(163, 84b9c1be0d88b6592595e6e16827dbc1) already exists.

2022-05-20 10:29:58.275 UTC [664] discourse@discourse STATEMENT: INSERT INTO poll_options

(poll_id, digest, html, anonymous_votes, created_at, updated_at)

VALUES

(163, 'e8b71c653ce9b67fbfdeb23956415a45', '&lt;2%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, '19aab1c9ed0e7bf7aff0dc154f3f349a', '3%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, 'ba429f197b4f9f3ce89f4e1fb2e8b009', '4%', 1, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, '30eb71c6082b75ca751c3d4e94aa386c', '5%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, '7575912ab29a386e8f6797e280aca664', '6%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, '17950b1d5d660a2e8a078640be0def0a', '7%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, '1c4e675eb7d2d561f16d1afce8330816', '8%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, 'a891f2abb4531189affefe9896df814e', '9%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, 'd7d8f9a60fc4dc25f2e6a986b12e5176', '10%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, '3d5e680f80b95ddbf99490991327349a', '11%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, '84b9c1be0d88b6592595e6e16827dbc1', '12%', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC'),(163, '84b9c1be0d88b6592595e6e16827dbc1', '<blockquote>

<p>12%</p>

</blockquote>', 0, '2019-03-16 12:37:50 UTC', '2019-03-16 12:37:50 UTC')

RETURNING digest, id

rake aborted!

StandardError: An error has occurred, this and all later migrations canceled:

ERROR: duplicate key value violates unique constraint "index_poll_options_on_poll_id_and_digest"

DETAIL: Key (poll_id, digest)=(163, 84b9c1be0d88b6592595e6e16827dbc1) already exists.

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `exec'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `async_exec'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/postgres/connection.rb:209:in `run'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `block in run'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `block in with_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `with_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `run'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/postgres/connection.rb:64:in `query_single'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:131:in `block (2 levels) in up'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:87:in `each'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:87:in `block in up'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:64:in `each'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:64:in `up'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:873:in `public_send'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:873:in `exec_migration'

/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:9:in `block in exec_migration'

/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:854:in `block (2 levels) in migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:853:in `block in migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:852:in `migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1046:in `migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1360:in `block in execute_migration_in_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/transactions.rb:209:in `transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1411:in `ddl_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1359:in `execute_migration_in_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1333:in `each'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1333:in `migrate_without_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1282:in `block in migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1432:in `block in with_advisory_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1447:in `with_advisory_lock_connection'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1428:in `with_advisory_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1282:in `migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1117:in `up'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1092:in `migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/tasks/database_tasks.rb:262:in `migrate'

/var/www/discourse/lib/tasks/db.rake:227:in `block (2 levels) in <main>'

/var/www/discourse/lib/distributed_mutex.rb:33:in `block in synchronize'

/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'

/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'

/var/www/discourse/lib/distributed_mutex.rb:14:in `synchronize'

/var/www/discourse/lib/tasks/db.rake:210:in `block in <main>'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'

/usr/local/bin/bundle:25:in `load'

/usr/local/bin/bundle:25:in `<main>'

Caused by:

PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_poll_options_on_poll_id_and_digest"

DETAIL: Key (poll_id, digest)=(163, 84b9c1be0d88b6592595e6e16827dbc1) already exists.

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `exec'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/patches/db/pg.rb:110:in `async_exec'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/postgres/connection.rb:209:in `run'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `block in run'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `block in with_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `with_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `run'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/mini_sql-1.4.0/lib/mini_sql/postgres/connection.rb:64:in `query_single'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:131:in `block (2 levels) in up'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:87:in `each'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:87:in `block in up'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:64:in `each'

/var/www/discourse/plugins/poll/db/migrate/20180820080623_migrate_polls_data.rb:64:in `up'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:873:in `public_send'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:873:in `exec_migration'

/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:9:in `block in exec_migration'

/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:854:in `block (2 levels) in migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:853:in `block in migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:852:in `migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1046:in `migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1360:in `block in execute_migration_in_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/transactions.rb:209:in `transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1411:in `ddl_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1359:in `execute_migration_in_transaction'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1333:in `each'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1333:in `migrate_without_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1282:in `block in migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1432:in `block in with_advisory_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:215:in `with_connection'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1447:in `with_advisory_lock_connection'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1428:in `with_advisory_lock'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1282:in `migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1117:in `up'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/migration.rb:1092:in `migrate'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-7.0.3/lib/active_record/tasks/database_tasks.rb:262:in `migrate'

/var/www/discourse/lib/tasks/db.rake:227:in `block (2 levels) in <main>'

/var/www/discourse/lib/distributed_mutex.rb:33:in `block in synchronize'

/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'

/var/www/discourse/lib/distributed_mutex.rb:29:in `synchronize'

/var/www/discourse/lib/distributed_mutex.rb:14:in `synchronize'

/var/www/discourse/lib/tasks/db.rake:210:in `block in <main>'

/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'

/usr/local/bin/bundle:25:in `load'

/usr/local/bin/bundle:25:in `<main>'

Tasks: TOP => db:migrate

(See full trace by running task with --trace)

I, [2022-05-20T10:29:58.305849 #1] INFO -- : == 20180820073549 CreatePollsTables: migrating ================================

-- create_table(:polls, {})

-> 0.0172s

-- add_index(:polls, [:post_id, :name], {:unique=>true})

-> 0.0016s

-- create_table(:poll_options, {})

-> 0.0064s

-- add_index(:poll_options, [:poll_id, :digest], {:unique=>true})

-> 0.0018s

-- create_table(:poll_votes, {:id=>false})

-> 0.0067s

-- add_index(:poll_votes, [:poll_id, :poll_option_id, :user_id], {:unique=>true})

-> 0.0013s

== 20180820073549 CreatePollsTables: migrated (0.0376s) =======================

End

I, [2022-05-20T10:29:58.308710 #1] INFO – : Terminating async processes

I, [2022-05-20T10:29:58.308759 #1] INFO – : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 42

I, [2022-05-20T10:29:58.308837 #1] INFO – : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 103

2022-05-20 10:29:58.308 UTC [42] LOG: received fast shutdown request

103:signal-handler (1653042598) Received SIGTERM scheduling shutdown…

103:M 20 May 2022 10:29:58.310 # User requested shutdown…

103:M 20 May 2022 10:29:58.310 * Saving the final RDB snapshot before exiting.

2022-05-20 10:29:58.310 UTC [42] LOG: aborting any active transactions

2022-05-20 10:29:58.312 UTC [42] LOG: background worker “logical replication launcher” (PID 51) exited with exit code 1

2022-05-20 10:29:58.312 UTC [46] LOG: shutting down

2022-05-20 10:29:58.392 UTC [42] LOG: database system is shut down

103:M 20 May 2022 10:29:58.601 * DB saved on disk

103:M 20 May 2022 10:29:58.602 # Redis is now ready to exit, bye bye…

FAILED


Pups::ExecError: cd /var/www/discourse && su discourse -c ‘bundle exec rake db:migrate’ failed with return #<Process::Status: pid 650 exit 1>

Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn’

exec failed with the params {“cd”=>“$home”, “hook”=>“db_migrate”, “cmd”=>[“su discourse -c ‘bundle exec rake db:migrate’”]}

bootstrap failed with exit code 1

**** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.**

./discourse-doctor may help diagnose the problem.

I’ve run discourse doc many times including this time and it didn’t turn up anything I could see

在这种情况下,只需进行新安装,备份旧站点,然后将其恢复到新站点。

哈哈,这有点像我的 OP 角度。

如果这么简单,那我的所有问题都解决了。

你看,我担心的是,我将从 PG10 导出到全新的 2.9,而 2.9 是 PG13,不是吗?那么它会导入数据库吗?我的假设是不会。

因此,在备份和恢复场景中,在这种情况下——在不先升级旧数据库(我一直在尝试)的情况下,管理员导出/导入是否足够?

可以,但您可能需要在 2.9 上恢复当前数据库之前修复一个问题。

这里有一个可能有效的解决方案,但您需要使用 %84b9c1be0d88b6592595e6e16827dbc1% 作为 value,因为这是在您的情况下导致问题的投票 ID。

1 个赞

听起来你的索引已损坏?(我没注意到,但上次回复是这么说的)。
如果是这样,你可以找些例子看看。大部分情况下,你会尝试重新索引,看看哪些索引无法重建,然后删除(或者如果你很聪明,就修复)那些有问题的记录。

谢谢,看起来很有希望,但在应用了其中一些补救步骤后,它在一个新的 poll ID + VALUE 处停止了。

虽然这可能是问题所在,也可能是解决方案——我认为所有 poll 都会导致停止或太多,而不仅仅是一个,而且我的判断也基于 Falco 在另一个帖子中的声明:

那不是损坏的索引。

在 2.1 和 2.5 之间,我们将 poll 从 PluginStore 移到了正确的表中。迁移的原因之一是为了数据一致性,而这正是您遇到的问题。

poll_options 表中有一个重复的值。您能去那里删除重复的条目吗?

需要进行更仔细的调查。

1 个赞

大家好,

我和 @agemo 的情况一样,遇到了完全相同的错误,而且我擅长直接操作数据库。

我不明白的是。建议的解决方案是简单地删除值列中重复 ID 的投票,但当我检查我的表时,我发现这些重复条目都引用了不同的 post_id,因此属于不同的帖子,并且还具有不同的元数据,例如投票数量等。

有人能向我解释一下旧结构与新结构吗,这样我才能理解这个错误。对我来说,删除投票并不能解决问题,因为我实际上是在删除用户数据。

谢谢!

1 个赞

在我看来,这听起来像是索引损坏。你能重新索引那个表吗?

或者,也许是某些东西确实发生了变化,需要更复杂的迁移。或者迁移本身出了问题。

您好 @pfaffman,很高兴再次见到您。我以前也为不同的网站使用过您的服务。

  1. 我绝对可以在此表上重建索引,但这将如何帮助处理非唯一数据?您能详细说明一下为什么您总是从这里开始吗?(我只是在您的回复中注意到这一点)

  2. 迁移是用版本 2.2b4 完成的,那是投票导入实际有效的版本。

  3. 我是否正确理解,在旧表 post_custom_fields 中,值 → poll → options → id 指的是 digest 而不是实际的 poll id?

  4. 什么是 poll digest?

1 个赞

感谢您的回复,但仅仅删除投票并不是解决重复记录的办法。我猜想在 phpbb3 导入的早期阶段就出现了问题,导致了这些记录的创建。它们是有效的,只是具有重复的 UUID,因为原始导入程序没有对此进行检查。

无论如何,对于遇到此问题的任何人,解决方案是执行以下操作:

  1. 更改 post_custom_fields 表中有问题的记录,将它们移开。最好这样做,而不是等待几分钟的重建,结果却看到另一个错误。

    update post_custom_fields set name = 'polls' where name = 'polls_bak';
    update post_custom_fields set name = 'polls-votes' where name = 'polls-votes_bak';

  2. 运行重建应用程序、更新或用户试图做的任何事情。

  3. 在一切构建并启动后,连接到正在运行的实时容器。

  4. 将投票改回原始名称:

    update post_custom_fields set name = 'polls'_bak' where name = 'polls';
    update post_custom_fields set name = 'polls-votes_bak'' where name = 'polls-votes';

  5. 从应用程序容器内部手动运行导致问题的迁移。请注意,VERSION 是迁移文件名中的数字。

    首先撤销迁移,这不会对数据库做任何事情:
    REFACTOR: use tables instead of custom fields for polls by ZogStriP · Pull Request #6359 · discourse/discourse · GitHub

    rake db:migrate:down VERSION=20180820080623

    运行迁移并查找第一个错误:

    rake db:migrate:up VERSION=20180820080623

  6. 使用数据库 GUI 搜索表,以便更轻松地编辑导致问题的 UUID:

    select from post_custom_fields where value like '%your_UUID%';

  7. 现在是棘手的部分。UUID 是投票答案/选项的标识符,所以您需要做的是更改 poll 行中的 UUID,例如从 731ef6901e968fc3f4e785fcb9e9abe8 更改为 731ef6901e968fc3f4e785fcb9e9abe9。您不太可能在系统中找到另一个相同的 UUID。但完成此操作后,您还需要在 poll-votes 中找到对应的条目并将其更改为您的新 UUID。这样您就不会丢失任何投票或答案。

  8. 再次运行迁移并查找下一个错误:

    rake db:migrate:up VERSION=20180820080623

  9. 重复此过程,直到迁移完成,并且所有投票都已迁移到新表中。

我感到失望的是,没有人愿意回复并解释那个 UUID 是什么以及它指的是什么。我知道它是开源的,我知道它提交以来已经过去了几年,我不是在抱怨,但如果官方仓库的提交者能提供一些帮助,将不胜感激。

问题已解决,皆大欢喜。

谢谢!

3 个赞

做得不错 :sunglasses:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.