From f50ac4a6c37c30a9b4c9ec1b1bb8867591908bf8 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. Change-Id: I3b9a38c3fbf055724139cbf4b476117b90edbefe (cherry picked from commit 4c8443a1822e6ff8ed48c9817e2682e253878439) --- helper/compare_dbs.pl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/helper/compare_dbs.pl b/helper/compare_dbs.pl index 7cd47ed..3f675e0 100755 --- a/helper/compare_dbs.pl +++ b/helper/compare_dbs.pl @@ -14,13 +14,15 @@ 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 - tables/mysql/global_priv/create_options + tables/mysql/.+/create_options ); my @missing_sp1_exceptions = qw(); my @missing_sp2_exceptions = qw(); @@ -244,19 +246,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; } }