Skip to content

fix: role detection; feat: set inside transactions#647

Merged
levkk merged 10 commits intomainfrom
levkk-set-inside-transactions
Dec 4, 2025
Merged

fix: role detection; feat: set inside transactions#647
levkk merged 10 commits intomainfrom
levkk-set-inside-transactions

Conversation

@levkk
Copy link
Copy Markdown
Collaborator

@levkk levkk commented Dec 4, 2025

The role detection was pretty bad, it was causing an infinite loop on role change and DoSing itself. Now, we're using atomics on load balancer targets, so we don't need to reload the config when role changes.

For SET, we now handle it inside transactions and run it on the client's behalf. This makes it work when cross_shard_disabled = true. Additionally, all SET commands executed inside a transaction are rewritten to use SET LOCAL instead to avoid leaking client state between servers.

@blacksmith-sh

This comment has been minimized.

@levkk levkk changed the title fix: role detection; fix: set inside transactions fix: role detection; fix, set inside transactions Dec 4, 2025
@levkk levkk marked this pull request as ready for review December 4, 2025 05:57
@levkk levkk changed the title fix: role detection; fix, set inside transactions fix: role detection; feat: set inside transactions Dec 4, 2025
@blacksmith-sh

This comment has been minimized.

@blacksmith-sh
Copy link
Copy Markdown
Contributor

blacksmith-sh Bot commented Dec 4, 2025

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
crud_spec/CRUD and Join for Customer and Order does full CRUD and join View Logs

Fix in Cursor

@levkk levkk merged commit ea620b7 into main Dec 4, 2025
7 of 8 checks passed
@levkk levkk deleted the levkk-set-inside-transactions branch December 4, 2025 19:49
dev-lew pushed a commit to dev-lew/pgdog that referenced this pull request Feb 18, 2026
The role detection was pretty bad, it was causing an infinite loop on
role change and DoSing itself. Now, we're using atomics on load balancer
targets, so we don't need to reload the config when role changes.

For `SET`, we now handle it inside transactions and run it on the
client's behalf. This makes it work when `cross_shard_disabled = true`.
Additionally, all `SET` commands executed inside a transaction are
rewritten to use `SET LOCAL` instead to avoid leaking client state
between servers.
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