Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit e8d0fa0

Browse files
committed
Merge branch 'release-dallas' into dallas-query-store
2 parents 99fb851 + 159cd01 commit e8d0fa0

2,479 files changed

Lines changed: 117000 additions & 4995 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.acrolinx-config.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{:allowed-branchname-matches ["main" "release-.*" "sandbox-.*"]
2-
:allowed-filename-matches ["(?i)docs/(?:(?!toc.yml))" "docs-msdn"]}
2+
:allowed-filename-matches ["(?i)docs/(?:(?!toc.yml))" "docs-msdn" "(?i)azure-sql/(?:(?!toc.yml))" "(?i)data-migration/(?:(?!toc.yml))"]}

.openpublishing.publish.config.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,30 @@
6666
"branch": "main",
6767
"branch_mapping": {}
6868
},
69+
{
70+
"path_to_root": "azure",
71+
"url": "https://github.com/MicrosoftDocs/azure-docs-pr",
72+
"branch": "main",
73+
"branch_mapping": {}
74+
},
75+
{
76+
"path_to_root": "azure_cli_scripts",
77+
"url": "https://github.com/Azure-Samples/azure-cli-samples",
78+
"branch": "master",
79+
"branch_mapping": {}
80+
},
81+
{
82+
"path_to_root": "powershell_scripts",
83+
"url": "https://github.com/Azure/azure-docs-powershell-samples",
84+
"branch": "master",
85+
"branch_mapping": {}
86+
},
87+
{
88+
"path_to_root": "quickstart-templates",
89+
"url": "https://github.com/Azure/azure-quickstart-templates",
90+
"branch": "master",
91+
"branch_mapping": {}
92+
},
6993
{
7094
"path_to_root": "samples",
7195
"url": "https://github.com/dotnet/samples",
@@ -118,5 +142,8 @@
118142
"need_generate_pdf": false,
119143
"need_generate_intellisense": false,
120144
"enable_branch_build_custom_validation": true,
121-
"enable_pull_request_custom_validation": true
122-
}
145+
"enable_pull_request_custom_validation": true,
146+
"redirection_files": [
147+
".openpublishing.redirection.azure-sql.json"
148+
]
149+
}

.openpublishing.redirection.azure-sql.json

Lines changed: 524 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
title: Accelerated database recovery
3+
titleSuffix: Azure SQL
4+
description: Accelerated database recovery provides fast and consistent database recovery, instantaneous transaction rollback, and aggressive log truncation for databases in the Azure SQL portfolio.
5+
ms.service: sql-database
6+
ms.subservice: backup-restore
7+
ms.custom: sqldbrb=4
8+
ms.devlang:
9+
ms.topic: conceptual
10+
author: kfarlee
11+
ms.author: kfarlee
12+
ms.reviewer: mathoma, kendralittle, nvraparl, wiassaf
13+
ms.date: 02/18/2022
14+
monikerRange: "=azuresql||=azuresql-db||=azuresql-mi"
15+
---
16+
# Accelerated Database Recovery in Azure SQL
17+
[!INCLUDE[appliesto-sqldb-sqlmi](includes/appliesto-sqldb-sqlmi.md)]
18+
19+
**Accelerated Database Recovery (ADR)** is a SQL Server database engine feature that greatly improves database availability, especially in the presence of long running transactions, by redesigning the SQL Server database engine recovery process.
20+
21+
ADR is currently available for Azure SQL Database, Azure SQL Managed Instance, databases in Azure Synapse Analytics, and SQL Server on Azure VMs starting with SQL Server 2019. For information on ADR in SQL Server, see [Manage accelerated database recovery](/sql/relational-databases/accelerated-database-recovery-management).
22+
23+
> [!NOTE]
24+
> ADR is enabled by default in Azure SQL Database and Azure SQL Managed Instance. Disabling ADR in Azure SQL Database and Azure SQL Managed Instance is not supported.
25+
26+
## Overview
27+
28+
The primary benefits of ADR are:
29+
30+
- **Fast and consistent database recovery**
31+
32+
With ADR, long running transactions do not impact the overall recovery time, enabling fast and consistent database recovery irrespective of the number of active transactions in the system or their sizes.
33+
34+
- **Instantaneous transaction rollback**
35+
36+
With ADR, transaction rollback is instantaneous, irrespective of the time that the transaction has been active or the number of updates that has performed.
37+
38+
- **Aggressive log truncation**
39+
40+
With ADR, the transaction log is aggressively truncated, even in the presence of active long-running transactions, which prevents it from growing out of control.
41+
42+
## Standard database recovery process
43+
44+
Database recovery follows the [ARIES](https://people.eecs.berkeley.edu/~brewer/cs262/Aries.pdf) recovery model and consists of three phases, which are illustrated in the following diagram and explained in more detail following the diagram.
45+
46+
![current recovery process](./media/accelerated-database-recovery/current-recovery-process.png)
47+
48+
- **Analysis phase**
49+
50+
Forward scan of the transaction log from the beginning of the last successful checkpoint (or the oldest dirty page LSN) until the end, to determine the state of each transaction at the time the database stopped.
51+
52+
- **Redo phase**
53+
54+
Forward scan of the transaction log from the oldest uncommitted transaction until the end, to bring the database to the state it was at the time of the crash by redoing all committed operations.
55+
56+
- **Undo phase**
57+
58+
For each transaction that was active as of the time of the crash, traverses the log backwards, undoing the operations that this transaction performed.
59+
60+
Based on this design, the time it takes the SQL Server database engine to recover from an unexpected restart is (roughly) proportional to the size of the longest active transaction in the system at the time of the crash. Recovery requires a rollback of all incomplete transactions. The length of time required is proportional to the work that the transaction has performed and the time it has been active. Therefore, the recovery process can take a long time in the presence of long-running transactions (such as large bulk insert operations or index build operations against a large table).
61+
62+
Also, cancelling/rolling back a large transaction based on this design can also take a long time as it is using the same Undo recovery phase as described above.
63+
64+
In addition, the SQL Server database engine cannot truncate the transaction log when there are long-running transactions because their corresponding log records are needed for the recovery and rollback processes. As a result of this design of the SQL Server database engine, some customers used to face the problem that the size of the transaction log grows very large and consumes huge amounts of drive space.
65+
66+
## The Accelerated Database Recovery process
67+
68+
ADR addresses the above issues by completely redesigning the SQL Server database engine recovery process to:
69+
70+
- Make it constant time/instant by avoiding having to scan the log from/to the beginning of the oldest active transaction. With ADR, the transaction log is only processed from the last successful checkpoint (or oldest dirty page Log Sequence Number (LSN)). As a result, recovery time is not impacted by long running transactions.
71+
- Minimize the required transaction log space since there is no longer a need to process the log for the whole transaction. As a result, the transaction log can be truncated aggressively as checkpoints and backups occur.
72+
73+
At a high level, ADR achieves fast database recovery by versioning all physical database modifications and only undoing logical operations, which are limited and can be undone almost instantly. Any transaction that was active as of the time of a crash are marked as aborted and, therefore, any versions generated by these transactions can be ignored by concurrent user queries.
74+
75+
The ADR recovery process has the same three phases as the current recovery process. How these phases operate with ADR is illustrated in the following diagram and explained in more detail following the diagram.
76+
77+
![ADR recovery process](./media/accelerated-database-recovery/adr-recovery-process.png)
78+
79+
- **Analysis phase**
80+
81+
The process remains the same as before with the addition of reconstructing SLOG and copying log records for non-versioned operations.
82+
83+
- **Redo** phase
84+
85+
Broken into two phases (P)
86+
- Phase 1
87+
88+
Redo from SLOG (oldest uncommitted transaction up to last checkpoint). Redo is a fast operation as it only needs to process a few records from the SLOG.
89+
90+
- Phase 2
91+
92+
Redo from Transaction Log starts from last checkpoint (instead of oldest uncommitted transaction)
93+
94+
- **Undo phase**
95+
96+
The Undo phase with ADR completes almost instantaneously by using SLOG to undo non-versioned operations and Persisted Version Store (PVS) with Logical Revert to perform row level version-based Undo.
97+
98+
## ADR recovery components
99+
100+
The four key components of ADR are:
101+
102+
- **Persisted version store (PVS)**
103+
104+
The persisted version store is a new SQL Server database engine mechanism for persisting the row versions generated in the database itself instead of the traditional `tempdb` version store. PVS enables resource isolation as well as improves availability of readable secondaries.
105+
106+
- **Logical revert**
107+
108+
Logical revert is the asynchronous process responsible for performing row-level version-based Undo - providing instant transaction rollback and undo for all versioned operations. Logical revert is accomplished by:
109+
110+
- Keeping track of all aborted transactions and marking them invisible to other transactions.
111+
- Performing rollback by using PVS for all user transactions, rather than physically scanning the transaction log and undoing changes one at a time.
112+
- Releasing all locks immediately after transaction abort. Since abort involves simply marking changes in memory, the process is very efficient and therefore locks do not have to be held for a long time.
113+
114+
- **SLOG**
115+
116+
SLOG is a secondary in-memory log stream that stores log records for non-versioned operations (such as metadata cache invalidation, lock acquisitions, and so on). The SLOG is:
117+
118+
- Low volume and in-memory
119+
- Persisted on disk by being serialized during the checkpoint process
120+
- Periodically truncated as transactions commit
121+
- Accelerates redo and undo by processing only the non-versioned operations
122+
- Enables aggressive transaction log truncation by preserving only the required log records
123+
124+
- **Cleaner**
125+
126+
The cleaner is the asynchronous process that wakes up periodically and cleans page versions that are not needed.
127+
128+
## Accelerated Database Recovery (ADR) patterns
129+
130+
The following types of workloads benefit most from ADR:
131+
132+
- ADR is recommended for workloads with long running transactions.
133+
- ADR is recommended for workloads that have seen cases where active transactions are causing the transaction log to grow significantly.
134+
- ADR is recommended for workloads that have experienced long periods of database unavailability due to long running recovery (such as unexpected service restart or manual transaction rollback).
135+
136+
## Best practices for Accelerated Database Recovery
137+
138+
- Avoid long-running transactions in the database. Though one objective of ADR is to speed up database recovery due to redo long active transactions, long-running transactions can delay version cleanup and increase the size of the PVS.
139+
140+
- Avoid large transactions with data definition changes or DDL operations. ADR uses a SLOG (system log stream) mechanism to track DDL operations used in recovery. The SLOG is only used while the transaction active. SLOG is checkpointed, so avoiding large transactions that use SLOG can help overall performance. These scenarios can cause the SLOG to take up more space:
141+
142+
- Many DDLs are executed in one transaction. For example, in one transaction, rapidly creating and dropping temp tables.
143+
144+
- A table has very large number of partitions/indexes that are modified. For example, a DROP TABLE operation on such table would require a large reservation of SLOG memory, which would delay truncation of the transaction log and delay undo/redo operations. The workaround can be drop the indexes individually and gradually, then drop the table. For more information on the SLOG, see [ADR recovery components](/sql/relational-databases/accelerated-database-recovery-concepts).
145+
146+
- Prevent or reduce unnecessary aborted situations. A high abort rate will put pressure on the PVS cleaner and lower ADR performance. The aborts may come from a high rate of deadlocks, duplicate keys, or other constraint violations.
147+
148+
- The `sys.dm_tran_aborted_transactions` DMV shows all aborted transactions on the SQL Server instance. The `nested_abort` column indicates that the transaction committed but there are portions that aborted (savepoints or nested transactions) which can block the PVS cleanup process. For more information, see [sys.dm_tran_aborted_transactions (Transact-SQL)](/sql/relational-databases/system-dynamic-management-views/sys-dm-tran-aborted-transactions).
149+
150+
- To activate the PVS cleanup process manually between workloads or during maintenance windows, use `sys.sp_persistent_version_cleanup`. For more information, see [sys.sp_persistent_version_cleanup](/sql/relational-databases/system-stored-procedures/sys-sp-persistent-version-cleanup-transact-sql).
151+
152+
- If you observe issues either with storage usage, high abort transaction and other factors, see [Troubleshooting Accelerated Database Recovery (ADR) on SQL Server](/sql/relational-databases/accelerated-database-recovery-troubleshoot).
153+
154+
## Next steps
155+
156+
- [Accelerated database recovery](/sql/relational-databases/accelerated-database-recovery-concepts)
157+
- [Troubleshooting Accelerated Database Recovery (ADR) on SQL Server](/sql/relational-databases/accelerated-database-recovery-troubleshoot).

0 commit comments

Comments
 (0)