Add CREATE TABLE statement functionality for pt-heartbeat --create-table
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
Medium
|
Carlos Salguero |
Bug Description
It would be nice to have the ability to add a custom CREATE TABLE statement to the --create-table argument.
Right now, the only way to do this is manually editing the code in the following section:
"""
Create the heartbeat L<"--table"> if it does not exist.
This option causes the table specified by L<"--database"> and L<"--table"> to
be created with the following MAGIC_create_
CREATE TABLE heartbeat (
ts varchar(26) NOT NULL,
server_id int unsigned NOT NULL PRIMARY KEY,
file varchar(255) DEFAULT NULL, -- SHOW MASTER STATUS
position bigint unsigned DEFAULT NULL, -- SHOW MASTER STATUS
relay_master_
exec_master_log_pos bigint unsigned DEFAULT NULL -- SHOW SLAVE STATUS
);
"""
In the manual pages, engine=memory is suggested, but there's no way of implementing it in an automated way:
"""
You must either manually create the heartbeat table on the master or use --create-table. See --create-table for the proper heartbeat table structure. The MEMORY storage engine is suggested, but not required of course, for MySQL.
"""
Some options discussed (with DanielN):
- Add to pt-heartbeat's config file (Daniel mentioned potential issues with multiline parsing).
- Add to one file that only has the CREATE TABLE statement, like --create-table /path/to/
Note that the file should also contain the INSERT INTO statement to be used to insert the first row to that table.
The user should make sure that the CREATE TABLE and the INSERT INTO statement work together well, in my opinion.
Changed in percona-toolkit: | |
status: | New → Confirmed |
Changed in percona-toolkit: | |
milestone: | 2.2.17 → 2.2.18 |
Changed in percona-toolkit: | |
milestone: | 2.2.18 → 2.2.19 |
Changed in percona-toolkit: | |
assignee: | Frank Cizmich (frank-cizmich) → Carlos Salguero (carlos-salguero) |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
Another option, different from the request above, would be to add a --create- table-engine option so one can at least choose the engine used for the table (in the lines of using the Memory engine, as suggested in the docs).