Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

merge upstream

  • Loading branch information...
commit 60523e8a4cc3be7a246378e66334eef4866a65bc 2 parents 29c098c + 409851c
Ben Osheroff and Simon Wistow authored osheroff committed
5 CHANGELOG
... ... @@ -1,5 +1,10 @@
1 1 deadlock_retry changes
2 2
  3 +== v1.1.0 (2011-04-20)
  4 +
  5 +* Modernize.
  6 +* Drop support for Rails 2.1 and earlier.
  7 +
3 8 == v1.0 - (2009-02-07)
4 9
5 10 * Add INNODB status logging for debugging deadlock issues.
20 LICENSE
... ... @@ -0,0 +1,20 @@
  1 +# Copyright (c) 2005 Jamis Buck
  2 +#
  3 +# Permission is hereby granted, free of charge, to any person obtaining
  4 +# a copy of this software and associated documentation files (the
  5 +# "Software"), to deal in the Software without restriction, including
  6 +# without limitation the rights to use, copy, modify, merge, publish,
  7 +# distribute, sublicense, and/or sell copies of the Software, and to
  8 +# permit persons to whom the Software is furnished to do so, subject to
  9 +# the following conditions:
  10 +#
  11 +# The above copyright notice and this permission notice shall be
  12 +# included in all copies or substantial portions of the Software.
  13 +#
  14 +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15 +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16 +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17 +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  18 +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  19 +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  20 +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 README
@@ -10,11 +10,8 @@ This capability is automatically added to ActiveRecord. No code changes or other
10 10
11 11 Add it to your Rails application by installing the gem:
12 12
13   - sudo gem install mperham-deadlock_retry
  13 + gem install deadlock_retry
14 14
15   -and including a reference to it in your application's config/environment.rb:
  15 +and including a reference to it in your application's Gemfile:
16 16
17   - config.gem 'mperham-deadlock_retry', :lib => 'deadlock_retry', :source => 'http://gems.github.com'
18   -
19   -
20   -Copyright (c) 2005 Jamis Buck, released under the MIT license
  17 + gem 'deadlock_retry'
19 Rakefile
@@ -5,21 +5,8 @@ desc "Default task"
5 5 task :default => [ :test ]
6 6
7 7 Rake::TestTask.new do |t|
  8 + t.libs = ['lib', 'test']
8 9 t.test_files = Dir["test/**/*_test.rb"]
9 10 t.verbose = true
10   -end
11   -
12   -begin
13   - require 'jeweler'
14   -
15   - Jeweler::Tasks.new do |s|
16   - s.name = "deadlock_retry"
17   - s.email = "mperham@gmail.com"
18   - s.homepage = "http://github.com/mperham/deadlock_retry"
19   - s.description = s.summary = "Provides automatical deadlock retry and logging functionality for ActiveRecord and MySQL"
20   - s.authors = ["Jamis Buck", "Mike Perham"]
21   - s.files = FileList['README', 'Rakefile', 'version.yml', "{lib,test}/**/*", 'CHANGELOG']
22   - end
23   -rescue LoadError
24   - # Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com
25   -end
  11 + t.warning = true
  12 +end
4 VERSION.yml
... ... @@ -1,4 +0,0 @@
1   ----
2   -:patch: 0
3   -:major: 1
4   -:minor: 0
27 deadlock_retry.gemspec
@@ -2,28 +2,11 @@
2 2
3 3 Gem::Specification.new do |s|
4 4 s.name = %q{deadlock_retry}
5   - s.version = "1.0.1.2"
6   -
7   - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8   - s.authors = ["Jamis Buck", "Mike Perham", "Ben Osheroff", "Simon Wistow"]
9   - s.date = %q{2009-02-07}
10   - s.description = %q{Provides automatical deadlock retry and logging functionality for ActiveRecord and MySQL}
  5 + s.version = "1.1.1"
  6 + s.authors = ["Jamis Buck", "Mike Perham"]
  7 + s.description = s.summary = %q{Provides automatic deadlock retry and logging functionality for ActiveRecord and MySQL}
11 8 s.email = %q{mperham@gmail.com}
12   - s.files = ["README", "Rakefile", "version.yml", "lib/deadlock_retry.rb", "test/deadlock_retry_test.rb", "CHANGELOG"]
13   - s.has_rdoc = true
14   - s.homepage = %q{http://github.com/zendesk/deadlock_retry}
15   - s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
  9 + s.files = `git ls-files`.split("\n")
  10 + s.homepage = %q{http://github.com/mperham/deadlock_retry}
16 11 s.require_paths = ["lib"]
17   - s.rubygems_version = %q{1.3.1}
18   - s.summary = %q{Provides automatical deadlock retry and logging functionality for ActiveRecord and MySQL}
19   -
20   - if s.respond_to? :specification_version then
21   - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22   - s.specification_version = 2
23   -
24   - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25   - else
26   - end
27   - else
28   - end
29 12 end
23 lib/deadlock_retry.rb
... ... @@ -1,23 +1,3 @@
1   -# Copyright (c) 2005 Jamis Buck
2   -#
3   -# Permission is hereby granted, free of charge, to any person obtaining
4   -# a copy of this software and associated documentation files (the
5   -# "Software"), to deal in the Software without restriction, including
6   -# without limitation the rights to use, copy, modify, merge, publish,
7   -# distribute, sublicense, and/or sell copies of the Software, and to
8   -# permit persons to whom the Software is furnished to do so, subject to
9   -# the following conditions:
10   -#
11   -# The above copyright notice and this permission notice shall be
12   -# included in all copies or substantial portions of the Software.
13   -#
14   -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15   -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16   -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17   -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18   -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19   -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20   -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 1 module DeadlockRetry
22 2
23 3 # Should we try to log innodb status -- if we don't have permission to,
@@ -64,9 +44,8 @@ def transaction_with_deadlock_handling(*objects, &block)
64 44 private
65 45
66 46 def in_nested_transaction?
67   - cn = connection
68 47 # open_transactions was added in 2.2's connection pooling changes.
69   - cn.respond_to?(:open_transactions) && cn.open_transactions != 0
  48 + connection.open_transactions != 0
70 49 end
71 50
72 51 def log_innodb_status
5 test/deadlock_retry_test.rb
... ... @@ -1,13 +1,14 @@
1 1 require 'rubygems'
2 2
3 3 # Change the version if you want to test a different version of ActiveRecord
4   -gem 'activerecord', '2.3.8'
  4 +gem 'activerecord', '3.0.7'
5 5 require 'active_record'
6 6 require 'active_record/version'
7 7 puts "Testing ActiveRecord #{ActiveRecord::VERSION::STRING}"
8 8
9 9 require 'test/unit'
10   -require "#{File.dirname(__FILE__)}/../lib/deadlock_retry"
  10 +require 'logger'
  11 +require "deadlock_retry"
11 12
12 13 class MockModel
13 14 @@open_transactions = 0

0 comments on commit 60523e8

Please sign in to comment.
Something went wrong with that request. Please try again.