redis_queued_locks 1.16.2 → 1.18.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/.claude/project-overview.md +281 -0
- data/.claude/rules/acquirer.md +81 -0
- data/.claude/rules/arguments.md +60 -0
- data/.claude/rules/git.md +46 -0
- data/.claude/rules/logic.md +63 -0
- data/.claude/rules/swarm.md +120 -0
- data/.claude/rules/tests.md +48 -0
- data/.claude/rules/type-checking.md +50 -0
- data/.claude/rules/visitors.md +69 -0
- data/.rubocop.rbs.yml +31 -0
- data/.rubocop.yml +3 -3
- data/.ruby-version +1 -1
- data/CHANGELOG.md +80 -0
- data/CLAUDE.md +36 -0
- data/README.md +367 -82
- data/Rakefile +31 -2
- data/github_ci/.keep +0 -0
- data/lib/redis_queued_locks/acquirer/acquire_lock/delay_execution.rb +2 -2
- data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +6 -3
- data/lib/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rb +9 -7
- data/lib/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rb +20 -10
- data/lib/redis_queued_locks/acquirer/acquire_lock/log_visitor.rb +34 -16
- data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rb +240 -28
- data/lib/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rb +398 -132
- data/lib/redis_queued_locks/acquirer/acquire_lock/yield_expire/log_visitor.rb +12 -6
- data/lib/redis_queued_locks/acquirer/acquire_lock/yield_expire.rb +33 -9
- data/lib/redis_queued_locks/acquirer/acquire_lock.rb +73 -24
- data/lib/redis_queued_locks/acquirer/clear_dead_requests.rb +9 -1
- data/lib/redis_queued_locks/acquirer/extend_lock_ttl.rb +182 -3
- data/lib/redis_queued_locks/acquirer/is_locked.rb +19 -2
- data/lib/redis_queued_locks/acquirer/is_queued.rb +6 -2
- data/lib/redis_queued_locks/acquirer/lock_info.rb +96 -6
- data/lib/redis_queued_locks/acquirer/lock_series_poc/instr_visitor.rb +8 -4
- data/lib/redis_queued_locks/acquirer/lock_series_poc/log_visitor.rb +18 -7
- data/lib/redis_queued_locks/acquirer/lock_series_poc.rb +126 -29
- data/lib/redis_queued_locks/acquirer/locks.rb +103 -6
- data/lib/redis_queued_locks/acquirer/queue_info.rb +38 -9
- data/lib/redis_queued_locks/acquirer/queues.rb +28 -4
- data/lib/redis_queued_locks/acquirer/release_all_locks.rb +35 -1
- data/lib/redis_queued_locks/acquirer/release_lock.rb +40 -9
- data/lib/redis_queued_locks/acquirer/release_locks_of.rb +43 -3
- data/lib/redis_queued_locks/acquirer/release_read_lock.rb +143 -0
- data/lib/redis_queued_locks/acquirer.rb +1 -0
- data/lib/redis_queued_locks/client.rb +274 -158
- data/lib/redis_queued_locks/config/dsl.rb +4 -10
- data/lib/redis_queued_locks/resource.rb +117 -9
- data/lib/redis_queued_locks/swarm/flush_zombies.rb +46 -6
- data/lib/redis_queued_locks/swarm/supervisor.rb +1 -1
- data/lib/redis_queued_locks/swarm/swarm_element/isolated.rb +166 -44
- data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +45 -47
- data/lib/redis_queued_locks/swarm/zombie_info.rb +42 -0
- data/lib/redis_queued_locks/version.rb +2 -2
- data/rbs_collection.lock.yaml +10 -2
- data/rbs_collection.yaml +0 -2
- data/redis_queued_locks.gemspec +1 -1
- data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue/log_visitor.rbs +2 -1
- data/sig/redis_queued_locks/acquirer/acquire_lock/dequeue_from_lock_queue.rbs +0 -1
- data/sig/redis_queued_locks/acquirer/acquire_lock/instr_visitor.rbs +5 -0
- data/sig/redis_queued_locks/acquirer/acquire_lock/log_visitor.rbs +12 -6
- data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock/log_visitor.rbs +74 -7
- data/sig/redis_queued_locks/acquirer/acquire_lock/try_to_lock.rbs +4 -2
- data/sig/redis_queued_locks/acquirer/acquire_lock/yield_expire.rbs +3 -0
- data/sig/redis_queued_locks/acquirer/acquire_lock/yield_with_expire/log_visitor.rbs +4 -2
- data/sig/redis_queued_locks/acquirer/extend_lock_ttl.rbs +19 -1
- data/sig/redis_queued_locks/acquirer/lock_info.rbs +9 -1
- data/sig/redis_queued_locks/acquirer/locks.rbs +10 -1
- data/sig/redis_queued_locks/acquirer/queue_info.rbs +2 -4
- data/sig/redis_queued_locks/acquirer/queues.rbs +1 -1
- data/sig/redis_queued_locks/acquirer/release_lock.rbs +8 -1
- data/sig/redis_queued_locks/acquirer/release_read_lock.rbs +44 -0
- data/sig/redis_queued_locks/client.rbs +22 -2
- data/sig/redis_queued_locks/resource.rbs +9 -2
- data/sig/redis_queued_locks/swarm/flush_zombies.rbs +1 -1
- data/sig/redis_queued_locks/swarm/swarm_element/isolated.rbs +13 -5
- data/sig/redis_queued_locks/swarm/swarm_element/threaded.rbs +6 -6
- data/sig/redis_queued_locks/swarm/zombie_info.rbs +5 -0
- metadata +17 -5
- data/github_ci/ruby3.3.gemfile +0 -17
- data/github_ci/ruby3.3.gemfile.lock +0 -216
data/Rakefile
CHANGED
|
@@ -11,18 +11,47 @@ require 'rubocop-rake'
|
|
|
11
11
|
require 'rubocop-on-rbs'
|
|
12
12
|
require 'rubocop-thread_safety'
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
# NOTE: Ruby sources and RBS signatures are linted by separate runs with separate configs:
|
|
15
|
+
# Ruby cops (and the project index they use) must not see RBS signatures;
|
|
16
|
+
desc 'Run RuboCop for Ruby sources'
|
|
17
|
+
RuboCop::RakeTask.new('rubocop:ruby') do |t|
|
|
18
|
+
# NOTE: replace the default "Running RuboCop..." message (printed when verbose);
|
|
19
|
+
t.verbose = false
|
|
20
|
+
puts 'Running RuboCop (Ruby sources)...'
|
|
15
21
|
config_path = File.expand_path(File.join('.rubocop.yml'), __dir__)
|
|
16
22
|
t.options = [
|
|
17
23
|
'--config', config_path,
|
|
18
24
|
'--plugin', 'rubocop-rspec',
|
|
19
25
|
'--plugin', 'rubocop-performance',
|
|
20
26
|
'--plugin', 'rubocop-rake',
|
|
21
|
-
'--plugin', 'rubocop-on-rbs',
|
|
22
27
|
'--plugin', 'rubocop-thread_safety'
|
|
23
28
|
]
|
|
24
29
|
end
|
|
25
30
|
|
|
31
|
+
desc 'Run RuboCop for RBS signatures and inline RBS annotations'
|
|
32
|
+
RuboCop::RakeTask.new('rubocop:rbs') do |t|
|
|
33
|
+
# NOTE: replace the default "Running RuboCop..." message (printed when verbose);
|
|
34
|
+
t.verbose = false
|
|
35
|
+
puts 'Running RuboCop (RBS signatures and inline RBS annotations)...'
|
|
36
|
+
config_path = File.expand_path(File.join('.rubocop.rbs.yml'), __dir__)
|
|
37
|
+
t.options = [
|
|
38
|
+
'--config', config_path,
|
|
39
|
+
'--plugin', 'rubocop-on-rbs'
|
|
40
|
+
]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
desc 'Run RuboCop for Ruby sources and RBS signatures'
|
|
44
|
+
task :rubocop do
|
|
45
|
+
# NOTE: run both linters even if the first one fails (a failed RuboCop task aborts);
|
|
46
|
+
failed = %w[rubocop:ruby rubocop:rbs].reject do |task_name|
|
|
47
|
+
Rake::Task[task_name].invoke
|
|
48
|
+
true
|
|
49
|
+
rescue SystemExit
|
|
50
|
+
false
|
|
51
|
+
end
|
|
52
|
+
abort("RuboCop failed: #{failed.join(', ')}") if failed.any?
|
|
53
|
+
end
|
|
54
|
+
|
|
26
55
|
RSpec::Core::RakeTask.new(:rspec)
|
|
27
56
|
Steep::RakeTask.new(:steep)
|
|
28
57
|
|
data/github_ci/.keep
ADDED
|
File without changes
|
|
@@ -12,7 +12,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::DelayExecution
|
|
|
12
12
|
# @api private
|
|
13
13
|
# @since 1.0.0
|
|
14
14
|
def delay_execution(retry_delay, retry_jitter)
|
|
15
|
-
delay = (retry_delay +
|
|
16
|
-
|
|
15
|
+
delay = (retry_delay + Kernel.rand(retry_jitter)).to_f / 1_000
|
|
16
|
+
Kernel.sleep(delay)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -11,11 +11,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue::LogVisitor
|
|
|
11
11
|
# @param acquirer_id [String]
|
|
12
12
|
# @param host_id [String]
|
|
13
13
|
# @param access_strategy [Symbol]
|
|
14
|
+
# @param rw_mode [Symbol]
|
|
14
15
|
# @return [void]
|
|
15
16
|
#
|
|
16
17
|
# @api private
|
|
17
18
|
# @since 1.7.0
|
|
18
|
-
# @version 1.
|
|
19
|
+
# @version 1.18.0
|
|
19
20
|
def dequeue_from_lock_queue(
|
|
20
21
|
logger,
|
|
21
22
|
log_sampled,
|
|
@@ -23,7 +24,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue::LogVisitor
|
|
|
23
24
|
queue_ttl,
|
|
24
25
|
acquirer_id,
|
|
25
26
|
host_id,
|
|
26
|
-
access_strategy
|
|
27
|
+
access_strategy,
|
|
28
|
+
rw_mode
|
|
27
29
|
)
|
|
28
30
|
return unless log_sampled
|
|
29
31
|
|
|
@@ -33,7 +35,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue::LogVisitor
|
|
|
33
35
|
"queue_ttl => #{queue_ttl} " \
|
|
34
36
|
"acq_id => '#{acquirer_id}' " \
|
|
35
37
|
"hst_id => '#{host_id}' " \
|
|
36
|
-
"acs_strat => '#{access_strategy}"
|
|
38
|
+
"acs_strat => '#{access_strategy}' " \
|
|
39
|
+
"rw_mode => '#{rw_mode}'"
|
|
37
40
|
end rescue nil
|
|
38
41
|
end
|
|
39
42
|
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# @api private
|
|
4
4
|
# @since 1.7.0
|
|
5
|
+
# @version 1.18.0
|
|
5
6
|
module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue
|
|
6
7
|
require_relative 'dequeue_from_lock_queue/log_visitor'
|
|
7
8
|
|
|
@@ -9,9 +10,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue
|
|
|
9
10
|
# @param logger [::Logger,#debug]
|
|
10
11
|
# @param lock_key [String]
|
|
11
12
|
# @param read_write_mode [Symbol]
|
|
12
|
-
# @param lock_key_queue [String]
|
|
13
|
-
# @param read_lock_key_queue [String]
|
|
14
|
-
# @param write_lock_key_queue [String]
|
|
13
|
+
# @param lock_key_queue [String] Queue of write lock requests.
|
|
14
|
+
# @param read_lock_key_queue [String] Queue of read lock requests.
|
|
15
15
|
# @param queue_ttl [Integer]
|
|
16
16
|
# @param acquirer_id [String]
|
|
17
17
|
# @param host_id [String]
|
|
@@ -22,7 +22,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue
|
|
|
22
22
|
#
|
|
23
23
|
# @api private
|
|
24
24
|
# @since 1.7.0
|
|
25
|
-
# @version 1.
|
|
25
|
+
# @version 1.18.0
|
|
26
26
|
def dequeue_from_lock_queue(
|
|
27
27
|
redis,
|
|
28
28
|
logger,
|
|
@@ -30,7 +30,6 @@ module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue
|
|
|
30
30
|
read_write_mode,
|
|
31
31
|
lock_key_queue,
|
|
32
32
|
read_lock_key_queue,
|
|
33
|
-
write_lock_key_queue,
|
|
34
33
|
queue_ttl,
|
|
35
34
|
acquirer_id,
|
|
36
35
|
host_id,
|
|
@@ -38,12 +37,15 @@ module RedisQueuedLocks::Acquirer::AcquireLock::DequeueFromLockQueue
|
|
|
38
37
|
log_sampled,
|
|
39
38
|
instr_sampled
|
|
40
39
|
)
|
|
40
|
+
# NOTE: the request lives in the queue of the requested mode
|
|
41
|
+
request_queue = (read_write_mode == :read) ? read_lock_key_queue : lock_key_queue
|
|
42
|
+
|
|
41
43
|
# @type var result: Integer
|
|
42
|
-
result = redis.call('ZREM',
|
|
44
|
+
result = redis.call('ZREM', request_queue, acquirer_id)
|
|
43
45
|
|
|
44
46
|
LogVisitor.dequeue_from_lock_queue(
|
|
45
47
|
logger, log_sampled,
|
|
46
|
-
lock_key, queue_ttl, acquirer_id, host_id, access_strategy
|
|
48
|
+
lock_key, queue_ttl, acquirer_id, host_id, access_strategy, read_write_mode
|
|
47
49
|
)
|
|
48
50
|
|
|
49
51
|
{ ok: true, result: result }
|
|
@@ -7,6 +7,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
7
7
|
# @param instrumenter [#notify]
|
|
8
8
|
# @param instr_sampled [Boolean]
|
|
9
9
|
# @param lock_key [String]
|
|
10
|
+
# @param rw_mode [Symbol]
|
|
10
11
|
# @param ttl [Integer, NilClass]
|
|
11
12
|
# @param acq_id [String]
|
|
12
13
|
# @param hst_id [String]
|
|
@@ -17,11 +18,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
17
18
|
#
|
|
18
19
|
# @api private
|
|
19
20
|
# @since 1.7.0
|
|
20
|
-
# @version 1.
|
|
21
|
+
# @version 1.18.0
|
|
21
22
|
def extendable_reentrant_lock_obtained(
|
|
22
23
|
instrumenter,
|
|
23
24
|
instr_sampled,
|
|
24
25
|
lock_key,
|
|
26
|
+
rw_mode,
|
|
25
27
|
ttl,
|
|
26
28
|
acq_id,
|
|
27
29
|
hst_id,
|
|
@@ -31,13 +33,14 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
31
33
|
)
|
|
32
34
|
return unless instr_sampled
|
|
33
35
|
instrumenter.notify('redis_queued_locks.extendable_reentrant_lock_obtained', {
|
|
34
|
-
lock_key:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
36
|
+
lock_key:, rw_mode:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
35
37
|
}) rescue nil
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
# @param instrumenter [#notify]
|
|
39
41
|
# @param instr_sampled [Boolean]
|
|
40
42
|
# @param lock_key [String]
|
|
43
|
+
# @param rw_mode [Symbol]
|
|
41
44
|
# @param ttl [Integer, NilClass]
|
|
42
45
|
# @param acq_id [String]
|
|
43
46
|
# @param hst_id [String]
|
|
@@ -48,11 +51,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
48
51
|
#
|
|
49
52
|
# @api private
|
|
50
53
|
# @since 1.7.0
|
|
51
|
-
# @version 1.
|
|
54
|
+
# @version 1.18.0
|
|
52
55
|
def reentrant_lock_obtained(
|
|
53
56
|
instrumenter,
|
|
54
57
|
instr_sampled,
|
|
55
58
|
lock_key,
|
|
59
|
+
rw_mode,
|
|
56
60
|
ttl,
|
|
57
61
|
acq_id,
|
|
58
62
|
hst_id,
|
|
@@ -62,13 +66,14 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
62
66
|
)
|
|
63
67
|
return unless instr_sampled
|
|
64
68
|
instrumenter.notify('redis_queued_locks.reentrant_lock_obtained', {
|
|
65
|
-
lock_key:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
69
|
+
lock_key:, rw_mode:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
66
70
|
}) rescue nil
|
|
67
71
|
end
|
|
68
72
|
|
|
69
73
|
# @param instrumenter [#notify]
|
|
70
74
|
# @param instr_sampled [Boolean]
|
|
71
75
|
# @param lock_key [String]
|
|
76
|
+
# @param rw_mode [Symbol]
|
|
72
77
|
# @param ttl [Integer, NilClass]
|
|
73
78
|
# @param acq_id [String]
|
|
74
79
|
# @param hst_id [String]
|
|
@@ -79,11 +84,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
79
84
|
#
|
|
80
85
|
# @api private
|
|
81
86
|
# @since 1.7.0
|
|
82
|
-
# @version 1.
|
|
87
|
+
# @version 1.18.0
|
|
83
88
|
def lock_obtained(
|
|
84
89
|
instrumenter,
|
|
85
90
|
instr_sampled,
|
|
86
91
|
lock_key,
|
|
92
|
+
rw_mode,
|
|
87
93
|
ttl,
|
|
88
94
|
acq_id,
|
|
89
95
|
hst_id,
|
|
@@ -93,13 +99,14 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
93
99
|
)
|
|
94
100
|
return unless instr_sampled
|
|
95
101
|
instrumenter.notify('redis_queued_locks.lock_obtained', {
|
|
96
|
-
lock_key:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
102
|
+
lock_key:, rw_mode:, ttl:, acq_id:, hst_id:, ts:, acq_time:, instrument:
|
|
97
103
|
}) rescue nil
|
|
98
104
|
end
|
|
99
105
|
|
|
100
106
|
# @param instrumenter [#notify]
|
|
101
107
|
# @param instr_sampled [Boolean]
|
|
102
108
|
# @param lock_key [String]
|
|
109
|
+
# @param rw_mode [Symbol]
|
|
103
110
|
# @param ttl [Integer, NilClass]
|
|
104
111
|
# @param acq_id [String]
|
|
105
112
|
# @param hst_id [String]
|
|
@@ -111,11 +118,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
111
118
|
#
|
|
112
119
|
# @api private
|
|
113
120
|
# @since 1.7.0
|
|
114
|
-
# @version 1.
|
|
121
|
+
# @version 1.18.0
|
|
115
122
|
def reentrant_lock_hold_completes(
|
|
116
123
|
instrumenter,
|
|
117
124
|
instr_sampled,
|
|
118
125
|
lock_key,
|
|
126
|
+
rw_mode,
|
|
119
127
|
ttl,
|
|
120
128
|
acq_id,
|
|
121
129
|
hst_id,
|
|
@@ -126,13 +134,14 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
126
134
|
)
|
|
127
135
|
return unless instr_sampled
|
|
128
136
|
instrumenter.notify('redis_queued_locks.reentrant_lock_hold_completes', {
|
|
129
|
-
hold_time:, ttl:, acq_id:, hst_id:, ts:, lock_key:, acq_time:, instrument:
|
|
137
|
+
hold_time:, ttl:, acq_id:, hst_id:, ts:, lock_key:, rw_mode:, acq_time:, instrument:
|
|
130
138
|
}) rescue nil
|
|
131
139
|
end
|
|
132
140
|
|
|
133
141
|
# @param instrumenter [#notify]
|
|
134
142
|
# @param instr_sampled [Boolean]
|
|
135
143
|
# @param lock_key [String]
|
|
144
|
+
# @param rw_mode [Symbol]
|
|
136
145
|
# @param ttl [Integer, NilClass]
|
|
137
146
|
# @param acq_id [String]
|
|
138
147
|
# @param hst_id [String]
|
|
@@ -144,11 +153,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
144
153
|
#
|
|
145
154
|
# @api private
|
|
146
155
|
# @since 1.7.0
|
|
147
|
-
# @version 1.
|
|
156
|
+
# @version 1.18.0
|
|
148
157
|
def lock_hold_and_release(
|
|
149
158
|
instrumenter,
|
|
150
159
|
instr_sampled,
|
|
151
160
|
lock_key,
|
|
161
|
+
rw_mode,
|
|
152
162
|
ttl,
|
|
153
163
|
acq_id,
|
|
154
164
|
hst_id,
|
|
@@ -159,7 +169,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::InstrVisitor
|
|
|
159
169
|
)
|
|
160
170
|
return unless instr_sampled
|
|
161
171
|
instrumenter.notify('redis_queued_locks.lock_hold_and_release', {
|
|
162
|
-
hold_time:, ttl:, acq_id:, hst_id:, ts:, lock_key:, acq_time:, instrument:
|
|
172
|
+
hold_time:, ttl:, acq_id:, hst_id:, ts:, lock_key:, rw_mode:, acq_time:, instrument:
|
|
163
173
|
}) rescue nil
|
|
164
174
|
end
|
|
165
175
|
end
|
|
@@ -13,11 +13,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
13
13
|
# @param acquirer_id [String]
|
|
14
14
|
# @param host_id [String]
|
|
15
15
|
# @param access_strategy [Symbol]
|
|
16
|
+
# @param rw_mode [Symbol]
|
|
16
17
|
# @return [void]
|
|
17
18
|
#
|
|
18
19
|
# @api private
|
|
19
20
|
# @since 1.7.0
|
|
20
|
-
# @version 1.
|
|
21
|
+
# @version 1.18.0
|
|
21
22
|
def start_lock_obtaining(
|
|
22
23
|
logger,
|
|
23
24
|
log_sampled,
|
|
@@ -25,7 +26,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
25
26
|
queue_ttl,
|
|
26
27
|
acquirer_id,
|
|
27
28
|
host_id,
|
|
28
|
-
access_strategy
|
|
29
|
+
access_strategy,
|
|
30
|
+
rw_mode
|
|
29
31
|
)
|
|
30
32
|
return unless log_sampled
|
|
31
33
|
|
|
@@ -35,7 +37,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
35
37
|
"queue_ttl => #{queue_ttl} " \
|
|
36
38
|
"acq_id => '#{acquirer_id}' " \
|
|
37
39
|
"hst_id => '#{host_id}' " \
|
|
38
|
-
"acs_strat => '#{access_strategy}'"
|
|
40
|
+
"acs_strat => '#{access_strategy}' " \
|
|
41
|
+
"rw_mode => '#{rw_mode}'"
|
|
39
42
|
end rescue nil
|
|
40
43
|
end
|
|
41
44
|
|
|
@@ -46,11 +49,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
46
49
|
# @param acquirer_id [String]
|
|
47
50
|
# @param host_id [String]
|
|
48
51
|
# @param access_strategy [Symbol]
|
|
52
|
+
# @param rw_mode [Symbol]
|
|
49
53
|
# @return [void]
|
|
50
54
|
#
|
|
51
55
|
# @api private
|
|
52
56
|
# @since 1.7.0
|
|
53
|
-
# @version 1.
|
|
57
|
+
# @version 1.18.0
|
|
54
58
|
def start_try_to_lock_cycle(
|
|
55
59
|
logger,
|
|
56
60
|
log_sampled,
|
|
@@ -58,7 +62,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
58
62
|
queue_ttl,
|
|
59
63
|
acquirer_id,
|
|
60
64
|
host_id,
|
|
61
|
-
access_strategy
|
|
65
|
+
access_strategy,
|
|
66
|
+
rw_mode
|
|
62
67
|
)
|
|
63
68
|
return unless log_sampled
|
|
64
69
|
|
|
@@ -68,7 +73,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
68
73
|
"queue_ttl => #{queue_ttl} " \
|
|
69
74
|
"acq_id => '#{acquirer_id}' " \
|
|
70
75
|
"hst_id => '#{host_id}' " \
|
|
71
|
-
"acs_strat => '#{access_strategy}'"
|
|
76
|
+
"acs_strat => '#{access_strategy}' " \
|
|
77
|
+
"rw_mode => '#{rw_mode}'"
|
|
72
78
|
end rescue nil
|
|
73
79
|
end
|
|
74
80
|
|
|
@@ -79,11 +85,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
79
85
|
# @param acquirer_id [String]
|
|
80
86
|
# @param host_id [String]
|
|
81
87
|
# @param access_strategy [Symbol]
|
|
88
|
+
# @param rw_mode [Symbol]
|
|
82
89
|
# @return [void]
|
|
83
90
|
#
|
|
84
91
|
# @api private
|
|
85
92
|
# @since 1.7.0
|
|
86
|
-
# @version 1.
|
|
93
|
+
# @version 1.18.0
|
|
87
94
|
def dead_score_reached__reset_acquirer_position(
|
|
88
95
|
logger,
|
|
89
96
|
log_sampled,
|
|
@@ -91,7 +98,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
91
98
|
queue_ttl,
|
|
92
99
|
acquirer_id,
|
|
93
100
|
host_id,
|
|
94
|
-
access_strategy
|
|
101
|
+
access_strategy,
|
|
102
|
+
rw_mode
|
|
95
103
|
)
|
|
96
104
|
return unless log_sampled
|
|
97
105
|
|
|
@@ -101,7 +109,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
101
109
|
"queue_ttl => #{queue_ttl} " \
|
|
102
110
|
"acq_id => '#{acquirer_id}' " \
|
|
103
111
|
"hst_id => '#{host_id}' " \
|
|
104
|
-
"acs_strat => '#{access_strategy}'"
|
|
112
|
+
"acs_strat => '#{access_strategy}' " \
|
|
113
|
+
"rw_mode => '#{rw_mode}'"
|
|
105
114
|
end rescue nil
|
|
106
115
|
end
|
|
107
116
|
|
|
@@ -113,11 +122,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
113
122
|
# @param host_id [String]
|
|
114
123
|
# @param acq_time [Numeric]
|
|
115
124
|
# @param access_strategy [Symbol]
|
|
125
|
+
# @param rw_mode [Symbol]
|
|
116
126
|
# @return [void]
|
|
117
127
|
#
|
|
118
128
|
# @api private
|
|
119
129
|
# @since 1.7.0
|
|
120
|
-
# @version 1.
|
|
130
|
+
# @version 1.18.0
|
|
121
131
|
def extendable_reentrant_lock_obtained(
|
|
122
132
|
logger,
|
|
123
133
|
log_sampled,
|
|
@@ -126,7 +136,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
126
136
|
acquirer_id,
|
|
127
137
|
host_id,
|
|
128
138
|
acq_time,
|
|
129
|
-
access_strategy
|
|
139
|
+
access_strategy,
|
|
140
|
+
rw_mode
|
|
130
141
|
)
|
|
131
142
|
return unless log_sampled
|
|
132
143
|
|
|
@@ -135,8 +146,9 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
135
146
|
"lock_key => '#{lock_key}' " \
|
|
136
147
|
"queue_ttl => #{queue_ttl} " \
|
|
137
148
|
"acq_id => '#{acquirer_id}' " \
|
|
138
|
-
"
|
|
149
|
+
"hst_id => '#{host_id}' " \
|
|
139
150
|
"acs_strat => '#{access_strategy}' " \
|
|
151
|
+
"rw_mode => '#{rw_mode}' " \
|
|
140
152
|
"acq_time => #{acq_time} (ms)"
|
|
141
153
|
end rescue nil
|
|
142
154
|
end
|
|
@@ -149,11 +161,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
149
161
|
# @param host_id [String]
|
|
150
162
|
# @param acq_time [Numeric]
|
|
151
163
|
# @param access_strategy [Symbol]
|
|
164
|
+
# @param rw_mode [Symbol]
|
|
152
165
|
# @return [void]
|
|
153
166
|
#
|
|
154
167
|
# @api private
|
|
155
168
|
# @since 1.7.0
|
|
156
|
-
# @version 1.
|
|
169
|
+
# @version 1.18.0
|
|
157
170
|
def reentrant_lock_obtained(
|
|
158
171
|
logger,
|
|
159
172
|
log_sampled,
|
|
@@ -162,7 +175,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
162
175
|
acquirer_id,
|
|
163
176
|
host_id,
|
|
164
177
|
acq_time,
|
|
165
|
-
access_strategy
|
|
178
|
+
access_strategy,
|
|
179
|
+
rw_mode
|
|
166
180
|
)
|
|
167
181
|
return unless log_sampled
|
|
168
182
|
|
|
@@ -173,6 +187,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
173
187
|
"acq_id => '#{acquirer_id}' " \
|
|
174
188
|
"hst_id => '#{host_id}' " \
|
|
175
189
|
"acs_strat => '#{access_strategy}' " \
|
|
190
|
+
"rw_mode => '#{rw_mode}' " \
|
|
176
191
|
"acq_time => #{acq_time} (ms)"
|
|
177
192
|
end rescue nil
|
|
178
193
|
end
|
|
@@ -185,11 +200,12 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
185
200
|
# @param host_id [String]
|
|
186
201
|
# @param acq_time [Numeric]
|
|
187
202
|
# @param access_strategy [Symbol]
|
|
203
|
+
# @param rw_mode [Symbol]
|
|
188
204
|
# @return [void]
|
|
189
205
|
#
|
|
190
206
|
# @api private
|
|
191
207
|
# @since 1.7.0
|
|
192
|
-
# @version 1.
|
|
208
|
+
# @version 1.18.0
|
|
193
209
|
def lock_obtained(
|
|
194
210
|
logger,
|
|
195
211
|
log_sampled,
|
|
@@ -198,7 +214,8 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
198
214
|
acquirer_id,
|
|
199
215
|
host_id,
|
|
200
216
|
acq_time,
|
|
201
|
-
access_strategy
|
|
217
|
+
access_strategy,
|
|
218
|
+
rw_mode
|
|
202
219
|
)
|
|
203
220
|
return unless log_sampled
|
|
204
221
|
|
|
@@ -209,6 +226,7 @@ module RedisQueuedLocks::Acquirer::AcquireLock::LogVisitor
|
|
|
209
226
|
"acq_id => '#{acquirer_id}' " \
|
|
210
227
|
"hst_id => '#{host_id}' " \
|
|
211
228
|
"acs_strat => '#{access_strategy}' " \
|
|
229
|
+
"rw_mode => '#{rw_mode}' " \
|
|
212
230
|
"acq_time => #{acq_time} (ms)"
|
|
213
231
|
end rescue nil
|
|
214
232
|
end
|