Replication of CREATE TABLE-opracowanie

Nasza ocena:

3
Wyświetleń: 609
Komentarze: 0
Notatek.pl

Pobierz ten dokument za darmo

Podgląd dokumentu
Replication of CREATE TABLE-opracowanie - strona 1 Replication of CREATE TABLE-opracowanie - strona 2

Fragment notatki:

Replication of CREATE TABLE ... SELECT Statements
This section discusses how MySQL replicates CREATE TABLE ... SELECT statements.
MySQL 5.6 does not allow a CREATE TABLE ... SELECT statement to make any changes in
tables other than the table that is created by the statement. This is a change in behavior from
previous versions of MySQL, which permitted these statements to do so. This means that, when using
statement-based replication between a MySQL 5.6 or later slave and a master running a previous
version of MySQL, a CREATE TABLE ... SELECT statement causing changes in other tables on
the master fails on the slave, causing replication to stop. To keep this from happening, you should use
row-based replication, rewrite the offending statement before running it on the master, or upgrade the
master to MySQL 5.6 (or later). (If you choose to upgrade the master, keep in mind that such a CREATE
TABLE ... SELECT statement will fail following the upgrade unless it is rewritten to remove any side
effects on other tables.) This is not an issue when using row-based replication, because the statement
is logged as a CREATE TABLE statement with any changes to table data logged as row-insert events,
rather than as the entire CREATE TABLE ... SELECT.
These behaviors are not dependent on MySQL version:
• CREATE TABLE ... SELECT always performs an implicit commit (Section 13.3.3, “Statements
That Cause an Implicit Commit”).
• If destination table does not exist, logging occurs as follows. It does not matter whether IF NOT
EXISTS is present.
• STATEMENT or MIXED format: The statement is logged as written.
• ROW format: The statement is logged as a CREATE TABLE statement followed by a series of insertrow
events.
• If the statement fails, nothing is logged. This includes the case that the destination table exists and
IF NOT EXISTS is not given.
When the destination table exists and IF NOT EXISTS is given, MySQL handles the statement in a
version-dependent way.
In MySQL 5.1 before 5.1.51 and in MySQL 5.5 before 5.5.6 (this is the original behavior):
• STATEMENT or MIXED format: The statement is logged as written.
• ROW format: The statement is logged as a CREATE TABLE statement followed by a series of insertrow
events.
In MySQL 5.1 as of 5.1.51:
• STATEMENT or MIXED format: The statement is logged as the equivalent pair of CREATE TABLE and
INSERT INTO ... SELECT statements.
... zobacz całą notatkę

Komentarze użytkowników (0)

Zaloguj się, aby dodać komentarz