tailieunhanh - MySQL High Availability- P3
MySQL High Availability- P3: A lot of research has been done on replication, but most of the resulting concepts are never put into production. In contrast, MySQL replication is widely deployed but has never been adequately explained. This book changes that. Things are explained here that were previously limited to people willing to read a lot of source code and spend a lot of time debugging it in production, including a few late-night sessions. | transaction the server writes all the statements that are part of the transaction to the binary log as a single unit. For this purpose the server keeps a transaction cache for each thread as illustrated in Figure 3-4. Each statement executed for a transaction is placed in the transaction cache and the contents of the transaction cache are then copied to the binary log and emptied when the transaction commits. Figure 3-4. Threads with transaction caches and a binary log Statements that contain nontransactional changes require special attention. Recall from our previous discussion that nontransactional statements do not cause the current transaction to terminate so the changes introduced by the execution of a nontransactional statement have to be recorded somewhere without closing the currently open transaction. The situation is further complicated by statements that simultaneously affect transactional and nontransactional tables. These statements are considered transactional but include changes that are not part of the transaction. Statement-based replication cannot handle this correctly in all situations and therefore a best-effort approach has been taken. We ll describe the measures taken by the server followed by the issues you have to be aware of in order to avoid the replication problems that are left over. How nontransactional statements are logged When no transaction is open nontransactional statements are written directly to the binary log and do not transit in the transaction cache before ending up in the binary log. If however a transaction is open the rules for how to handle the statement are as follows 1. If the statement is marked as transactional it is written to the transaction cache. 2. If the statement is not marked as transactional and there are no statements in the transaction cache the statement is written directly to the binary log. Logging Transactions 77 Please purchase PDF Split-Merge on to remove this watermark. 3. If the .
đang nạp các trang xem trước