github / github/gh-ost

I encountered a problem when using gh-ost to alter primary key , Please help me

Open
#1,294 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
13.6k
Forks
1.4k
Avg merge
2h 31m
Merged PRs (30d)
4

Description

>
This is the command:
gh-ost -allow-on-master -assume-rbr -exact-rowcount -initially-drop-ghost-table -initially-drop-old-table -initially-drop-socket-file -critical-load-hibernate-seconds 60 -database xxx -nice-ratio 0.1 -chunk-size 3888 -ask-pass -table ixxx_logging -user username -host host1 -alter 'ALTER TABLE ixxx_logging MODIFY COLUMN id varchar(50) NOT NULL' -verbose -execute 2>&1 | tee gh-ost.log
DB: 5.7.mysql_aurora.2.11.1 . This db has five slaves.
TABLE :
CREATE TABLE ixxx_logging (
id bigint(20) NOT NULL AUTO_INCREMENT,
x9 VARCHAR(32),
x8 VARCHAR(32),
x7 INT DEFAULT 0,
x6 INT DEFAULT 0,
x5 INT DEFAULT 1,
x4 VARCHAR(2) DEFAULT 0,
x3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
x2 TIMESTAMP timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ,
x1 DATETIME DEFAULT null,
xxxxx1 VARCHAR(1000),
xxxx9 VARCHAR(32),
xxxx8 VARCHAR(32),
xxxx7 VARCHAR(70),
xxxx6 INT DEFAULT 0,
xxxx5 VARCHAR(1) DEFAULT 0,
xxxx4 VARCHAR(1) DEFAULT 0,
xxxx3 VARCHAR(256),
xxxx2 VARCHAR(256),
xxx1 VARCHAR(1) DEFAULT 0,
bb1 VARCHAR(10),
bb2 CHAR(30),
bb3 VARCHAR(30),
bb4 VARCHAR(2) DEFAULT 0,
bb5 VARCHAR(100) DEFAULT null,
bb6 VARCHAR(100) DEFAULT null,
bb7 VARCHAR(20) DEFAULT null,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_x9` (`x9`) USING BTREE,
KEY `idx_x8` (`x8`) USING BTREE,
KEY `idx_x3` (`x3`)
) ENGINE=InnoDB AUTO_INCREMENT=2694513087735591693 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

error:
2023-08-15 02:16:06 ERROR Error 1062: Duplicate entry '26945130xxxx5506529' for key 'PRIMARY'; query=
update /* gh-ost `schema1`.`_ixxx_logging_gho` */
`schema1`.`_ixxx_logging_gho`
set
`id`=?, `x9`=?, `x8`=?, `x7`=?, `x6`=?, `x5`=?, `x3`=?, ....
where
((`id` = ?));

args=[26945130xxxx5506529 242920747xxx526657 242920747xxx526657 2 2 1 9D0C49xxxx08118 2024-08-14 01:37:07 0 0 1 2 2023-08-15 01:37:11 +0000 UTC 2023-08-15 01:44:57 +0000 UTC 0 0 2694513087xxxx06524 242920747xxx526657 26945130xxxx5506529]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.