Graylog2 / Graylog2/graylog-plugin-integrations
Distributed Lock/Lease Function
- Dominant language
- Java
- Stars
- 17
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
In order to support polling inputs failing over when the primary node fails (and other use cases), we need a distributed lock/lease function supported in Graylog.
# Notes
Will need a single interface with a Mongo implementation and possibly a Cloud implementation. Need an atomic function like:
```
boolean claim(lease_id, client_id, duration) {
if (lease exists) {
if (client owns lease OR current time > expire time) {
upsert lease record with client_id and new expire time
return true
} else {
return false
}
} else {
claim lease for client with expire time
return true
}
}
```
Will probably need to ensure lease/lock collection is indexed to enforce uniqueness. Need to consider how it will behave in a multi-node Mongo cluster.
Polling inputs will need to attempt to claim a lease before they can run. If the claim fails, they no-op.
# Input Criteria
- [ ] TBD
# Acceptance Criteria
- [ ] TBD
# Tasks
- [ ] TBD
Contributor guide
Assessment
This issue has not been assessed yet.