Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to keep data consistency during mysqldump backup

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Mysqldump has different internal implementations for different types of storage engines. It is mainly aimed at two types of storage engines: storage engines that support transactions (such as InnoDB) and storage engines that do not support transactions (such as MyISAM). Let's take a look at the implementation of these two storage engines:

1. For engines that support transactions, such as InnoDB, add-single-transaction to the parameters when backing up to ensure data consistency

-- single-transaction actually does the following two operations:

1)。 Set the transaction isolation level of the session to repeatable read at the beginning

2)。 Then start a transaction (execute begin), and end the transaction when the backup ends (execute commit)

With these two operations, the data read by the session during the backup is the data (at the same point) when the backup was started. It can be understood that with the addition of this parameter to the innodb engine, the data to be backed up has been set at the beginning of the backup, and the committed transactions during the backup process will not be seen and will not be backed up.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report