ADR Does Not Reverse Committed Schema Changes in Azure SQL Database
0 reputation · 05 Feb 2024, 18:39 UTC
0 reputation · 05 Feb 2024, 18:39 UTC
Accelerated Database Recovery (ADR) in Azure SQL Database is documented to shorten rollback and crash recovery through a persisted version store. While most DDL is transactional and an uncommitted ALTER TABLE can be reversed with ROLLBACK TRANSACTION, ADR does not make a committed schema change undoable. After a COMMIT TRANSACTION, reversal requires a database-level point-in-time restore limited by backup retention.
Even for uncommitted changes, ADR reduces undo duration but does not remove schema-modification lock contention, tempdb usage, or transaction-log growth during rollback. ADR availability and exact locking behavior depend on service tier, hardware generation, and engine version, while certain online index or replication-related DDL carries separate restrictions.
Is there a documented size, duration, or resource threshold that indicates a schema change has become unsafe to roll back in place, even with ADR enabled? How can a team confirm that ADR is actually reducing rollback blocking on their specific service tier before depending on it? What monitoring signals distinguish a progressing uncommitted DDL rollback from one that is escalating lock contention?
34775 reputation · 06 Feb 2024, 05:47 UTC
Short answer: No. Once a DDL statement is committed the change is durable. ADR only speeds the undo of uncommitted work and does not affect the persistence of committed changes. Reverting a committed schema change still requires a database‑level point‑in‑time restore (PITR) within the backup retention window.
Microsoft does not publish a universal size, duration or resource limit that declares an uncommitted DDL “unsafe” for in‑place rollback, even when ADR is enabled. The safety of a rollback depends on the workload, the size of the affected objects, the service tier, and the underlying hardware generation.
SELECT database_ddl_compatibility_level, accelerated_recovery_state
FROM sys.database_recovery_status
WHERE name = DB_NAME();
State 1 means ADR is active. If it returns 0, enable it with ALTER DATABASE db SET ACCELERATED_RECOVERY = ON; (subject to tier support).
SELECT subscription_id, service_objective, sku_name, is_hardware_generation_2
FROM sys.database_service_objectives;
ADR is supported on v12.0+ engines on Generation 2 or newer. If your database is on an older generation, ADR will be ignored.
sys.dm_tran_locks, sys.dm_tran_version_store, and sys.dm_exec_requests for wait types LCK_M_SCH_M and VERSIONSTORE.ALTER DATABASE db SET ACCELERATED_RECOVERY = OFF; for the test).VERSIONSTORE activity and a decreasing number of rows in the version store, with no growth in blocked sessions.LCK_M_SCH_M waits grow, blocked sessions increase, and the version store remains static.| Signal | Progressing Rollback | Escalating Contention |
|---|---|---|
| sys.dm_tran_version_store rows | Decreasing over time | Stagnant or increasing |
| Blocked sessions (sys.dm_os_waiting_tasks) | Stable or decreasing | Increasing, often tied to LCK_M_SCH_M |
| Wait type distribution (sys.dm_exec_requests) | Mostly VERSIONSTORE | High proportion of LCK_M_SCH_M |
| Rollback duration (estimated via client or sys.dm_exec_requests) | Shorter with ADR on | Longer, often > minutes |
If you do not yet know the exact service tier or hardware generation of your database, that information is critical for determining ADR support and expected behavior. Please provide the output of SELECT service_objective, sku_name, is_hardware_generation_2 FROM sys.database_service_objectives; so the recommendation can be tuned to your environment.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.