redis_queued_locks 1.7.0 → 1.9.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/.ruby-version +1 -1
- data/CHANGELOG.md +60 -1
- data/README.md +485 -46
- data/lib/redis_queued_locks/acquier/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +4 -0
- data/lib/redis_queued_locks/acquier/acquire_lock/dequeue_from_lock_queue.rb +4 -1
- data/lib/redis_queued_locks/acquier/acquire_lock/instr_visitor.rb +20 -5
- data/lib/redis_queued_locks/acquier/acquire_lock/log_visitor.rb +24 -0
- data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock/log_visitor.rb +56 -0
- data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock.rb +37 -30
- data/lib/redis_queued_locks/acquier/acquire_lock/with_acq_timeout.rb +41 -7
- data/lib/redis_queued_locks/acquier/acquire_lock/yield_expire/log_visitor.rb +8 -0
- data/lib/redis_queued_locks/acquier/acquire_lock/yield_expire.rb +21 -9
- data/lib/redis_queued_locks/acquier/acquire_lock.rb +61 -22
- data/lib/redis_queued_locks/acquier/clear_dead_requests.rb +5 -1
- data/lib/redis_queued_locks/acquier/extend_lock_ttl.rb +5 -1
- data/lib/redis_queued_locks/acquier/lock_info.rb +4 -3
- data/lib/redis_queued_locks/acquier/locks.rb +2 -2
- data/lib/redis_queued_locks/acquier/queue_info.rb +2 -2
- data/lib/redis_queued_locks/acquier/release_all_locks.rb +12 -2
- data/lib/redis_queued_locks/acquier/release_lock.rb +12 -2
- data/lib/redis_queued_locks/client.rb +320 -10
- data/lib/redis_queued_locks/errors.rb +8 -0
- data/lib/redis_queued_locks/instrument.rb +8 -1
- data/lib/redis_queued_locks/logging.rb +8 -1
- data/lib/redis_queued_locks/resource.rb +59 -1
- data/lib/redis_queued_locks/swarm/acquirers.rb +44 -0
- data/lib/redis_queued_locks/swarm/flush_zombies.rb +133 -0
- data/lib/redis_queued_locks/swarm/probe_hosts.rb +69 -0
- data/lib/redis_queued_locks/swarm/redis_client_builder.rb +67 -0
- data/lib/redis_queued_locks/swarm/supervisor.rb +83 -0
- data/lib/redis_queued_locks/swarm/swarm_element/isolated.rb +287 -0
- data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +351 -0
- data/lib/redis_queued_locks/swarm/swarm_element.rb +8 -0
- data/lib/redis_queued_locks/swarm/zombie_info.rb +145 -0
- data/lib/redis_queued_locks/swarm.rb +241 -0
- data/lib/redis_queued_locks/utilities/lock.rb +22 -0
- data/lib/redis_queued_locks/utilities.rb +75 -0
- data/lib/redis_queued_locks/version.rb +2 -2
- data/lib/redis_queued_locks.rb +2 -0
- data/redis_queued_locks.gemspec +6 -10
- metadata +24 -6
- data/lib/redis_queued_locks/watcher.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f787fbfe22ef8fe8dec78e5b17d4305621a4b9e2df7d3582648959e68dabef09
|
4
|
+
data.tar.gz: 8d874d80738959f41985e6e52d6668aa63d8232ca4964006be82f5d67ea7e1a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb726c270398079b142d68e3e45dd93226e1f17b52f370107db2f4cc47bfa6b0ce010f55dec029443bfb932d73f905f61040087577f47dca9cef5ad505fca430
|
7
|
+
data.tar.gz: 129089ba8f764ecabae8d0598af0f627a1156bb8b1a3e845697f1f32863d7ccd3eb2cd64cb80406408e8518b9809b35cce36e1253598744d52529d32cb092598
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.3
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,67 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.9.0] - 2024-07-15
|
4
|
+
### Added
|
5
|
+
- Brand New Extremely Major Feature: **Swarm Mode** - eliminate zombie locks with a swarm:
|
6
|
+
- works by `supervisor` + `actor model` abstractions;
|
7
|
+
- all your ruby workers can become an element of the processs swarm;
|
8
|
+
- each ruby worker of the swarm probes himself that he is alive;
|
9
|
+
- worker that does not probes himselfs treats as a zombie;
|
10
|
+
- worekr becomes dead when your ruby process is dead, or thread is dead or your ractor is dead;
|
11
|
+
- each zombie's lock, acquier and position in queue are flushed in background via `flush_zombies` swarm element;
|
12
|
+
- the supervisor module keeps up and running each swarm melement (`probe_hosts` and `flush_zombies`):
|
13
|
+
- cuz each element works in background and can fail by any unexpected exception the supervisor guarantees that your elements will ressurect after that;
|
14
|
+
- each element can be deeply configured (and enabled/disabled);
|
15
|
+
- abilities:
|
16
|
+
- configurable swarming and deswarming (`#swarmize!`, `#deswarmize!`);
|
17
|
+
- encapsulated swarm interface;
|
18
|
+
- two fully isolated swarm elements: `probe_hosts` and `flush_zombies`;
|
19
|
+
- supervisor that keeps all elements running and wokring;
|
20
|
+
- an ability to check the swarm status (`#swarm_status`): who is working, who is dead, running status, internal main loop states, etc;
|
21
|
+
- an abiltiy to check the swarm information (`#swarm_info`): showing the current swarm hosts and their last probes and current zombie status;
|
22
|
+
- an ability to find zombie locks, zombie acquiers and zombie hosts (`#zombie_locks`, `#zombie_acquiers`, `#zombie_hosts`);
|
23
|
+
- an ability to extract the full zombie information (`#zombies_info`/`#zombies`);
|
24
|
+
- each zombie lock will be flushed in background by appropriated swarm element (`flush_zombies`);
|
25
|
+
- deeply configurable zombie factors: zombie ttl, host probing period, supervisor check period;
|
26
|
+
- an ability to manually probe hosts;
|
27
|
+
- an ability to flush zombies manually;
|
28
|
+
- you can made `swarm`-based logic by yourself (by manually runnable `#flush_zombies` and `#probe_hosts`);
|
29
|
+
- summarized interface:
|
30
|
+
- `#swarmize!`, `#deswarmize!`;
|
31
|
+
- `#swarm_status`/`#swarm_state`, `#swarm_info`
|
32
|
+
- `#zombie_locks`, `#zmobie_acquiers`, `#zombie_hosts`, `#zombies_info`/`#zombies`;
|
33
|
+
- manual abilities: `#probe_hosts`, `#flush_zombies`;
|
34
|
+
- **general note**: each swarm element should have their own `RedisClient` instance so each have their own redis-client configuration
|
35
|
+
and each of the can be configured separately (**RedisClient** multithreading limitation and **Ractor** limitations);
|
36
|
+
- Added the `lock host` abstraction (`hst_id`):
|
37
|
+
- each lock is hosted by some ruby workers so this fact is abstracted into the host identifier represended as a combination of `process_id`/`thread_id`/`ractor_id`/`uniq_identity`;
|
38
|
+
- the ruby worker is a combination of `process_id`/`thread_id`/`ractor_id`/`uniq_identity`);
|
39
|
+
- each lock stores the host id (`hst_id` field) indisde their data (for debugging purposes and zombie identification purposes);
|
40
|
+
- every lock information method now includes `hst_id` field: `#lock_info`, `#lock_data`, `#locks_info`;
|
41
|
+
- an ability to fetch the current host id (your ruby worker host id): `#current_host_id`;
|
42
|
+
- an ability to fetch all possible host ids in the current Ractor (all possible and reachable ruby workers from the current ractor): `#possible_host_ids`;
|
43
|
+
- extended `RedisQueuedLocks::TimedLocktimeoutError` message: added `hst_id` field data from the lock data;
|
44
|
+
- **Instrumentation** updates:
|
45
|
+
- added the `hst_id` field to each locking-process-related instrumentation event;
|
46
|
+
- **Logging** updates:
|
47
|
+
- added `hst_id` field to each locking-process-related log;
|
48
|
+
- **Logging/Instrumentation Sampling** updates:
|
49
|
+
- an ability to mark any loggable/instrumentable method as sampled for instrumentation/logging despite of the enabled instrumentation/log sampling
|
50
|
+
by providing the `log_sample_this: true` attribute and `instr_sample_this: true` attribute respectively;
|
51
|
+
- an alias for `#clear_locks`: `#release_locks`;
|
52
|
+
- an alias for `#unlock`: `#release_lock`;
|
53
|
+
|
54
|
+
## [1.8.0] - 2024-06-13
|
55
|
+
### Added
|
56
|
+
- A configurable option that enables the adding additional lock/queue data to "Acquirement Timeout"-related error messages for better debugging;
|
57
|
+
- Configurable option is used beacuse of the extra error data requires some additional Redis requests that can be costly for memory/cpu/etc resources;
|
58
|
+
- An ability to get the current acquirer id (`RedisQueuedLocks::Client#current_acquirer_id`);
|
59
|
+
### Changed
|
60
|
+
- Added additional lock information to some exceptions that does not require extra Redis requests;
|
61
|
+
|
3
62
|
## [1.7.0] - 2024-06-12
|
4
63
|
### Added
|
5
|
-
- New feature: **Lock Access Strategy**: you can obtain a lock in different ways: `queued` (classic queued FIFO), `random` (get the lock immideatly if lock is free)
|
64
|
+
- New feature: **Lock Access Strategy**: you can obtain a lock in different ways: `queued` (classic queued FIFO), `random` (get the lock immideatly if lock is free):
|
6
65
|
- `:queued` is used by default (classic `redis_queued_locks` behavior);
|
7
66
|
- `:random`: obtain a lock without checking the positions in the queue => if lock is free to obtain - it will be obtained;
|
8
67
|
### Changed
|