From 61c2fc8128e481b8c418bb09736e453231df5f5b Mon Sep 17 00:00:00 2001 From: Mykola Malkov Date: Fri, 5 Aug 2022 13:23:32 +0300 Subject: [PATCH] TT#187700 Support regex in exceptions Currently we have diff in all tables of 'mysql' schema: ======================== Schema1: transactional=1 Schema2: page_checksum=1 transactional=1 ======================== This is harmless diff investigated in TT#108653 So to skip all the specific entities instead of comparing every element just use regex matching. This is logical cherry-pick from 4c8443a1822e6ff8ed48c9817e2682e253878439 without new exceptions. Change-Id: I2c6e2bc369ee785d952fe43f97086f30afa282f0 --- helper/compare_dbs.pl | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/helper/compare_dbs.pl b/helper/compare_dbs.pl index ad0b95f..b051734 100755 --- a/helper/compare_dbs.pl +++ b/helper/compare_dbs.pl @@ -14,10 +14,12 @@ use Carp; # schema-name - name of the schema # element-name - name of the element (table, index, etc) # element-attribute - engine for the table, is_nullable for the column, etc +# Perl regex can be used here # F.e.: # views/ldap/ldap_entries/view_definition # For columns: columns//_ # columns/billing/table1_column1/is_nullable +# tables/mysql/.+/create_options my @diff_exceptions = qw( views/ldap/ldap_entries/view_definition ); @@ -233,19 +235,13 @@ __USAGE__ } sub is_exception { - my ($exceptions, $type, $schema, $element, $attr) = @_; + my $exceptions, $type, $schema, $element, $attr) = @_; $attr //= ''; foreach my $exception (@{$exceptions}) { # 'views/ldap/ldap_entries/view_definition' - my ($e_type, $e_schema, $e_element, $e_attr) = split( /\//, $exception ); - $e_attr //= ''; - if ( lc($element) eq lc($e_element) - and lc($type) eq lc($e_type) - and lc($schema) eq lc($e_schema) - and lc($attr) eq lc($e_attr) ) - { - print {*STDERR} "Exception found: $e_type/$e_schema/$e_element/$e_attr\n"; + if ( lc("$type/$schema/$element/$attr") =~ $exception ) { + print {*STDERR} "Exception found: $exception\n"; return 1; } }