当获取到binlog的值为负数的时候,需判断系统表中的列属性(COLUMN_TYPE)是否含有unsigned;
如:
tinyint(3) unsigned
smallint(5) unsigned
正常的binlog处理逻辑应为如下:
tinyint unsigned 插入 235
2^7 - 1 = 255
255 + 1 + -21 = 235
smallint unsigned 插入 42000
2^15 - 1 = 65535
65535 + 1 + -23536 = 42000