Importing old database to latest version

Q: If you have an old DB from Discourse install, v2.0 > export - import > 2.9 - will it fail or is there a conversion process built into import to allow a successful importation?

A: PostgreSQL 13 update

2 Likes

Ah thanks, that seems to work, except now failing to bootstrap on rebuild app.

Seems to be a ā€œdiscourse database already exists: type errorā€ in there as well as ruby/gems error at the boot strap warning.

Iā€™ve read through some of the errors.

For context, this 2.2b4 build (PG10) is the original import setup and build used to import form another old school forum platform - this it has not had any updates or changes made since afaik.

My impression is the solution may be to comment out some lines somewhere only used for the original migration/import - Where would you normally find such customisations for a build?

Note: I have already removed or commented out - plugins, letsā€™ encrypt and the 2.2b4 version lines from the app.yml

Youā€™d need to include your file for real help. If you see stuff like

  apt get

Or something about modifying Gemfile, that would be stuff to remove.

What I would probably do =given that the database upgrade worked) is rename your app.yml and run discourse-setup (assuming that your current file has its data in shared/standalone. It you could just compare your file with samples/standalone.yml.

1 Like

Cool thanks for the pointers. Iā€™ll try the rm app.yml and see what happens.

When you say file do you mean errors in terminal or the app.yml or a different file?

Extra info - Iā€™m spinning up a droplet for learning and puzzling it out so I better understand how to maintain with the bonus of peace of mind trashing. i.e. I didnā€™t run this on/and trash a live forum :wink:

When I walked away for the day yesterday, it struck me I should obviously check out the importer instructions and understand how that is setup and see if there is residue, but you suggestion re: app.yml probably bypasses such curve balls. :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

In that case, just do a new installation, backup the old site, and restore it to the new site.

Ha ha, that was kind of my OP angling.

If itā€™s that simple then all my problem are solved.

See, my concern was Iā€™d be exporting from PG10 into shiny new 2.9 which is PG13 is it not, and so will it suck in the database - my assumption would be no.

Thus in backup and restore scenario, in this context - Is admin export/import sufficient without first upgrading the older DB as I have been trying?

Yes, it is, but you might need to fix a problem with your current DB before you can restore it on 2.9.

Hereā€™s a solution that might work, but you will need to use %84b9c1be0d88b6592595e6e16827dbc1% as value because thatā€™s the poll ID thatā€™s causing problems in your case.

1 Like

So it sounds like you have a corrupt index? (I didnā€™t notice but thatā€™s what the last reply suggests).

If thatā€™s the car then you can look around for some examples. Mostly, you try to reindex and see which indexes wonā€™t rebuild, then delete (or fix if youā€™re clever) the errant records.

Thanks for that, it looked promising, but it stopped on a new poll ID + VALUE after applying some of those remedying steps.

While this may be the problem and it may be the solution - me thinks all the polls will cause a stop or too many, not simply one, and I also base that on Falco statement in the other thread:

That is not a corrupt index.

Between 2.1 and 2.5 we moved pools from PluginStore to proper tables. One of the reasons for the move is to have data consistency, which is exactly the problem you have.

You have a duplicate value on the poll_options table. Can you go there and delete the duplicate entries?

Some closer investigation is required.

1 Like

Hi everyone,

Im in the same boat as @agemo i get exactly the same error and Iā€™m handy with fiddling with database directly.

Here is what I do not understand. The suggested solution is to simply delete the pools of duplicate id in value column, but when I checked my table it turns out those duplicate entries all have reference to different post_id so belong to different posts and also have different meta such as amount of votes and etc

Can someone explain to me old structure vs new structure so I can understand this error. To me deleting polls does not solve the problem as I actually delete users data.

Thank you!

1 Like

It sounds to me like a broken index. Can you reindex that table?

Or maybe itā€™s the case that something did change and a more complex migration is required. Or the migration is broken somehow.

Hi @pfaffman nice to see you again. I did use your service before for different site.

  1. I can definitely rebuild index on this table, but how will it help with non unique data? Can you elaborate why this is what you always start with? ( just noticed it in your replays )

  2. Migration was done with version 2.2b4 it was the one where polls import actually worked.

  3. Do I understand correctly that in the old table post_custom_fields the value->poll->options->id actually refers to digest and not actual poll id?

  4. What is poll digest anyway?

1 Like

Thank you for your replay but simply removing polls is not a solution to duplicate records. I assume somewhere early on the import from phpbb3 was incorrect and created those records. They are valid they just have duplicate UUIDā€™s since original imported did not check for that.

Anyway, the solution for anyone who stumbles across this issue is to do the following:

  1. change problematic records on post_custom_fields table to move them out of the way. It is better to do it that way instead of waiting for rebuild few minutes just to see another error.

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

  1. run the rebuild app, update or whatever user is trying to do.

  2. connect to the live running container after everything builds up and starts up.

  3. change polls back to original naming:

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

  1. run the migration that causes the problem manually from inside the app container, note that VERSION is the number in the filename of the migration

first unrun the migration, this will do nothing as the down method does nothing to the database:

rake db:migrate:down VERSION=20180820080623

run the migration and look for the first error:

rake db:migrate:up VERSION=20180820080623

  1. Search the table using some database GUI for easier editing for the UUID that causes the issue:

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

  1. Now the tricky part. The UUID is the identifier of the polls answer/option so what you have to do is change that UUID on row poll lest say from 731ef6901e968fc3f4e785fcb9e9abe8 to 731ef6901e968fc3f4e785fcb9e9abe9 it is highly unlikely that you fill find another one like this in your system. But after doing this you also need to find the corresponding one in poll-votes and change it to your new one. This way you will not loose any votes or answers.

  2. run the migration again and look for the next error:

rake db:migrate:up VERSION=20180820080623

  1. repeat this process until migration completes and you have all of the polls migrated to your new tables.

Iā€™m disappointed that no one bothered to even replay and explain what that UUID is and what it refers to. I know its open source and I know it has been years since it was committed, Iā€™m not complaining but some sort of assistance from people actually doing comits on the official repo would be much appreciated.

Problem was solved so happy days.

Thanks!

3 Likes

Some noice work going on there. :sunglasses:

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