- Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Feature request: I'd like better access to the Ruby Spanner RPC list_sessions method to support Emulator session transaction resetting.
Background
Facts:
- The Spanner local emulator only permits one transaction to be open at a time.
- Opening a transaction and then crashing or killing a program while a transaction is open can result in the client going away and the stale transaction left open until the emulator is restarted.
Annoying, because rebuilding large (100+ table, 300+ index, 1000s of columns) database from scratch can take up to 30 seconds. It'd be much faster to just clear stale open transactions for detached sessions.
Fast forward, I figured out how to do this with the existing library, but it required this monkey patch:
module Google module Cloud module Spanner class Service # add a missing list_sessions method # @param database [String] in the form of a full Spanner identifier like # "project/.../instance/.../database/..." def list_sessions(database:, call_options: nil, token: nil, max: nil) opts = default_options call_options: call_options request = { database: database, page_size: max, page_token: token } paged_enum = service.list_sessions request, opts paged_enum.response end end end end endAnd then some egregious private API calling to:
- list instances on a project
- list databases on an instance
- list sessions on a database
- open and immediately roll back a transaction on a specific
project/instance/database/session
So, it'd be cool to have list_sessions as a first class method on whatever class or classes where it makes sense.
Metadata
Metadata
Assignees
Labels
No labels