[DO NOT MERGE] Implement RLS and use SPI for PG backend interaction with duroxide - #40
Closed
Pino de Candia (pinodeca) wants to merge 1 commit into
Closed
Pino de Candia (pinodeca) wants to merge 1 commit into
Pino de Candia (pinodeca) wants to merge 1 commit into
Conversation
Replace async sqlx/tokio calls with direct SPI in PostgreSQL backend processes (user sessions). This eliminates TCP connection pools and async runtime overhead for client, monitoring, and explain operations. The background worker continues to use sqlx via duroxide-pg-opt since the Provider trait requires Send + Sync + async. This work builds on the POC in docs/design-native-provider.md, which explored three phases: SPI for client ops, SPI for monitoring, and UDS for BGW connections. This branch isolates the first two phases (SPI). Changes: - Rewrite src/client.rs to enqueue work items via SPI instead of async Client/Provider - Rewrite src/monitoring.rs to query duroxide stored procedures via SPI - Rewrite src/explain.rs get_duroxide_instance_info() to use SPI - Add GRANTs on df and duroxide schema objects so non-superusers can call functions through SPI (which runs as the calling user) - Enable Row-Level Security on df.instances, df.nodes, duroxide.instances, duroxide.executions, duroxide.history, and duroxide.orchestrator_queue so users only see/modify their own data - Fix 21_signals test: split signal+wait into separate transactions for SPI transaction visibility - Add docs/design-backend-spi.md design document
Contributor
Author
|
#47 implements RLS SPI for duroxide-pg-opt has been de-prioritized. Abandoning this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace async sqlx/tokio calls with direct SPI in PostgreSQL backend
processes (user sessions). This eliminates TCP connection pools and
async runtime overhead for client, monitoring, and explain operations.
The background worker continues to use sqlx via duroxide-pg-opt since
the Provider trait requires Send + Sync + async.
This work builds on the POC in docs/design-native-provider.md, which
explored three phases: SPI for client ops, SPI for monitoring, and UDS
for BGW connections. This branch isolates the first two phases (SPI).
Changes
src/client.rsto enqueue work items via SPI instead of async Client/Providersrc/monitoring.rsto query duroxide stored procedures via SPIsrc/explain.rsget_duroxide_instance_info()to use SPIdfandduroxideschema objects so non-superusers can call functions through SPI (which runs as the calling user)df.instances,df.nodes,duroxide.instances,duroxide.executions,duroxide.history, andduroxide.orchestrator_queueso users only see/modify their own data21_signalstest: split signal+wait into separate transactions for SPI transaction visibilitydocs/design-backend-spi.mddesign document