redis_queued_locks 1.8.0 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +51 -0
  4. data/README.md +402 -46
  5. data/lib/redis_queued_locks/acquier/acquire_lock/dequeue_from_lock_queue/log_visitor.rb +4 -0
  6. data/lib/redis_queued_locks/acquier/acquire_lock/dequeue_from_lock_queue.rb +4 -1
  7. data/lib/redis_queued_locks/acquier/acquire_lock/instr_visitor.rb +20 -5
  8. data/lib/redis_queued_locks/acquier/acquire_lock/log_visitor.rb +24 -0
  9. data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock/log_visitor.rb +56 -0
  10. data/lib/redis_queued_locks/acquier/acquire_lock/try_to_lock.rb +37 -30
  11. data/lib/redis_queued_locks/acquier/acquire_lock/yield_expire/log_visitor.rb +8 -0
  12. data/lib/redis_queued_locks/acquier/acquire_lock/yield_expire.rb +13 -9
  13. data/lib/redis_queued_locks/acquier/acquire_lock.rb +44 -20
  14. data/lib/redis_queued_locks/acquier/clear_dead_requests.rb +5 -1
  15. data/lib/redis_queued_locks/acquier/extend_lock_ttl.rb +5 -1
  16. data/lib/redis_queued_locks/acquier/lock_info.rb +4 -3
  17. data/lib/redis_queued_locks/acquier/locks.rb +2 -2
  18. data/lib/redis_queued_locks/acquier/queue_info.rb +2 -2
  19. data/lib/redis_queued_locks/acquier/release_all_locks.rb +12 -2
  20. data/lib/redis_queued_locks/acquier/release_lock.rb +12 -2
  21. data/lib/redis_queued_locks/client.rb +284 -34
  22. data/lib/redis_queued_locks/errors.rb +8 -0
  23. data/lib/redis_queued_locks/instrument.rb +8 -1
  24. data/lib/redis_queued_locks/logging.rb +8 -1
  25. data/lib/redis_queued_locks/resource.rb +59 -1
  26. data/lib/redis_queued_locks/swarm/acquirers.rb +44 -0
  27. data/lib/redis_queued_locks/swarm/flush_zombies.rb +133 -0
  28. data/lib/redis_queued_locks/swarm/probe_hosts.rb +69 -0
  29. data/lib/redis_queued_locks/swarm/redis_client_builder.rb +67 -0
  30. data/lib/redis_queued_locks/swarm/supervisor.rb +83 -0
  31. data/lib/redis_queued_locks/swarm/swarm_element/isolated.rb +287 -0
  32. data/lib/redis_queued_locks/swarm/swarm_element/threaded.rb +351 -0
  33. data/lib/redis_queued_locks/swarm/swarm_element.rb +8 -0
  34. data/lib/redis_queued_locks/swarm/zombie_info.rb +145 -0
  35. data/lib/redis_queued_locks/swarm.rb +241 -0
  36. data/lib/redis_queued_locks/utilities/lock.rb +22 -0
  37. data/lib/redis_queued_locks/utilities.rb +75 -0
  38. data/lib/redis_queued_locks/version.rb +2 -2
  39. data/lib/redis_queued_locks.rb +2 -0
  40. metadata +14 -4
  41. data/lib/redis_queued_locks/watcher.rb +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f8dd117ee12f1f598da555d02516bb950a2d9640b075a048612726b7a88a6ad
4
- data.tar.gz: c0a5ac4a4dcb6f3b448dc23ffa8d0e0e13a726d50bdd98fc40193704aa6f967d
3
+ metadata.gz: f787fbfe22ef8fe8dec78e5b17d4305621a4b9e2df7d3582648959e68dabef09
4
+ data.tar.gz: 8d874d80738959f41985e6e52d6668aa63d8232ca4964006be82f5d67ea7e1a6
5
5
  SHA512:
6
- metadata.gz: b35d0ef98da0e1ec2c2368b36064eb0501b45d26aaa1b7204230692a41025583366ce181b85eec09cff2d6fe4e93ec146280db78e08f8cbb232a559b91f6d489
7
- data.tar.gz: 4776dd89a7bf1e27476877465faf3240988929efe398090fa4b8b4f604a976a861558e6f606278b91c2c95530be6c5205f8245c887befe92a75d4efde31820dc
6
+ metadata.gz: eb726c270398079b142d68e3e45dd93226e1f17b52f370107db2f4cc47bfa6b0ce010f55dec029443bfb932d73f905f61040087577f47dca9cef5ad505fca430
7
+ data.tar.gz: 129089ba8f764ecabae8d0598af0f627a1156bb8b1a3e845697f1f32863d7ccd3eb2cd64cb80406408e8518b9809b35cce36e1253598744d52529d32cb092598
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 3.3.3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
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
+
3
54
  ## [1.8.0] - 2024-06-13
4
55
  ### Added
5
56
  - A configurable option that enables the adding additional lock/queue data to "Acquirement Timeout"-related error messages for better debugging;