LP #1673399: Inconsistent creation of toolkit tables

Description

**Reported in Launchpad by Ceri WIlliams last update 04-09-2017 13:46:54

A number of the tools will write to a table, which in a replication scenario would require the slaves to contain the same table to avoid replication breakage (assuming no filters).

pt-table-checksum for example will use CREATE DATABASE IF NOT EXISTS and checks the slaves.

Please ensure that any of the tools that can write to a table also check that the schema exists and either completely fail to run (acceptable as safe) and give an error, or ensure that the schema and tables are created in a replication-safe manner.

For the following tools:

  • pt-deadlock-logger

  • pt-heartbeat

  • pt-upgrade

  • pt-kill

The following shows those scripts that contain a CREATE TABLE compared against those that contain a CREATE DATABASE:

@@ -1,16 +1,4 @@ -/usr/bin/pt-archiver -/usr/bin/pt-deadlock-logger -/usr/bin/pt-duplicate-key-checker -/usr/bin/pt-find -/usr/bin/pt-fingerprint -/usr/bin/pt-fk-error-logger -/usr/bin/pt-heartbeat /usr/bin/pt-index-usage -/usr/bin/pt-kill -/usr/bin/pt-mysql-summary -/usr/bin/pt-online-schema-change /usr/bin/pt-query-digest /usr/bin/pt-table-checksum -/usr/bin/pt-table-sync -/usr/bin/pt-table-usage /usr/bin/pt-upgrade

Environment

None
100% Done
Loading...

Smart Checklist

hide

Activity

Show:

Michael Coburn August 5, 2019 at 2:07 PM

-

As discussed on Aug 5, can you review please and provide your perspective?  Thanks,

Michael Coburn June 6, 2019 at 9:53 PM

 - Good point, there was some concern that if the database was created on a slave that it could later break replication. But CREATE TABLE IF NOT EXISTS should be replication-safe.

can we go ahead with the four tools mentioned above.  Thanks,

C W May 16, 2019 at 12:52 PM
Edited

why would you not create the schema when other scripts do?

CREATE DATABASE IF NOT EXISTS

i.e.
CREATE DATABASE IF NOT EXISTS
CREATE TABLE IF NOT EXISTS

Something extra to note is that it looks like the default schema varies too:

$ find /usr/bin -maxdepth 1 -type f -name pt-\* | while read pt; do printf "%s - %s\n" "${pt}" "$($pt --help | fgrep percona.)"; done 2>/dev/null | fgrep -B1 percona. /usr/bin/pt-mext - /usr/bin/pt-table-checksum - default percona.checksums) --ignore-tables percona.checksums --replicate percona.checksums $ find /usr/bin -maxdepth 1 -type f -name pt-\* | while read pt; do printf "%s - %s\n" "${pt}" "$($pt --help | fgrep percona_schema.)"; done 2>/dev/null | fgrep -B1 percona_schema. /usr/bin/pt-upgrade - percona_schema.pt_upgrade) --upgrade-table percona_schema.pt_upgrade

I suppose that these are probably most useful

  • pt-deadlock-logger

  • pt-heartbeat

  • pt-upgrade

  • pt-kill

Michael Coburn May 14, 2019 at 2:41 PM

Today , and discussed:

  • We should check that the database exists when the tool starts up

  • We should not create the database
    We estimate 2-4 hours per tool of Engineering investment. So we have two questions for you:

  1. Do you agree  with these points ?

  2. Do you have a priority list of tools you would like to see this for first? Can we begin with pt-deadlock-logger and is that sufficient or do you have other tools?

Carlos Salguero November 22, 2018 at 12:48 PM

Since we shoudl analyze every program individually and there are no specific reported error, I am setting this ticket to on-hold

Done

Details

Assignee

Reporter

Priority

Fix versions

Smart Checklist Progress

Story Points

Time tracking

No time logged

Smart Checklist

Created January 24, 2018 at 9:32 PM
Updated August 8, 2024 at 5:00 AM
Resolved August 3, 2021 at 2:02 PM