Kategoria: (MySQL) Autor: Gabrym Data 23 mar 2009

Czas rozwiazać kolejny problem.
Replikacja zostaje przerwana błędem 1535 przy zastosowania tabeli z polami FLOAT i GEOMETRY.

Przykład tabeli:


CREATE TABLE `lokalizacje` (
  `id` mediumint(10) unsigned,
  `pkt` geometry NOT NULL DEFAULT '',
  `x` FLOAT(20,17),
  `y` FLOAT(20,17),
  PRIMARY KEY (`id`),
  SPATIAL KEY `pkt` (`pkt`)
) ENGINE=MyISAM;

Po zainsertowaniu rekordów na serwerze master replikacja ulega przerwaniu.
Na maszynie slave widzimy:


mysql (database) > show slave statusG
************************ 1. row ************************
Slave_IO_State: Waiting for master to send event
Master_Host: x.x.x.x
Master_User: user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000024
Read_Master_Log_Pos: 183819499
Relay_Log_File: relay-log.000033
Relay_Log_Pos: 1235861
Relay_Master_Log_File: mysql-bin.000024
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1535
Last_Error: Table definition on master and slave does not match:
 Column 5 size mismatch - master has size 247, database.lokalizacje on slave
 has size 1. Master's column size should be <= the slave's column size.
Skip_Counter: 0
Exec_Master_Log_Pos: 182967168
Relay_Log_Space: 2094792
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1535
Last_SQL_Error: Table definition on master and slave does not match:
 Column 5 size mismatch - master has size 247, database.lokalizacje on slave
 has size 1. Master's column size should be <= the slave's column size.
1 row in set (0.00 sec)

Zaistniały błąd pojawia się w momencie gdy tabela różni się kolumnami na serwerach master i slave.
Czy aby napewno w naszym przypadku tak jest !?
Porównujemy budowę tabel na maszynach.


SHOW CREATE TABLE lokalizacjaG
SHOW TABLE STATUS LIKE 'lokalizacja';

I w tym przypadku są identyczne.

Problem rozwiązuje zmiana formatu binloga z mixed na statement.

Środowisko:


mysql (database) > show variables like '%version%';
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| protocol_version        | 10                           |
| version                 | 5.1.32-log                   |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86_64                       |
| version_compile_os      | pc-solaris2.10               |
+-------------------------+------------------------------+
5 rows in set (0.00 sec)

mysql (database) > show variables like '%binlog_format%';
+---------------+-----------+
| Variable_name | Value     |
+---------------+-----------+
| binlog_format | MIXED     |
+---------------+-----------+
1 row in set (0.00 sec)

Wprowadzamy zmiany


mysql (database) > SET GLOBAL BINLOG_FORMAT=MIXED;
+---------------+-----------+
| Variable_name | Value     |
+---------------+-----------+
| binlog_format | STATEMENT |
+---------------+-----------+
1 row in set (0.00 sec)

mysql (database) > show variables like '%binlog_format%';
+---------------+-----------+
| Variable_name | Value     |
+---------------+-----------+
| binlog_format | STATEMENT |
+---------------+-----------+
1 row in set (0.00 sec)

Pozostaje wznowić replikację.


SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
START SLAVE;

Po czym zrzucić tabelę na mastrze i ponownie wrzucić.

Komentarze dle tego wpisu zostały wyłączone.