Repository navigation
feat(alloydb): add native read-only session locking - #3617
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a read-only mode for the AlloyDB PostgreSQL source by setting the alloydb_session_read_only=locked session parameter, and adds a corresponding read-only SQL execution tool. It also includes an integration test to verify that write operations are blocked in this mode. The review feedback suggests clarifying the documentation to explain that read-only mode is enforced via session state rather than physical endpoint routing, and improving the integration test's robustness by checking for alternative spelling formats of the read-only error message.
a975dc7 to
efeaaa2
Compare
410930e to
071a167
Compare
efeaaa2 to
c638838
Compare
071a167 to
345cb7f
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a read-only mode for the AlloyDB PostgreSQL source, allowing users to enforce read-only session states on database connections to prevent write operations. It adds a new execute_sql_readonly prebuilt tool, updates the connection configuration to append the appropriate read-only session options, and includes an integration test to verify the write-blocking behavior. The feedback suggests documenting the new prebuilt tool in the README, centralizing the read-only option string into a constant, and refactoring the integration test to construct the configuration map directly in Go rather than unmarshaling a raw YAML string.
bc19b9b to
21954fb
Compare
c35957e to
a6f8ff1
Compare
21954fb to
be7f372
Compare
4091cdd to
8011f00
Compare
302e833 to
c51553a
Compare
6242771 to
cc44835
Compare
c51553a to
6dbd955
Compare
cc44835 to
bf538b0
Compare
6dbd955 to
9ddedc4
Compare
bf538b0 to
b058146
Compare
9ddedc4 to
05b7eff
Compare
3bcf247 to
f9cc575
Compare
05b7eff to
d6a5d68
Compare
f9cc575 to
50037a4
Compare
d6a5d68 to
ed2124b
Compare
50037a4 to
bddc2c0
Compare
ed2124b to
fd283c5
Compare
bddc2c0 to
fd7a8e9
Compare
fd283c5 to
57a036c
Compare
|
🧨 Preview deployments removed. Cloudflare Pages environments for |
Description
This PR implements native, protocol-level Read-Only session enforcement for AlloyDB for PostgreSQL.
Changes
options='-c alloydb_session_read_only=locked'to the connection DSN whenreadOnly: trueis configured on the source.ReadOnly booltoalloydbpg.Configand implementedIsReadOnly() boolonalloydbpg.Source.alloydb-postgres.yamlandalloydb-postgres-admin.yaml) to dynamically resolve read-only mode via theALLOYDB_READONLYenvironment variable (readonly: ${ALLOYDB_READONLY:false}).COMMIT; START TRANSACTION READ WRITE;), and mutating stored procedures fail-closed at the engine layer.