Skip to content

Instantly share code, notes, and snippets.

@markjeee
Created February 3, 2016 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markjeee/9f0baa7b10b746bfd8e7 to your computer and use it in GitHub Desktop.
Save markjeee/9f0baa7b10b746bfd8e7 to your computer and use it in GitHub Desktop.
## Context
Two dataset.import() calls happen on the same table.
## Stack trace
/home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/logging.rb:58:in `query': Mysql2::Error: Deadlock found when trying to get lock; try restarting transaction (Sequel::SerializationFailure)
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/logging.rb:58:in `block in log_connection_execute'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/logging.rb:33:in `log_yield'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/logging.rb:58:in `log_connection_execute'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/transactions.rb:263:in `commit_transaction'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/adapters/shared/mysql.rb:333:in `commit_transaction'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/transactions.rb:248:in `commit_or_rollback_transaction'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/transactions.rb:136:in `_transaction'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/transactions.rb:100:in `block in transaction'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/connecting.rb:250:in `block in synchronize'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/connection_pool/threaded.rb:98:in `hold'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/connecting.rb:250:in `synchronize'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/database/transactions.rb:89:in `transaction'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/dataset/actions.rb:838:in `_import'
from /home/rubydev/.rvm/gems/ruby-1.9.3-p484/gems/sequel-4.18.0/lib/sequel/dataset/actions.rb:292:in `import'
from /opt/apps/medsafe/releases/20160202052551/lib/palmade/medsafe/workflows/data_points.rb:232:in `block in import_data_points'
from /opt/apps/medsafe/releases/20160202052551/lib/palmade/medsafe/workflows/data_points.rb:385:in `with_notification'
from /opt/apps/medsafe/releases/20160202052551/lib/palmade/medsafe/workflows/data_points.rb:231:in `import_data_points'
from /opt/apps/medsafe/releases/20160202052551/lib/palmade/medsafe/workflows/relocate_patient.rb:208:in `bulk_insert'
from /opt/apps/medsafe/releases/20160202052551/lib/palmade/medsafe/workflows/relocate_patient.rb:139:in `gather_and_insert'
from /opt/apps/medsafe/releases/20160202052551/lib/palmade/medsafe/workflows/relocate_patient.rb:95:in `block in process_all_datapoints'
from /opt/apps/medsafe/releases/20160202052551/lib/palmade/medsafe/workflows/relocate_patient.rb:94:in `each'
from /opt/apps/medsafe/releases/20160202052551/lib/palmade/medsafe/workflows/relocate_patient.rb:94:in `process_all_datapoints'
from thorlib/repart.rb:264:in `perform_relocation'
from thorlib/repart.rb:204:in `block in relocate'
from thorlib/repart.rb:177:in `each'
from thorlib/repart.rb:177:in `relocate'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment