Problem with digest_unsubscribe_keys?


(Clay Heaton) #1

Not sure if this is a bug or what’s going on, but I’m recently seeing a lot of this in the logs, as if the digest_unsubscribe_keys table doesn’t exist. Any idea what’s going on?

Job exception: PG::UndefinedTable: ERROR:  relation "digest_unsubscribe_keys" does not exist
LINE 1: INSERT INTO "digest_unsubscribe_keys" ("user_id", "created_a...
                    ^
: INSERT INTO "digest_unsubscribe_keys" ("user_id", "created_at", "updated_at", "key") VALUES (35, '2016-06-21 16:10:21.054377', '2016-06-21 16:10:21.054377', '18d16f40954b3985c0d27eec5bdda91dcbada746e51a1e1087bad072aced8ce7') RETURNING "key"
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `exec'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `block in exec_no_cache'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:592:in `exec_no_cache'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:584:in `execute_and_clear'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:160:in `exec_query'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql/database_statements.rb:192:in `exec_insert'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:108:in `insert'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `insert'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/relation.rb:64:in `insert'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:524:in `_create_record'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/counter_cache.rb:139:in `_create_record'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/locking/optimistic.rb:75:in `_create_record'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:133:in `_create_record'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:306:in `block in _create_record'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_create_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:306:in `_create_record'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/timestamp.rb:57:in `_create_record'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:504:in `create_or_update'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `block in create_or_update'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:117:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:505:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_save_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/callbacks.rb:302:in `create_or_update'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:120:in `save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/validations.rb:37:in `save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:21:in `save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:286:in `block (2 levels) in save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:286:in `block in save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:301:in `rollback_active_record_state!'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/transactions.rb:285:in `save'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.6/lib/active_record/persistence.rb:34:in `create'
/var/www/discourse/app/models/digest_unsubscribe_key.rb:7:in `create_key_for'
/var/www/discourse/app/mailers/user_notifications.rb:419:in `build_summary_for'
/var/www/discourse/app/mailers/user_notifications.rb:94:in `digest'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:198:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.6/lib/abstract_controller/base.rb:137:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.6/lib/action_view/rendering.rb:30:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:596:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.6/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:593:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/base.rb:584:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/message_delivery.rb:25:in `new'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.6/lib/action_mailer/message_delivery.rb:25:in `__getobj__'
/usr/local/lib/ruby/2.0.0/delegate.rb:70:in `method_missing'
/var/www/discourse/lib/email/sender.rb:30:in `send'
/var/www/discourse/app/jobs/regular/user_email.rb:41:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

hostname	moxie-app
process_id	14650
application_version	ad15c4ac78084f88662ada2a0e24727e7868d7ce
current_db	default
current_hostname	moxie.rtp.rti.org
job	Jobs::UserEmail
problem_db	default
opts	
type	digest
user_id	35
current_site_id	default


(Clay Heaton) #2

As a side note, it would be convenient to be able to look up a user by user_id. The closest we have are urls like: http://website.com/admin/users/6/username but the links don’t work without the username at the end.


(Felix Freiberger) #3

You can actually use anything as the usename; it will still find the user – so you can simply navigate to http://website.com/admin/users/<id>/magic :slight_smile:


(Clay Heaton) #4

This issue might have come from needing to rebuild the app – though upgrades were working great through the web UI and there was no indication that I needed to rebuild. Is there any way that the admin dashboard could indicate that a rebuild is necessary?


(Jeff Atwood) #5

This error with digest_unsubscribe_keys keeps coming up. @sam said it is a timing problem with the rebuild. Go in and rebuild again via the command line.


(Sam Saffron) #6

Yeah, if you use the web UI to update you can get this during the upgrade, should go away after