Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init_replica: ERROR 1270 (HY000): Illegal mix of collations #5

Closed
ghost opened this issue Jul 17, 2017 · 6 comments
Closed

init_replica: ERROR 1270 (HY000): Illegal mix of collations #5

ghost opened this issue Jul 17, 2017 · 6 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Jul 17, 2017

We got the following table:

 CREATE TABLE `channel_attributes` (
  `channel_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `attribute_id` bigint(20) NOT NULL,
  `value` varchar(500) CHARACTER SET utf8 NOT NULL DEFAULT 'true',
  PRIMARY KEY (`channel_id`,`attribute_id`),
  KEY `attribute_id` (`attribute_id`),
  CONSTRAINT `channel_attributes_ibfk_2` FOREIGN KEY (`attribute_id`) REFERENCES `channel_attributes_domain` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

This table produces the following issue when running init_replica:

Jul 17 09:46:49: [INFO] - mysql_lib.py (612): copying table channel_attributes
Jul 17 09:46:49: [DEBUG] - mysql_lib.py (615): estimating rows in channel_attributes
Jul 17 09:46:49: [DEBUG] - mysql_lib.py (644): channel_attributes will be copied in 1 slices of 3054105 rows
Jul 17 09:46:49: [DEBUG] - mysql_lib.py (651): Executing query for table channel_attributes
Jul 17 09:46:49: [ERROR] - mysql_lib.py (654): error when pulling data from channel_attributes. sql executed: SELECT REPLACE(CONCAT('"',CONCAT_WS('","',COALESCE(REPLACE(`channel_id`, '"', '""'),'NULL') ,COALESCE(REPLACE(`attribute_id`, '"', '""'),'NULL') ,COALESCE(REPLACE(`value`, '"', '""'),'NULL') ),'"'),'"NULL"','NULL') as data FROM channel_attributes;
Jul 17 09:46:49: [DEBUG] - mysql_lib.py (656): Starting extraction loop for table channel_attributes
Jul 17 09:46:49: [INFO] - mysql_lib.py (692): the table channel_attributes does not exist

running the sql manually shows the following extra error:

mysql> SELECT REPLACE(CONCAT('"',CONCAT_WS('","',COALESCE(REPLACE(`channel_id`, '"', '""'),'NULL') ,COALESCE(REPLACE(`attribute_id`, '"', '""'),'NULL') ,COALESCE(REPLACE(`value`, '"', '""'),'NULL') ),'"'),'"NULL"','NULL') as data FROM channel_attributes;
ERROR 1270 (HY000): Illegal mix of collations (utf8_bin,NONE), (utf8_general_ci,COERCIBLE), (utf8_general_ci,COERCIBLE) for operation 'replace'

The issue is primarily with the value column - removing it from the sql and it works.

@ghost
Copy link
Author

ghost commented Jul 17, 2017

Note we got a similar issue with a table that contains a bit column:

CREATE TABLE `channel_attributes_domain` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `code` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
  `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `internal_description` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
  `attribute_type` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'Boolean',
  `editable` bit(1) NOT NULL DEFAULT b'1',
  `channel_type` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'All',
  `channel_id` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code_2` (`code`,`channel_type`,`channel_id`),
  KEY `channel_id` (`channel_id`),
  KEY `code` (`code`),
  CONSTRAINT `channel_attributes_domain_ibfk_1` FOREIGN KEY (`channel_id`) REFERENCES `channel` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=630 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci 

@the4thdoctor the4thdoctor self-assigned this Jul 17, 2017
@the4thdoctor
Copy link
Owner

thanks for the report. I'll have a look asap.

@the4thdoctor
Copy link
Owner

can you please test the branch ver1.5? I've added a cast with character set on the column generation.

Thanks

@ghost
Copy link
Author

ghost commented Jul 17, 2017

running tests right now

@ghost
Copy link
Author

ghost commented Jul 17, 2017

those channel_attribute* tables are now running without issues when running init_replica
Thanks!

@ghost ghost closed this as completed Jul 17, 2017
@the4thdoctor
Copy link
Owner

thank you for the quick feedback :)
I'll release the patched version at last by Saturday 22nd.
I need to sort out the default value DDL replica first.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant