Repository navigation
Conversation
Move the tracking of the last executed DDL operation ID from an internal connection field into the connection state as a read-only property. Previously, the operation ID was stored in an unmanaged private field on the connection. As a result, the value was not cleared when a connection was returned to the connection pool and reset, which could leak stale operation IDs to subsequent queries reusing that pooled connection. With this change: - The last DDL operation ID is stored in connection state as the read-only property `last_ddl_operation_id`. - Applications can inspect the value using `SHOW VARIABLE last_ddl_operation_id` or via the `LastDDLOperationID()` method on the Spanner connection interface. - Direct modifications via `SET` are rejected because the property is read-only. - The property is automatically cleared whenever the session is reset, preventing operation IDs from leaking across pooled connections.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces the last_ddl_operation_id connection property as a read-only connection property bound to connectionstate.ConnectionState. It updates the SpannerConn interface to include LastDDLOperationID(), replaces the direct lastDDLOperationID field access on the private conn struct with state-backed getter and setter methods, and updates DDL execution paths to use these new methods. Additionally, it adds unit and integration tests to verify the behavior of the new property, including its reset behavior and visibility via SHOW VARIABLE. There are no review comments, and I have no feedback to provide.
This branch has not been deployed
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.
Move the tracking of the last executed DDL operation ID from an internal connection field into the connection state as a read-only property.
Previously, the operation ID was stored in an unmanaged private field on the connection. As a result, the value was not cleared when a connection was returned to the connection pool and reset, which could leak stale operation IDs to subsequent queries reusing that pooled connection.
With this change:
last_ddl_operation_id.SHOW VARIABLE last_ddl_operation_idor via theLastDDLOperationID()method on the Spanner connection interface.SETare rejected because the property is read-only.