Will mysql master-slave and slave database lock tables cause replication blocking?
淡淡烟草味
淡淡烟草味 2017-06-22 11:54:33
0
3
1213

Mysql is configured with master and slave, and the slave database is used to query slow statements. If the table is locked during query, will the master database always copy it? Or will it wait until the slow query is completed before copying it?

淡淡烟草味
淡淡烟草味

reply all(3)
巴扎黑
  1. Master-slave synchronization is performed through binlog. The slave library has two threads, one is responsible for receiving binlog logs, and the other is responsible for parsing the logs and writing data to the library. Therefore, master-slave synchronization generally has a certain delay.

  2. As for the issue of read-write locks, write locks are exclusive and read locks can be obtained multiple times. In Innodb, locks are divided into table locks, row locks and gap locks. It depends on your operation. If an insert operation requires locking the table, and a query locks a row in the table, you will naturally need to wait.

phpcn_u1582

Please think about the question carefully again.

According to my understanding of the question, are you sure the master library is replicating the slave library in real time? There is something wrong with this logic.

小葫芦

Misleading, master-slave replication. Normally, the slave library does not allow write operations other than the replication process. Query operations in the slave library will not block the replication write process. Of course, if you have to manually remove the lock When the main library synchronizes the data from the slave library to the locked record, it will wait for the lock on the slave library, so the writing actions of the slave library must be strictly controlled. All except the administrator are read-only

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!