Skip to content

Commit 1fc04fe

Browse files
olavloiteaakashanandgrenovate-botrelease-please[bot]pracucci
authored
chore: add grpc-server API for SpannerLib (#534)
* chore: add grpc-server API for SpannerLib Adds a gRPC server that exposes the API of SpannerLib. This allows clients to connect to run SpannerLib as a child process and connect to it using gRPC. * refactor(ruby): Introduce MessageHandler and Rows classes (#553) * refactor: add new message handler in ruby wrapper * chore: delay transaction activation until actual use (#552) * chore: store temp TransactionOptions in connection state Store temporary TransactionOptions in the connection state as local options. Local options only apply to the current transaction. This simplifies the internal state handling of the driver, as all transaction state should only be read from the connection state, and not also from a temporary variable. This also enables the use of a combination of temporary transaction options and using SQL statements to set further options. The shared library always includes temporary transaction options, as the BeginTransaction function accepts TransactionOptions as an input argument. This meant that using SQL statements to set further transaction options was not supported through the shared library. * chore: delay transaction activation until actual use Delay the actual transaction activation until the first actual usage of the transaction. That is; the first time that a statement is being sent to Spanner. This allows the application to amend the transaction options after calling BeginTx or executing `BEGIN TRANSACTION`. The transaction options can be amended by executing a statement like `SET TRANSACTION READ ONLY`. * chore: update actions/checkout action to v5 (#555) * fix: update all dependencies (#551) * fix: update all dependencies * chore: go mod tidy --------- Co-authored-by: Knut Olav Løite <koloite@gmail.com> * chore: add signal handler to remove temp file * chore: add .NET gRPC wrapper (#539) * fix: update dependency net.java.dev.jna:jna to v5.18.0 (#538) * chore: update all dependencies (#537) * fix: update all dependencies (#536) * fix: update all dependencies * chore: go mod tidy --------- Co-authored-by: Knut Olav Løite <koloite@gmail.com> * chore(main): release 1.18.1 (#525) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * fix: update module github.com/googleapis/go-sql-spanner to v1.18.1 (#540) * chore: add .NET gRPC wrapper Adds a gRPC wrapper for .NET. This wrapper uses the gRPC API to connect to SpannerLib. The gRPC channel uses a Unix domain socket. * fix: update dependency net.java.dev.jna:jna to v5.18.1 (#544) This PR contains the following updates: | Package | Change | Age | Confidence | |---|---|---|---| | [net.java.dev.jna:jna](https://redirect.github.com/java-native-access/jna) | `5.18.0` -> `5.18.1` | [![age](https://developer.mend.io/api/mc/badges/age/maven/net.java.dev.jna:jna/5.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/net.java.dev.jna:jna/5.18.0/5.18.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>java-native-access/jna (net.java.dev.jna:jna)</summary> ### [`v5.18.1`](https://redirect.github.com/java-native-access/jna/blob/HEAD/CHANGES.md#Release-5181) [Compare Source](https://redirect.github.com/java-native-access/jna/compare/5.18.0...5.18.1) \============== ## Bug Fixes - [#&#8203;1686](https://redirect.github.com/java-native-access/jna/issues/1686): Fix `sortFields` race condition while getting fields - [@&#8203;bendk](https://redirect.github.com/bendk). </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/googleapis/go-sql-spanner). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzEuOSIsInVwZGF0ZWRJblZlciI6IjQxLjEzMS45IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> * feat: add authority param support to DSN (#546) Signed-off-by: Marco Pracucci <marco@pracucci.com> * fix: update all dependencies (#542) * fix: update all dependencies * chore: go mod tidy * build: add ByteBuddy for Java wrapper --------- Co-authored-by: Knut Olav Løite <koloite@gmail.com> * feat(ruby): Add Ruby FFI wrapper for spannerlib (#545) * feat(ruby): add Ruby FFI wrapper for spannerlib * chore(main): release 1.19.0 (#541) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> * chore: store temp TransactionOptions in connection state (#548) Store temporary TransactionOptions in the connection state as local options. Local options only apply to the current transaction. This simplifies the internal state handling of the driver, as all transaction state should only be read from the connection state, and not also from a temporary variable. This also enables the use of a combination of temporary transaction options and using SQL statements to set further options. The shared library always includes temporary transaction options, as the BeginTransaction function accepts TransactionOptions as an input argument. This meant that using SQL statements to set further transaction options was not supported through the shared library. * feat: parse SET TRANSACTION statements (#549) * feat: parse SET TRANSACTION statements Parse SET TRANSACTION statements and translate these to SET LOCAL statements. SET TRANSACTION may only be executed in a transaction block, and can only be used for a specific, limited set of connection properties. The syntax is specified by the SQL standard and PostgreSQL. See also https://www.postgresql.org/docs/current/sql-set-transaction.html This change only adds partial support. The following features will be added in future changes: 1. SET TRANSACTION READ {WRITE | ONLY} is not picked up by the driver, as the type of transaction is set directly when BeginTx is called. A refactor of this transaction handling is needed to be able to pick up SET TRANSACTION READ ONLY / SET TRANSACTION READ WRITE statements that are executed after BeginTx has been called. 2. PostgreSQL allows multiple transaction modes to be set in a single SET TRANSACTION statement. E.g. the following is allowed: SET TRANSACTION READ WRITE, ISOLATION LEVEL SERIALIZABLE The current implementation only supports one transaction mode per SET statement. * feat: support multiple transaction options in one statement * feat: support transaction options in BEGIN statements (#550) * feat: parse SET TRANSACTION statements Parse SET TRANSACTION statements and translate these to SET LOCAL statements. SET TRANSACTION may only be executed in a transaction block, and can only be used for a specific, limited set of connection properties. The syntax is specified by the SQL standard and PostgreSQL. See also https://www.postgresql.org/docs/current/sql-set-transaction.html This change only adds partial support. The following features will be added in future changes: 1. SET TRANSACTION READ {WRITE | ONLY} is not picked up by the driver, as the type of transaction is set directly when BeginTx is called. A refactor of this transaction handling is needed to be able to pick up SET TRANSACTION READ ONLY / SET TRANSACTION READ WRITE statements that are executed after BeginTx has been called. 2. PostgreSQL allows multiple transaction modes to be set in a single SET TRANSACTION statement. E.g. the following is allowed: SET TRANSACTION READ WRITE, ISOLATION LEVEL SERIALIZABLE The current implementation only supports one transaction mode per SET statement. * feat: support multiple transaction options in one statement * feat: support transaction options in BEGIN statements Adds support for including transaction options in BEGIN statements, like: ```sql BEGIN READ ONLY; BEGIN READ WRITE; BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ; BEGIN READ WRITE, ISOLATION LEVEL SERIALIZABLE; ``` * chore: re-trigger checks * chore: add timeout for server startup --------- Signed-off-by: Marco Pracucci <marco@pracucci.com> Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Marco Pracucci <marco@pracucci.com> Co-authored-by: aakashanandg <aakashanand@google.com> * chore: return long instead of int * chore: remove TODO --------- Signed-off-by: Marco Pracucci <marco@pracucci.com> Co-authored-by: aakashanandg <aakashanand@google.com> Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Marco Pracucci <marco@pracucci.com>
1 parent 3eba323 commit 1fc04fe

File tree

127 files changed

+25733
-723
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+25733
-723
lines changed

.github/workflows/integration-tests-on-emulator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
go-version: 1.25.x
2424
- name: Checkout code
25-
uses: actions/checkout@v4
25+
uses: actions/checkout@v5
2626
- name: Run Go integration tests on emulator
2727
run: go test -race
2828
env:

.github/workflows/spanner-lib-tests.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,27 @@ jobs:
4848
- name: Build shared library
4949
working-directory: spannerlib/shared
5050
run: go build -o spannerlib.so -buildmode=c-shared shared_lib.go
51+
- name: Build gRPC server
52+
working-directory: spannerlib/grpc-server
53+
run: |
54+
go build -o grpc_server server.go
55+
chmod +x grpc_server
5156
- name: Copy to Java wrapper
5257
working-directory: spannerlib
5358
run: |
5459
echo "$RUNNER_OS"
5560
if [ "$RUNNER_OS" == "Windows" ]; then
5661
mkdir -p wrappers/spannerlib-java/src/main/resources/win32-x86-64
5762
cp shared/spannerlib.so wrappers/spannerlib-java/src/main/resources/win32-x86-64/spanner.dll
63+
cp grpc-server/grpc_server wrappers/spannerlib-java/src/main/resources/win32-x86-64/grpc_server
5864
elif [ "$RUNNER_OS" == "macOS" ]; then
5965
mkdir -p wrappers/spannerlib-java/src/main/resources/darwin-aarch64
6066
cp shared/spannerlib.so wrappers/spannerlib-java/src/main/resources/darwin-aarch64/libspanner.dylib
67+
cp grpc-server/grpc_server wrappers/spannerlib-java/src/main/resources/darwin-aarch64/grpc_server
6168
else
6269
mkdir -p wrappers/spannerlib-java/src/main/resources/linux-x86-64
6370
cp shared/spannerlib.so wrappers/spannerlib-java/src/main/resources/linux-x86-64/libspanner.so
71+
cp grpc-server/grpc_server wrappers/spannerlib-java/src/main/resources/linux-x86-64/grpc_server
6472
fi
6573
shell: bash
6674
- name: ls spannerlib.so
@@ -89,6 +97,8 @@ jobs:
8997
go-version: ${{ matrix.go-version }}
9098
- name: Checkout code
9199
uses: actions/checkout@v4
100+
with:
101+
submodules: 'true'
92102
- name: Build shared library
93103
working-directory: spannerlib/shared
94104
run: go build -o spannerlib.so -buildmode=c-shared shared_lib.go
@@ -116,6 +126,34 @@ jobs:
116126
fi
117127
working-directory: spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-native
118128
shell: bash
129+
- name: Build gRPC server
130+
working-directory: spannerlib/grpc-server
131+
run: |
132+
go build -o grpc_server server.go
133+
chmod +x grpc_server
134+
- name: Copy gRPC server to .NET wrapper
135+
working-directory: spannerlib
136+
run: |
137+
mkdir -p wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-server/binaries/any
138+
if [ "$RUNNER_OS" == "Windows" ]; then
139+
cp grpc-server/grpc_server wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-server/binaries/any/grpc_server.exe
140+
else
141+
cp grpc-server/grpc_server wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-server/binaries/any/grpc_server
142+
fi
143+
shell: bash
144+
- name: Build .NET gRPC server package
145+
run: dotnet pack
146+
working-directory: spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-server
147+
shell: bash
148+
- name: Add .NET package source
149+
run: |
150+
if [ "$RUNNER_OS" == "Windows" ]; then
151+
dotnet nuget add source ${GITHUB_WORKSPACE}"\spannerlib\wrappers\spannerlib-dotnet\spannerlib-dotnet-grpc-server\bin\Release" --name local-grpc-server
152+
else
153+
dotnet nuget add source "$PWD"/bin/Release --name local-grpc-server
154+
fi
155+
working-directory: spannerlib/wrappers/spannerlib-dotnet/spannerlib-dotnet-grpc-server
156+
shell: bash
119157
- name: Restore dependencies
120158
run: dotnet restore
121159
working-directory: spannerlib/wrappers/spannerlib-dotnet

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "spannerlib/grpc-server/googleapis"]
2+
path = spannerlib/grpc-server/googleapis
3+
url = git@github.com:googleapis/googleapis.git

aborted_transactions_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ func TestCommitAborted(t *testing.T) {
4141
if err != nil {
4242
t.Fatalf("begin failed: %v", err)
4343
}
44+
if _, err := tx.ExecContext(ctx, testutil.UpdateBarSetFoo); err != nil {
45+
t.Fatal(err)
46+
}
4447
server.TestSpanner.PutExecutionTime(testutil.MethodCommitTransaction, testutil.SimulatedExecutionTime{
4548
Errors: []error{status.Error(codes.Aborted, "Aborted")},
4649
})
@@ -51,7 +54,7 @@ func TestCommitAborted(t *testing.T) {
5154
reqs := server.TestSpanner.DrainRequestsFromServer()
5255
commitReqs := testutil.RequestsOfType(reqs, reflect.TypeOf(&sppb.CommitRequest{}))
5356
if g, w := len(commitReqs), 2; g != w {
54-
t.Fatalf("commit request count mismatch\nGot: %v\nWant: %v", g, w)
57+
t.Fatalf("commit request count mismatch\n Got: %v\nWant: %v", g, w)
5558
}
5659

5760
// Verify that the db is still usable.
@@ -117,6 +120,9 @@ func TestCommitAbortedWithInternalRetriesDisabled(t *testing.T) {
117120
if err != nil {
118121
t.Fatalf("begin failed: %v", err)
119122
}
123+
if _, err := tx.ExecContext(ctx, testutil.UpdateBarSetFoo); err != nil {
124+
t.Fatal(err)
125+
}
120126
server.TestSpanner.PutExecutionTime(testutil.MethodCommitTransaction, testutil.SimulatedExecutionTime{
121127
Errors: []error{status.Error(codes.Aborted, "Aborted")},
122128
})

benchmarks/go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ module github.com/googleapis/go-sql-spanner/benchmarks
22

33
go 1.24.0
44

5-
toolchain go1.25.1
5+
toolchain go1.25.2
66

77
replace github.com/googleapis/go-sql-spanner => ../
88

99
require (
1010
cloud.google.com/go v0.123.0
1111
cloud.google.com/go/spanner v1.86.0
1212
github.com/google/uuid v1.6.0
13-
github.com/googleapis/go-sql-spanner v1.18.1
14-
google.golang.org/api v0.251.0
15-
google.golang.org/grpc v1.75.1
13+
github.com/googleapis/go-sql-spanner v1.19.0
14+
google.golang.org/api v0.252.0
15+
google.golang.org/grpc v1.76.0
1616
google.golang.org/protobuf v1.36.10
1717
)
1818

1919
require (
2020
cel.dev/expr v0.24.0 // indirect
21-
cloud.google.com/go/auth v0.16.5 // indirect
21+
cloud.google.com/go/auth v0.17.0 // indirect
2222
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
2323
cloud.google.com/go/compute/metadata v0.9.0 // indirect
2424
cloud.google.com/go/iam v1.5.2 // indirect
@@ -61,5 +61,5 @@ require (
6161
golang.org/x/time v0.13.0 // indirect
6262
google.golang.org/genproto v0.0.0-20250804133106-a7a43d27e69b // indirect
6363
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
64-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251002232023-7c0ddcbb5797 // indirect
64+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251007200510-49b9836ed3ff // indirect
6565
)

benchmarks/go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVo
101101
cloud.google.com/go/assuredworkloads v1.8.0/go.mod h1:AsX2cqyNCOvEQC8RMPnoc0yEarXQk6WEKkxYfL6kGIo=
102102
cloud.google.com/go/assuredworkloads v1.9.0/go.mod h1:kFuI1P78bplYtT77Tb1hi0FMxM0vVpRC7VVoJC3ZoT0=
103103
cloud.google.com/go/assuredworkloads v1.10.0/go.mod h1:kwdUQuXcedVdsIaKgKTp9t0UJkE5+PAVNhdQm4ZVq2E=
104-
cloud.google.com/go/auth v0.16.5 h1:mFWNQ2FEVWAliEQWpAdH80omXFokmrnbDhUS9cBywsI=
105-
cloud.google.com/go/auth v0.16.5/go.mod h1:utzRfHMP+Vv0mpOkTRQoWD2q3BatTOoWbA7gCc2dUhQ=
104+
cloud.google.com/go/auth v0.17.0 h1:74yCm7hCj2rUyyAocqnFzsAYXgJhrG26XCFimrc/Kz4=
105+
cloud.google.com/go/auth v0.17.0/go.mod h1:6wv/t5/6rOPAX4fJiRjKkJCvswLwdet7G8+UGXt7nCQ=
106106
cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
107107
cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
108108
cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0=
@@ -1371,8 +1371,8 @@ google.golang.org/api v0.108.0/go.mod h1:2Ts0XTHNVWxypznxWOYUeI4g3WdP9Pk2Qk58+a/
13711371
google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI=
13721372
google.golang.org/api v0.111.0/go.mod h1:qtFHvU9mhgTJegR31csQ+rwxyUTHOKFqCKWp1J0fdw0=
13731373
google.golang.org/api v0.114.0/go.mod h1:ifYI2ZsFK6/uGddGfAD5BMxlnkBqCmqHSDUVi45N5Yg=
1374-
google.golang.org/api v0.251.0 h1:6lea5nHRT8RUmpy9kkC2PJYnhnDAB13LqrLSVQlMIE8=
1375-
google.golang.org/api v0.251.0/go.mod h1:Rwy0lPf/TD7+T2VhYcffCHhyyInyuxGjICxdfLqT7KI=
1374+
google.golang.org/api v0.252.0 h1:xfKJeAJaMwb8OC9fesr369rjciQ704AjU/psjkKURSI=
1375+
google.golang.org/api v0.252.0/go.mod h1:dnHOv81x5RAmumZ7BWLShB/u7JZNeyalImxHmtTHxqw=
13761376
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
13771377
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
13781378
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
@@ -1516,8 +1516,8 @@ google.golang.org/genproto v0.0.0-20250804133106-a7a43d27e69b h1:eZTgydvqZO44zyT
15161516
google.golang.org/genproto v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:suyz2QBHQKlGIF92HEEsCfO1SwxXdk7PFLz+Zd9Uah4=
15171517
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c h1:AtEkQdl5b6zsybXcbz00j1LwNodDuH6hVifIaNqk7NQ=
15181518
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c/go.mod h1:ea2MjsO70ssTfCjiwHgI0ZFqcw45Ksuk2ckf9G468GA=
1519-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251002232023-7c0ddcbb5797 h1:CirRxTOwnRWVLKzDNrs0CXAaVozJoR4G9xvdRecrdpk=
1520-
google.golang.org/genproto/googleapis/rpc v0.0.0-20251002232023-7c0ddcbb5797/go.mod h1:HSkG/KdJWusxU1F6CNrwNDjBMgisKxGnc5dAZfT0mjQ=
1519+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251007200510-49b9836ed3ff h1:A90eA31Wq6HOMIQlLfzFwzqGKBTuaVztYu/g8sn+8Zc=
1520+
google.golang.org/genproto/googleapis/rpc v0.0.0-20251007200510-49b9836ed3ff/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
15211521
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
15221522
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
15231523
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
@@ -1559,8 +1559,8 @@ google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5v
15591559
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
15601560
google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g=
15611561
google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s=
1562-
google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI=
1563-
google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ=
1562+
google.golang.org/grpc v1.76.0 h1:UnVkv1+uMLYXoIz6o7chp59WfQUYA2ex/BXQ9rHZu7A=
1563+
google.golang.org/grpc v1.76.0/go.mod h1:Ju12QI8M6iQJtbcsV+awF5a4hfJMLi4X0JLo94ULZ6c=
15641564
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
15651565
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
15661566
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=

client_side_statement_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestStatementExecutor_StartBatchDdl(t *testing.T) {
6565
}
6666

6767
// Starting a DDL batch while the connection is in a transaction is not allowed.
68-
c.tx = &readWriteTransaction{}
68+
c.tx = &delegatingTransaction{conn: c, ctx: ctx}
6969
if _, err := c.ExecContext(ctx, "start batch ddl", []driver.NamedValue{}); spanner.ErrCode(err) != codes.FailedPrecondition {
7070
t.Fatalf("error mismatch for starting a DDL batch while in a transaction\nGot: %v\nWant: %v", spanner.ErrCode(err), codes.FailedPrecondition)
7171
}
@@ -102,13 +102,13 @@ func TestStatementExecutor_StartBatchDml(t *testing.T) {
102102
}
103103

104104
// Starting a DML batch while the connection is in a read-only transaction is not allowed.
105-
c.tx = &readOnlyTransaction{logger: noopLogger}
105+
c.tx = &delegatingTransaction{conn: c, contextTransaction: &readOnlyTransaction{logger: noopLogger}}
106106
if _, err := c.ExecContext(ctx, "start batch dml", []driver.NamedValue{}); spanner.ErrCode(err) != codes.FailedPrecondition {
107107
t.Fatalf("error mismatch for starting a DML batch while in a read-only transaction\nGot: %v\nWant: %v", spanner.ErrCode(err), codes.FailedPrecondition)
108108
}
109109

110110
// Starting a DML batch while the connection is in a read/write transaction is allowed.
111-
c.tx = &readWriteTransaction{logger: noopLogger}
111+
c.tx = &delegatingTransaction{conn: c, contextTransaction: &readWriteTransaction{logger: noopLogger}}
112112
if _, err := c.ExecContext(ctx, "start batch dml", []driver.NamedValue{}); err != nil {
113113
t.Fatalf("could not start a DML batch while in a read/write transaction: %v", err)
114114
}

0 commit comments

Comments
 (0)