免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1845 | 回复: 1
打印 上一主题 下一主题

Binlog 的错误 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-06-23 12:50 |只看该作者 |倒序浏览
因原来使用 Mysql 5.0的 主从复制,在master做一些基于uuid 之类的操作,导致Slave数据不一致,看文章,了解到5.12 开始,Binlog 可以基于行数据做记录,所以测试Mysql 的binlog 能否支持uuid 值的记录

version                                (windows)
-------------------------
5.1.25-rc-community-log

设置了相关参数在 my.ini

binlog-do-db=test
log-bin=test
max_binlog_size=200K

重新启动mysql ,做如下操作:

create table test (name char(36) not null);
insert into test (name) values (uuid());
insert into test (name) values (uuid());
insert into test (name) values (uuid());
create procedure test1() select * from test;

产生了一个binlog : test.000001
mysql> show binlog events;
+-------------+-----+-------------+-----------+-------------+--------------------------------------------------------------------------------------+
| Log_name    | Pos | Event_type  | Server_id | End_log_pos | Info                                                                                 |
+-------------+-----+-------------+-----------+-------------+--------------------------------------------------------------------------------------+
| test.000001 |   4 | Format_desc |         1 |         106 | Server ver: 5.1.25-rc-community-log, Binlog ver: 4                                   |
| test.000001 | 106 | Query       |         1 |         211 | use `test`; create table test (name char(36) not null)                               |
| test.000001 | 211 | Query       |         1 |         279 | use `test`; BEGIN                                                                    |
| test.000001 | 279 | Table_map   |         1 |         324 | table_id: 15 (test.test)                                                             |
| test.000001 | 324 | Write_rows  |         1 |         391 | table_id: 15 flags: STMT_END_F                                                       |
| test.000001 | 391 | Xid         |         1 |         418 | COMMIT /* xid=5 */                                                                   |
| test.000001 | 418 | Query       |         1 |         486 | use `test`; BEGIN                                                                    |
| test.000001 | 486 | Table_map   |         1 |         531 | table_id: 15 (test.test)                                                             |
| test.000001 | 531 | Write_rows  |         1 |         598 | table_id: 15 flags: STMT_END_F                                                       |
| test.000001 | 598 | Xid         |         1 |         625 | COMMIT /* xid=6 */                                                                   |
| test.000001 | 625 | Query       |         1 |         693 | use `test`; BEGIN                                                                    |
| test.000001 | 693 | Table_map   |         1 |         738 | table_id: 15 (test.test)                                                             |
| test.000001 | 738 | Write_rows  |         1 |         805 | table_id: 15 flags: STMT_END_F                                                       |
| test.000001 | 805 | Xid         |         1 |         832 | COMMIT /* xid=7 */                                                                   |
| test.000001 | 832 | Query       |         1 |         967 | use `test`; CREATE [email=DEFINER=%60root%60@%60localhost]DEFINER=`root`@`localhost[/email]` PROCEDURE `test1`()
select * from test |
| test.000001 | 967 | Stop        |         1 |         986 |                                                                                      |
+-------------+-----+-------------+-----------+-------------+--------------------------------------------------------------------------------------+
16 rows in set (0.00 sec)

查看日志:
E:\MySQL\MySQL Server 5.1\data>mysqlbinlog test.000001
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 4
#080623 11:46:25 server id 1  end_log_pos 106   Start: binlog v 4, server v 5.1.25-rc-community-log created 080623 11:46:2
ROLLBACK/*!*/;
# at 106
#080623 11:47:16 server id 1  end_log_pos 211   Query   thread_id=1     exec_time=0     error_code=0
use test/*!*/;
SET TIMESTAMP=1214192836/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=1344274432/*!*/;
/*!\C utf8 *//*!*/;
SET @@session.character_set_client=33,@@session.collation_connection=33,@@session.collation_server=33/*!*/;
create table test (name char(36) not null)
/*!*/;
# at 211
#080623 11:47:31 server id 1  end_log_pos 279   Query   thread_id=1     exec_time=0     error_code=0
SET TIMESTAMP=1214192851/*!*/;
BEGIN
/*!*/;
ERROR: Error in Log_event::read_log_event(): 'Found invalid event in binary log', data_len: 45, event_type: 19
Could not read entry at offset 279:Error in log format or read error
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET [email=COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/]COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/[/email];

查资料:5.1.12 binlog 是支持混合和行 模式,混合模式是默认的,但出现的这个错误,导致我直接用binlog 恢复时候同样失败。

请问,有谁了解问题原因和解决办法?多谢了!

论坛徽章:
0
2 [报告]
发表于 2008-06-23 17:38 |只看该作者
恩,原因找到,是mysqlbinlog版本问题
先装了5.0, 再装5.1,环境变量还是指向了5.0 的bin
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP