Manage mutation of permissions directly in the proxy #1393
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.
Rather than send ddlx commands through the replication stream and then apply them to the current permissions state when they come out of pg, this pr instead moves mutation of the permissions to the proxy process. so we load the current permissions state within the proxy transaction then mutate them on receipt of any ddlx commands.
if at the end of the tx the perms have changed, then we write them to pg before committing the txn.
the advantage of this is that the proxy is able to retrieve a consistent view of the permissions within migration transactions and so can determine the permissions state for any table when updating triggers. basically an essential building block if we're going to defer adding the consistency triggers at the point of granting write perms.
also includes a re-factor of the way we keep track of published tables to hopefully make that process less error prone, and a bit of a clean up of the internal migration code.