Skip to content

Spanner updates#316

Open
toddlipcon wants to merge 7 commits into
pingcap:masterfrom
toddlipcon:spanner_updates
Open

Spanner updates#316
toddlipcon wants to merge 7 commits into
pingcap:masterfrom
toddlipcon:spanner_updates

Conversation

@toddlipcon
Copy link
Copy Markdown

Hi,

Here are a few various updates to the Spanner connector as I was playing around with it today. I'm happy to break these into separate PRs per feature, but I figured it may be easier just to send it as a single one since there are likely some conflicts depending which order the changes land in.

toddlipcon and others added 7 commits April 20, 2026 13:25
GetDatabase returns codes.NotFound when the database doesn't exist, but
createDatabase was treating any error as fatal and returning early, so
the "database missing -> create it" path was unreachable. Check for
NotFound explicitly and fall through to CreateDatabase in that case.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Pull the per-row spanner.Row -> map[string][]byte conversion out of
queryRows so it can be reused by other read paths. Pure refactor, no
behavior change.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add three new driver properties so the benchmark can target Spanner
emulators or other non-public gRPC endpoints:

  spanner.endpoint           custom gRPC endpoint (e.g. localhost:9010)
  spanner.insecure           skip Google auth; use insecure gRPC creds
  spanner.experimental_host  sets ClientConfig.IsExperimentalHost

The credentials-file fallback is only consulted when spanner.insecure
is false. The same options are plumbed into both the admin client and
the data client, and NewClient is replaced with NewClientWithConfig so
IsExperimentalHost can be set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add BatchInsert, BatchUpdate, BatchDelete, and BatchRead so go-ycsb's
batch path (batch.size > 1) actually batches operations into a single
client.Apply / Query call. Previously only Insert/Update/Delete/Read
were implemented, so the ycsb.BatchDB type assertion in DbWrapper
failed and the framework silently fell back to one-row-per-RPC.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Expose Spanner's MaxCommitDelay commit option as a driver property.
When unset, Spanner may server-side-amortize commits with a small
delay, which hurts throughput on latency-bound benchmarks. Setting
the property to 0 disables that amortization; any positive value
sets an explicit upper bound in milliseconds. The value is plumbed
through every client.Apply call via spanner.ApplyCommitOptions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Allow point reads to go through the Spanner Read API
(client.Single().ReadRow) instead of a parameterized SELECT. The
Read API skips query parsing / planning on every call and measured
meaningfully faster for workload C point lookups.

The SQL path remains the default so existing setups behave
identically. When spanner.use_read_api=true, we precompute the full
column list once at Create() time (YCSB_KEY plus FIELD0..FIELDn-1
from fieldcount) so readallfields doesn't have to rebuild it per
call.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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