PostgreSQL Major-Version Migration with Controlled Cutover and Rollback

Migrate a transactional order database from PostgreSQL 17 to 18, transfer one-writer authority and roll back after new target orders without discarding them.

PostgreSQL DBA. Advanced.

What you will build and explain

  • Reconcile exact rows and business invariants after a fresh replication barrier.
  • Fence existing sessions, align sequences and establish a reverse stream before target writes.
  • Recover an interrupted handover using durable last-authorized state.

Before you begin

  • SQL transactions, primary/foreign keys, basic PostgreSQL roles and a terminal. Docker/Compose, logical replication and the Python controller are taught.
  • An approved local Unix Docker host, Python 3.11+, Compose/Buildx, at least 2 CPUs, 2 GiB memory and 3 GiB disk plus image/build cache.

Who this is for

For PostgreSQL DBAs who know SQL transactions, keys and basic roles, and want to migrate between major versions with exact reconciliation, one-writer cutover and rollback after new writes.

Curriculum

Learning topics (9)
  1. Follow data and write authority through a database migration

    An order acknowledged by PostgreSQL 17 remains a business obligation after the application starts using PostgreSQL 18. A copied database alone does not preserve that obligation: the old server may still accept writes, a sequence may still allocate an existing ID, or the copied rows may be behind the last commit. The design therefore treats data movement and permission to write as separate problems, joined by an explicit handover.

  2. Prepare a host and a way to reason about its state

    By the end of this lesson you should be able to identify the Docker engine that owns the lab, explain why the two databases need separate volumes, and locate the state needed to resume safely. You need a terminal and basic SQL knowledge; you do not need prior logical-replication experience.

  3. Decide what can cross the version boundary

    Your objective is to distinguish a compatible row stream from a complete database migration. Begin with SQL tables, constraints and roles. A major version change is more than replacing a container image: PostgreSQL's versioning policy distinguishes major upgrades from minor maintenance releases. Version policy, checked 2026-11-03.

  4. Follow a logical stream and the history it needs

    Learn to distinguish initial table copy, ongoing apply and retained history. You should already understand the compatible schema and separate clusters. The architecture's blue database-to-database arrows are native replication, while the green controller arrows are administrative SQL.

  5. Keep one business request through retries and uncertainty

    Your objective is to separate a database transaction, a client response and a business request identity. You should know SQL keys and transactions. Morrow Parts cannot treat a missing response as permission to sell the same order twice. That problem exists before, during and after a major-version migration.

  6. Close application writes before declaring the final copy

    Learn why routing, fencing and replication barriers solve different problems. You should understand subscriptions and client outcomes. The goal is a defensible last-write boundary, not a moment when two dashboards happen to show the same count.

  7. Move allocation state without creating a second writer

    Learn why copied order IDs do not prepare the next order allocation. You should understand identity columns and the fenced interval. Sequences solve concurrent allocation within one cluster; they do not arbitrate authority between two clusters.

  8. Preserve authority when the controller stops halfway

    Learn to distinguish abandoning an unused target, returning after target writes and recovering an incomplete transition. You should understand fencing, barriers and sequences. The difficult question is not which engine the operator prefers; it is which engine may already own acknowledged history.

  9. Operate within the host, identity and evidence boundaries

    Learn what this lab's controls protect and which observations support a safe next action. You should understand the migration protocol. The last step is to connect privileges, networking, image dependencies, diagnostics and cleanup to the system you can actually operate.

Practical build steps (8)
  1. Prepare the Docker host

    Prepare a source checkout and an intended local Docker engine. This milestone ends when both tool versions and local Docker server answer. Use the instructions displayed below, then check the actual state before marking it complete. Cleanup remains available independently of this sequence.

  2. Create identity and private state

    Host checks complete; no .runtime exists. This milestone ends when a unique project and initialized phase are recorded. Use the instructions displayed below, then check the actual state before marking it complete. Cleanup remains available independently of this sequence.

  3. Build and start both versions

    Initialized state on the same local engine. This milestone ends when 17.11 and 18.6 run independently; source alone accepts app login. Use the instructions displayed below, then check the actual state before marking it complete. Cleanup remains available independently of this sequence.

  4. Copy and reconcile orders

    Active source; target has no app writer. This milestone ends when the three-table stream is ready and exact rows/invariants match. Use the instructions displayed below, then check the actual state before marking it complete. Cleanup remains available independently of this sequence.

  5. Move the writer to PostgreSQL 18

    Source active with healthy forward replication. This milestone ends when target accepts writes after reverse replication and sequence alignment. Use the instructions displayed below, then check the actual state before marking it complete. Cleanup remains available independently of this sequence.

  6. Roll back after new target orders

    Target active and compatible reverse stream available. This milestone ends when target-origin orders are retained before source reopens. Use the instructions displayed below, then check the actual state before marking it complete. Cleanup remains available independently of this sequence.

  7. Recover an interrupted handover

    Source active after rollback, or an existing transition to inspect. This milestone ends when the recorded writer reopens only after stream and exact-row checks. Use the instructions displayed below, then check the actual state before marking it complete. Cleanup remains available independently of this sequence.

  8. Remove the owned resources

    Any state, including partial failure; original ownership state retained. This milestone ends when owned runtime inventory is empty; host-owner teardown is separately verified. Use the instructions displayed below, then check the actual state before marking it complete. Cleanup remains available independently of this sequence.

Access

Learning Access: INR 199 plus 18% GST. Source Pack: INR 399 plus 18% GST. 90 days of online access. No auto-renewal.

Cloud costs and boundaries

Uses your own Docker host and synthetic data. Optional VM, disk/network and Docker licensing costs are yours; obtain account and spending approval before cloud provisioning. Both databases share one host.

Licence and completion

Vectametric Project Source Licence (2026-09-27): personal learning, modification/deployment and attributed portfolio/interview demonstrations are permitted. Lawfully obtained copies remain usable after online access expires. Do not redistribute original source or the Source Pack; commercial/client production use requires separate permission. Third-party terms remain separate. See included LICENSE.txt and the Project Source Licence section of the site Terms.

Questions about projects

Do I need a cloud account?

You can read the project material without deploying it. Running a cloud build requires the accounts, permissions and tools listed in that project's prerequisites. Deployment runs in your environment, not in a hosted Vectametric lab.

Can I read the code with Learning Access?

Yes. Learning Access includes the online source-file browser and explanations. The Source Pack adds the downloadable reference repository where available. The project's licence governs use of the source.

Are cloud charges included?

No. Cloud and CI usage are separate. Read the project's cost notice, set a budget and stop deadline, and follow its destruction and leftover-resource checks.

Does the project include troubleshooting and interview preparation?

The project curriculum lists the available scenarios and interview topics. These focus on understanding the architecture and explaining decisions; they are not a promise of particular interview questions or a job.

How long can I use the project?

The project page and checkout show the online access period for your selected plan. Access does not auto-renew. Downloaded source remains subject to its licence; future releases are not automatically included.

Review the Terms and No-Refund Policy before confirming access. All sales are final; Vectametric does not offer refunds.

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy