vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.53k stars 2.09k forks source link

vreplication: can not replicate char column with binary collate #8743

Closed tokikanno closed 3 years ago

tokikanno commented 3 years ago

Overview of the Issue

Due to #7969, fixed length char column with binary collate will not be able to be replicated because the extra padding bytes.

Reproduction Steps

CREATE TABLE `chrome_subscription` (
  `beacon` varchar(64) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `locale` char(5) COLLATE utf8mb4_bin DEFAULT NULL,
  `currency` char(3) COLLATE utf8mb4_bin DEFAULT NULL,
  `geo` char(3) COLLATE utf8mb4_bin DEFAULT NULL,
  `city` char(3) COLLATE utf8mb4_bin DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`beacon`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
E0830 22:06:41.975815       1 dbclient.go:107] error in stream 11, retrying after 5s: Data too long for column 'locale' at row 1 (errno 1406) (sqlstate 22001) during query: update chrome_subscription set locale='ja\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', currency='TWD\0\0\0\0\0\0\0\0\0', geo='TW\0\0\0\0\0\0\0\0\0\0', city='TPE\0\0\0\0\0\0\0\0\0', created='2021-08-14 08:51:26' where beacon='202107232XaefvbpM4'

Plz also see:

Binary version

v11.0.0

mattlord commented 3 years ago

This was resolved via https://github.com/vitessio/vitess/pull/8730

Thank you @tokikanno!