Albert Li
Albert Li
@agapple 这个问题把之前错错得对的情况暴露了出来。 先来解释这个问题的原因:这个乱码是由于binlog_checksum设置成了CRC32导致。 Dump日志前有这样一句:SET @master_binlog_checksum='@@global.binlog_checksum' 这句的原来的意思是设置slave端此次session的binlog_checksum与master端一致。但是经过测试 这句没有达到预期的效果。正确的是:SET @master_binlog_checksum=@@global.binlog_checksum(不用引号)。 在MySQL(5.7)上效果等同于‘NONE’,但是在MariaDB(10.3.10)上效果等同于'CRC32'。 侧面验证:第一句改成SET @master_binlog_checksum='NONE'之后,没有乱码。 再来解析代码中逻辑有问题的地方: 在LogDecoder.decode() 方法中有这样一句代码: int checksumAlg = LogEvent.BINLOG_CHECKSUM_ALG_UNDEF; 设置checksum的处所值,因为此时ROTATE_EVENT事件在FORMAT_DESCRIPTION_EVENT之前就已经出来了,所以第一次ROTATE_EVENT中的binlog名称由于没有忽略CRC32的4个字节的校验码,导致尾巴有4个乱码一样的字符。 通过上面的解释应该能解释为啥之前为啥是错错得对了。 1错 SET @master_binlog_checksum='@@global.binlog_checksum' 2错 int checksumAlg = LogEvent.BINLOG_CHECKSUM_ALG_UNDEF; MySQL下等同于每次设置checksum为‘NONE’。 解决方案:...
1. 感觉规避的方法不太对,之所以能规避是因为加上引号就不是系统变量了,这样就引出了binlog_checksum在未定义值的情况下的问题。 2. 我觉得 这种行为的不一致,是由于SET @master_binlog_checksum='@@global.binlog_checksum' 这样的未定义的值引起的。mysql 和 mariadb 正常情况下对于ROTATE_EVENT的checksum是一致的。通过显式的设置SET @master_binlog_checksum='CRC32' 时,MySQL(5.6.41 5.6需要用新一些的版本)时会发送checksum的。 关于binlog文件名乱码的问题,如果master段一直是关闭checksum的话,改第一条(master_binlog_checksum)是没有问题的。但是当master端checksum是开启的话, 就需要调整下初始化checksumAlg参数。 还有一种比较粗暴的解决方案是。 SET @master_binlog_checksum='@@global.binlog_checksum' 改成 SET @master_binlog_checksum='NONE'。 这样变相将当前会话的binlog_checksum 与checksumAlg参数保持了一样的效果值。(都是未开启)
@terrymanu I found the fix code, merge to version 3.1.0.1 . When will this version be released, does it has a certain time?
> Please subscribe mail list, you can find the scheduler of release Thank you so much for your patience~
@terrymanu @codefairy08 I just try with version 4.0.0.M1-SNAPSHOT , also get different with version 2.0.3. version 2.0.3 get value "abcd" (4 chars), but in version 4.0.0.M1-SNAPSHOT get value "'abcd'" (6chars)。
Result in InlineShardingStrategy.doSharding()  pom.xml dependency ```xml org.apache.shardingsphere sharding-jdbc-core 4.0.0.M1-SNAPSHOT com.alibaba druid 1.0.9 mysql mysql-connector-java 5.1.36 ``` Java code ```java BufferedReader reader = new BufferedReader(new InputStreamReader(OrderTest.class .getResourceAsStream("/sharding-config-order-test.yaml"), "utf-8")); StringBuffer sb...
I had test this code in 4.0.0-RC1, and get the right value ! But I am not sure whether this problem was fix by the same code as #1754. I...
thanks so much for your reply.
Actually, I am a little confuse whether this is a bug or not. But I tried mycat, then get only one row data in this test case. And, suppose we...
Thanks so much for your reply. This config resolve my problem ! J just found the config in [document](https://shardingsphere.apache.org/document/current/cn/manual/sharding-jdbc/configuration/config-yaml) ```yaml bindingTables: # 绑定表,也就是实际上哪些配置的sharidng表规则需要实际生效的列表,配置为yaml列表,并且允许单个条目中以逗号切割,所配置表必须已经配置为逻辑表 - sharding_t1 - sharding_t2,sharding_t3 ``` But after...