LP #1059732: pt-table-checksum doesn't test all hash functions

Description

**Reported in Launchpad by Matthew B last update 16-11-2012 00:06:18

pt-table-checksum doesn't test all hash functions in available array and continues anyway on error.

To Test/Reproduce:
Change line:
my @funcs = qw(CRC32 MD5 SHA1);
To:
my @funcs = qw(CRC32A MD5 SHA1);

Run pt-t-c. The test for CRC32A will fail but script continues as if it has chosen bad function. Script will eventually exit on SQL error when master attempts to use bad function.

Additionally, the online-documentation implies that pt-t-c will check for "recommended" functions (MURMUR_HASH, FNV1A_64) and it does not.

The attached patch adds MURMUR_HASH, FNV1A_64 and FNV_64 to check list in preferred order over built-ins. The patch also continues evaluation of all functions until it finds one or dies with appropriate message.

Environment

None

Smart Checklist

Activity

Show:

lpjirasync January 24, 2018 at 3:59 PM

**Comment from Launchpad by: Daniel Nichter on: 30-10-2012 21:39:40

Agreed, but for whatever reason the docs say that CRC32 is default, so we should not change that yet because I don't know what the consequences would be--perhaps nothing, but we try to avoid changing how tool internals work (unless something is broken) during stable releases (i.e. 2.1). For 2.2, though, we should definitely default to the best. Until then, and given that the UDFs are probably only rarely installed and when they are the user knows about it (because they probably installed them), then they can be specified still with --function.

lpjirasync January 24, 2018 at 3:59 PM

**Comment from Launchpad by: Matthew B on: 30-10-2012 17:43:41

Well, we know that CRC32 will always work. So if we are checking in array order, the "preferred" functions will never get tested for.

It should be, IMO: qw(MURMUR_HASH FNV1A_64 FNV_64 CRC32 MD5 SHA1)

lpjirasync January 24, 2018 at 3:59 PM

**Comment from Launchpad by: Daniel Nichter on: 30-10-2012 16:21:15

Let's change

my @funcs = qw(CRC32 FNV1A_64 FNV_64 MD5 SHA1);

to

my @funcs = qw(CRC32 FNV1A_64 FNV_64 MURMUR_HASH MD5 SHA1);

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 3:59 PM
Updated January 24, 2018 at 3:59 PM
Resolved January 24, 2018 at 3:59 PM