KEMBAR78
gh-ost fails to insert a row with Error 1366: Incorrect string value · Issue #1112 · github/gh-ost · GitHub
Skip to content

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

@mmeller-wikia

Description

@mmeller-wikia

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions