PT-1554 Updated pt-table-checksum var type

In different OSes, using BIGINT to store the checksum for a query, will
produce collisions and/or unstable values.
Because of this, I changed the type for the checksum field in the history
table from BIGINT to CHAR(32) and the checksum function is no longer
truncating the MD5_HEX result to 16 chars.
This commit is contained in:
Carlos Salguero
2018-05-24 15:57:21 -03:00
parent b6040629cd
commit e2cf183762
5 changed files with 2 additions and 35 deletions

View File

@@ -2679,8 +2679,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
warn ($checksum, ' checksum for ', $val);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}
@@ -16189,7 +16188,7 @@ by pt-query-digest.
MAGIC_create_review_table:
CREATE TABLE IF NOT EXISTS query_review (
checksum BIGINT UNSIGNED NOT NULL PRIMARY KEY,
checksum CHAR(32) NOT NULL PRIMARY KEY,
fingerprint TEXT NOT NULL,
sample TEXT NOT NULL,
first_seen DATETIME,