Skip to content

Expose PostgreSQL lease contention as a build error - #1133

Merged
tnull merged 1 commit into
lightningdevkit:mainfrom
joostjager:postgres-lease-contention-error
Oct 7, 2026
Merged

tnull merged 1 commit into
lightningdevkit:mainfrom
joostjager:postgres-lease-contention-error

Conversation

@joostjager

Copy link
Copy Markdown
Contributor

Return KVStoreAlreadyInUse when PostgreSQL lease acquisition reports an occupied store, allowing applications to retry node construction. Keep other setup errors as KVStoreSetupFailed and avoid logging expected contention as a setup failure.

Document the new error on both builder interfaces and exercise it through the existing lease collision and schema rollback test.

@ldk-reviews-bot

ldk-reviews-bot commented Oct 7, 2026 •

Copy link
Copy Markdown

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tnull tnull left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, mod one comment.

Comment thread src/io/postgres_store/mod.rs Outdated
#[cfg(test)]
mod tests {
use super::*;
use crate::builder::{BuildError, NodeBuilder};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It' s a bit odd to pull in Builder logic into the store. If we want to test that it should probably live somewhere in integration tests. Otherwise fine to just not add coverage of the BuildError here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, much better

Return KVStoreAlreadyInUse when PostgreSQL lease acquisition reports
an occupied store, allowing applications to retry node construction.
Keep other setup errors as KVStoreSetupFailed and avoid logging
expected contention as a setup failure.

Document the new error on both builder interfaces and verify it in
the PostgreSQL integration test. Keep lease collision and schema
rollback coverage at the store level.
@joostjager
joostjager force-pushed the postgres-lease-contention-error branch from d7427c2 to aa4e673 Compare October 7, 2026 14:40
@joostjager
joostjager requested a review from tnull October 7, 2026 14:40
@tnull
tnull merged commit 179b4b2 into lightningdevkit:main Oct 7, 2026
17 of 25 checks passed
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.

3 participants