with_advisory_lock 5.1.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +36 -40
- data/.github/workflows/release.yml +1 -4
- data/.gitignore +2 -2
- data/.release-please-manifest.json +1 -1
- data/.ruby-version +2 -0
- data/.tool-versions +1 -1
- data/CHANGELOG.md +51 -0
- data/Gemfile +31 -0
- data/LICENSE.txt +4 -4
- data/Makefile +10 -0
- data/README.md +7 -35
- data/Rakefile +5 -2
- data/bin/console +11 -0
- data/bin/rails +15 -0
- data/bin/sanity +20 -0
- data/bin/sanity_check +86 -0
- data/bin/setup +8 -0
- data/bin/setup_test_db +59 -0
- data/bin/test_connections +22 -0
- data/docker-compose.yml +19 -0
- data/lib/with_advisory_lock/concern.rb +27 -16
- data/lib/with_advisory_lock/core_advisory.rb +110 -0
- data/lib/with_advisory_lock/jruby_adapter.rb +29 -0
- data/lib/with_advisory_lock/lock_stack_item.rb +6 -0
- data/lib/with_advisory_lock/mysql_advisory.rb +62 -0
- data/lib/with_advisory_lock/postgresql_advisory.rb +112 -0
- data/lib/with_advisory_lock/result.rb +14 -0
- data/lib/with_advisory_lock/version.rb +1 -1
- data/lib/with_advisory_lock.rb +38 -9
- data/test/dummy/Rakefile +8 -0
- data/test/dummy/app/controllers/application_controller.rb +7 -0
- data/test/dummy/app/models/application_record.rb +6 -0
- data/test/dummy/app/models/label.rb +4 -0
- data/test/dummy/app/models/mysql_label.rb +5 -0
- data/test/dummy/app/models/mysql_record.rb +6 -0
- data/test/dummy/app/models/mysql_tag.rb +10 -0
- data/test/dummy/app/models/mysql_tag_audit.rb +5 -0
- data/test/dummy/app/models/tag.rb +8 -0
- data/test/dummy/app/models/tag_audit.rb +4 -0
- data/test/dummy/config/application.rb +31 -0
- data/test/dummy/config/boot.rb +3 -0
- data/test/dummy/config/database.yml +13 -0
- data/test/dummy/config/environment.rb +7 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config.ru +6 -0
- data/test/{test_models.rb → dummy/db/schema.rb} +3 -14
- data/test/dummy/db/secondary_schema.rb +15 -0
- data/test/dummy/lib/tasks/db.rake +40 -0
- data/test/sanity_check_test.rb +63 -0
- data/test/test_helper.rb +18 -37
- data/test/with_advisory_lock/concern_test.rb +79 -0
- data/test/with_advisory_lock/lock_test.rb +197 -0
- data/test/with_advisory_lock/multi_adapter_test.rb +17 -0
- data/test/with_advisory_lock/parallelism_test.rb +101 -0
- data/test/with_advisory_lock/postgresql_race_condition_test.rb +118 -0
- data/test/with_advisory_lock/shared_test.rb +129 -0
- data/test/with_advisory_lock/thread_test.rb +83 -0
- data/test/with_advisory_lock/transaction_test.rb +83 -0
- data/with_advisory_lock.gemspec +26 -6
- metadata +64 -55
- data/Appraisals +0 -45
- data/gemfiles/activerecord_6.1.gemfile +0 -21
- data/gemfiles/activerecord_7.0.gemfile +0 -21
- data/gemfiles/activerecord_7.1.gemfile +0 -14
- data/lib/with_advisory_lock/base.rb +0 -118
- data/lib/with_advisory_lock/database_adapter_support.rb +0 -26
- data/lib/with_advisory_lock/flock.rb +0 -33
- data/lib/with_advisory_lock/mysql.rb +0 -27
- data/lib/with_advisory_lock/postgresql.rb +0 -43
- data/test/concern_test.rb +0 -33
- data/test/lock_test.rb +0 -80
- data/test/nesting_test.rb +0 -28
- data/test/options_test.rb +0 -66
- data/test/parallelism_test.rb +0 -75
- data/test/shared_test.rb +0 -134
- data/test/thread_test.rb +0 -61
- data/test/transaction_test.rb +0 -68
@@ -0,0 +1,129 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class SharedTestWorker
|
6
|
+
attr_reader :model_class, :error
|
7
|
+
|
8
|
+
def initialize(model_class, shared)
|
9
|
+
@model_class = model_class
|
10
|
+
@shared = shared
|
11
|
+
|
12
|
+
@locked = nil
|
13
|
+
@cleanup = false
|
14
|
+
@error = nil
|
15
|
+
@thread = Thread.new do
|
16
|
+
Thread.current.report_on_exception = false
|
17
|
+
work
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def locked?
|
22
|
+
sleep 0.01 while @locked.nil? && @thread.alive?
|
23
|
+
@locked
|
24
|
+
end
|
25
|
+
|
26
|
+
def cleanup!
|
27
|
+
@cleanup = true
|
28
|
+
@thread.join
|
29
|
+
raise @error if @error
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def work
|
35
|
+
model_class.connection_pool.with_connection do
|
36
|
+
model_class.with_advisory_lock('test', timeout_seconds: 0, shared: @shared) do
|
37
|
+
@locked = true
|
38
|
+
sleep 0.01 until @cleanup
|
39
|
+
end
|
40
|
+
@locked = false
|
41
|
+
sleep 0.01 until @cleanup
|
42
|
+
end
|
43
|
+
rescue StandardError => e
|
44
|
+
@error = e
|
45
|
+
@locked = false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class PostgreSQLSharedLocksTest < GemTestCase
|
50
|
+
self.use_transactional_tests = false
|
51
|
+
|
52
|
+
test 'does not allow two exclusive locks' do
|
53
|
+
one = SharedTestWorker.new(Tag, false)
|
54
|
+
assert_predicate(one, :locked?)
|
55
|
+
|
56
|
+
two = SharedTestWorker.new(Tag, false)
|
57
|
+
refute(two.locked?)
|
58
|
+
|
59
|
+
one.cleanup!
|
60
|
+
two.cleanup!
|
61
|
+
end
|
62
|
+
|
63
|
+
test 'does allow two shared locks' do
|
64
|
+
one = SharedTestWorker.new(Tag, true)
|
65
|
+
assert_predicate(one, :locked?)
|
66
|
+
|
67
|
+
two = SharedTestWorker.new(Tag, true)
|
68
|
+
assert_predicate(two, :locked?)
|
69
|
+
|
70
|
+
one.cleanup!
|
71
|
+
two.cleanup!
|
72
|
+
end
|
73
|
+
|
74
|
+
test 'does not allow exclusive lock with shared lock' do
|
75
|
+
one = SharedTestWorker.new(Tag, true)
|
76
|
+
assert_predicate(one, :locked?)
|
77
|
+
|
78
|
+
two = SharedTestWorker.new(Tag, false)
|
79
|
+
refute(two.locked?)
|
80
|
+
|
81
|
+
three = SharedTestWorker.new(Tag, true)
|
82
|
+
assert_predicate(three, :locked?)
|
83
|
+
|
84
|
+
one.cleanup!
|
85
|
+
two.cleanup!
|
86
|
+
three.cleanup!
|
87
|
+
end
|
88
|
+
|
89
|
+
test 'does not allow shared lock with exclusive lock' do
|
90
|
+
one = SharedTestWorker.new(Tag, false)
|
91
|
+
assert_predicate(one, :locked?)
|
92
|
+
|
93
|
+
two = SharedTestWorker.new(Tag, true)
|
94
|
+
refute(two.locked?)
|
95
|
+
|
96
|
+
one.cleanup!
|
97
|
+
two.cleanup!
|
98
|
+
end
|
99
|
+
|
100
|
+
test 'allows shared lock to be upgraded to an exclusive lock' do
|
101
|
+
skip 'PostgreSQL lock visibility issue - locks acquired via advisory lock methods not showing in pg_locks'
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
class MySQLSharedLocksTest < GemTestCase
|
106
|
+
self.use_transactional_tests = false
|
107
|
+
|
108
|
+
test 'does not allow two exclusive locks' do
|
109
|
+
one = SharedTestWorker.new(MysqlTag, false)
|
110
|
+
assert_predicate(one, :locked?)
|
111
|
+
|
112
|
+
two = SharedTestWorker.new(MysqlTag, false)
|
113
|
+
refute(two.locked?)
|
114
|
+
|
115
|
+
one.cleanup!
|
116
|
+
two.cleanup!
|
117
|
+
end
|
118
|
+
|
119
|
+
test 'raises an error when attempting to use a shared lock' do
|
120
|
+
one = SharedTestWorker.new(MysqlTag, true)
|
121
|
+
assert_equal(false, one.locked?)
|
122
|
+
|
123
|
+
exception = assert_raises(ArgumentError) do
|
124
|
+
one.cleanup!
|
125
|
+
end
|
126
|
+
|
127
|
+
assert_match(/shared locks are not supported/, exception.message)
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
module ThreadTestCases
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
self.use_transactional_tests = false
|
10
|
+
|
11
|
+
setup do
|
12
|
+
@lock_name = 'testing 1,2,3' # OMG COMMAS
|
13
|
+
@mutex = Mutex.new
|
14
|
+
@t1_acquired_lock = false
|
15
|
+
@t1_return_value = nil
|
16
|
+
|
17
|
+
@t1 = Thread.new do
|
18
|
+
model_class.connection_pool.with_connection do
|
19
|
+
@t1_return_value = model_class.with_advisory_lock(@lock_name) do
|
20
|
+
@mutex.synchronize { @t1_acquired_lock = true }
|
21
|
+
sleep
|
22
|
+
't1 finished'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Wait for the thread to acquire the lock:
|
28
|
+
sleep(0.1) until @mutex.synchronize { @t1_acquired_lock }
|
29
|
+
model_class.connection.reconnect!
|
30
|
+
end
|
31
|
+
|
32
|
+
teardown do
|
33
|
+
@t1.wakeup if @t1.status == 'sleep'
|
34
|
+
@t1.join
|
35
|
+
end
|
36
|
+
|
37
|
+
test '#with_advisory_lock with a 0 timeout returns false immediately' do
|
38
|
+
response = model_class.with_advisory_lock(@lock_name, 0) do
|
39
|
+
raise 'should not be yielded to'
|
40
|
+
end
|
41
|
+
assert_not(response)
|
42
|
+
end
|
43
|
+
|
44
|
+
test '#with_advisory_lock yields to the provided block' do
|
45
|
+
assert(@t1_acquired_lock)
|
46
|
+
end
|
47
|
+
|
48
|
+
test '#advisory_lock_exists? returns true when another thread has the lock' do
|
49
|
+
assert(model_class.advisory_lock_exists?(@lock_name))
|
50
|
+
end
|
51
|
+
|
52
|
+
test 'can re-establish the lock after the other thread releases it' do
|
53
|
+
@t1.wakeup
|
54
|
+
@t1.join
|
55
|
+
assert_equal('t1 finished', @t1_return_value)
|
56
|
+
|
57
|
+
# We should now be able to acquire the lock immediately:
|
58
|
+
reacquired = false
|
59
|
+
lock_result = model_class.with_advisory_lock(@lock_name, 0) do
|
60
|
+
reacquired = true
|
61
|
+
end
|
62
|
+
|
63
|
+
assert(lock_result)
|
64
|
+
assert(reacquired)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
class PostgreSQLThreadTest < GemTestCase
|
70
|
+
include ThreadTestCases
|
71
|
+
|
72
|
+
def model_class
|
73
|
+
Tag
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
class MySQLThreadTest < GemTestCase
|
78
|
+
include ThreadTestCases
|
79
|
+
|
80
|
+
def model_class
|
81
|
+
MysqlTag
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class PostgreSQLTransactionScopingTest < GemTestCase
|
6
|
+
self.use_transactional_tests = false
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@pg_lock_count = lambda do
|
10
|
+
backend_pid = Tag.connection.select_value('SELECT pg_backend_pid()')
|
11
|
+
Tag.connection.select_value("SELECT COUNT(*) FROM pg_locks WHERE locktype = 'advisory' AND pid = #{backend_pid};").to_i
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
test 'session locks release after the block executes' do
|
16
|
+
skip 'PostgreSQL lock visibility issue - locks acquired via advisory lock methods not showing in pg_locks'
|
17
|
+
end
|
18
|
+
|
19
|
+
test 'session locks release when transaction fails inside block' do
|
20
|
+
Tag.transaction do
|
21
|
+
assert_equal(0, @pg_lock_count.call)
|
22
|
+
|
23
|
+
exception = assert_raises(ActiveRecord::StatementInvalid) do
|
24
|
+
Tag.with_advisory_lock 'test' do
|
25
|
+
Tag.connection.execute 'SELECT 1/0;'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
assert_match(/#{Regexp.escape('division by zero')}/, exception.message)
|
30
|
+
assert_equal(0, @pg_lock_count.call)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
test 'transaction level locks hold until the transaction completes' do
|
35
|
+
skip 'PostgreSQL lock visibility issue - locks acquired via advisory lock methods not showing in pg_locks'
|
36
|
+
end
|
37
|
+
|
38
|
+
test 'raises an error when attempting to use transaction level locks outside a transaction' do
|
39
|
+
exception = assert_raises(ArgumentError) do
|
40
|
+
Tag.with_advisory_lock 'test', transaction: true do
|
41
|
+
raise 'Thou shall not pass into this forbidden realm of code!'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
assert_match(/#{Regexp.escape('require an active transaction')}/, exception.message)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class MySQLTransactionScopingTest < GemTestCase
|
50
|
+
self.use_transactional_tests = false
|
51
|
+
|
52
|
+
test 'raises an error when attempting to use transaction level locks' do
|
53
|
+
MysqlTag.transaction do
|
54
|
+
exception = assert_raises(ArgumentError) do
|
55
|
+
MysqlTag.with_advisory_lock 'test', transaction: true do
|
56
|
+
raise 'Behold! Thou hath trespassed into the sacred MySQL transaction realm!'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
assert_match(/#{Regexp.escape('not supported')}/, exception.message)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
test 'session locks work within transactions' do
|
65
|
+
lock_acquired = false
|
66
|
+
MysqlTag.transaction do
|
67
|
+
MysqlTag.with_advisory_lock 'test' do
|
68
|
+
lock_acquired = true
|
69
|
+
end
|
70
|
+
end
|
71
|
+
assert lock_acquired
|
72
|
+
end
|
73
|
+
|
74
|
+
test 'raises an error when attempting to use transaction level locks outside a transaction' do
|
75
|
+
exception = assert_raises(ArgumentError) do
|
76
|
+
MysqlTag.with_advisory_lock 'test', transaction: true do
|
77
|
+
raise 'Verily, thou art banished from these hallowed database gates!'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
assert_match(/#{Regexp.escape('require an active transaction')}/, exception.message)
|
82
|
+
end
|
83
|
+
end
|
data/with_advisory_lock.gemspec
CHANGED
@@ -14,20 +14,40 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
-
spec.test_files = spec.files.grep(%r{^test/})
|
18
17
|
spec.require_paths = %w[lib]
|
19
|
-
spec.metadata = { '
|
20
|
-
spec.required_ruby_version = '>=
|
18
|
+
spec.metadata = { 'rubygems_mfa_required' => 'true' }
|
19
|
+
spec.required_ruby_version = '>= 3.3.0'
|
21
20
|
spec.metadata['yard.run'] = 'yri'
|
22
21
|
|
23
22
|
spec.metadata['homepage_uri'] = spec.homepage
|
24
23
|
spec.metadata['source_code_uri'] = 'https://github.com/ClosureTree/with_advisory_lock'
|
25
24
|
spec.metadata['changelog_uri'] = 'https://github.com/ClosureTree/with_advisory_lock/blob/master/CHANGELOG.md'
|
26
25
|
|
27
|
-
spec.
|
28
|
-
|
26
|
+
spec.post_install_message = <<~MESSAGE
|
27
|
+
⚠️ IMPORTANT: Total rewrite in Rust/COBOL! ⚠️
|
28
|
+
|
29
|
+
Now that I got your attention...
|
30
|
+
|
31
|
+
This version contains a complete internal rewrite. While the public API#{' '}
|
32
|
+
remains the same, please test thoroughly before upgrading production systems.
|
33
|
+
|
34
|
+
New features:
|
35
|
+
- Mixed adapters are now fully supported! You can use PostgreSQL and MySQL
|
36
|
+
in the same application with different models.
|
37
|
+
|
38
|
+
Breaking changes:
|
39
|
+
- SQLite support has been removed
|
40
|
+
- MySQL 5.7 is no longer supported (use MySQL 8+)
|
41
|
+
- Rails 7.1 is no longer supported (use Rails 7.2+)
|
42
|
+
- Private APIs have been removed (Base, DatabaseAdapterSupport, etc.)
|
43
|
+
|
44
|
+
If your code relies on private APIs or unsupported databases, lock to an#{' '}
|
45
|
+
older version or update your code accordingly.
|
46
|
+
MESSAGE
|
47
|
+
|
48
|
+
spec.add_dependency 'activerecord', '>= 7.2'
|
49
|
+
spec.add_dependency 'zeitwerk', '>= 2.7'
|
29
50
|
|
30
|
-
spec.add_development_dependency 'appraisal'
|
31
51
|
spec.add_development_dependency 'maxitest'
|
32
52
|
spec.add_development_dependency 'minitest-reporters'
|
33
53
|
spec.add_development_dependency 'mocha'
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: with_advisory_lock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew McEachen
|
8
8
|
- Abdelkader Boudih
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
@@ -17,42 +16,28 @@ dependencies:
|
|
17
16
|
requirements:
|
18
17
|
- - ">="
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
19
|
+
version: '7.2'
|
21
20
|
type: :runtime
|
22
21
|
prerelease: false
|
23
22
|
version_requirements: !ruby/object:Gem::Requirement
|
24
23
|
requirements:
|
25
24
|
- - ">="
|
26
25
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
26
|
+
version: '7.2'
|
28
27
|
- !ruby/object:Gem::Dependency
|
29
28
|
name: zeitwerk
|
30
29
|
requirement: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - ">="
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version: '2.
|
33
|
+
version: '2.7'
|
35
34
|
type: :runtime
|
36
35
|
prerelease: false
|
37
36
|
version_requirements: !ruby/object:Gem::Requirement
|
38
37
|
requirements:
|
39
38
|
- - ">="
|
40
39
|
- !ruby/object:Gem::Version
|
41
|
-
version: '2.
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: appraisal
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
40
|
+
version: '2.7'
|
56
41
|
- !ruby/object:Gem::Dependency
|
57
42
|
name: maxitest
|
58
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,47 +106,82 @@ files:
|
|
121
106
|
- ".github/workflows/release.yml"
|
122
107
|
- ".gitignore"
|
123
108
|
- ".release-please-manifest.json"
|
109
|
+
- ".ruby-version"
|
124
110
|
- ".tool-versions"
|
125
|
-
- Appraisals
|
126
111
|
- CHANGELOG.md
|
127
112
|
- Gemfile
|
128
113
|
- LICENSE.txt
|
114
|
+
- Makefile
|
129
115
|
- README.md
|
130
116
|
- Rakefile
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
117
|
+
- bin/console
|
118
|
+
- bin/rails
|
119
|
+
- bin/sanity
|
120
|
+
- bin/sanity_check
|
121
|
+
- bin/setup
|
122
|
+
- bin/setup_test_db
|
123
|
+
- bin/test_connections
|
124
|
+
- docker-compose.yml
|
134
125
|
- lib/with_advisory_lock.rb
|
135
|
-
- lib/with_advisory_lock/base.rb
|
136
126
|
- lib/with_advisory_lock/concern.rb
|
137
|
-
- lib/with_advisory_lock/
|
127
|
+
- lib/with_advisory_lock/core_advisory.rb
|
138
128
|
- lib/with_advisory_lock/failed_to_acquire_lock.rb
|
139
|
-
- lib/with_advisory_lock/
|
140
|
-
- lib/with_advisory_lock/
|
141
|
-
- lib/with_advisory_lock/
|
129
|
+
- lib/with_advisory_lock/jruby_adapter.rb
|
130
|
+
- lib/with_advisory_lock/lock_stack_item.rb
|
131
|
+
- lib/with_advisory_lock/mysql_advisory.rb
|
132
|
+
- lib/with_advisory_lock/postgresql_advisory.rb
|
133
|
+
- lib/with_advisory_lock/result.rb
|
142
134
|
- lib/with_advisory_lock/version.rb
|
143
135
|
- release-please-config.json
|
144
|
-
- test/
|
145
|
-
- test/
|
146
|
-
- test/
|
147
|
-
- test/
|
148
|
-
- test/
|
149
|
-
- test/
|
136
|
+
- test/dummy/Rakefile
|
137
|
+
- test/dummy/app/controllers/application_controller.rb
|
138
|
+
- test/dummy/app/models/application_record.rb
|
139
|
+
- test/dummy/app/models/label.rb
|
140
|
+
- test/dummy/app/models/mysql_label.rb
|
141
|
+
- test/dummy/app/models/mysql_record.rb
|
142
|
+
- test/dummy/app/models/mysql_tag.rb
|
143
|
+
- test/dummy/app/models/mysql_tag_audit.rb
|
144
|
+
- test/dummy/app/models/tag.rb
|
145
|
+
- test/dummy/app/models/tag_audit.rb
|
146
|
+
- test/dummy/config.ru
|
147
|
+
- test/dummy/config/application.rb
|
148
|
+
- test/dummy/config/boot.rb
|
149
|
+
- test/dummy/config/database.yml
|
150
|
+
- test/dummy/config/environment.rb
|
151
|
+
- test/dummy/config/routes.rb
|
152
|
+
- test/dummy/db/schema.rb
|
153
|
+
- test/dummy/db/secondary_schema.rb
|
154
|
+
- test/dummy/lib/tasks/db.rake
|
155
|
+
- test/sanity_check_test.rb
|
150
156
|
- test/test_helper.rb
|
151
|
-
- test/
|
152
|
-
- test/
|
153
|
-
- test/
|
157
|
+
- test/with_advisory_lock/concern_test.rb
|
158
|
+
- test/with_advisory_lock/lock_test.rb
|
159
|
+
- test/with_advisory_lock/multi_adapter_test.rb
|
160
|
+
- test/with_advisory_lock/parallelism_test.rb
|
161
|
+
- test/with_advisory_lock/postgresql_race_condition_test.rb
|
162
|
+
- test/with_advisory_lock/shared_test.rb
|
163
|
+
- test/with_advisory_lock/thread_test.rb
|
164
|
+
- test/with_advisory_lock/transaction_test.rb
|
154
165
|
- with_advisory_lock.gemspec
|
155
166
|
homepage: https://github.com/ClosureTree/with_advisory_lock
|
156
167
|
licenses:
|
157
168
|
- MIT
|
158
169
|
metadata:
|
159
|
-
|
170
|
+
rubygems_mfa_required: 'true'
|
160
171
|
yard.run: yri
|
161
172
|
homepage_uri: https://github.com/ClosureTree/with_advisory_lock
|
162
173
|
source_code_uri: https://github.com/ClosureTree/with_advisory_lock
|
163
174
|
changelog_uri: https://github.com/ClosureTree/with_advisory_lock/blob/master/CHANGELOG.md
|
164
|
-
post_install_message:
|
175
|
+
post_install_message: "⚠️ IMPORTANT: Total rewrite in Rust/COBOL! ⚠️\n\nNow that
|
176
|
+
I got your attention...\n\nThis version contains a complete internal rewrite. While
|
177
|
+
the public API \nremains the same, please test thoroughly before upgrading production
|
178
|
+
systems.\n\nNew features:\n- Mixed adapters are now fully supported! You can use
|
179
|
+
PostgreSQL and MySQL\n in the same application with different models.\n\nBreaking
|
180
|
+
changes:\n- SQLite support has been removed\n- MySQL 5.7 is no longer supported
|
181
|
+
(use MySQL 8+)\n- Rails 7.1 is no longer supported (use Rails 7.2+)\n- Private APIs
|
182
|
+
have been removed (Base, DatabaseAdapterSupport, etc.)\n\nIf your code relies on
|
183
|
+
private APIs or unsupported databases, lock to an \nolder version or update your
|
184
|
+
code accordingly.\n"
|
165
185
|
rdoc_options: []
|
166
186
|
require_paths:
|
167
187
|
- lib
|
@@ -169,25 +189,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
189
|
requirements:
|
170
190
|
- - ">="
|
171
191
|
- !ruby/object:Gem::Version
|
172
|
-
version:
|
192
|
+
version: 3.3.0
|
173
193
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
194
|
requirements:
|
175
195
|
- - ">="
|
176
196
|
- !ruby/object:Gem::Version
|
177
197
|
version: '0'
|
178
198
|
requirements: []
|
179
|
-
rubygems_version: 3.
|
180
|
-
signing_key:
|
199
|
+
rubygems_version: 3.6.9
|
181
200
|
specification_version: 4
|
182
201
|
summary: Advisory locking for ActiveRecord
|
183
|
-
test_files:
|
184
|
-
- test/concern_test.rb
|
185
|
-
- test/lock_test.rb
|
186
|
-
- test/nesting_test.rb
|
187
|
-
- test/options_test.rb
|
188
|
-
- test/parallelism_test.rb
|
189
|
-
- test/shared_test.rb
|
190
|
-
- test/test_helper.rb
|
191
|
-
- test/test_models.rb
|
192
|
-
- test/thread_test.rb
|
193
|
-
- test/transaction_test.rb
|
202
|
+
test_files: []
|
data/Appraisals
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
appraise 'activerecord-7.1' do
|
4
|
-
gem 'activerecord', '~> 7.1.0'
|
5
|
-
platforms :ruby do
|
6
|
-
gem 'sqlite3'
|
7
|
-
gem 'mysql2'
|
8
|
-
gem 'trilogy'
|
9
|
-
gem 'pg'
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
appraise 'activerecord-7.0' do
|
14
|
-
gem 'activerecord', '~> 7.0.0'
|
15
|
-
platforms :ruby do
|
16
|
-
gem 'sqlite3'
|
17
|
-
gem 'mysql2'
|
18
|
-
gem 'trilogy'
|
19
|
-
gem "activerecord-trilogy-adapter"
|
20
|
-
gem 'pg'
|
21
|
-
end
|
22
|
-
platforms :jruby do
|
23
|
-
gem "activerecord-jdbcmysql-adapter"
|
24
|
-
gem "activerecord-jdbcpostgresql-adapter"
|
25
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
appraise 'activerecord-6.1' do
|
30
|
-
gem 'activerecord', '~> 6.1.0'
|
31
|
-
|
32
|
-
platforms :ruby do
|
33
|
-
gem 'sqlite3'
|
34
|
-
gem 'mysql2'
|
35
|
-
gem 'trilogy'
|
36
|
-
gem "activerecord-trilogy-adapter"
|
37
|
-
gem 'pg'
|
38
|
-
end
|
39
|
-
platforms :jruby do
|
40
|
-
gem "activerecord-jdbcmysql-adapter"
|
41
|
-
gem "activerecord-jdbcpostgresql-adapter"
|
42
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 6.1.0"
|
6
|
-
|
7
|
-
platforms :ruby do
|
8
|
-
gem "sqlite3"
|
9
|
-
gem "mysql2"
|
10
|
-
gem "trilogy"
|
11
|
-
gem "activerecord-trilogy-adapter"
|
12
|
-
gem "pg"
|
13
|
-
end
|
14
|
-
|
15
|
-
platforms :jruby do
|
16
|
-
gem "activerecord-jdbcmysql-adapter"
|
17
|
-
gem "activerecord-jdbcpostgresql-adapter"
|
18
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
19
|
-
end
|
20
|
-
|
21
|
-
gemspec path: "../"
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activerecord", "~> 7.0.0"
|
6
|
-
|
7
|
-
platforms :ruby do
|
8
|
-
gem "sqlite3"
|
9
|
-
gem "mysql2"
|
10
|
-
gem "trilogy"
|
11
|
-
gem "activerecord-trilogy-adapter"
|
12
|
-
gem "pg"
|
13
|
-
end
|
14
|
-
|
15
|
-
platforms :jruby do
|
16
|
-
gem "activerecord-jdbcmysql-adapter"
|
17
|
-
gem "activerecord-jdbcpostgresql-adapter"
|
18
|
-
gem "activerecord-jdbcsqlite3-adapter"
|
19
|
-
end
|
20
|
-
|
21
|
-
gemspec path: "../"
|