You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(recovery): address review, and fix cleanup the same way
Keystore cleanup had the same bug, so it is fixed here rather than left for a
follow-up: the id now comes from the token SKI cleanup table name and
AcquireCleanupLeadership drops its lockID param, same as recovery.
Also from review:
- deleted NewAdvisoryLockFactory and NewCleanupLeaderFactory, both had no
production callers left and keeping them kept the caller-supplied lock id
around, which is the footgun being removed
- the lock id tests now call the production recoveryLockID instead of
mirroring the derivation, so they fail if it changes
- added a test that LoadConfig still succeeds with a stale advisoryLockID key
- dropped the cleanup advisoryLockID from docs/configuration.md
Signed-off-by: atharrva01 <atharvaborade568@gmail.com>
- instanceID: empty, auto-generated when the cleanup manager starts
692
682
693
683
**Parameter Relationships and Tuning:**
694
684
695
685
- **Cleanup is disabled by default** and must be explicitly enabled. This is a conservative default to prevent unexpected key deletion in existing deployments.
696
686
- **Only deleted tokens older than `ttl` are considered for cleanup** to ensure tokens are truly finalized before key deletion.
697
687
- **The manager validates** that `ttl`, `scanInterval`, `batchSize`, and `workerCount` are all greater than zero.
698
-
- **`advisoryLockID`** is used to acquire PostgreSQL advisory-lock leadership so that only one replica performs a cleanup sweep at a time. The default value (8389190333894887277 or 0x74746b636c65616e) represents the ASCII string "ttkclean" (Token Transaction Keystore Cleanup) encoded as a 64-bit integer.
688
+
- **Cleanup leadership** uses a PostgreSQL advisorylock so only one replica sweeps at a time. The identifier is not configurable: it is derived from the TMS's own token SKI cleanup table name, which already carries network, channel and namespace, so it is unique per TMS automatically.
699
689
- **`instanceID`** is used to identify this replica in logs and monitoring; if omitted, the manager generates a unique identifier automatically at startup.
700
690
701
691
**Tuning Recommendations:**
@@ -717,7 +707,6 @@ Default values:
717
707
718
708
4. **For Multi-Instance Deployments:**
719
709
- **PostgreSQL Required**: Multi-instance deployments require PostgreSQL for distributed coordination via advisory locks
720
-
- Keep default `advisoryLockID` unless running multiple independent cleanup systems
721
710
- Consider setting explicit `instanceID` values for easier debugging and monitoring
722
711
723
712
5. **For Single-Node Deployments:**
@@ -794,7 +783,6 @@ Default values:
794
783
795
784
4. **For Multi-Instance Deployments:**
796
785
- **PostgreSQL Required**: Multi-instance deployments require PostgreSQL for distributed coordination via advisory locks
797
-
- Keep default `advisoryLockID` unless running multiple independent recovery systems
798
786
- Consider setting explicit `instanceID` values for easier debugging and monitoring
799
787
- Ensure all instances share the same PostgreSQL database for proper coordination
0 commit comments