Hi,

Yesterday i encounter a very strange problem, i found some data on a
replication db differ from that on the master.

master:
+---------+------------+--------+---------+-------------+--------+
| id      | date       | uid    | type_id | report_type | amount |
+---------+------------+--------+---------+-------------+--------+
| 2721193 | 2008-11-11 | 534581 |      15 |           1 |    200 |
+---------+------------+--------+---------+-------------+--------+

slave:
+---------+------------+--------+---------+-------------+--------+
| id      | date       | uid    | type_id | report_type | amount |
+---------+------------+--------+---------+-------------+--------+
| 2721193 | 2008-11-11 | 534581 |      15 |           1 |  -4800 |
+---------+------------+--------+---------+-------------+--------+

the table:
CREATE TABLE `report` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `date` date NOT NULL default '0000-00-00',
  `uid` int(10) unsigned NOT NULL default '0',
  `type_id` int(10) unsigned NOT NULL default '0',
  `report_type` tinyint(4) NOT NULL default '0',
  `amount` int(11) NOT NULL default '0',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `date` (`date`,`uid`,`type_id`,`report_type`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1


Then i go to the relay-log and found two transactions:

# at 1002607297

#081111 19:52:03 server id 1  log_pos 992050073         Intvar

SET INSERT_ID=2721193;

# at 1002607325

#081111 19:52:03 server id 1  log_pos 992050073         Query
thread_id=9490103       exec_time=0     error_code=0

SET TIMESTAMP=1226404323;

INSERT INTO report (date, uid, type_id, report_type, amount) VALUES
(DATE(NOW()), 534581, 15, 1, 200) ON DUPLICATE KEY UPDATE amount = amount +
(200);

# at 1002609187
#081111 19:52:03 server id 1  log_pos 992050073         Intvar
SET INSERT_ID=2721193;
# at 1002609215
#081111 19:52:03 server id 1  log_pos 992050073         Query
thread_id=9478450       exec_time=0     error_code=0
SET TIMESTAMP=1226404323;
INSERT INTO report (date, uid, type_id, report_type, amount) VALUES
(DATE(NOW()), 548013, 17, 6, -5000) ON DUPLICATE KEY UPDATE amount = amount
+ (-5000);



It seems that the two "insert ... on duplicate" got the same insert_id so
they are 'duplicated'  and mix together! Which is not the case happened in
the master. I also checked the master bin log and
are the same as relay log. Is it a bug of bin log? I try a whole day to
reappear it, but failed.. Is there any hint about this problem?


Thanks,
jayven

Reply via email to