Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Commit b14ae95

Browse files
committed
Added option --expose_dd_tables
The new option allow you to show and use MySQL 8.0 data dictionary hidden tables. It requires mysqld-debug to be available
1 parent 33502bc commit b14ae95

File tree

5 files changed

+62
-5
lines changed

5 files changed

+62
-5
lines changed

Changelog

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
3.2.08 27-Apr-2017
2+
- Added option --expose_dd_tables to show and use MySQL 8.0
3+
data dictionary hidden tables.
14
3.2.07 21-Apr-2017
25
- Changed detection of USER variable to pass tests in unfriendly
36
environments

bin/low_level_make_sandbox

+29
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,34 @@ else
161161
die "# Can't get MySQL version from mysql_config\n";
162162
}
163163

164+
$msb->{options}{custom_mysqld} = '';
165+
if ($msb->{options}{expose_dd_tables})
166+
{
167+
my $mysql_version = $msb->{options}{detected_mysql_version};
168+
my ( $major, undef, undef) = split_version($mysql_version);
169+
if ( $major != '8')
170+
{
171+
die "The option 'expose_dd_tables' can only be used with version 8\n";
172+
}
173+
my $executable = sprintf '%s/bin/mysqld-debug', $msb->{options}{basedir} ;
174+
unless ( -x $executable)
175+
{
176+
die "mysqld-debug not found in $msb->{options}{basedir}/bin\n"
177+
}
178+
$msb->{options}{custom_mysqld} = 'mysqld-debug';
179+
unless ($msb->{options}{post_grants_sql})
180+
{
181+
$msb->{options}{post_grants_sql} = '';
182+
}
183+
184+
$msb->{options}{post_grants_sql} =
185+
"set persist debug='+d,skip_dd_table_access_check';
186+
create table sys.dd_hidden_tables select id, name, schema_id from mysql.tables where hidden=1;
187+
update mysql.tables set hidden=0 where hidden=1;
188+
"
189+
. $msb->{options}{post_grants_sql};
190+
}
191+
164192
if ($msb->{options}{'gtid'})
165193
{
166194
my $mysql_version = $msb->{options}{detected_mysql_version};
@@ -326,6 +354,7 @@ my %replace_options = (
326354
_MSB_VERSION_ => 'msb_version',
327355
_LOWER_CASE_TABLE_NAMES_ => 'lower_case_table_names',
328356
_HISTORY_DIR_ => 'history_dir',
357+
_CUSTOM_MYSQLD_ => 'custom_mysqld',
329358
);
330359

331360
$msb->{options}{msb_version} = $MySQL::Sandbox::VERSION;

lib/MySQL/Sandbox.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ our @EXPORT_OK= qw( is_port_open
3030
split_version
3131
) ;
3232

33-
our $VERSION=q{3.2.07};
33+
our $VERSION=q{3.2.08};
3434
our $DEBUG;
3535

3636
BEGIN {

lib/MySQL/Sandbox/Recipes.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package MySQL::Sandbox::Recipes;
33
use strict;
44
use warnings;
55

6-
our $VERSION=q{3.2.07};
6+
our $VERSION=q{3.2.08};
77

88
1;
99
__END__

lib/MySQL/Sandbox/Scripts.pm

+28-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ our @EXPORT_OK = qw(
1717
);
1818
our @EXPORT = @EXPORT_OK;
1919

20-
our $VERSION=q{3.2.07};
20+
our $VERSION=q{3.2.08};
2121

2222
our @MANIFEST = (
2323
'clear.sh',
@@ -447,6 +447,26 @@ my %parse_options_low_level_make_sandbox = (
447447
'Sets port for X-plugin (requires --plugin_mysqlx)',
448448
]
449449
},
450+
custom_mysqld => {
451+
value => $ENV{'CUSTOM_MYSQLD'},
452+
parse => 'custom_mysqld',
453+
so => 198,
454+
export => 1,
455+
help => [
456+
'uses alternative mysqld ',
457+
'(must be in the same directory as the regular mysqld)'
458+
]
459+
},
460+
expose_dd_tables => {
461+
value => $ENV{'EXPOSE_DD_TABLES'},
462+
parse => 'expose_dd_tables',
463+
so => 197,
464+
export => 1,
465+
help => [
466+
'Exposed MySQL 8.0.x data dictionary tables',
467+
]
468+
},
469+
450470
prompt_prefix => {
451471
value => 'mysql',
452472
parse => 'prompt_prefix=s',
@@ -1244,6 +1264,11 @@ export DYLD_LIBRARY_PATH=$BASEDIR_/lib:$BASEDIR/lib/mysql:$DYLD_LIBRARY_PATH
12441264
MYSQLD_SAFE="bin/_MYSQLDSAFE_"
12451265
SBDIR="_HOME_DIR_/_SANDBOXDIR_"
12461266
PIDFILE="$SBDIR/data/mysql_sandbox_SERVERPORT_.pid"
1267+
CUSTOM_MYSQLD=_CUSTOM_MYSQLD_
1268+
if [ -n "$CUSTOM_MYSQLD" ]
1269+
then
1270+
CUSTOM_MYSQLD="--mysqld=$CUSTOM_MYSQLD"
1271+
fi
12471272
__SBINSTR_SH__
12481273
if [ ! -f $BASEDIR/$MYSQLD_SAFE ]
12491274
then
@@ -1286,9 +1311,9 @@ else
12861311
cd $BASEDIR
12871312
if [ "$SBDEBUG" = "" ]
12881313
then
1289-
$MYSQLD_SAFE --defaults-file=$SBDIR/my.sandbox.cnf $@ > /dev/null 2>&1 &
1314+
$MYSQLD_SAFE --defaults-file=$SBDIR/my.sandbox.cnf $CUSTOM_MYSQLD $@ > /dev/null 2>&1 &
12901315
else
1291-
$MYSQLD_SAFE --defaults-file=$SBDIR/my.sandbox.cnf $@ > "$SBDIR/start.log" 2>&1 &
1316+
$MYSQLD_SAFE --defaults-file=$SBDIR/my.sandbox.cnf $CUSTOM_MYSQLD $@ > "$SBDIR/start.log" 2>&1 &
12921317
fi
12931318
cd $CURDIR
12941319
ATTEMPTS=1

0 commit comments

Comments
 (0)