pt-duplicate-key-checker wants to drop the unique key and does not offer equivalent replacement
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
my table:
CREATE TABLE `cat_cki_
`equipment_code` varchar(8) CHARACTER SET utf8 NOT NULL,
`carrier` varchar(3) CHARACTER SET utf8 NOT NULL,
`host` varchar(255) CHARACTER SET utf8 NOT NULL,
`code` varchar(255) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`host`,`code`),
UNIQUE KEY `uq_equpment_
KEY `fk_equipment_
CONSTRAINT `cat_cki_
CONSTRAINT `cat_cki_
) ENGINE=InnoDB DEFAULT CHARSET=latin1
pt-duplicate-
# Key uq_equpment_
# Key definitions:
# UNIQUE KEY `uq_equpment_
# PRIMARY KEY (`host`,`code`),
# Column types:
# `carrier` varchar(3) character set utf8 not null
# `host` varchar(255) character set utf8 not null
# `code` varchar(255) character set utf8 not null
# To shorten this duplicate clustered index, execute:
ALTER TABLE `edweedptp`
surely this can't be right as the uniqueness of the rows by (carrier,host,code) is no longer enforced.
tags: | added: pt125 |
Thank you for the report.
Verified as described.
You don't need foreign keys for this test, following table is enough:
CREATE TABLE `cat_cki_ equipment_ dcs_codes` ( dcs_codes` (`carrier` ,`host` ,`code` ), dcs_codes_ equipment` (`equipment_code`)
`equipment_code` varchar(8) CHARACTER SET utf8 NOT NULL,
`carrier` varchar(3) CHARACTER SET utf8 NOT NULL,
`host` varchar(255) CHARACTER SET utf8 NOT NULL,
`code` varchar(255) CHARACTER SET utf8 NOT NULL,
PRIMARY KEY (`host`,`code`),
UNIQUE KEY `uq_equpment_
KEY `fk_equipment_
) ENGINE=InnoDB DEFAULT CHARSET=latin1
$ pt-duplicate- key-checker --databases=test -v h=127.0. 0.1,P=3371, u=root ####### ####### ####### ####### ####### ####### ####### ####### ####### ## cki_equipment_ dcs_codes ####### ####### ####### ####### ####### ####### ####### ####### ####### ##
# #######
# test.cat_
# #######
# PRIMARY (`host`,`code`) dcs_codes_ equipment (`equipment_code`) dcs_codes (`carrier` ,`host` ,`code` )
# fk_equipment_
# uq_equpment_
# Key uq_equpment_ dcs_codes ends with a prefix of the clustered index dcs_codes` (`carrier` ,`host` ,`code` ), `cat_cki_ equipment_ dcs_codes` DROP INDEX `uq_equpment_ dcs_codes` , ADD INDEX `uq_equpment_ dcs_codes` (`carrier`);
# Key definitions:
# UNIQUE KEY `uq_equpment_
# PRIMARY KEY (`host`,`code`),
# Column types:
# `carrier` varchar(3) character set utf8 not null
# `host` varchar(255) character set utf8 not null
# `code` varchar(255) character set utf8 not null
# To shorten this duplicate clustered index, execute:
ALTER TABLE `test`.
# ####### ####### ####### ####### ####### ####### ####### ####### ####### ####### ## ####### ####### ####### ####### ####### ####### ####### ####### ####### ##
# test.node1
# #######
# PRIMARY (`id`)
# ####### ####### ####### ####### ####### ####### ####### ####### ####### ####### ## ####### ####### ####### ####### ####### ####### ####### ####### ####### ##
# test.node2
# #######
# PRIMARY (`id`)
# ####### ####### ####### ####### ####### ####### ####### ####### ####### ####### ## ####### ####### ####### ####### ####### ####### ####### ####### ####### ##
# Summary of indexes
# #######
# Size Duplicate Indexes 1545
# Total Duplicate Indexes 1
# Total Indexes 5
$ pt-duplicate- key-checker --version key-checker 3.0.2
pt-duplicate-