MySQL Forums
Forum List  »  Italian

Duplicate Entry in Replica
Posted by: Davide Dal Frà
Date: January 11, 2011 06:33AM

Salve a tutti,

Ho due server:

#server1: Mysql Master
#server2: Mysql Slave

Le tabelle sono tutte MyISAM, la replica principalmente funziona, ma si blocca " a volte" nell'inserimento sulla seguente tabella ( di cui allego il describe):


mysql-master> describe primanota_mov;
+----------------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------+------+-----+---------+----------------+
| primanota_data | date | NO | PRI | NULL | |
| is_incasso | tinyint(1) | NO | MUL | NULL | |
| tipo | varchar(5) | NO | | NULL | |
| outstat | tinyint(1) | NO | | 0 | |
| primanota_desc | varchar(200) | NO | | NULL | |
| data_mov | date | NO | | NULL | |
| desc_movimento | varchar(200) | NO | | NULL | |
| contanti_entrate | decimal(10,2) | NO | | NULL | |
| contanti_uscite | decimal(10,2) | NO | | NULL | |
| assegni_entrate | decimal(10,2) | NO | | NULL | |
| assegni_uscite | decimal(10,2) | NO | | NULL | |
| contopostale_entrate | decimal(10,2) | NO | | NULL | |
| contopostale_uscite | decimal(10,2) | NO | | NULL | |
| contobanca_entrate | decimal(10,2) | NO | | NULL | |
| contobanca_uscite | decimal(10,2) | NO | | NULL | |
| uid | bigint(20) | NO | PRI | NULL | auto_increment |
+----------------------+---------------+------+-----+---------+----------------+

C'è un campo con auto_increment (uid) che è in primary key con primanota_data.

Sul mysql-master non ci sono problemi, tutte le queri vengono eseguite senza problemi e senza warnings.

Mentre sul database slave , la replica salta con l'errore:


mysql-slave> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 94.230.68.35
Master_User: slave_user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000781
Read_Master_Log_Pos: 73521430
Relay_Log_File: mysqld-relay-bin.000031
Relay_Log_Pos: 884429
Relay_Master_Log_File: mysql-bin.000781
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB: crm
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1062
Last_Error: Error 'Duplicate entry '2011-01-01-2' for key 1' on query. Default database: 'crm'. Query: 'INSERT INTO primanota_mov (primanota_data,is_incasso,tipo,outstat,primanota_desc,data_mov,desc_movimento,contanti_entrate,contanti_uscite,assegni_entrate,assegni_uscite,contopostale_entrate,contopostale_uscite,contobanca_entrate,contobanca_uscite) VALUES ('2011-01-01',0,'M',0,'Prima Nota Del 01/2011','2011-01-11','COMMISSIONI ACCREDITO BOLLETTINI',0,0,0,0,0,round(10,2),0,0)'
Skip_Counter: 0
Exec_Master_Log_Pos: 72582489
Relay_Log_Space: 1823370
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

Come test ho provato a, ripristinare la replica (slave stop;slave start;), eseguire manualmente la query indicata nell'errore sul mysql-master e la replica non si ferma :(

Le query principalmente vengono eseguite da PHP.

Ho googlato un po, trovando alcuni post dai quali mi sembra di aver capito che nella replica master-slave con gli indici auto-increment c'è qualche problemino.


Sapete qualcosa a riguardo? Soluzioni?Work around?


Grazie a tutti,


Davide

Options: ReplyQuote


Subject
Views
Written By
Posted
Duplicate Entry in Replica
5377
January 11, 2011 06:33AM
1933
January 12, 2011 08:18AM
1998
January 12, 2011 10:00AM
1922
January 12, 2011 10:22AM
1862
January 12, 2011 10:32AM
2060
January 12, 2011 10:35AM
1778
January 12, 2011 10:39AM
1907
January 12, 2011 10:58AM
2064
January 17, 2011 05:13AM
2387
January 17, 2011 05:30AM
1890
January 17, 2011 09:16AM
1922
January 17, 2011 10:22AM
2005
January 17, 2011 11:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.