Skip to main content
Data Runs Deep Menu

Main navigation

  • Home
  • Who We Are
    • Careers
    • What We're Up To
    • What We Believe In
    • Ethical Policy
  • What We Do
  • Google Marketing Platform
    • Analytics 360
    • Tag Manager 360
    • Salesforce and GA360
    • Google Analytics App+Web
    • Data Studio
    • Optimize
  • Google Cloud Platform
    • Google BigQuery
      • Google BigQuery Training
      • Google Analytics Integration
  • Consulting
    • Strategy
    • Implementation
      • Google Analytics Audit
      • Google Tag Manager Audit
      • Enhanced Ecommerce Implementation
      • Google Tag Manager
    • Analysis
      • Google Data Studio
        • Google Data Studio Case Study - Mona
      • UX Analysis
  • Training
    • Five Day Google Analytics Online Workshop
    • Advanced Google Analytics Training
    • Google Tag Manager Training
    • Google Analytics 360 Training
    • Advanced Analytics Bootcamp
  • Partnerships
    • Conductrics
  • Blog
  • The Flying Beagle
  • Merch
  • Contact

Manual Deletion Of Spanner Sessions Using gcloud

By: Balkan Misirli
Posted in
  • Google Cloud Spanner
  • gcloud
Article Date
May 03, 2019

Google Cloud Spanner is Google’s global-scale, strongly consistent SQL database service. Spanner claims to be both consistent and 99.999% available despite operating over the entire planet, which was previously unheard of at this scale and degree.

Google Cloud Spanner has a default session limit of 10,000 sessions per node. After this, new sessions can't be created. We’ve occasionally been locked out of Spanner because over 10,000 sessions have been open but not closed. The culprit is usually a piece of code out there that opens a session but then does not correctly close the session after a transaction has been successful. 

In order to gain access back to Spanner, we need to delete those dangling sessions. To manually delete excess open sessions in Spanner, you can run the following bash script in the terminal to loop over the sessions and delete them one by one. Unfortunately, as of the time of writing this blog post, there is no batch delete command..

In the below code snippet, please replace DATABASE with the database ID of your Spanner database and replace INSTANCE with the instance ID of your Spanner instance. These are both visible in the Spanner web interface on console.cloud.google.com

Otherwise, you can grab the script file from our GitHub repo and run it in the terminal with the database name and instance ID as command line arguments, like this:

spanner/spanner_delete_sessions.sh dbname instanceid

Get in touch

To find out more, email us on hello@datarunsdeep.com.au or complete a quick contact form.

Get in touch

Talk to us: 1300 737 885

08:30 - 16:30, Monday to Friday. We love to chat

Visit us, we’re at:

Level 8, 313 Little Collins Street Melbourne, VIC 3000

Footer

  • Home
    • Who We Are
      • What We Do
      • What We're Up To
      • Careers
      • Contact
  • Training
    • Google Analytics Training Courses
    • Advanced Google Analytics Training
    • Google Tag Manager Training
  • Consulting
    • Analysis
    • Implementation
    • Strategy
    • Google Analytics Audit
    • Google Tag Manager Audit
  • Google Cloud Partner
  • Google Marketing Platform Sales Partner
  • Bitcoin accepted here
  • Registered Looker Consulting Partner Melbourne
  • Twitter
  • LinkedIn
  • Google Plus
  • Blog RSS feed
Copyright © 2009-2021 Data Runs Deep Pty Ltd. All Rights Reserved. Google Analytics is a trademark of Google Inc.
Website by Marin Sekesan