Advanced Track Do this after finishing Chapters 01-14.

Estimated Time

  • Reading: 30-40 min
  • Lab: 60-90 min
  • Quiz: 15-20 min

Prerequisites

  • Core track (Chapters 01-14) completed.
  • GitOps promotion and observability workflows available.

Source Code References

  • cnpg-clusters/ Members

Sign in to view source code.

What You Will Produce

A go/no-go evidence package: rollout results, remediation notes, and explicit rollback conditions.

Exercise: The Data Rollback

  1. Pre-Migration Drill: Verify your PITR status in CNPG. Capture the current timestamp.
  2. Execute Migration: Deploy a test migration that intentionally corrupts a “dummy” table.
  3. Verify Failure: Identify the data corruption and the resulting application error.
  4. Code Revert: Revert the migration commit in Git and let Flux reconcile the previous version.
  5. Data Restore: Trigger a PITR restore to the timestamp captured in step 1.
  6. Final Verify: Prove that the database schema and data have returned to their known-good state.

Core Exercises (Required)

  1. Status Check: Use kubectl get clusters.postgresql.cnpg.io -n develop to check the health and backup status of your database.
  2. Schema Audit: Inspect the migration history table in your database and identify the last successful and failed runs.
  3. Expand-Contract Review: Analyze a proposed breaking change and rewrite it using the Expand-Contract pattern.

Challenge Exercise (Optional)

Full Expand/Contract Migration Cycle: Execute a full expand/contract migration cycle on a test CNPG database: add a new column with default, deploy application code that uses it, then remove the old column. Verify rollback capability at each phase.

Done When

You have completed this chapter when:

  • You can explain why code rollbacks are insufficient for stateful changes.
  • You have successfully executed an atomic code + data rollback.
  • You can demonstrate a Point-in-Time Recovery (PITR) using CNPG.
  • You understand and can apply the Expand-Contract migration pattern.

Knowledge Check

Before finishing this chapter, complete the Quiz to verify your understanding of the guardrail principles.