This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Current ActiveRecord code: | |
Selector Thread reports shared record exists | |
Thread 1 (0.8ms) BEGIN | |
Thread 1 running before_destroy callback | |
Thread 2 (0.6ms) BEGIN | |
Thread 2 running before_destroy callback | |
Selector Thread reports shared record exists | |
Thread 1 running before_destroy callback | |
Thread 2 running before_destroy callback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_record' | |
require 'logger' | |
# Run as `ruby row_lock_test.rb [mysql|postgresql]` to see current Rails behavior when two processes | |
# try to destroy a record at the same time. | |
# | |
# Run as `ruby row_lock_test.rb [mysql|postgresql] patch` to see the behavior desired in pull request | |
# https://github.com/rails/rails/pull/7965 | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection("adapter" => "sqlite3", "database" => ":memory:") | |
class Widget < ActiveRecord::Base | |
connection.create_table table_name do |t| | |
t.string :name | |
t.integer :thing_count | |
end unless table_exists? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'bundler' | |
require 'benchmark' | |
REGEXPS = [ | |
/^no such file to load -- (.+)$/i, | |
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
/^Missing API definition file in (.+)$/i, | |
/^cannot load such file -- (.+)$/i, |
NewerOlder