Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PostgreSQL advisory locks to enforce only one subscription instance #98

Merged
merged 6 commits into from
Jan 5, 2018

Conversation

slashdotdash
Copy link
Member

@slashdotdash slashdotdash commented Jan 5, 2018

PostgreSQL's pg_try_advisory_lock function is used to acquire a session lock on the subscription id to guarantee that only once uniquely named subscription instance can run.

Each subscription now has its own connection. When the subscription process goes down, the connection will terminate and its lock will be released.

This supports running EventStore on multiple independent nodes without requiring them to form a cluster, but still guarantees subscriptions run once.

PostgreSQL's `pg_try_advisory_lock` function is used to acquire a session lock on the subscription id to guarantee that only once instance can run.

Each subscription now has its own connection. When the subscription process goes down, the connection will terminate and its lock will be released.
@slashdotdash slashdotdash merged commit 76bd6f1 into master Jan 5, 2018
@slashdotdash slashdotdash deleted the feature/advisory-locks branch January 5, 2018 20:44
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