HarbourBridge
Google's Spanner Migration Tool — core contributor
HarbourBridge is Google's open-source tool for migrating legacy relational databases to Cloud Spanner. It supports schema and data migration from MySQL, PostgreSQL, Oracle, SQL Server, and DynamoDB, handling the complex translation between source-specific SQL dialects and Spanner's distributed relational model. As a core contributor, I architected and built key components:
- Intelligent Schema Assistant Backend: APIs that analyze source schemas and recommend optimal Spanner designs (primary keys, interleaving, indexes).
- CDC Pipelines: Change Data Capture from Datastream through Pub/Sub to Dataflow, enabling zero-downtime migrations.
- Query Optimization: Post-migration query rewriting and performance tuning, delivering 40–60% improvements through PK design, strategic indexing, and table interleaving.
One of the core challenges HarbourBridge solves is schema translation. Relational databases like MySQL and PostgreSQL use auto-increment primary keys, foreign key constraints, and storage-engine-specific column types that have no direct equivalent in Spanner. HarbourBridge automatically maps source data types to Spanner-compatible types (for example, converting MySQL's ENUM to STRING or PostgreSQL's SERIAL to INT64 with sequence emulation), recommends composite primary keys to replace auto-increment patterns, and identifies parent-child relationships that benefit from Spanner's interleaved table design for co-located storage and efficient joins.
The migration workflow follows an assessment-then-migration pattern. In the assessment phase, HarbourBridge connects to the source database, introspects the schema, and generates a detailed migration report highlighting potential issues: unsupported column types, foreign key relationships that should become interleaved tables, and indexes that need restructuring for Spanner's distributed architecture. Engineers review and adjust the proposed schema mapping before committing to the actual data migration, reducing the risk of costly post-migration schema changes.
HarbourBridge integrates with the broader Spanner ecosystem through Datastream for change data capture, Cloud Pub/Sub for event buffering, and Dataflow (Apache Beam) for scalable data transformation. This pipeline architecture enables minimal-downtime migrations where the bulk data load runs first, followed by continuous CDC replication that keeps the Spanner target synchronized with the source until the final cutover. The tool has supported thousands of production migrations across enterprise customers adopting Spanner for globally distributed, strongly consistent workloads.
Key Highlights
- 40–60% post-migration query performance improvement
- Change Data Capture pipeline (Datastream → Pub/Sub → Dataflow)
- Intelligent Schema Assistant with interleaving recommendations
- PK design and indexing optimization strategies
- Thousands of successful production migrations