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

gh-ost fails to insert a row with Error 1366: Incorrect string value #1112

Open
mmeller-wikia opened this issue Mar 29, 2022 · 0 comments
Open

Comments

@mmeller-wikia
Copy link

Hello :)

I tried to run gh-ost to add index to a table.

Tested versions 1.1.0 and 1.14

gh-ost --version
1.1.4

Executed command

gh-ost --user="$USER" --password="$DB_PASSWORD" --host="$HOST" \
--database="$DATABASE" --table="$TABLE" --alter="ADD INDEX user_registration (user_registration)" \
--allow-on-master --exact-rowcount --verbose --debug --stack --execute

Error with stacktrace

2022-03-29 11:44:57 ERROR Error 1366: Incorrect string value: '\xEF\xBF\xBD\xC3\x90\xC2...' for column 'user_name' at row 1; query=
                        replace /* gh-ost `$DATABASE`.`_user_gho` */ into
                                `test`.`_user_gho`
                                        (`**redacted**`)
                                values
                                        (**redacted**)
                ; **redacted**
goroutine 70 [running]:
runtime/debug.Stack()
        /usr/local/Cellar/go/1.17.5/libexec/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
        /usr/local/Cellar/go/1.17.5/libexec/src/runtime/debug/stack.go:16 +0x19
github.com/github/gh-ost/vendor/github.com/outbrain/golib/log.logErrorEntry(0xc0002afa40, {0x7e5660, 0xc0002afa40})
        /Users/dm-2/git/gh-ost/.gopath/src/github.com/github/gh-ost/vendor/github.com/outbrain/golib/log/log.go:178 +0x98
github.com/github/gh-ost/vendor/github.com/outbrain/golib/log.Errore(...)
        /Users/dm-2/git/gh-ost/.gopath/src/github.com/github/gh-ost/vendor/github.com/outbrain/golib/log/log.go:224
github.com/github/gh-ost/go/base.(*simpleLogger).Errore(0xc0000aa000, {0x7e5660, 0xc0002afa40})
        /Users/dm-2/git/gh-ost/.gopath/src/github.com/github/gh-ost/go/base/default_logger.go:50 +0x28
github.com/github/gh-ost/go/logic.(*Migrator).onApplyEventStruct(0xc0000aa000, 0x0)
        /Users/dm-2/git/gh-ost/.gopath/src/github.com/github/gh-ost/go/logic/migrator.go:1239 +0x2fd
github.com/github/gh-ost/go/logic.(*Migrator).executeWriteFuncs(0xc0000aa000)
        /Users/dm-2/git/gh-ost/.gopath/src/github.com/github/gh-ost/go/logic/migrator.go:1272 +0xb8
created by github.com/github/gh-ost/go/logic.(*Migrator).Migrate
        /Users/dm-2/git/gh-ost/.gopath/src/github.com/github/gh-ost/go/logic/migrator.go:410 +0x625

Original table:

show create table $DATABASE.user;
CREATE TABLE `user` (
  `user_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_name` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
  `user_registration` varchar(16) DEFAULT NULL,
**redacted**,
  `user_name_normalized` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci GENERATED ALWAYS AS (convert(cast(convert(`user_name` using latin1) as char charset binary) using utf8mb4)) STORED,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `user_name` (`user_name`),
  KEY `user_name_normalized_idx` (`user_name_normalized`)
) ENGINE=InnoDB AUTO_INCREMENT=**redacted** DEFAULT CHARSET=latin1

gh-ost table:

CREATE TABLE `_user_gho` (
  `user_id` int unsigned NOT NULL AUTO_INCREMENT,
  `user_name` varchar(255) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
  `user_registration` varchar(16) DEFAULT NULL,
**redacted**,
  `user_name_normalized` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci GENERATED ALWAYS AS (convert(cast(convert(`user_name` using latin1) as char charset binary) using utf8mb4)) STORED,
  PRIMARY KEY (`user_id`),
  UNIQUE KEY `user_name` (`user_name`),
  KEY `user_name_normalized_idx` (`user_name_normalized`),
  KEY `user_registration` (`user_registration`)
) ENGINE=InnoDB AUTO_INCREMENT=**redacted** DEFAULT CHARSET=latin1

Notes
This issue looks like #267 which was fixed in 1.0.21

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

No branches or pull requests

1 participant