cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Best practices for DR & Checkpoint Management of Serverless Declarative Pipelines (ST/MV)?

kohei-matsumura
Databricks Partner

I am currently designing a Disaster Recovery (DR) strategy for our Databricks workspace to recover from system failures and human errors. Our main requirement is to restore both the data and the pipelines reliably if a workspace goes down or gets corrupted.
Initially, I expected that enabling Databricks Managed Disaster Recovery would be a simple and straightforward solution. However, our architecture heavily relies on Spark Declarative Pipelines within a Serverless environment, utilizing Streaming Tables (ST) and Materialized Views (MV).
Iโ€™ve realized there are significant limitations with this setup: STs and MVs are not fully supported by Managed DR replication, and the CLONE command does not work for them. Most importantly, because we are on Serverless, we do not have direct access to the pipelineโ€™s state and checkpoints, making it extremely difficult to safely migrate or replicate them to a secondary workspace/region for recovery.
Given these constraints, Iโ€™d love to get some advice from anyone who has tackled similar challenges:

DR Architecture: Are there any recommended architectural patterns or workarounds for safely backing up and recovering STs and MVs (including their states and checkpoints) in a Serverless environment?
State Management: How do you handle DLT/Declarative pipeline checkpoints and state management during a DR Failover?
Active-Active vs. Active-Passive: To guarantee exactly-once processing in streaming, is a fully Active-Active architecture strictly required? Or is there a viable Active-Passive strategy that works well here?
Reverting to Classic Delta: If we were to abandon Spark Declarative Pipelines and revert to standard Delta Tables (using classic Structured Streaming / Jobs), would that allow us to simply and reliably use Databricks Managed DR for backups and restores?
Any insights, tips, or reference architectures would be highly appreciated. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

Aravind_Reddy
Databricks Partner

Thanks for the detailed explanation everyone. The Active-Passive + replay/rebuild approach makes sense given that Serverless manages the checkpoint state internally.

One aspect Iโ€™m curious about is how this pattern should be designed when the source data volume is large and the DR requirement has a strict RPO/RTO (Recovery point and Recovery time objective). If the secondary environment needs to rebuild Streaming Tables from retained source data rather than restore the original checkpoint, the recovery time may depend heavily on how much data needs to be replayed or processed.

Would it be a good approach to maintain a separate, continuously replicated source layer specifically for DR, so that the failover environment only needs to replay data from a defined recovery point rather than rebuilding the entire Streaming Table history?

Also, for teams using CDC sources, would the recommendation be to keep the CDC/change history for at least the maximum expected failover window to make this replay-based Active-Passive strategy reliable?

Interested to hear how others are balancing RPO/RTO requirements with the rebuild-and-replay model.

View solution in original post

9 REPLIES 9

K_Anudeep
Databricks Employee
Databricks Employee

Hello @kohei-matsumura 

Yes, your understanding is correct! Databricks Managed Disaster Recovery currently does not provide end-to-end recovery for architectures using Serverless Declarative Pipelines, Streaming Tables (ST), and Materialized Views (MV).

Limitations:

  • Managed DR does not replicate STs, MVs, Lakeflow/Declarative Pipelines, or their streaming state/checkpoints.
  • STs and MVs cannot be used as the source or target of CLONE.
  • For Serverless Declarative Pipelines, checkpoint locations are managed internally and are not accessible to customers.

Doc Links: Managed Disaster Recovery , CLONE limitations and Pipeline checkpoint recovery

 

For the current architecture, an Active-Passive DR strategy would be good:

  • Keep the source data durable and retained long enough to support replay.
  • Use Managed DR for supported Unity Catalog Delta tables and workspace assets.
  • Keep pipeline code/configuration in source control and redeploy it in the secondary workspace.
  • Rebuild STs and MVs from the retained or replicated source data during failover.

For Streaming Tables, recovery may require a full refresh and creation of new checkpoint state.

Doc: Full refresh for Streaming Tables

Active-Active is not required for exactly-once processing. Active-Passive is a valid and simpler DR model, provided only one environment is consuming/writing at a time and the source data can be replayed. Doc: Databricks Disaster Recovery guidance

If recovering from the same cross-region checkpoint is a strict requirement, classic Structured Streaming provides more control because checkpoints can be stored in customer-managed storage and replicated separately.

Doc: Structured Streaming checkpoints

 

Therefore, i dont think it is recommended to move away from Declarative Pipelines solely for Managed DR. The main deciding factor should be whether direct ownership and cross-region recovery of streaming checkpoints is a hard requirement.

 

In summary, the recommended pattern is:

Active-Passive DR + durable/replicated source data + source-controlled pipeline definitions + single-writer control + replay/rebuild of STs and MVs during failover.

Anudeep

data_pulse
Contributor

@kohei-matsumura 

For regional DR, It's better to lean toward active-passive with replicated/replayable data, rather than trying to copy Lakeflow checkpoint state between regions.

  • Data layer: bootstrap the secondary region with DEEP CLONE or another replication mechanism, then keep it incrementally synchronized so failover does not require a full historical backfill.
  • Pipeline layer: redeploy the pipeline definition in the secondary region and recover/replay from the retained source/change data.
  • Checkpoint state: I would not assume that copying checkpoint files alone is enough to safely resume a pipeline exactly where it left off. Streaming state can include source offsets, state-store metadata, schema/state compatibility, and references to environment-specific locations. A partially or inconsistently replicated checkpoint could be worse than rebuilding from a known replayable boundary.

So the safer model sounds like active-passive + replicated data + sufficient source retention, with checkpoint recovery handled through supported pipeline mechanisms rather than cloning checkpoint directories directly.

If portable checkpoints are an explicit requirement, classic Structured Streaming gives more control because you own the checkpoint location, but even there have to validate failover carefully rather than assuming a storage copy alone guarantees a clean resume.

aayush_410
Contributor

Managed DR isn't the right tool for the streaming layer here, so don't try to make it one. Design the pipelines to be rebuildable rather than replicated, and use Managed DR (or a DIY equivalent) only for what it handles well.

The core idea

Treat the state and checkpoints of Streaming Tables as disposable. You can't reach them on Serverless, and a copied checkpoint is fragile anyway, because it's tied to source offsets and pipeline internals. Replicate the things you can control:

Raw/source data, which must be replayable.
Pipeline code and config, deployed through Git and Databricks Asset Bundles (DABs).
Table data, which you either replicate or recompute.
1. DR architecture for STs and MVs

Materialized Views: don't replicate them at all. They're derived data, so in the secondary region you deploy the pipeline and let it recompute. The only cost is the compute time for the first refresh, so factor that into your RTO.

Streaming Tables: split them into two kinds.

Rebuildable from source. Examples are Auto Loader over files in replicated storage, or Kafka with enough retention. Deploy the same pipeline in the secondary and run a full refresh from the replicated source. Auto Loader in the secondary starts with fresh file-discovery state and re-ingests everything, which is safe only if the downstream logic is idempotent (see section 3).
Not rebuildable. The source is gone or short-lived, or the ST holds data that only exists there, such as CDC history (SCD2). These need a data backup, described next.

Backing up ST data, since CLONE doesn't work on STs: you can still read an ST as a normal table. Run a scheduled job that copies each critical ST into a regular Delta table in a DR catalog or storage account. That table can then be deep-cloned or replicated by any normal mechanism. This gives you the data but not the state.

Restoring ST data in the secondary: create the ST and backfill it from the snapshot table using a one-time append flow (append_flow with once=True), then attach the live source flow. Test the seam between the backfill and the live flow carefully, because that's where duplicates or gaps appear. Bound it by a timestamp or offset and dedupe on a business key.

Human error (separate from regional outage):

ST time travel works, but MV time travel doesn't, so for STs you can use RESTORE and time travel. This is documented.
Use UNDROP for accidentally dropped UC managed tables.
Keep pipeline definitions only in Git and DABs, so a corrupted workspace is just a redeploy.
Keep the snapshot copies in a separate storage account with soft delete or immutability, ideally under different credentials.
2. Checkpoints and state during failover

Don't migrate them. The failover procedure for an SDP pipeline is:

Deploy (or un-pause) the pipeline in the secondary via DAB.
For rebuildable STs, run a full refresh from replicated sources.
For non-rebuildable STs, restore from the snapshot table as above, then start the live flow.
Re-point sources and consumers. Stable URLs help if you're using Managed DR.

The one place you'll genuinely fight offsets is Kafka. Offsets in a mirrored cluster don't match the original, so start from a timestamp (with a small overlap) and rely on idempotent writes.

3. Active-active vs active-passive

Active-active is not required. End-to-end exactly-once in practice means replayable source plus idempotent sink:

Make writes idempotent. Use AUTO CDC (or MERGE keyed on a business key) for anything that matters. Then reprocessing an overlap window after failover is harmless.
Use active-passive. A warm standby (pipeline deployed but paused, replicated raw data, snapshots current) gives you minutes to hours depending on refresh sizes. A cold standby is cheaper and slower.
Active-active would mean two live pipelines writing to separate stores and reconciling them, which adds cost and conflict handling. It's usually justified only by near-zero RTO.
4. Would reverting to classic Delta make Managed DR simple?

Partly, but it wouldn't remove the hard part, and I wouldn't abandon SDP just for this.

Managed DR replicates Unity Catalog managed Delta tables with data. Per the docs, external tables and volumes get metadata only, and it can also replicate workspace assets like notebooks, jobs and ACLs. It's also gated, so Databricks enables it only after your account is accepted.
Classic Structured Streaming checkpoints live in storage you control, so they're reachable, but they're still tied to source offsets. Databricks' own DR guidance points to dual writes or checkpoint replication for this, so you'd still design a streaming failover plan.
Replication is continuous but asynchronous, so expect a nonzero RPO.

A better path is a hybrid. Keep SDP for the MV and derived layers, which recompute. For anything that is a hard system of record, use plain Delta tables (written by Jobs or a sink) that Managed DR or deep clone can handle, and treat it as the source for downstream SDP layers.

Aayush Sharma

anuj_lathi
Databricks Employee
Databricks Employee

Short answer: don't try to back up or migrate ST/MV state and checkpoints at all. On Serverless you can't reach them, and they aren't designed to be portable. Design for rebuild and replay instead: pipeline definitions in Git, replayable sources replicated, and an independent pipeline (with its own checkpoints) in the secondary workspace. As you noticed, CLONE isn't an option for these objects [2].

1. Backing up and recovering STs and MVs

Split your estate by whether the data can be recomputed:

  • Materialized views: treat them as pure derived data. Nothing to back up. As long as their upstream tables exist in the secondary, a pipeline update there recomputes them.
  • Streaming tables: the question is whether the source is replayable.
    • If the source is files in cloud storage (Auto Loader), replicate the landing bucket cross-region and keep the files. The secondary pipeline re-ingests from there.
    • If the source is Kafka/Kinesis with limited retention, the ST may be the only durable copy. Land that data into a plain Delta table first, and keep STs and MVs for the layers downstream of it.
  • Where to put the "irreplaceable" layer: regular Delta tables (bronze/raw) are the easiest place for it. They work with deep clone [2] and other table-replication approaches. STs and MVs then sit on top as rebuildable layers.
  • Pipeline definitions: keep the source, pipeline settings, schedules, and permissions in Git and deploy them to both workspaces via CI/CD (Databricks Asset Bundles work well). Then "restore the pipeline" is just a deployment, not a backup restore.
  • Human error: for corruption or bad deploys, the recovery path for an ST/MV is to fix the code and run an update or full refresh from source. Be careful with full refresh on an ST whose source no longer holds the history, because that will drop data you can't re-ingest.

Pipelines and their concepts (flows, STs, MVs) are described here [1].

2. Checkpoints and state during failover

Don't carry checkpoints across. Streaming checkpoints track offsets, and for Delta sources, table versions. After you replicate a table to another region, its versions and file layout no longer line up with the primary's, so a copied checkpoint can't be trusted. The safe model is:

  1. The secondary pipeline owns its own checkpoints, created in the secondary workspace.
  2. It reads from a replicated, replayable source.
  3. On failover, you start or resume that pipeline and repoint consumers to the secondary catalog.

3. Active-active vs. active-passive

You don't need a full active-active setup. Exactly-once in streaming is a property of one pipeline, one checkpoint, one target. Two independent pipelines, each with its own checkpoint and its own target, are each exactly-once relative to their own output. What you must avoid is two regions writing to the same target, or trying to share a checkpoint.

Practical active-passive variants:

Mode How it works Trade-off
Warm standby Same pipeline deployed in the secondary and run on a schedule or triggered, ingesting from replicated sources Higher cost, low RTO
Cold standby Deploy on failover, then backfill from replicated sources Cheap, but RTO scales with data volume

Keep in mind that outputs in the two regions won't be byte-identical (file layout, versions, ordering of micro-batches), so pick one region as the writer of record at any time.

4. Reverting to classic Delta + Structured Streaming

It makes the data side simpler, since Delta tables support deep clone [2] and the usual replication tooling. But it isn't a free lunch:

  • You now own checkpoints. They live in your storage, but they still aren't safely portable for the same version-mismatch reason above.
  • You still need a replay-based failover: start a new checkpoint in the secondary and make the write path idempotent, for example foreachBatch with MERGE on a business key, or a dedup step.
  • You lose the managed operations (retries, orchestration of flows, incremental MV refresh) that pushed you to declarative pipelines.

Before I'd abandon pipelines over this, I'd check the current Managed DR supported-object list for your cloud, since coverage changes. The hybrid pattern above (plain Delta for the irreplaceable raw layer, pipelines for everything downstream) gets you most of the DR benefit without giving up declarative pipelines.

Recommendation

  1. Keep raw/landing data replicated and replayable, as plain Delta tables or files.
  2. Deploy identical pipelines to both workspaces from Git.
  3. Choose warm or cold standby based on your RTO.
  4. Rehearse a failover, including the consumer cutover, before you rely on it.

References

[1] Spark Declarative Pipelines | Databricks on AWS โ€” https://docs.databricks.com/aws/en/ldp
[2] CREATE TABLE CLONE | Databricks on AWS โ€” https://docs.databricks.com/aws/en/sql/language-manual/delta-clone

Anuj Lathi
Solutions Engineer @ Databricks

If possible, could you also share your insights on another issue I am currently considering? The details are a bit lengthy, so I have outlined them below:

YUNSUNG_YANG
New Contributor III

Thank you for the explanation. Based on the previous answers, I understand that restoring data for Streaming Tables (ST) and Materialized Views (MV) typically involves rerunning the pipeline using the original source data.

This approach seems perfectly fine when the data volume is small. However, if a system has been in operation for several years, I have a few concerns. Over years of operation, the volume of historical source data becomes massive, and there is a high probability that schema changes have occurred over time.

Therefore, I am concerned that executing a full recovery from the original raw sources would incur tremendous compute costs and time, and might not even guarantee a 100% accurate data restoration due to historical schema drift.

Considering this, I was wondering if a better approach would be to periodically create a "latest snapshot" source file/table based on the Silver layer data, and use that snapshot to rebuild the pipeline data when recovery is needed, rather than reading years of raw data from the beginning.

I would highly appreciate any advice, insights, or best practices regarding this backup/recovery architecture in production.

Short answer: yes, a periodic Silver snapshot is the right instinct, and it's how I'd design it. Treat raw replay as the break-glass option, not the routine recovery path. There's one catch: you can't snapshot an ST or MV with CLONE [1][2], so the snapshot has to be a plain Delta table that your job writes.

Why the snapshot approach works

  • Cost and time: recovery becomes "load the latest snapshot, then replay only what arrived since", so it scales with your RPO window rather than your years of history.
  • Schema drift: Silver is already conformed to your current schema. Restoring from it means you never re-run years of old parsing logic against old raw shapes, which is where drift bites.
  • Trade-off: you're trusting Silver as the source of truth. If you later find a Silver transformation bug that goes back years, only raw reprocessing fixes it. So keep raw, but on cheap storage tiers, as the audit and reprocessing path rather than the DR path.

The pattern

1. Mirror Silver into plain Delta tables. Use a scheduled job, separate from the pipeline, that writes to a backup schema.

Full copy, fine for small and medium tables:

CREATE OR REPLACE TABLE dr_backup.silver.orders AS
SELECT * FROM prod.silver.orders;

Incremental, if the ST is append-only and has a monotonic ingestion column:

INSERT INTO dr_backup.silver.orders
SELECT * FROM prod.silver.orders
WHERE _ingested_at > (
  SELECT coalesce(max(_ingested_at), TIMESTAMP '1970-01-01')
  FROM dr_backup.silver.orders
);

If the ST gets updates or deletes (for example from CDC), an append-only mirror will drift from it. Use a MERGE, or a periodic full rewrite.

2. Get the mirror to the secondary region. These are now ordinary Delta tables, so the normal tools apply:

  • Deep clone can be re-run to sync incrementally, and Databricks explicitly positions it for DR archiving [1]:

    CREATE OR REPLACE TABLE dr_catalog.silver.orders CLONE dr_backup.silver.orders;
    
  • If you get access to Managed DR, plain UC managed Delta tables are within what it replicates [3]. That's a good reason to keep the backup layer as plain managed tables. Note that Managed DR is gated and has prerequisites such as Enterprise plan, Mission Critical add-on, and serverless on both sides [3].

3. Record a manifest per snapshot. For each table, store the snapshot timestamp, the high-water mark (max ingestion time, or Kafka offsets and file modification time), and the Git tag or commit of the pipeline code that produced it. The manifest tells you where to resume replay, and which code version matches the snapshot's schema. Snapshot all tables in one run, or at least record each one's mark, so your restore point is coherent across tables.

4. Don't snapshot MVs. They're derived, so a pipeline update recomputes them from the restored Silver. The exception is an MV that's very expensive to rebuild. In that case, mirror it too.

The restore

  1. Deploy the pipeline code from Git in the secondary, at the tag recorded in the manifest.
  2. Seed the Silver STs from the snapshot. You can't clone into an ST, so do it inside the pipeline: add a one-time backfill flow that appends from the

References

[1] Clone a table on Databricks | Databricks on AWS โ€” https://docs.databricks.com/aws/en/tables/operations/clone
[2] CREATE TABLE CLONE | Databricks on AWS โ€” https://docs.databricks.com/aws/en/sql/language-manual/delta-clone
[3] Managed disaster recovery | Databricks on AWS โ€” https://docs.databricks.com/aws/en/admin/managed-disaster-recovery

Anuj Lathi
Solutions Engineer @ Databricks

@YUNSUNG_YANG 

I did a small serverless validation of the main recovery scenarios using a Lakeflow Declarative Pipeline with a Delta source, a stateless Streaming Table, a stateful deduplicating Streaming Table, and a Materialized View. The results support a production DR model based on active-passive + warm replicated data + synchronized schema/code + explicit recovery boundaries, rather than replaying years of raw history or trying to copy checkpoints.

  • Bootstrap a warm DR baseline : For a mature production system, I would avoid making โ€œreplay everything from day oneโ€ the default DR path. Bootstrap the secondary region from the current trusted production state and keep that baseline reasonably current.
    For supported Delta tables, a DEEP CLONE or another replication mechanism can be used 
CREATE OR REPLACE TABLE dr_catalog.schema.orders
DEEP CLONE prod_catalog.schema.orders;โ€‹


Subsequent clone operations can be incremental, so Databricks only copies the changes since the previous clone rather than doing a full historical copy every time.

The goal is to recover from baseline + delta, not from several years of historical raw data.

  • Keep schema, code and configuration synchronized:  Data alone is not enough. Promote schema evolution, Lakeflow pipeline definitions, DAB configuration, permissions/connections and other dependencies to DR as part of the normal release process.
    This is especially important for historical schema drift: failover should start from a recent known-good data + schema + code state.
  • Stateless Streaming Tables - validated:  
    In my test, have preserved the existing target, reset only that flowโ€™s checkpoint, configured a known Delta startingVersion, and resumed processing.
    The result was successful: existing target data remained intact and only the newer source changes were processed.
    Since startingVersion is inclusive, if the preserved target already represents source version N, recovery should start from N+1.
spark.readStream
.option("startingVersion", recovery_version)
.table("bronze.orders")โ€‹

For production, can keep those boundaries in a control table rather than hardcode them like:

flow_name          source_table       baseline_version
orders_flow        bronze.orders      12500
customers_flow     bronze.customers    8420
  •  Stateful Streaming Tables - validated limitation: I repeated the same test with a deduplication flow.
    The target rows were preserved, but the historical deduplication state was not. A previously seen ID was accepted again after checkpoint reset.
    So this is an important boundary: target data does not recreate state-store/checkpoint semantics.
    Stateful flows such as deduplication, aggregations, watermarks or stream-stream joins need a separately designed and tested recovery path, potentially replaying enough history to rebuild state.
  • Materialized Views - validated: I have also tested an MV recovery path.
    With the source data kept intact, an explicit MV only refresh rebuilt the correct current result without rerunning the original historical ingestion process. In my test pipeline chose a Full recompute.
    So for DR, I would keep the underlying source data current, deploy the same MV definition, and refresh/rebuild the MV in the secondary region.
    Whether a given MV can incrementally refresh or requires a full recompute should be validated separately for the actual query.
  • Do not use checkpoint copying as the DR boundary: I would avoid trying to copy or artificially advance Lakeflow checkpoint files. A checkpoint can contain source offsets, state-store information, schema/progress metadata and execution state. A copied target plus a copied/advanced checkpoint does not automatically guarantee that both represent the same logical processing state.
    A known baseline plus an explicit recovery boundary is much easier to reason about and audit.
  • Keep enough incremental history to cover the RPO: Retain enough raw/CDC/CDF history after the latest DR baseline so the secondary region can catch up after failover:
  • Validate the DR path regularly: Periodically verify:
    - replicated data freshness
    - schema/code alignment
    - per-flow recovery boundaries
    - stateless flow recovery
    - stateful flow recovery procedure
    - MV refresh/rebuild
    - row counts, keys and business-level reconciliations
    This is what gives confidence in actual RPO/RTO rather than just having a theoretical DR design.
  • REST API caveat from my test:  The selective checkpoint-reset conclusion above came from a successful raw REST API call using reset_checkpoint_selection.
    A normal databricks bundle run didn't not request a checkpoint reset and the Databricks CLI version I tested (v0.290.0) warned that pipelines start-update --json did not recognize reset_checkpoint_selection. So, have tested this with: 
databricks api post /api/2.0/pipelines/<pipeline-id>/updates
  -p default
  --json "@reset-request.json"โ€‹

For ST recovery, I have used a raw pipeline update request with reset_checkpoint_selection + refresh_selection, for the MV we used an explicit MV-only refresh. 

Summary: For production Iโ€™d aim for active-passive + warm replicated data + synchronized schema/code + explicit per-stream recovery boundaries, with a different recovery strategy for stateful flows. That avoids both extremes: copying opaque checkpoint state blindly or replaying years of history every time DR is invoked.

Aravind_Reddy
Databricks Partner

Thanks for the detailed explanation everyone. The Active-Passive + replay/rebuild approach makes sense given that Serverless manages the checkpoint state internally.

One aspect Iโ€™m curious about is how this pattern should be designed when the source data volume is large and the DR requirement has a strict RPO/RTO (Recovery point and Recovery time objective). If the secondary environment needs to rebuild Streaming Tables from retained source data rather than restore the original checkpoint, the recovery time may depend heavily on how much data needs to be replayed or processed.

Would it be a good approach to maintain a separate, continuously replicated source layer specifically for DR, so that the failover environment only needs to replay data from a defined recovery point rather than rebuilding the entire Streaming Table history?

Also, for teams using CDC sources, would the recommendation be to keep the CDC/change history for at least the maximum expected failover window to make this replay-based Active-Passive strategy reliable?

Interested to hear how others are balancing RPO/RTO requirements with the rebuild-and-replay model.