Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Google Cloud · Professional Data Engineer

Fault tolerance and recovery

Professional Data Engineer · Lesson 23 of 23 · 2:48:12

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Google Cloud Professional Data Engineer exam, on the official exam guide. In this lesson: retries, unique IDs, and idempotent sinks, running jobs across zones and regions, BigQuery time travel, fail-safe, snapshots, and dataset replicas, Cloud Storage versioning and soft delete, Pub/Sub seek, and replication and failover for Cloud SQL, Memorystore for Redis, Bigtable, and Spanner. Includes three original practice questions, with Cymbal Mobility, a fictional ride-hailing and scooter company, as the example.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

When things break

At Cymbal Mobility, a zone goes down during the night stream, and a faulty release overwrites a day of trip prices. The rider database must also keep working if its zone fails. The data engineer must design for failures, and recover the data when something goes wrong.

Fault tolerance and restarts

Failures are normal, so pipelines must expect them. Dataflow retries failed work, and tags each message with a unique ID, so retries do not create repeats in its results. Airflow tasks retry too, and idempotent tasks make every restart safe, as lesson twenty-one showed. Design sinks to accept retries, with idempotent writes or deduplication by key, because a downstream system may receive the same row twice. And Pub/Sub keeps unacknowledged messages, so a subscriber that restarts picks up where it stopped.

Zones and regions

Plan for two levels of failure: a zone, and a whole region. By default, a Dataflow job uses every zone of its region, and when a zone fails, workers are recreated in other zones, for jobs that use Streaming Engine or Dataflow Shuffle. Cloud SQL high availability and Memorystore replicas span zones, and BigQuery already stores data across the zones of a region. For a regional outage, keep code and templates ready to start the pipelines in a second region, with the data in multi-region or replicated storage. BigQuery can also replicate a dataset to a secondary region, asynchronously, as a replica that can be promoted.

Corrupted or missing data

Data can be damaged by a faulty release, a bad source file, or a mistaken query. BigQuery time travel restores a table as it was at any point in its window, from two to seven days, and fail-safe keeps deleted data for seven more days, for emergency recovery. Table snapshots preserve a table at a point in time, read-only, for as long as you want, and you restore a standard table from them. In Cloud Storage, object versioning and soft delete keep earlier objects, and Pub/Sub can seek to a time or a snapshot, to replay messages. Detect problems early with quality checks and freshness alerts, then backfill missing dates with idempotent runs.

Replication and failover

A Cloud SQL high availability instance has a primary and a standby in two zones, with synchronous replication, and fails over when the zone or the instance fails. Read replicas scale reads, but they offer no automatic failover, and a cross-region replica can be promoted during a regional outage. Memorystore for Redis, in the Standard Tier, keeps replicas in other zones with automated failover, and a Redis cluster spreads the primary and replicas of each shard across zones. Bigtable replicates clusters across zones or regions, and multi-cluster routing sends requests to the nearest cluster, and fails over when one is unavailable. And Spanner keeps strong consistency across zones, or across regions in a multi-region configuration.

Recap

Let's recap. Expect failures: retries, unique message IDs, idempotent tasks and sinks, and Pub/Sub messages kept until acknowledged. Spread work across zones, and prepare a second region with templates and replicated data. Time travel, fail-safe, snapshots, versioning, and replay recover damaged data, and backfills fill the gaps. Cloud SQL high availability fails over across zones, while read replicas only scale reads. And Memorystore, Bigtable, and Spanner replicate across zones or regions, with automatic failover.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. A streaming Dataflow job must keep running if one zone of its region fails. The job uses Streaming Engine. What should the data engineer do?

    • Pin every worker of the job to a single zone
    • Run a second copy of the job in the same zone
    • Turn off Streaming Engine for the job
    • Keep the default regional placement of workers
    Show the answer

    Keep the default regional placement of workers

    With the default regional placement, workers lost in a failed zone are recreated in the other zones. “Pin every worker of the job to a single zone” would tie every worker to the zone that might fail. “Run a second copy of the job in the same zone” would run a second copy, still exposed to the same zone. And “Turn off Streaming Engine for the job” would remove the condition that regional placement needs.

  2. Four hours ago, a faulty release overwrote yesterday’s trip prices, in a BigQuery table with the default settings. What should the data engineer do?

    • Request recovery from fail-safe through support
    • Restore it with time travel, from before the release
    • Restore it from the last monthly table snapshot
    • Reload every source file of the past year again
    Show the answer

    Restore it with time travel, from before the release

    Time travel covers the last seven days by default, so the table can be restored as it was before the release. “Request recovery from fail-safe through support” is for emergencies after the time travel window has passed. “Restore it from the last monthly table snapshot” would lose every change made since the last snapshot. And “Reload every source file of the past year again” would take far longer, for data that time travel still holds.

  3. The rider database, on Cloud SQL, must stay available if its zone fails, with no committed data lost, and the failover must be automatic. What should the data engineer configure?

    • A high availability, regional instance
    • A read replica in another zone of the region
    • Daily backups exported to Cloud Storage
    • A cross-region replica, promoted by hand
    Show the answer

    A high availability, regional instance

    A high availability instance replicates every write to a standby in a second zone, and fails over to it. “A read replica in another zone of the region” would scale reads, but a read replica does not take over automatically. “Daily backups exported to Cloud Storage” would lose the changes since the last backup, and restoring takes time. And “A cross-region replica, promoted by hand” needs a manual promotion, so the failover would not be automatic.