mirror of
https://github.com/percona/percona-toolkit.git
synced 2026-04-16 01:00:38 +08:00
PT-143 Fixed key handling
When tehre is a table having a key like: PRIMARY KEY (`id`,`start`,`end`,`user_id`(13),`interval`), DBI driver is taking (13) as part of the field name. Fixed the way pt-archiver composes the key using DBI cols field instead of the colnames field since the cols field has the correct field names for the key.
This commit is contained in:
33
t/pt-archiver/samples/pt-143.sql
Normal file
33
t/pt-archiver/samples/pt-143.sql
Normal file
@@ -0,0 +1,33 @@
|
||||
DROP SCHEMA IF EXISTS test;
|
||||
CREATE SCHEMA test;
|
||||
|
||||
CREATE TABLE test.`stats_r` (
|
||||
`id` int(10) unsigned NOT NULL,
|
||||
`end` datetime NOT NULL,
|
||||
`start` datetime NOT NULL,
|
||||
`sum_value` float DEFAULT NULL,
|
||||
`user_id` varchar(100) NOT NULL DEFAULT '',
|
||||
`interval` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`mean` float DEFAULT NULL,
|
||||
`max` float DEFAULT NULL,
|
||||
`min` float DEFAULT NULL,
|
||||
PRIMARY KEY (`id`,`start`,`end`,`user_id`(13),`interval`),
|
||||
KEY `cid_start_end` (`user_id`(13),`start`,`end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
CREATE TABLE test.stats_s LIKE test.stats_r;
|
||||
|
||||
INSERT INTO `test`.`stats_r`
|
||||
(`id`,`end`,`start`,`sum_value`,`user_id`,`interval`,`mean`,`max`,`min`)
|
||||
VALUES
|
||||
(1,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(2,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(3,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(4,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(5,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(6,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(7,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(8,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(9,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1),
|
||||
(10,now() + INTERVAL 1 hour, NOW(), 1,1,1,1,1,1);
|
||||
|
||||
Reference in New Issue
Block a user