Data Tracking and Rollback
- Audit core data changes, collect change statistics, and view sensitive information. For example, you can use this function to query bank statements, statistics on new orders, and key configuration changes.
- Roll back the misoperation to the state before it is operated. For example, you can use the rollback function if the DBA does not add the WHERE condition during configuration update, configuration data is deleted by mistake, or a large amount of dirty data and ripple effects are generated due to program bugs.
- On the top menu bar, choose Data Scheme > Data Tracking.
Figure 1 Viewing task details
- Search for tasks by time range or database name.
- You can delete tasks as required by selecting check boxes next to task IDs. The deletion operation is synchronized to DAS.
- In the task list, click the task ID to view task details.
- In the task list, locate the target task and click View Task in the Operation column. Then, you can view task details under Task Information, Log Search, and Rollback Task List.
A created task will expire in 15 days. Once the task expires, the system automatically retrieves and deletes the changes in DAS.
- On the displayed page, click Create Tracking Task. In the displayed dialog box, specify task details, including the task name, time range, and database name.Figure 2 Creating a tracking task
- Users who create the tracking task for the first time need to agree to the agreement.
- Task tracking and rollback take three hours by default.
- Click Precheck to obtain the operation details at a specific point in time.
- During the pre-check, binlog files are displayed based on time range. RDS DB instances with the backup function enabled periodically back up the binlog file to the OBS bucket. The backup delay is no more than five minutes.
- When you create a tracking task, there may be no changes in the latest five minutes. In this case, you can create a task again later.
- Click Read Logs to obtain log details.
When reading logs, the system initiates binlog parsing and stores log changes for filtering and displaying data.Figure 3 Reading logs
- You can search for logs only after all logs are successfully read.
- If a new task is started before the last tracking task has not been completely read, it is normal that the log start time is later than the end time.Figure 4 Viewing details
A tracking task reads logs from binlogs. If the data read in a task is the one not completely read in the previous task, that is, the log end time is the time of the logs in the previous task, the log end time will be earlier than the start time.
- Click Log Search to obtain details about the event changes.
- Create a rollback task if you need to roll back multiple events. Specifically, click Rollback Tasks on the Log Search tab page. In the displayed dialog box, specify event IDs and storage of rollback statements, set advanced settings as required, and click OK.Figure 5 Creating a rollback task
- The start and end event IDs are the ones in the task list and must be entered in ascending order.
- Combing changes
- Statement Type
Obtain the original data before changes: generates rollback tables and insert statements by mirroring before data change.
- In the rollback task list, view the current rollback task information or create a rollback task.Figure 6 Viewing the current rollback task
- Locate the target rollback task and click View Details in the Operation column to view task details.
- In the Operation column, click Download to download the compressed data package of the task.
Changes (such as insert->delete, delete->insert, update->update) on the same record will be combined or canceled. Therefore, the generated file may have no rollback SQL statements or original data.