Skip to content

fix: recover etcd leases after server restart #47

Merged
axfor merged 3 commits intomainfrom
r27
Feb 28, 2026
Merged

fix: recover etcd leases after server restart #47
axfor merged 3 commits intomainfrom
r27

Conversation

@axfor
Copy link
Copy Markdown
Owner

@axfor axfor commented Feb 28, 2026

LeaseManager was creating an empty leases map on startup, causing
KeepAlive/TimeToLive to fail and expired leases to never be cleaned up
after a server restart. Add LoadLeases() to hydrate the in-memory map
from the store and initialize leaseIDCounter to prevent ID collisions.
- Remove unused nodeID, leaseIDCounter fields and counter recovery logic
  from LeaseManager (replaced by idutil.Generator upstream)
- Fix comment mismatch: NewLeaseManagerWithNodeID → NewLeaseManagerWithMemberID
- Update test constructor to match renamed function signature
- Remove TestLeaseManager_LoadLeases_CounterInit (references deleted GenerateLeaseID)
- Fix test imports: metaStore/api/http → metaStore/internal/http (package relocated)
@axfor axfor merged commit 77ca094 into main Feb 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant