Merge branch '10.4' into 10.5
This commit is contained in:
commit
f33e57a9e6
265
mysql-test/lib/My/Debugger.pm
Normal file
265
mysql-test/lib/My/Debugger.pm
Normal file
@ -0,0 +1,265 @@
|
|||||||
|
package My::Debugger;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Text::Wrap;
|
||||||
|
use Cwd;
|
||||||
|
use My::Platform;
|
||||||
|
|
||||||
|
# 1. options to support:
|
||||||
|
# --xxx[=ARGS]
|
||||||
|
# --manual-xxx[=ARGS]
|
||||||
|
# --client-xxx[=ARGS]
|
||||||
|
# --boot-xxx[=ARGS]
|
||||||
|
# TODO --manual-client-xxx[=ARGS]
|
||||||
|
# TODO --manual-boot-xxx[=ARGS]
|
||||||
|
# TODO --exec-xxx[=ARGS] (for $ENV{MYSQL}, etc)
|
||||||
|
#
|
||||||
|
# ARGS is a semicolon-separated list of commands for the
|
||||||
|
# command file. If the first command starts from '-' it'll
|
||||||
|
# be for a command line, not for a command file.
|
||||||
|
#
|
||||||
|
# 2. terminal to use: xterm
|
||||||
|
# TODO MTR_TERM="xterm -title {title} -e {command}"
|
||||||
|
#
|
||||||
|
# 3. debugger combinations are *not allowed*
|
||||||
|
# (thus no --valgrind --gdb)
|
||||||
|
#
|
||||||
|
# 4. variables for the command line / file templates:
|
||||||
|
# {vardir} -> vardir
|
||||||
|
# {exe} -> /path/to/binary/to/execute
|
||||||
|
# {args} -> command-line arguments, "-quoted
|
||||||
|
# {input}
|
||||||
|
# {type} -> client, mysqld.1, etc
|
||||||
|
# {script} -> vardir/tmp/{debugger}init.$type
|
||||||
|
# {log} -> vardir/log/$type.{debugger}
|
||||||
|
# {options} -> user options for the debugger.
|
||||||
|
#
|
||||||
|
# if {options} isn't used, they're auto-placed before {exe}
|
||||||
|
# or at the end if no {exe}
|
||||||
|
|
||||||
|
my %debuggers = (
|
||||||
|
gdb => {
|
||||||
|
term => 1,
|
||||||
|
options => '-x {script} {exe}',
|
||||||
|
script => 'set args {args} < {input}',
|
||||||
|
},
|
||||||
|
ddd => {
|
||||||
|
options => '--command {script} {exe}',
|
||||||
|
script => 'set args {args} < {input}',
|
||||||
|
},
|
||||||
|
dbx => {
|
||||||
|
term => 1,
|
||||||
|
options => '-c "stop in main; run {exe} {args} < {input}"',
|
||||||
|
},
|
||||||
|
devenv => {
|
||||||
|
options => '/debugexe {exe} {args}',
|
||||||
|
},
|
||||||
|
windbg => {
|
||||||
|
options => '{exe} {args}',
|
||||||
|
},
|
||||||
|
lldb => {
|
||||||
|
term => 1,
|
||||||
|
options => '-s {script} {exe}',
|
||||||
|
script => 'process launch --stop-at-entry {args}',
|
||||||
|
},
|
||||||
|
valgrind => {
|
||||||
|
options => '--tool=memcheck --show-reachable=yes --leak-check=yes --num-callers=16 --quiet --suppressions='.cwd().'/valgrind.supp {exe} {args} --loose-wait-for-pos-timeout=1500',
|
||||||
|
pre => sub {
|
||||||
|
my $debug_libraries_path= "/usr/lib/debug";
|
||||||
|
$ENV{LD_LIBRARY_PATH} .= ":$debug_libraries_path" if -d $debug_libraries_path;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
strace => {
|
||||||
|
options => '-f -o {log} {exe} {args}',
|
||||||
|
},
|
||||||
|
rr => {
|
||||||
|
options => 'record -o {log} {exe} {args}',
|
||||||
|
pre => sub {
|
||||||
|
::mtr_error('rr requires kernel.perf_event_paranoid <= 1')
|
||||||
|
if ::mtr_grab_file('/proc/sys/kernel/perf_event_paranoid') > 1;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
valgdb => {
|
||||||
|
term => 1,
|
||||||
|
run => 'gdb',
|
||||||
|
options => '-x {script} {exe}',
|
||||||
|
script => <<EEE,
|
||||||
|
py
|
||||||
|
import subprocess,shlex,time
|
||||||
|
valg=subprocess.Popen(shlex.split("""valgrind --tool=memcheck --show-reachable=yes --leak-check=yes --num-callers=16 --quiet --suppressions=valgrind.supp --vgdb-error=0 {exe} {args} --loose-wait-for-pos-timeout=1500"""))
|
||||||
|
time.sleep(2)
|
||||||
|
gdb.execute("target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=" + str(valg.pid))
|
||||||
|
EEE
|
||||||
|
pre => sub {
|
||||||
|
my $debug_libraries_path= "/usr/lib/debug";
|
||||||
|
$ENV{LD_LIBRARY_PATH} .= ":$debug_libraries_path" if -d $debug_libraries_path;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
# aliases
|
||||||
|
vsjitdebugger => 'windbg',
|
||||||
|
ktrace => 'strace',
|
||||||
|
);
|
||||||
|
|
||||||
|
my %opts;
|
||||||
|
my %opt_vals;
|
||||||
|
my $help = "\n\nOptions for running debuggers\n\n";
|
||||||
|
|
||||||
|
for my $k (sort keys %debuggers) {
|
||||||
|
my $v = $debuggers{$k};
|
||||||
|
$v = $debuggers{$k} = $debuggers{$v} if not ref $v; # resolve aliases
|
||||||
|
|
||||||
|
sub register_opt($$) {
|
||||||
|
my ($name, $msg) = @_;
|
||||||
|
$opts{"$name=s"} = \$opt_vals{$name};
|
||||||
|
$help .= wrap(sprintf(" %-23s", $name), ' 'x25, "$msg under $name\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
$v->{script} = '' unless $v->{script};
|
||||||
|
$v->{options} =~ s/(\{exe\}|$)/ {options} $&/ unless $v->{options} =~ /\{options\}/;
|
||||||
|
|
||||||
|
register_opt "$k" => "Start mariadbd";
|
||||||
|
register_opt "client-$k" => "Start mariadb-test client";
|
||||||
|
register_opt "boot-$k" => "Start bootstrap server";
|
||||||
|
register_opt "manual-$k" => "Before running test(s) let user manually start mariadbd";
|
||||||
|
}
|
||||||
|
|
||||||
|
sub subst($%) {
|
||||||
|
use warnings FATAL => 'uninitialized';
|
||||||
|
my ($templ, %vars) = @_;
|
||||||
|
$templ =~ s/\{(\w+)\}/$vars{$1}/g;
|
||||||
|
$templ;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub do_args($$$$$) {
|
||||||
|
my ($args, $exe, $input, $type, $opt) = @_;
|
||||||
|
my $k = $opt =~ /^(?:client|boot|manual)-(.*)$/ ? $1 : $opt;
|
||||||
|
my $v = $debuggers{$k};
|
||||||
|
|
||||||
|
# on windows mtr args are quoted (for system), otherwise not (for exec)
|
||||||
|
sub quote($) { $_[0] =~ / / ? "\"$_[0]\"" : $_[0] }
|
||||||
|
sub unquote($) { $_[0] =~ s/^"(.*)"$/$1/; $_[0] }
|
||||||
|
sub quote_from_mtr($) { IS_WINDOWS() ? $_[0] : quote($_[0]) }
|
||||||
|
sub unquote_for_mtr($) { IS_WINDOWS() ? $_[0] : unquote($_[0]) }
|
||||||
|
|
||||||
|
my %vars = (
|
||||||
|
vardir => $::opt_vardir,
|
||||||
|
exe => $$exe,
|
||||||
|
args => join(' ', map { quote_from_mtr $_ } @$$args, '--gdb'),
|
||||||
|
input => $input,
|
||||||
|
script => "$::opt_vardir/tmp/${k}init.$type",
|
||||||
|
log => "$::opt_vardir/log/$type.$k",
|
||||||
|
options => '',
|
||||||
|
);
|
||||||
|
my @params = split /;/, $opt_vals{$opt};
|
||||||
|
$vars{options} = shift @params if @params and $params[0] =~ /^-/;
|
||||||
|
|
||||||
|
my $script = join "\n", @params;
|
||||||
|
if ($v->{script}) {
|
||||||
|
::mtr_tofile($vars{script}, subst($v->{script}, %vars)."\n".$script);
|
||||||
|
} elsif ($script) {
|
||||||
|
die "$k is not using a script file, nowhere to write the script \n---\n$script\n---\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
my $options = subst($v->{options}, %vars);
|
||||||
|
@$$args = map { unquote_for_mtr $_ } $options =~ /("[^"]+"|\S+)/g;
|
||||||
|
my $run = $v->{run} || $k;
|
||||||
|
|
||||||
|
if ($opt =~ /^manual-/) {
|
||||||
|
print "\nTo start $k for $type, type in another window:\n";
|
||||||
|
print "$run $options\n";
|
||||||
|
$$exe= undef; # Indicate the exe should not be started
|
||||||
|
} elsif ($v->{term}) {
|
||||||
|
unshift @$$args, '-title', $type, '-e', $run;
|
||||||
|
$$exe = 'xterm';
|
||||||
|
} else {
|
||||||
|
$$exe = $run;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub options() { %opts }
|
||||||
|
sub help() { $help }
|
||||||
|
|
||||||
|
sub fix_options(@) {
|
||||||
|
my $re=join '|', keys %opts;
|
||||||
|
$re =~ s/=s//g;
|
||||||
|
map { $_ . (/^--($re)$/ and '=;') } @_;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub pre_setup() {
|
||||||
|
my $used;
|
||||||
|
for my $k (keys %debuggers) {
|
||||||
|
for my $opt ($k, "manual-$k", "boot-$k", "client-$k") {
|
||||||
|
if ($opt_vals{$opt})
|
||||||
|
{
|
||||||
|
$used = 1;
|
||||||
|
if ($debuggers{$k}->{pre}) {
|
||||||
|
$debuggers{$k}->{pre}->();
|
||||||
|
delete $debuggers{$k}->{pre};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($used) {
|
||||||
|
$ENV{ASAN_OPTIONS}= 'abort_on_error=1:'.($ENV{ASAN_OPTIONS} || '');
|
||||||
|
::mtr_error("Can't use --extern when using debugger") if $ENV{USE_RUNNING_SERVER};
|
||||||
|
|
||||||
|
$::opt_retry= 1;
|
||||||
|
$::opt_retry_failure= 1;
|
||||||
|
$::opt_testcase_timeout= 7 * 24 * 60; # in minutes
|
||||||
|
$::opt_suite_timeout= 7 * 24 * 60; # in minutes
|
||||||
|
$::opt_shutdown_timeout= 24 * 60 *60; # in seconds
|
||||||
|
$::opt_start_timeout= 24 * 60 * 60; # in seconds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup_boot_args($$$) {
|
||||||
|
my ($args, $exe, $input) = @_;
|
||||||
|
my $found;
|
||||||
|
|
||||||
|
for my $k (keys %debuggers) {
|
||||||
|
if ($opt_vals{"boot-$k"}) {
|
||||||
|
die "--boot-$k and --$found cannot be used at the same time\n" if $found;
|
||||||
|
|
||||||
|
$found="boot-$k";
|
||||||
|
do_args($args, $exe, $input, 'bootstrap', $found);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup_client_args($$) {
|
||||||
|
my ($args, $exe) = @_;
|
||||||
|
my $found;
|
||||||
|
my $embedded = $::opt_embedded_server ? ' with --embedded' : '';
|
||||||
|
|
||||||
|
for my $k (keys %debuggers) {
|
||||||
|
my @opt_names=("client-$k");
|
||||||
|
push @opt_names, $k if $embedded;
|
||||||
|
for my $opt (@opt_names) {
|
||||||
|
if ($opt_vals{$opt}) {
|
||||||
|
die "--$opt and --$found cannot be used at the same time$embedded\n" if $found;
|
||||||
|
$found=$opt;
|
||||||
|
do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', 'client', $found);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setup_args($$$) {
|
||||||
|
my ($args, $exe, $type) = @_;
|
||||||
|
my $found;
|
||||||
|
|
||||||
|
for my $k (keys %debuggers) {
|
||||||
|
for my $opt ($k, "manual-$k") {
|
||||||
|
if ($opt_vals{$opt}) {
|
||||||
|
die "--$opt and --$found cannot be used at the same time\n" if $found;
|
||||||
|
$found=$opt;
|
||||||
|
do_args($args, $exe, IS_WINDOWS() ? 'NUL' : '/dev/null', $type, $found);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
@ -3388,3 +3388,18 @@ ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
|||||||
ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
|
ERROR 42S22: Unknown column 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in 'DEFAULT'
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
# end of 10.2 test
|
# end of 10.2 test
|
||||||
|
#
|
||||||
|
# MDEV-22703 DEFAULT() on a BLOB column can overwrite the default
|
||||||
|
# record, which can cause crashes when accessing already released
|
||||||
|
# memory.
|
||||||
|
#
|
||||||
|
CREATE TEMPORARY TABLE t1 (h POINT DEFAULT ST_GEOMFROMTEXT('Point(1 1)')) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 () VALUES (),();
|
||||||
|
ALTER TABLE t1 FORCE;
|
||||||
|
SELECT DEFAULT(h) FROM t1;
|
||||||
|
SELECT length(DEFAULT(h)) FROM t1;
|
||||||
|
length(DEFAULT(h))
|
||||||
|
25
|
||||||
|
25
|
||||||
|
INSERT INTO t1 () VALUES ();
|
||||||
|
drop table t1;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
#
|
#
|
||||||
# test of already fixed bugs
|
# test of already fixed bugs
|
||||||
#
|
#
|
||||||
@ -2107,5 +2109,20 @@ CREATE OR REPLACE TABLE t1(i int);
|
|||||||
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
|
ALTER TABLE t1 ADD b CHAR(255) DEFAULT `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
--echo # end of 10.2 test
|
--echo # end of 10.2 test
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-22703 DEFAULT() on a BLOB column can overwrite the default
|
||||||
|
--echo # record, which can cause crashes when accessing already released
|
||||||
|
--echo # memory.
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE t1 (h POINT DEFAULT ST_GEOMFROMTEXT('Point(1 1)')) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 () VALUES (),();
|
||||||
|
ALTER TABLE t1 FORCE;
|
||||||
|
--disable_result_log
|
||||||
|
SELECT DEFAULT(h) FROM t1;
|
||||||
|
--enable_result_log
|
||||||
|
SELECT length(DEFAULT(h)) FROM t1;
|
||||||
|
INSERT INTO t1 () VALUES ();
|
||||||
|
drop table t1;
|
||||||
|
22
mysql-test/main/flush_and_binlog.result
Normal file
22
mysql-test/main/flush_and_binlog.result
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#
|
||||||
|
# MDEV-23843 Assertions in Diagnostics_area upon table operations under
|
||||||
|
# FTWRL
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
FLUSH TABLES WITH READ LOCK;
|
||||||
|
connect con1,localhost,root,,;
|
||||||
|
SET lock_wait_timeout= 1;
|
||||||
|
OPTIMIZE TABLE t1;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
disconnect con1;
|
||||||
|
connection default;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
DROP TABLE t1;
|
||||||
|
FLUSH TABLES WITH READ LOCK;
|
||||||
|
connect con1,localhost,root,,test;
|
||||||
|
SET lock_wait_timeout= 1;
|
||||||
|
FLUSH TABLES;
|
||||||
|
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||||
|
connection default;
|
||||||
|
disconnect con1;
|
||||||
|
unlock tables;
|
29
mysql-test/main/flush_and_binlog.test
Normal file
29
mysql-test/main/flush_and_binlog.test
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
--source include/have_log_bin.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-23843 Assertions in Diagnostics_area upon table operations under
|
||||||
|
--echo # FTWRL
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT);
|
||||||
|
FLUSH TABLES WITH READ LOCK;
|
||||||
|
--connect (con1,localhost,root,,)
|
||||||
|
SET lock_wait_timeout= 1;
|
||||||
|
--error ER_LOCK_WAIT_TIMEOUT
|
||||||
|
OPTIMIZE TABLE t1;
|
||||||
|
# Cleanup
|
||||||
|
--disconnect con1
|
||||||
|
--connection default
|
||||||
|
UNLOCK TABLES;
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Second test case from MDEV_23843
|
||||||
|
#
|
||||||
|
FLUSH TABLES WITH READ LOCK;
|
||||||
|
--connect (con1,localhost,root,,test)
|
||||||
|
SET lock_wait_timeout= 1;
|
||||||
|
--error ER_LOCK_WAIT_TIMEOUT
|
||||||
|
FLUSH TABLES;
|
||||||
|
--connection default
|
||||||
|
--disconnect con1
|
||||||
|
unlock tables;
|
@ -2325,5 +2325,18 @@ group by f;
|
|||||||
f
|
f
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-24929 Server crash in thr_multi_unlock or in
|
||||||
|
# get_schema_tables_result upon select from I_S with joins
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a TIMESTAMP, KEY (a));
|
||||||
|
INSERT INTO t1 VALUES ('2012-12-12'),('2021-11-11');
|
||||||
|
SELECT count(*) FROM t1 AS t1a LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.ROUTINES) ON (t1b.a IS NULL);
|
||||||
|
count(*)
|
||||||
|
2
|
||||||
|
SELECT count(*) FROM t1 AS t1a LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.PROFILING) ON (t1b.a IS NULL);
|
||||||
|
count(*)
|
||||||
|
2
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
# End of 10.3 tests
|
# End of 10.3 tests
|
||||||
#
|
#
|
||||||
|
@ -2032,6 +2032,16 @@ inner join t1 on f=i.column_name
|
|||||||
group by f;
|
group by f;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-24929 Server crash in thr_multi_unlock or in
|
||||||
|
--echo # get_schema_tables_result upon select from I_S with joins
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a TIMESTAMP, KEY (a));
|
||||||
|
INSERT INTO t1 VALUES ('2012-12-12'),('2021-11-11');
|
||||||
|
SELECT count(*) FROM t1 AS t1a LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.ROUTINES) ON (t1b.a IS NULL);
|
||||||
|
SELECT count(*) FROM t1 AS t1a LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.PROFILING) ON (t1b.a IS NULL);
|
||||||
|
DROP TABLE t1;
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.3 tests
|
--echo # End of 10.3 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -799,6 +799,21 @@ EXPLAIN
|
|||||||
}
|
}
|
||||||
drop table t1;
|
drop table t1;
|
||||||
SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||||
|
#
|
||||||
|
# MDEV-11172: EXPLAIN shows non-sensical value for key_len with type=index
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a INT);
|
||||||
|
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
pk VARCHAR(50),
|
||||||
|
a VARCHAR(20),
|
||||||
|
KEY k1(a),
|
||||||
|
PRIMARY KEY(pk)
|
||||||
|
)ENGINE=INNODB;
|
||||||
|
INSERT INTO t2 SELECT a,a FROM t1;
|
||||||
|
EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t2 index NULL k1 23 NULL 10 Using index
|
||||||
|
DROP TABLE t1,t2;
|
||||||
set global innodb_stats_persistent= @innodb_stats_persistent_save;
|
set global innodb_stats_persistent= @innodb_stats_persistent_save;
|
||||||
set global innodb_stats_persistent_sample_pages=
|
set global innodb_stats_persistent_sample_pages= @innodb_stats_persistent_sample_pages_save;
|
||||||
@innodb_stats_persistent_sample_pages_save;
|
|
||||||
|
@ -624,6 +624,25 @@ select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
SET optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-11172: EXPLAIN shows non-sensical value for key_len with type=index
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1(a INT);
|
||||||
|
INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
pk VARCHAR(50),
|
||||||
|
a VARCHAR(20),
|
||||||
|
KEY k1(a),
|
||||||
|
PRIMARY KEY(pk)
|
||||||
|
)ENGINE=INNODB;
|
||||||
|
|
||||||
|
INSERT INTO t2 SELECT a,a FROM t1;
|
||||||
|
EXPLAIN SELECT pk FROM t2 FORCE INDEX(k1);
|
||||||
|
|
||||||
|
DROP TABLE t1,t2;
|
||||||
|
|
||||||
set global innodb_stats_persistent= @innodb_stats_persistent_save;
|
set global innodb_stats_persistent= @innodb_stats_persistent_save;
|
||||||
set global innodb_stats_persistent_sample_pages=
|
set global innodb_stats_persistent_sample_pages= @innodb_stats_persistent_sample_pages_save;
|
||||||
@innodb_stats_persistent_sample_pages_save;
|
|
||||||
|
@ -156,6 +156,7 @@ alter user user1@localhost PASSWORD EXPIRE NEVER ACCOUNT UNLOCK ;
|
|||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
||||||
|
ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER
|
||||||
alter user user1@localhost ACCOUNT LOCK PASSWORD EXPIRE DEFAULT;
|
alter user user1@localhost ACCOUNT LOCK PASSWORD EXPIRE DEFAULT;
|
||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
@ -167,5 +168,6 @@ localhost user1 {"access":0,"version_id":XXX,"plugin":"mysql_native_password","a
|
|||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
||||||
|
ALTER USER `user1`@`localhost` PASSWORD EXPIRE INTERVAL 60 DAY
|
||||||
drop user user1@localhost;
|
drop user user1@localhost;
|
||||||
drop user user2@localhost;
|
drop user user2@localhost;
|
||||||
|
@ -125,6 +125,7 @@ alter user user1@localhost password expire;
|
|||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
||||||
|
ALTER USER `user1`@`localhost` PASSWORD EXPIRE INTERVAL 123 DAY
|
||||||
set password for user1@localhost= password('');
|
set password for user1@localhost= password('');
|
||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
@ -151,10 +152,12 @@ alter user user1@localhost password expire;
|
|||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
||||||
|
ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER
|
||||||
flush privileges;
|
flush privileges;
|
||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
||||||
|
ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER
|
||||||
set password for user1@localhost= password('');
|
set password for user1@localhost= password('');
|
||||||
alter user user1@localhost password expire default;
|
alter user user1@localhost password expire default;
|
||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
@ -184,10 +187,12 @@ alter user user1@localhost password expire;
|
|||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
||||||
|
ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER
|
||||||
flush privileges;
|
flush privileges;
|
||||||
show create user user1@localhost;
|
show create user user1@localhost;
|
||||||
CREATE USER for user1@localhost
|
CREATE USER for user1@localhost
|
||||||
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
CREATE USER `user1`@`localhost` PASSWORD EXPIRE
|
||||||
|
ALTER USER `user1`@`localhost` PASSWORD EXPIRE NEVER
|
||||||
set global disconnect_on_expired_password=ON;
|
set global disconnect_on_expired_password=ON;
|
||||||
connect(localhost,user1,,test,MYSQL_PORT,MYSQL_SOCK);
|
connect(localhost,user1,,test,MYSQL_PORT,MYSQL_SOCK);
|
||||||
connect con1,localhost,user1;
|
connect con1,localhost,user1;
|
||||||
|
@ -5485,6 +5485,18 @@ ERROR HY000: Default/ignore value is not supported for such parameter usage
|
|||||||
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
|
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
|
||||||
Database
|
Database
|
||||||
#
|
#
|
||||||
|
# MDEV-24779: main.subselect fails in buildbot with --ps-protocol
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a INT);
|
||||||
|
PREPARE stmt FROM "SELECT EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))";
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))
|
||||||
|
0
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -4931,6 +4931,16 @@ DROP TABLE t1;
|
|||||||
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
|
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
|
||||||
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
|
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-24779: main.subselect fails in buildbot with --ps-protocol
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1(a INT);
|
||||||
|
PREPARE stmt FROM "SELECT EXISTS(SELECT 1 FROM t1 GROUP BY a IN (select a from t1))";
|
||||||
|
EXECUTE stmt;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.2 tests
|
--echo # End of 10.2 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -1882,4 +1882,62 @@ a b
|
|||||||
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
# End of 10.1 tests
|
# End of 10.1 tests
|
||||||
|
#
|
||||||
|
# MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect
|
||||||
|
#
|
||||||
|
SET optimizer_use_condition_selectivity=4;
|
||||||
|
SET histogram_size=255;
|
||||||
|
CREATE TABLE t1 (a BIT(32), b INT);
|
||||||
|
INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82);
|
||||||
|
ANALYZE TABLE t1 PERSISTENT FOR ALL;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status Engine-independent statistics collected
|
||||||
|
test.t1 analyze status OK
|
||||||
|
EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.41 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81
|
||||||
|
SELECT HEX(a), b from t1 where t1.a >= 81;
|
||||||
|
HEX(a) b
|
||||||
|
51 81
|
||||||
|
52 82
|
||||||
|
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||||
|
set histogram_size=@save_histogram_size;
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a int);
|
||||||
|
INSERT INTO t1 values (1),(2),(2),(3),(4);
|
||||||
|
SET optimizer_use_condition_selectivity=4;
|
||||||
|
SET histogram_size= 255;
|
||||||
|
set use_stat_tables='preferably';
|
||||||
|
ANALYZE TABLE t1 PERSISTENT FOR ALL;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status Engine-independent statistics collected
|
||||||
|
test.t1 analyze status OK
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 39.84 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
|
||||||
|
SET optimizer_use_condition_selectivity=3;
|
||||||
|
# filtered should show 25 %
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
|
||||||
|
FLUSH TABLES;
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
|
||||||
|
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||||
|
set histogram_size=@save_histogram_size;
|
||||||
|
set use_stat_tables= @save_use_stat_tables;
|
||||||
|
DROP TABLE t1;
|
||||||
|
# End of 10.2 tests
|
||||||
set @@global.histogram_size=@save_histogram_size;
|
set @@global.histogram_size=@save_histogram_size;
|
||||||
|
@ -1281,6 +1281,51 @@ drop table t1;
|
|||||||
|
|
||||||
--echo # End of 10.1 tests
|
--echo # End of 10.1 tests
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SET optimizer_use_condition_selectivity=4;
|
||||||
|
SET histogram_size=255;
|
||||||
|
CREATE TABLE t1 (a BIT(32), b INT);
|
||||||
|
INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82);
|
||||||
|
ANALYZE TABLE t1 PERSISTENT FOR ALL;
|
||||||
|
EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81;
|
||||||
|
SELECT HEX(a), b from t1 where t1.a >= 81;
|
||||||
|
|
||||||
|
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||||
|
set histogram_size=@save_histogram_size;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1(a int);
|
||||||
|
INSERT INTO t1 values (1),(2),(2),(3),(4);
|
||||||
|
SET optimizer_use_condition_selectivity=4;
|
||||||
|
SET histogram_size= 255;
|
||||||
|
|
||||||
|
set use_stat_tables='preferably';
|
||||||
|
|
||||||
|
ANALYZE TABLE t1 PERSISTENT FOR ALL;
|
||||||
|
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
SET optimizer_use_condition_selectivity=3;
|
||||||
|
|
||||||
|
--echo # filtered should show 25 %
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
FLUSH TABLES;
|
||||||
|
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||||
|
set histogram_size=@save_histogram_size;
|
||||||
|
set use_stat_tables= @save_use_stat_tables;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo # End of 10.2 tests
|
||||||
|
|
||||||
#
|
#
|
||||||
# Clean up
|
# Clean up
|
||||||
#
|
#
|
||||||
|
@ -1892,6 +1892,64 @@ a b
|
|||||||
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
# End of 10.1 tests
|
# End of 10.1 tests
|
||||||
|
#
|
||||||
|
# MDEV-22583: Selectivity for BIT columns in filtered column for EXPLAIN is incorrect
|
||||||
|
#
|
||||||
|
SET optimizer_use_condition_selectivity=4;
|
||||||
|
SET histogram_size=255;
|
||||||
|
CREATE TABLE t1 (a BIT(32), b INT);
|
||||||
|
INSERT INTO t1 VALUES (80, 80), (81, 81), (82, 82);
|
||||||
|
ANALYZE TABLE t1 PERSISTENT FOR ALL;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status Engine-independent statistics collected
|
||||||
|
test.t1 analyze status OK
|
||||||
|
EXPLAIN EXTENDED SELECT * from t1 where t1.a >= 81;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 66.41 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` >= 81
|
||||||
|
SELECT HEX(a), b from t1 where t1.a >= 81;
|
||||||
|
HEX(a) b
|
||||||
|
51 81
|
||||||
|
52 82
|
||||||
|
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||||
|
set histogram_size=@save_histogram_size;
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# MDEV-19474: Histogram statistics are used even with optimizer_use_condition_selectivity=3
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a int);
|
||||||
|
INSERT INTO t1 values (1),(2),(2),(3),(4);
|
||||||
|
SET optimizer_use_condition_selectivity=4;
|
||||||
|
SET histogram_size= 255;
|
||||||
|
set use_stat_tables='preferably';
|
||||||
|
ANALYZE TABLE t1 PERSISTENT FOR ALL;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status Engine-independent statistics collected
|
||||||
|
test.t1 analyze status OK
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 39.84 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
|
||||||
|
SET optimizer_use_condition_selectivity=3;
|
||||||
|
# filtered should show 25 %
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
|
||||||
|
FLUSH TABLES;
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
|
||||||
|
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
|
||||||
|
set histogram_size=@save_histogram_size;
|
||||||
|
set use_stat_tables= @save_use_stat_tables;
|
||||||
|
DROP TABLE t1;
|
||||||
|
# End of 10.2 tests
|
||||||
set @@global.histogram_size=@save_histogram_size;
|
set @@global.histogram_size=@save_histogram_size;
|
||||||
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
|
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
|
||||||
set @tmp_ust= @@use_stat_tables;
|
set @tmp_ust= @@use_stat_tables;
|
||||||
|
@ -2687,6 +2687,15 @@ f
|
|||||||
bar
|
bar
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
#
|
#
|
||||||
|
# MDEV-23449: alias do not exist and a query do not report an error
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a INT, b INT);
|
||||||
|
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
|
||||||
|
SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id);
|
||||||
|
ERROR 42S22: Unknown column 's.id' in 'group statement'
|
||||||
|
DROP TABLE t1;
|
||||||
|
# End of 10.2 tests
|
||||||
|
#
|
||||||
# MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init
|
# MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 (i1 int,v1 varchar(1),KEY (v1,i1));
|
CREATE TABLE t1 (i1 int,v1 varchar(1),KEY (v1,i1));
|
||||||
@ -2717,7 +2726,6 @@ Warnings:
|
|||||||
Warning 1931 Query execution was interrupted. The query examined at least 3020 rows, which exceeds LIMIT ROWS EXAMINED (500). The query result may be incomplete
|
Warning 1931 Query execution was interrupted. The query examined at least 3020 rows, which exceeds LIMIT ROWS EXAMINED (500). The query result may be incomplete
|
||||||
SET join_cache_level= @save_join_cache_level;
|
SET join_cache_level= @save_join_cache_level;
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
# End of 10.2 tests
|
|
||||||
#
|
#
|
||||||
# MDEV-21265: IN predicate conversion to IN subquery should be allowed for a broader set of datatype comparison
|
# MDEV-21265: IN predicate conversion to IN subquery should be allowed for a broader set of datatype comparison
|
||||||
#
|
#
|
||||||
|
@ -2201,6 +2201,19 @@ SELECT * FROM t2;
|
|||||||
|
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-23449: alias do not exist and a query do not report an error
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1(a INT, b INT);
|
||||||
|
INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4), (5,5);
|
||||||
|
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
SELECT a, b FROM t1 WHERE a IN (SELECT A.a FROM t1 A GROUP BY s.id);
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo # End of 10.2 tests
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init
|
--echo # MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init
|
||||||
--echo #
|
--echo #
|
||||||
@ -2236,9 +2249,6 @@ from t2 join t1 on
|
|||||||
SET join_cache_level= @save_join_cache_level;
|
SET join_cache_level= @save_join_cache_level;
|
||||||
|
|
||||||
DROP TABLE t1,t2,t3,t4;
|
DROP TABLE t1,t2,t3,t4;
|
||||||
|
|
||||||
--echo # End of 10.2 tests
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-21265: IN predicate conversion to IN subquery should be allowed for a broader set of datatype comparison
|
--echo # MDEV-21265: IN predicate conversion to IN subquery should be allowed for a broader set of datatype comparison
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -214,6 +214,7 @@ alter user user@localhost password expire;
|
|||||||
show create user user@localhost;
|
show create user user@localhost;
|
||||||
CREATE USER for user@localhost
|
CREATE USER for user@localhost
|
||||||
CREATE USER `user`@`localhost` PASSWORD EXPIRE
|
CREATE USER `user`@`localhost` PASSWORD EXPIRE
|
||||||
|
ALTER USER `user`@`localhost` PASSWORD EXPIRE INTERVAL 123 DAY
|
||||||
set password for user@localhost= password('');
|
set password for user@localhost= password('');
|
||||||
show create user user@localhost;
|
show create user user@localhost;
|
||||||
CREATE USER for user@localhost
|
CREATE USER for user@localhost
|
||||||
|
@ -2675,6 +2675,107 @@ values ((select min(a), max(b) from t1));
|
|||||||
ERROR 21000: Operand should contain 1 column(s)
|
ERROR 21000: Operand should contain 1 column(s)
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-24840: union of TVCs in IN subquery
|
||||||
|
#
|
||||||
|
create table t1 (a int) engine=myisam;
|
||||||
|
insert into t1 values (3), (7), (1);
|
||||||
|
select a from t1 where a in (values (7) union values (8));
|
||||||
|
a
|
||||||
|
7
|
||||||
|
explain extended select a from t1 where a in (values (7) union values (8));
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
|
4 DEPENDENT SUBQUERY <derived2> ref key0 key0 4 func 2 100.00
|
||||||
|
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
5 DEPENDENT UNION <derived3> ref key0 key0 4 func 2 100.00
|
||||||
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
|
||||||
|
Warnings:
|
||||||
|
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`7` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0` where <cache>(`test`.`t1`.`a`) = `tvc_0`.`8`)))
|
||||||
|
prepare stmt from "select a from t1 where a in (values (7) union values (8))";
|
||||||
|
execute stmt;
|
||||||
|
a
|
||||||
|
7
|
||||||
|
execute stmt;
|
||||||
|
a
|
||||||
|
7
|
||||||
|
deallocate prepare stmt;
|
||||||
|
select a from t1 where a not in (values (7) union values (8));
|
||||||
|
a
|
||||||
|
3
|
||||||
|
1
|
||||||
|
explain extended select a from t1 where a not in (values (7) union values (8));
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
|
4 DEPENDENT SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
5 DEPENDENT UNION <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||||
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
|
||||||
|
Warnings:
|
||||||
|
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where !<expr_cache><`test`.`t1`.`a`>(<in_optimizer>(`test`.`t1`.`a`,<exists>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`7`) union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0` where trigcond(<cache>(`test`.`t1`.`a`) = `tvc_0`.`8`))))
|
||||||
|
select a from t1 where a < all(values (7) union values (8));
|
||||||
|
a
|
||||||
|
3
|
||||||
|
1
|
||||||
|
explain extended select a from t1 where a < all(values (7) union values (8));
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
|
4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
5 UNION <derived3> ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
|
||||||
|
Warnings:
|
||||||
|
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <not>(<in_optimizer>(`test`.`t1`.`a`,<min>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0`) <= <cache>(`test`.`t1`.`a`)))
|
||||||
|
select a from t1 where a >= any(values (7) union values (8));
|
||||||
|
a
|
||||||
|
7
|
||||||
|
explain extended select a from t1 where a >= any(values (7) union values (8));
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||||
|
4 SUBQUERY <derived2> ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
5 UNION <derived3> ALL NULL NULL NULL NULL 2 100.00
|
||||||
|
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
NULL UNION RESULT <union4,5> ALL NULL NULL NULL NULL NULL NULL
|
||||||
|
Warnings:
|
||||||
|
Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where <nop>(<in_optimizer>(`test`.`t1`.`a`,<min>(/* select#4 */ select `tvc_0`.`7` from (values (7)) `tvc_0` union /* select#5 */ select `tvc_0`.`8` from (values (8)) `tvc_0`) <= <cache>(`test`.`t1`.`a`)))
|
||||||
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-24934:EXPLAIN for queries based on TVC using subqueries
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 values (3), (7), (1);
|
||||||
|
values (8), ((select * from t1 where a between 2 and 4));
|
||||||
|
8
|
||||||
|
8
|
||||||
|
3
|
||||||
|
explain values (8), ((select * from t1 where a between 2 and 4));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
|
values ((select * from t1 where a between 2 and 4)),
|
||||||
|
((select * from t1 where a > 10));
|
||||||
|
(select * from t1 where a between 2 and 4)
|
||||||
|
3
|
||||||
|
NULL
|
||||||
|
explain values ((select * from t1 where a between 2 and 4)),
|
||||||
|
((select * from t1 where a > 10));
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
3 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
|
values (10,11), ((select * from t1 where a = 7) + 1, 21);
|
||||||
|
10 11
|
||||||
|
10 11
|
||||||
|
8 21
|
||||||
|
explain values (10,11), ((select * from t1 where a = 7) + 1, 21);
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
|
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 Using where
|
||||||
|
drop table t1;
|
||||||
|
#
|
||||||
# End of 10.3 tests
|
# End of 10.3 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -1401,6 +1401,64 @@ values ((select min(a), max(b) from t1));
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-24840: union of TVCs in IN subquery
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1 (a int) engine=myisam;
|
||||||
|
insert into t1 values (3), (7), (1);
|
||||||
|
|
||||||
|
let $q=
|
||||||
|
select a from t1 where a in (values (7) union values (8));
|
||||||
|
eval $q;
|
||||||
|
eval explain extended $q;
|
||||||
|
eval prepare stmt from "$q";
|
||||||
|
execute stmt;
|
||||||
|
execute stmt;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
|
||||||
|
let $q=
|
||||||
|
select a from t1 where a not in (values (7) union values (8));
|
||||||
|
eval $q;
|
||||||
|
eval explain extended $q;
|
||||||
|
|
||||||
|
let $q=
|
||||||
|
select a from t1 where a < all(values (7) union values (8));
|
||||||
|
eval $q;
|
||||||
|
eval explain extended $q;
|
||||||
|
|
||||||
|
let $q=
|
||||||
|
select a from t1 where a >= any(values (7) union values (8));
|
||||||
|
eval $q;
|
||||||
|
eval explain extended $q;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-24934:EXPLAIN for queries based on TVC using subqueries
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 values (3), (7), (1);
|
||||||
|
|
||||||
|
let $q1=
|
||||||
|
values (8), ((select * from t1 where a between 2 and 4));
|
||||||
|
eval $q1;
|
||||||
|
eval explain $q1;
|
||||||
|
|
||||||
|
let $q2=
|
||||||
|
values ((select * from t1 where a between 2 and 4)),
|
||||||
|
((select * from t1 where a > 10));
|
||||||
|
eval $q2;
|
||||||
|
eval explain $q2;
|
||||||
|
|
||||||
|
let $q3=
|
||||||
|
values (10,11), ((select * from t1 where a = 7) + 1, 21);
|
||||||
|
eval $q3;
|
||||||
|
eval explain $q3;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.3 tests
|
--echo # End of 10.3 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -176,9 +176,8 @@ Note 1265 Data truncated for column 'a' at row 2
|
|||||||
insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
|
insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'a' at row 1
|
Warning 1264 Out of range value for column 'a' at row 1
|
||||||
Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2
|
Warning 1264 Out of range value for column 'a' at row 2
|
||||||
Note 1265 Data truncated for column 'a' at row 3
|
Note 1265 Data truncated for column 'a' at row 3
|
||||||
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4
|
|
||||||
insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
|
insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'a' at row 1
|
Warning 1265 Data truncated for column 'a' at row 1
|
||||||
@ -209,7 +208,7 @@ a
|
|||||||
99999999.99
|
99999999.99
|
||||||
0.00
|
0.00
|
||||||
99999999.99
|
99999999.99
|
||||||
0.00
|
99999999.99
|
||||||
0.00
|
0.00
|
||||||
0.00
|
0.00
|
||||||
123.40
|
123.40
|
||||||
@ -1078,6 +1077,90 @@ t1 CREATE TABLE `t1` (
|
|||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE t1dec102;
|
DROP TABLE t1dec102;
|
||||||
#
|
#
|
||||||
|
# MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong result
|
||||||
|
#
|
||||||
|
SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a;
|
||||||
|
a
|
||||||
|
0
|
||||||
|
SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a;
|
||||||
|
a
|
||||||
|
0
|
||||||
|
SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a;
|
||||||
|
a
|
||||||
|
99999999999999999999999999999999999999
|
||||||
|
Warnings:
|
||||||
|
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
|
||||||
|
Warning 1292 Truncated incorrect DECIMAL value: '.00000000000000000000000000000000000001e111111111111111111111'
|
||||||
|
Warning 1264 Out of range value for column 'a' at row 1
|
||||||
|
CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128));
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'),
|
||||||
|
('1e111111111111111111111', 'Non-zero mantissa, huge positive exponent'),
|
||||||
|
('0e-111111111111111111111', 'Zero mantissa and a huge negative exponent'),
|
||||||
|
('1e-111111111111111111111', 'Non-zero mantissa and a huge negative exponent');
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE done INT DEFAULT FALSE;
|
||||||
|
DECLARE vstr, vcomment VARCHAR(128);
|
||||||
|
DECLARE cur1 CURSOR FOR SELECT str, comment FROM t1 ORDER BY str;
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||||
|
OPEN cur1;
|
||||||
|
read_loop:
|
||||||
|
LOOP
|
||||||
|
FETCH cur1 INTO vstr, vcomment;
|
||||||
|
IF done THEN
|
||||||
|
LEAVE read_loop;
|
||||||
|
END IF;
|
||||||
|
SELECT vstr AS `--------`, vcomment AS `--------`;
|
||||||
|
SELECT CAST(str AS DECIMAL(38,0)) FROM t1 WHERE str=vstr;
|
||||||
|
SHOW WARNINGS;
|
||||||
|
SELECT CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) FROM t1 WHERE str=vstr;
|
||||||
|
SHOW WARNINGS;
|
||||||
|
END LOOP;
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
-------- --------
|
||||||
|
0e-111111111111111111111 Zero mantissa and a huge negative exponent
|
||||||
|
CAST(str AS DECIMAL(38,0))
|
||||||
|
0
|
||||||
|
Level Code Message
|
||||||
|
CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
|
||||||
|
0
|
||||||
|
Level Code Message
|
||||||
|
Warning 1292 Truncated incorrect DECIMAL value: '0e-111111111111111111111garbage'
|
||||||
|
-------- --------
|
||||||
|
0e111111111111111111111 Zero mantissa and a huge positive exponent
|
||||||
|
CAST(str AS DECIMAL(38,0))
|
||||||
|
0
|
||||||
|
Level Code Message
|
||||||
|
CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
|
||||||
|
0
|
||||||
|
Level Code Message
|
||||||
|
Warning 1292 Truncated incorrect DECIMAL value: '0e111111111111111111111garbage'
|
||||||
|
-------- --------
|
||||||
|
1e-111111111111111111111 Non-zero mantissa and a huge negative exponent
|
||||||
|
CAST(str AS DECIMAL(38,0))
|
||||||
|
0
|
||||||
|
Level Code Message
|
||||||
|
CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
|
||||||
|
0
|
||||||
|
Level Code Message
|
||||||
|
Warning 1292 Truncated incorrect DECIMAL value: '1e-111111111111111111111garbage'
|
||||||
|
-------- --------
|
||||||
|
1e111111111111111111111 Non-zero mantissa, huge positive exponent
|
||||||
|
CAST(str AS DECIMAL(38,0))
|
||||||
|
99999999999999999999999999999999999999
|
||||||
|
Level Code Message
|
||||||
|
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
|
||||||
|
Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111'
|
||||||
|
Warning 1264 Out of range value for column 'CAST(str AS DECIMAL(38,0))' at row 1
|
||||||
|
CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))
|
||||||
|
99999999999999999999999999999999999999
|
||||||
|
Level Code Message
|
||||||
|
Warning 1916 Got overflow when converting '' to DECIMAL. Value truncated
|
||||||
|
Warning 1292 Truncated incorrect DECIMAL value: '1e111111111111111111111garbage'
|
||||||
|
Warning 1264 Out of range value for column 'CAST(CONCAT(str,'garbage') AS DECIMAL(38,0))' at row 1
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -669,6 +669,50 @@ DROP TABLE t1;
|
|||||||
|
|
||||||
DROP TABLE t1dec102;
|
DROP TABLE t1dec102;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-24790 CAST('0e1111111111' AS DECIMAL(38,0)) returns a wrong result
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SELECT CAST('0e111111111' AS DECIMAL(38,0)) AS a;
|
||||||
|
SELECT CAST('0e1111111111' AS DECIMAL(38,0)) AS a;
|
||||||
|
SELECT CAST('.00000000000000000000000000000000000001e111111111111111111111' AS DECIMAL(38,0)) AS a;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (str VARCHAR(128), comment VARCHAR(128));
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
('0e111111111111111111111', 'Zero mantissa and a huge positive exponent'),
|
||||||
|
('1e111111111111111111111', 'Non-zero mantissa, huge positive exponent'),
|
||||||
|
('0e-111111111111111111111', 'Zero mantissa and a huge negative exponent'),
|
||||||
|
('1e-111111111111111111111', 'Non-zero mantissa and a huge negative exponent');
|
||||||
|
|
||||||
|
# The loop below issues SHOW WARNINGS manually, disable automatic warnings
|
||||||
|
--disable_warnings
|
||||||
|
DELIMITER $$;
|
||||||
|
BEGIN NOT ATOMIC
|
||||||
|
DECLARE done INT DEFAULT FALSE;
|
||||||
|
DECLARE vstr, vcomment VARCHAR(128);
|
||||||
|
DECLARE cur1 CURSOR FOR SELECT str, comment FROM t1 ORDER BY str;
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||||
|
OPEN cur1;
|
||||||
|
read_loop:
|
||||||
|
LOOP
|
||||||
|
FETCH cur1 INTO vstr, vcomment;
|
||||||
|
IF done THEN
|
||||||
|
LEAVE read_loop;
|
||||||
|
END IF;
|
||||||
|
SELECT vstr AS `--------`, vcomment AS `--------`;
|
||||||
|
SELECT CAST(str AS DECIMAL(38,0)) FROM t1 WHERE str=vstr;
|
||||||
|
SHOW WARNINGS;
|
||||||
|
SELECT CAST(CONCAT(str,'garbage') AS DECIMAL(38,0)) FROM t1 WHERE str=vstr;
|
||||||
|
SHOW WARNINGS;
|
||||||
|
END LOOP;
|
||||||
|
END;
|
||||||
|
$$
|
||||||
|
DELIMITER ;$$
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.2 tests
|
--echo # End of 10.2 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -6777,6 +6777,21 @@ DROP PROCEDURE sp1;
|
|||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
#
|
#
|
||||||
|
# MDEV-23291: SUM column from a derived table returns invalid values
|
||||||
|
#
|
||||||
|
CREATE TABLE t1(a INT, b INT);
|
||||||
|
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||||
|
CREATE view v1 AS
|
||||||
|
SELECT a as x, (select x) as y, (select y) as z FROM t1;
|
||||||
|
SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q;
|
||||||
|
sum(z)
|
||||||
|
3
|
||||||
|
SELECT sum(z) FROM v1;
|
||||||
|
sum(z)
|
||||||
|
3
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP VIEW v1;
|
||||||
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -6484,6 +6484,22 @@ DROP PROCEDURE sp1;
|
|||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
DROP TABLE t1, t2;
|
DROP TABLE t1, t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-23291: SUM column from a derived table returns invalid values
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1(a INT, b INT);
|
||||||
|
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||||
|
|
||||||
|
CREATE view v1 AS
|
||||||
|
SELECT a as x, (select x) as y, (select y) as z FROM t1;
|
||||||
|
|
||||||
|
SELECT sum(z) FROM (SELECT a as x, (select x) as y, (select y) as z FROM t1) q;
|
||||||
|
SELECT sum(z) FROM v1;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP VIEW v1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.2 tests
|
--echo # End of 10.2 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,280 +0,0 @@
|
|||||||
#
|
|
||||||
# This include file is used by more than one test suite
|
|
||||||
# (currently binlog and binlog_encryption).
|
|
||||||
# Please check all dependent tests after modifying it
|
|
||||||
#
|
|
||||||
|
|
||||||
--source include/have_innodb.inc
|
|
||||||
--source include/have_debug.inc
|
|
||||||
--source include/have_debug_sync.inc
|
|
||||||
--source include/have_binlog_format_row.inc
|
|
||||||
# Valgrind does not work well with test that crashes the server
|
|
||||||
--source include/not_valgrind.inc
|
|
||||||
|
|
||||||
# (We do not need to restore these settings, as we crash the server).
|
|
||||||
SET GLOBAL max_binlog_size= 4096;
|
|
||||||
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
|
||||||
RESET MASTER;
|
|
||||||
|
|
||||||
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
|
||||||
# Insert some data to force a couple binlog rotations (3), so we get some
|
|
||||||
# normal binlog checkpoints before starting the test.
|
|
||||||
INSERT INTO t1 VALUES (100, REPEAT("x", 4100));
|
|
||||||
# Wait for the master-bin.000002 binlog checkpoint to appear.
|
|
||||||
--let $wait_for_all= 0
|
|
||||||
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002"
|
|
||||||
--let $field= Info
|
|
||||||
--let $condition= = "master-bin.000002"
|
|
||||||
--source include/wait_show_condition.inc
|
|
||||||
INSERT INTO t1 VALUES (101, REPEAT("x", 4100));
|
|
||||||
--let $wait_for_all= 0
|
|
||||||
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003"
|
|
||||||
--let $field= Info
|
|
||||||
--let $condition= = "master-bin.000003"
|
|
||||||
--source include/wait_show_condition.inc
|
|
||||||
INSERT INTO t1 VALUES (102, REPEAT("x", 4100));
|
|
||||||
--let $wait_for_all= 0
|
|
||||||
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
|
|
||||||
--let $field= Info
|
|
||||||
--let $condition= = "master-bin.000004"
|
|
||||||
--source include/wait_show_condition.inc
|
|
||||||
|
|
||||||
# Now start a bunch of transactions that span multiple binlog
|
|
||||||
# files. Leave then in the state prepared-but-not-committed in the engine
|
|
||||||
# and crash the server. Check that crash recovery is able to recover all
|
|
||||||
# of them.
|
|
||||||
#
|
|
||||||
# We use debug_sync to get all the transactions into the prepared state before
|
|
||||||
# we commit any of them. This is because the prepare step flushes the InnoDB
|
|
||||||
# redo log - including any commits made before, so recovery would become
|
|
||||||
# unnecessary, decreasing the value of this test.
|
|
||||||
#
|
|
||||||
# We arrange to have con1 with a prepared transaction in master-bin.000004,
|
|
||||||
# con2 and con3 with a prepared transaction in master-bin.000005, and a new
|
|
||||||
# empty master-bin.000006. So the latest binlog checkpoint should be
|
|
||||||
# master-bin.000006.
|
|
||||||
|
|
||||||
connect(con1,localhost,root,,);
|
|
||||||
# First wait after prepare and before write to binlog.
|
|
||||||
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont";
|
|
||||||
# Then complete InnoDB commit in memory (but not commit checkpoint / write to
|
|
||||||
# disk), and hang until crash, leaving a transaction to be XA recovered.
|
|
||||||
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever";
|
|
||||||
send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con1_wait";
|
|
||||||
|
|
||||||
connect(con2,localhost,root,,);
|
|
||||||
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont";
|
|
||||||
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever";
|
|
||||||
send INSERT INTO t1 VALUES (2, NULL);
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con2_wait";
|
|
||||||
|
|
||||||
connect(con3,localhost,root,,);
|
|
||||||
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont";
|
|
||||||
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever";
|
|
||||||
send INSERT INTO t1 VALUES (3, REPEAT("x", 4100));
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con3_wait";
|
|
||||||
|
|
||||||
connect(con4,localhost,root,,);
|
|
||||||
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont";
|
|
||||||
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
|
||||||
send INSERT INTO t1 VALUES (4, NULL);
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con4_wait";
|
|
||||||
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con1_cont";
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con2_cont";
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con3_cont";
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
|
|
||||||
|
|
||||||
# Check that everything is committed in binary log.
|
|
||||||
--source include/show_binary_logs.inc
|
|
||||||
--let $binlog_file= master-bin.000003
|
|
||||||
--let $binlog_start= 4
|
|
||||||
--source include/show_binlog_events.inc
|
|
||||||
--let $binlog_file= master-bin.000004
|
|
||||||
--source include/show_binlog_events.inc
|
|
||||||
--let $binlog_file= master-bin.000005
|
|
||||||
--source include/show_binlog_events.inc
|
|
||||||
--let $binlog_file= master-bin.000006
|
|
||||||
--source include/show_binlog_events.inc
|
|
||||||
|
|
||||||
|
|
||||||
# Check that server will not purge too much.
|
|
||||||
PURGE BINARY LOGS TO "master-bin.000006";
|
|
||||||
--source include/show_binary_logs.inc
|
|
||||||
|
|
||||||
# Now crash the server with one more transaction in prepared state.
|
|
||||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
||||||
wait-binlog_xa_recover.test
|
|
||||||
EOF
|
|
||||||
--error 0,2006,2013
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con4_cont";
|
|
||||||
connection con4;
|
|
||||||
--error 2006,2013
|
|
||||||
reap;
|
|
||||||
|
|
||||||
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
||||||
restart-group_commit_binlog_pos.test
|
|
||||||
EOF
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
--enable_reconnect
|
|
||||||
--source include/wait_until_connected_again.inc
|
|
||||||
|
|
||||||
# Check that all transactions are recovered.
|
|
||||||
SELECT a FROM t1 ORDER BY a;
|
|
||||||
|
|
||||||
--echo Test that with multiple binlog checkpoints, recovery starts from the last one.
|
|
||||||
SET GLOBAL max_binlog_size= 4096;
|
|
||||||
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
|
||||||
RESET MASTER;
|
|
||||||
|
|
||||||
# Rotate to binlog master-bin.000003 while delaying binlog checkpoints.
|
|
||||||
# So we get multiple binlog checkpoints in master-bin.000003.
|
|
||||||
# Then complete the checkpoints, crash, and check that we only scan
|
|
||||||
# the necessary binlog file (ie. that we use the _last_ checkpoint).
|
|
||||||
|
|
||||||
connect(con10,localhost,root,,);
|
|
||||||
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont";
|
|
||||||
send INSERT INTO t1 VALUES (10, REPEAT("x", 4100));
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
|
|
||||||
|
|
||||||
connect(con11,localhost,root,,);
|
|
||||||
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont";
|
|
||||||
send INSERT INTO t1 VALUES (11, REPEAT("x", 4100));
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con11_ready";
|
|
||||||
|
|
||||||
connect(con12,localhost,root,,);
|
|
||||||
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont";
|
|
||||||
send INSERT INTO t1 VALUES (12, REPEAT("x", 4100));
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR con12_ready";
|
|
||||||
INSERT INTO t1 VALUES (13, NULL);
|
|
||||||
|
|
||||||
--source include/show_binary_logs.inc
|
|
||||||
--let $binlog_file= master-bin.000004
|
|
||||||
--let $binlog_start= 4
|
|
||||||
--source include/show_binlog_events.inc
|
|
||||||
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con10_cont";
|
|
||||||
connection con10;
|
|
||||||
reap;
|
|
||||||
connection default;
|
|
||||||
|
|
||||||
# We need to sync the test case with the background processing of the
|
|
||||||
# commit checkpoint, otherwise we get nondeterministic results.
|
|
||||||
SET @old_dbug= @@global.DEBUG_DBUG;
|
|
||||||
SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con12_cont";
|
|
||||||
connection con12;
|
|
||||||
reap;
|
|
||||||
connection default;
|
|
||||||
SET GLOBAL debug_dbug= @old_dbug;
|
|
||||||
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con11_cont";
|
|
||||||
connection con11;
|
|
||||||
reap;
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
# Wait for the last (master-bin.000004) binlog checkpoint to appear.
|
|
||||||
--let $wait_for_all= 0
|
|
||||||
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
|
|
||||||
--let $field= Info
|
|
||||||
--let $condition= = "master-bin.000004"
|
|
||||||
--source include/wait_show_condition.inc
|
|
||||||
|
|
||||||
--echo Checking that master-bin.000004 is the last binlog checkpoint
|
|
||||||
--source include/show_binlog_events.inc
|
|
||||||
|
|
||||||
--echo Now crash the server
|
|
||||||
# It is not too easy to test XA recovery, as it runs early during server
|
|
||||||
# startup, before any connections can be made.
|
|
||||||
# What we do is set a DBUG error insert which will crash if XA recovery
|
|
||||||
# starts from any other binlog than master-bin.000004 (check the file
|
|
||||||
# binlog_xa_recover-master.opt). Then we will fail here if XA recovery
|
|
||||||
# would start from the wrong place.
|
|
||||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
||||||
wait-binlog_xa_recover.test
|
|
||||||
EOF
|
|
||||||
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
|
||||||
--error 2006,2013
|
|
||||||
INSERT INTO t1 VALUES (14, NULL);
|
|
||||||
|
|
||||||
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
||||||
restart-group_commit_binlog_pos.test
|
|
||||||
EOF
|
|
||||||
|
|
||||||
connection default;
|
|
||||||
--enable_reconnect
|
|
||||||
--source include/wait_until_connected_again.inc
|
|
||||||
|
|
||||||
# Check that all transactions are recovered.
|
|
||||||
SELECT a FROM t1 ORDER BY a;
|
|
||||||
|
|
||||||
|
|
||||||
--echo *** Check that recovery works if we crashed early during rotate, before
|
|
||||||
--echo *** binlog checkpoint event could be written.
|
|
||||||
|
|
||||||
SET GLOBAL max_binlog_size= 4096;
|
|
||||||
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
|
||||||
RESET MASTER;
|
|
||||||
|
|
||||||
# We need some initial data to reach binlog master-bin.000004. Otherwise
|
|
||||||
# crash recovery fails due to the error insert used for previous test.
|
|
||||||
INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
|
|
||||||
INSERT INTO t1 VALUES (22, REPEAT("x", 4100));
|
|
||||||
# Wait for the master-bin.000003 binlog checkpoint to appear.
|
|
||||||
--let $wait_for_all= 0
|
|
||||||
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003"
|
|
||||||
--let $field= Info
|
|
||||||
--let $condition= = "master-bin.000003"
|
|
||||||
--source include/wait_show_condition.inc
|
|
||||||
INSERT INTO t1 VALUES (23, REPEAT("x", 4100));
|
|
||||||
# Wait for the last (master-bin.000004) binlog checkpoint to appear.
|
|
||||||
--let $wait_for_all= 0
|
|
||||||
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
|
|
||||||
--let $field= Info
|
|
||||||
--let $condition= = "master-bin.000004"
|
|
||||||
--source include/wait_show_condition.inc
|
|
||||||
|
|
||||||
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
||||||
wait-binlog_xa_recover.test
|
|
||||||
EOF
|
|
||||||
SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event";
|
|
||||||
--error 2006,2013
|
|
||||||
INSERT INTO t1 VALUES (24, REPEAT("x", 4100));
|
|
||||||
|
|
||||||
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
|
||||||
restart-group_commit_binlog_pos.test
|
|
||||||
EOF
|
|
||||||
|
|
||||||
--enable_reconnect
|
|
||||||
--source include/wait_until_connected_again.inc
|
|
||||||
|
|
||||||
# Check that all transactions are recovered.
|
|
||||||
SELECT a FROM t1 ORDER BY a;
|
|
||||||
|
|
||||||
--source include/show_binary_logs.inc
|
|
||||||
--let $binlog_file= master-bin.000004
|
|
||||||
--let $binlog_start= 4
|
|
||||||
--source include/show_binlog_events.inc
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
connection default;
|
|
||||||
DROP TABLE t1;
|
|
@ -146,29 +146,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */
|
|||||||
SET DEBUG_SYNC= "now SIGNAL con10_cont";
|
SET DEBUG_SYNC= "now SIGNAL con10_cont";
|
||||||
connection con10;
|
connection con10;
|
||||||
connection default;
|
connection default;
|
||||||
SET @old_dbug= @@global.DEBUG_DBUG;
|
|
||||||
SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con12_cont";
|
SET DEBUG_SYNC= "now SIGNAL con12_cont";
|
||||||
connection con12;
|
connection con12;
|
||||||
connection default;
|
connection default;
|
||||||
SET GLOBAL debug_dbug= @old_dbug;
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con11_cont";
|
SET DEBUG_SYNC= "now SIGNAL con11_cont";
|
||||||
connection con11;
|
connection con11;
|
||||||
connection default;
|
connection default;
|
||||||
Checking that master-bin.000004 is the last binlog checkpoint
|
|
||||||
include/show_binlog_events.inc
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
||||||
master-bin.000004 # Gtid_list # # [#-#-#]
|
|
||||||
master-bin.000004 # Binlog_checkpoint # # master-bin.000001
|
|
||||||
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
||||||
master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL)
|
|
||||||
master-bin.000004 # Table_map # # table_id: # (test.t1)
|
|
||||||
master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
|
||||||
master-bin.000004 # Xid # # COMMIT /* XID */
|
|
||||||
master-bin.000004 # Binlog_checkpoint # # master-bin.000002
|
|
||||||
master-bin.000004 # Binlog_checkpoint # # master-bin.000004
|
|
||||||
Now crash the server
|
Now crash the server
|
||||||
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
||||||
INSERT INTO t1 VALUES (14, NULL);
|
INSERT INTO t1 VALUES (14, NULL);
|
||||||
|
@ -1 +1,276 @@
|
|||||||
--source include/binlog_xa_recover.inc
|
#
|
||||||
|
# This include file is used by more than one test suite
|
||||||
|
# (currently binlog and binlog_encryption).
|
||||||
|
# Please check all dependent tests after modifying it
|
||||||
|
#
|
||||||
|
|
||||||
|
--source include/have_innodb.inc
|
||||||
|
--source include/have_debug.inc
|
||||||
|
--source include/have_debug_sync.inc
|
||||||
|
--source include/have_binlog_format_row.inc
|
||||||
|
# Valgrind does not work well with test that crashes the server
|
||||||
|
--source include/not_valgrind.inc
|
||||||
|
|
||||||
|
# (We do not need to restore these settings, as we crash the server).
|
||||||
|
SET GLOBAL max_binlog_size= 4096;
|
||||||
|
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
||||||
|
RESET MASTER;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
||||||
|
# Insert some data to force a couple binlog rotations (3), so we get some
|
||||||
|
# normal binlog checkpoints before starting the test.
|
||||||
|
INSERT INTO t1 VALUES (100, REPEAT("x", 4100));
|
||||||
|
# Wait for the master-bin.000002 binlog checkpoint to appear.
|
||||||
|
--let $wait_for_all= 0
|
||||||
|
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000002"
|
||||||
|
--let $field= Info
|
||||||
|
--let $condition= = "master-bin.000002"
|
||||||
|
--source include/wait_show_condition.inc
|
||||||
|
INSERT INTO t1 VALUES (101, REPEAT("x", 4100));
|
||||||
|
--let $wait_for_all= 0
|
||||||
|
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003"
|
||||||
|
--let $field= Info
|
||||||
|
--let $condition= = "master-bin.000003"
|
||||||
|
--source include/wait_show_condition.inc
|
||||||
|
INSERT INTO t1 VALUES (102, REPEAT("x", 4100));
|
||||||
|
--let $wait_for_all= 0
|
||||||
|
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
|
||||||
|
--let $field= Info
|
||||||
|
--let $condition= = "master-bin.000004"
|
||||||
|
--source include/wait_show_condition.inc
|
||||||
|
|
||||||
|
# Now start a bunch of transactions that span multiple binlog
|
||||||
|
# files. Leave then in the state prepared-but-not-committed in the engine
|
||||||
|
# and crash the server. Check that crash recovery is able to recover all
|
||||||
|
# of them.
|
||||||
|
#
|
||||||
|
# We use debug_sync to get all the transactions into the prepared state before
|
||||||
|
# we commit any of them. This is because the prepare step flushes the InnoDB
|
||||||
|
# redo log - including any commits made before, so recovery would become
|
||||||
|
# unnecessary, decreasing the value of this test.
|
||||||
|
#
|
||||||
|
# We arrange to have con1 with a prepared transaction in master-bin.000004,
|
||||||
|
# con2 and con3 with a prepared transaction in master-bin.000005, and a new
|
||||||
|
# empty master-bin.000006. So the latest binlog checkpoint should be
|
||||||
|
# master-bin.000006.
|
||||||
|
|
||||||
|
connect(con1,localhost,root,,);
|
||||||
|
# First wait after prepare and before write to binlog.
|
||||||
|
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con1_wait WAIT_FOR con1_cont";
|
||||||
|
# Then complete InnoDB commit in memory (but not commit checkpoint / write to
|
||||||
|
# disk), and hang until crash, leaving a transaction to be XA recovered.
|
||||||
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR _ever";
|
||||||
|
send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con1_wait";
|
||||||
|
|
||||||
|
connect(con2,localhost,root,,);
|
||||||
|
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con2_wait WAIT_FOR con2_cont";
|
||||||
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR _ever";
|
||||||
|
send INSERT INTO t1 VALUES (2, NULL);
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con2_wait";
|
||||||
|
|
||||||
|
connect(con3,localhost,root,,);
|
||||||
|
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con3_wait WAIT_FOR con3_cont";
|
||||||
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con3_ready WAIT_FOR _ever";
|
||||||
|
send INSERT INTO t1 VALUES (3, REPEAT("x", 4100));
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con3_wait";
|
||||||
|
|
||||||
|
connect(con4,localhost,root,,);
|
||||||
|
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL con4_wait WAIT_FOR con4_cont";
|
||||||
|
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
||||||
|
send INSERT INTO t1 VALUES (4, NULL);
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con4_wait";
|
||||||
|
|
||||||
|
SET DEBUG_SYNC= "now SIGNAL con1_cont";
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
||||||
|
SET DEBUG_SYNC= "now SIGNAL con2_cont";
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
|
||||||
|
SET DEBUG_SYNC= "now SIGNAL con3_cont";
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
|
||||||
|
|
||||||
|
# Check that everything is committed in binary log.
|
||||||
|
--source include/show_binary_logs.inc
|
||||||
|
--let $binlog_file= master-bin.000003
|
||||||
|
--let $binlog_start= 4
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
--let $binlog_file= master-bin.000004
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
--let $binlog_file= master-bin.000005
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
--let $binlog_file= master-bin.000006
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
|
||||||
|
# Check that server will not purge too much.
|
||||||
|
PURGE BINARY LOGS TO "master-bin.000006";
|
||||||
|
--source include/show_binary_logs.inc
|
||||||
|
|
||||||
|
# Now crash the server with one more transaction in prepared state.
|
||||||
|
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||||
|
wait-binlog_xa_recover.test
|
||||||
|
EOF
|
||||||
|
--error 0,2006,2013
|
||||||
|
SET DEBUG_SYNC= "now SIGNAL con4_cont";
|
||||||
|
connection con4;
|
||||||
|
--error 2006,2013
|
||||||
|
reap;
|
||||||
|
|
||||||
|
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||||
|
restart-group_commit_binlog_pos.test
|
||||||
|
EOF
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
--enable_reconnect
|
||||||
|
--source include/wait_until_connected_again.inc
|
||||||
|
|
||||||
|
# Check that all transactions are recovered.
|
||||||
|
SELECT a FROM t1 ORDER BY a;
|
||||||
|
|
||||||
|
--echo Test that with multiple binlog checkpoints, recovery starts from the last one.
|
||||||
|
SET GLOBAL max_binlog_size= 4096;
|
||||||
|
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
||||||
|
RESET MASTER;
|
||||||
|
|
||||||
|
# Rotate to binlog master-bin.000003 while delaying binlog checkpoints.
|
||||||
|
# So we get multiple binlog checkpoints in master-bin.000003.
|
||||||
|
# Then complete the checkpoints, crash, and check that we only scan
|
||||||
|
# the necessary binlog file (ie. that we use the _last_ checkpoint).
|
||||||
|
|
||||||
|
connect(con10,localhost,root,,);
|
||||||
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con10_ready WAIT_FOR con10_cont";
|
||||||
|
send INSERT INTO t1 VALUES (10, REPEAT("x", 4100));
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
|
||||||
|
|
||||||
|
connect(con11,localhost,root,,);
|
||||||
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con11_ready WAIT_FOR con11_cont";
|
||||||
|
send INSERT INTO t1 VALUES (11, REPEAT("x", 4100));
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con11_ready";
|
||||||
|
|
||||||
|
connect(con12,localhost,root,,);
|
||||||
|
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con12_ready WAIT_FOR con12_cont";
|
||||||
|
send INSERT INTO t1 VALUES (12, REPEAT("x", 4100));
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
SET DEBUG_SYNC= "now WAIT_FOR con12_ready";
|
||||||
|
INSERT INTO t1 VALUES (13, NULL);
|
||||||
|
|
||||||
|
--source include/show_binary_logs.inc
|
||||||
|
--let $binlog_file= master-bin.000004
|
||||||
|
--let $binlog_start= 4
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
SET DEBUG_SYNC= "now SIGNAL con10_cont";
|
||||||
|
connection con10;
|
||||||
|
reap;
|
||||||
|
connection default;
|
||||||
|
|
||||||
|
# We need to sync the test case with the background processing of the
|
||||||
|
# commit checkpoint, otherwise we get nondeterministic results.
|
||||||
|
let $wait_condition= select count(*) = 1 from performance_schema.threads where processlist_state = "Waiting for background binlog tasks";
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
|
SET DEBUG_SYNC= "now SIGNAL con12_cont";
|
||||||
|
connection con12;
|
||||||
|
reap;
|
||||||
|
connection default;
|
||||||
|
|
||||||
|
SET DEBUG_SYNC= "now SIGNAL con11_cont";
|
||||||
|
connection con11;
|
||||||
|
reap;
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
# Wait for the last (master-bin.000004) binlog checkpoint to appear.
|
||||||
|
--let $wait_for_all= 0
|
||||||
|
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
|
||||||
|
--let $field= Info
|
||||||
|
--let $condition= = "master-bin.000004"
|
||||||
|
--source include/wait_show_condition.inc
|
||||||
|
|
||||||
|
--echo Now crash the server
|
||||||
|
# It is not too easy to test XA recovery, as it runs early during server
|
||||||
|
# startup, before any connections can be made.
|
||||||
|
# What we do is set a DBUG error insert which will crash if XA recovery
|
||||||
|
# starts from any other binlog than master-bin.000004 (check the file
|
||||||
|
# binlog_xa_recover-master.opt). Then we will fail here if XA recovery
|
||||||
|
# would start from the wrong place.
|
||||||
|
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||||
|
wait-binlog_xa_recover.test
|
||||||
|
EOF
|
||||||
|
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
||||||
|
--error 2006,2013
|
||||||
|
INSERT INTO t1 VALUES (14, NULL);
|
||||||
|
|
||||||
|
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||||
|
restart-group_commit_binlog_pos.test
|
||||||
|
EOF
|
||||||
|
|
||||||
|
connection default;
|
||||||
|
--enable_reconnect
|
||||||
|
--source include/wait_until_connected_again.inc
|
||||||
|
|
||||||
|
# Check that all transactions are recovered.
|
||||||
|
SELECT a FROM t1 ORDER BY a;
|
||||||
|
|
||||||
|
|
||||||
|
--echo *** Check that recovery works if we crashed early during rotate, before
|
||||||
|
--echo *** binlog checkpoint event could be written.
|
||||||
|
|
||||||
|
SET GLOBAL max_binlog_size= 4096;
|
||||||
|
SET GLOBAL innodb_flush_log_at_trx_commit= 1;
|
||||||
|
RESET MASTER;
|
||||||
|
|
||||||
|
# We need some initial data to reach binlog master-bin.000004. Otherwise
|
||||||
|
# crash recovery fails due to the error insert used for previous test.
|
||||||
|
INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
|
||||||
|
INSERT INTO t1 VALUES (22, REPEAT("x", 4100));
|
||||||
|
# Wait for the master-bin.000003 binlog checkpoint to appear.
|
||||||
|
--let $wait_for_all= 0
|
||||||
|
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000003"
|
||||||
|
--let $field= Info
|
||||||
|
--let $condition= = "master-bin.000003"
|
||||||
|
--source include/wait_show_condition.inc
|
||||||
|
INSERT INTO t1 VALUES (23, REPEAT("x", 4100));
|
||||||
|
# Wait for the last (master-bin.000004) binlog checkpoint to appear.
|
||||||
|
--let $wait_for_all= 0
|
||||||
|
--let $show_statement= SHOW BINLOG EVENTS IN "master-bin.000004"
|
||||||
|
--let $field= Info
|
||||||
|
--let $condition= = "master-bin.000004"
|
||||||
|
--source include/wait_show_condition.inc
|
||||||
|
|
||||||
|
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||||
|
wait-binlog_xa_recover.test
|
||||||
|
EOF
|
||||||
|
SET SESSION debug_dbug="+d,crash_before_write_checkpoint_event";
|
||||||
|
--error 2006,2013
|
||||||
|
INSERT INTO t1 VALUES (24, REPEAT("x", 4100));
|
||||||
|
|
||||||
|
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
||||||
|
restart-group_commit_binlog_pos.test
|
||||||
|
EOF
|
||||||
|
|
||||||
|
--enable_reconnect
|
||||||
|
--source include/wait_until_connected_again.inc
|
||||||
|
|
||||||
|
# Check that all transactions are recovered.
|
||||||
|
SELECT a FROM t1 ORDER BY a;
|
||||||
|
|
||||||
|
--source include/show_binary_logs.inc
|
||||||
|
--let $binlog_file= master-bin.000004
|
||||||
|
--let $binlog_start= 4
|
||||||
|
--source include/show_binlog_events.inc
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
connection default;
|
||||||
|
DROP TABLE t1;
|
||||||
|
@ -1 +0,0 @@
|
|||||||
--skip-stack-trace --skip-core-file --loose-debug-dbug=+d,xa_recover_expect_master_bin_000004
|
|
@ -151,30 +151,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */
|
|||||||
SET DEBUG_SYNC= "now SIGNAL con10_cont";
|
SET DEBUG_SYNC= "now SIGNAL con10_cont";
|
||||||
connection con10;
|
connection con10;
|
||||||
connection default;
|
connection default;
|
||||||
SET @old_dbug= @@global.DEBUG_DBUG;
|
|
||||||
SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
|
|
||||||
SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con12_cont";
|
SET DEBUG_SYNC= "now SIGNAL con12_cont";
|
||||||
connection con12;
|
connection con12;
|
||||||
connection default;
|
connection default;
|
||||||
SET GLOBAL debug_dbug= @old_dbug;
|
|
||||||
SET DEBUG_SYNC= "now SIGNAL con11_cont";
|
SET DEBUG_SYNC= "now SIGNAL con11_cont";
|
||||||
connection con11;
|
connection con11;
|
||||||
connection default;
|
connection default;
|
||||||
Checking that master-bin.000004 is the last binlog checkpoint
|
|
||||||
include/show_binlog_events.inc
|
|
||||||
Log_name Pos Event_type Server_id End_log_pos Info
|
|
||||||
master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
|
||||||
master-bin.000004 # Start_encryption # #
|
|
||||||
master-bin.000004 # Gtid_list # # [#-#-#]
|
|
||||||
master-bin.000004 # Binlog_checkpoint # # master-bin.000001
|
|
||||||
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
|
|
||||||
master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL)
|
|
||||||
master-bin.000004 # Table_map # # table_id: # (test.t1)
|
|
||||||
master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
|
||||||
master-bin.000004 # Xid # # COMMIT /* XID */
|
|
||||||
master-bin.000004 # Binlog_checkpoint # # master-bin.000002
|
|
||||||
master-bin.000004 # Binlog_checkpoint # # master-bin.000004
|
|
||||||
Now crash the server
|
Now crash the server
|
||||||
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
||||||
INSERT INTO t1 VALUES (14, NULL);
|
INSERT INTO t1 VALUES (14, NULL);
|
||||||
|
@ -1 +1 @@
|
|||||||
--source suite/binlog/include/binlog_xa_recover.inc
|
--source suite/binlog/t/binlog_xa_recover.test
|
||||||
|
@ -110,15 +110,12 @@ Warnings:
|
|||||||
Warning 1264 Out of range value for column 'c1' at row 1
|
Warning 1264 Out of range value for column 'c1' at row 1
|
||||||
Warning 1264 Out of range value for column 'c2' at row 1
|
Warning 1264 Out of range value for column 'c2' at row 1
|
||||||
Warning 1264 Out of range value for column 'c3' at row 1
|
Warning 1264 Out of range value for column 'c3' at row 1
|
||||||
Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c1` at row 2
|
Warning 1264 Out of range value for column 'c1' at row 2
|
||||||
Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c2` at row 2
|
Warning 1264 Out of range value for column 'c2' at row 2
|
||||||
Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c3` at row 2
|
Warning 1264 Out of range value for column 'c3' at row 2
|
||||||
Note 1265 Data truncated for column 'c1' at row 3
|
Note 1265 Data truncated for column 'c1' at row 3
|
||||||
Note 1265 Data truncated for column 'c2' at row 3
|
Note 1265 Data truncated for column 'c2' at row 3
|
||||||
Note 1265 Data truncated for column 'c3' at row 3
|
Note 1265 Data truncated for column 'c3' at row 3
|
||||||
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c1` at row 4
|
|
||||||
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c2` at row 4
|
|
||||||
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c3` at row 4
|
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
c1 c2 c3 c4
|
c1 c2 c3 c4
|
||||||
0.00000 -0.10000 0 13
|
0.00000 -0.10000 0 13
|
||||||
@ -142,7 +139,6 @@ c1 c2 c3 c4
|
|||||||
0 0 0 15
|
0 0 0 15
|
||||||
0 0 0 26
|
0 0 0 26
|
||||||
0 0 0 29
|
0 0 0 29
|
||||||
0 0 0 31
|
|
||||||
0 0 0 32
|
0 0 0 32
|
||||||
0 0 0 33
|
0 0 0 33
|
||||||
0 0 0 7
|
0 0 0 7
|
||||||
@ -160,6 +156,7 @@ c1 c2 c3 c4
|
|||||||
9999999999 9999999999 9999999999 25
|
9999999999 9999999999 9999999999 25
|
||||||
9999999999 9999999999 9999999999 28
|
9999999999 9999999999 9999999999 28
|
||||||
9999999999 9999999999 9999999999 30
|
9999999999 9999999999 9999999999 30
|
||||||
|
9999999999 9999999999 9999999999 31
|
||||||
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t1;
|
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t1;
|
||||||
total_rows min_value max_value sum avg
|
total_rows min_value max_value sum avg
|
||||||
7 0.00000 99999.99999 212446.04999 30349.435712857
|
7 0.00000 99999.99999 212446.04999 30349.435712857
|
||||||
@ -171,13 +168,13 @@ total_rows min_value max_value sum avg
|
|||||||
7 0 111111111 111211212 18535202.0000
|
7 0 111111111 111211212 18535202.0000
|
||||||
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t2;
|
SELECT count(*) as total_rows, min(c1) as min_value, max(c1) as max_value, sum(c1) as sum, avg(c1) as avg FROM t2;
|
||||||
total_rows min_value max_value sum avg
|
total_rows min_value max_value sum avg
|
||||||
30 -9999999999 9999999999 21322222222 710740740.7333
|
30 -9999999999 9999999999 31322222221 1044074074.0333
|
||||||
SELECT count(*) as total_rows, min(c2) as min_value, max(c2) as max_value, sum(c2) as sum, avg(c2) as avg FROM t2;
|
SELECT count(*) as total_rows, min(c2) as min_value, max(c2) as max_value, sum(c2) as sum, avg(c2) as avg FROM t2;
|
||||||
total_rows min_value max_value sum avg
|
total_rows min_value max_value sum avg
|
||||||
30 0 9999999999 33444444445 1114814814.8333
|
30 0 9999999999 43444444444 1448148148.1333
|
||||||
SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c3) as sum, avg(c3) as avg FROM t2;
|
SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c3) as sum, avg(c3) as avg FROM t2;
|
||||||
total_rows min_value max_value sum avg
|
total_rows min_value max_value sum avg
|
||||||
30 -9999999999 9999999999 43322222220 1444074074.0000
|
30 -9999999999 9999999999 53322222219 1777407407.3000
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
c1 c2 c3 c4
|
c1 c2 c3 c4
|
||||||
0.00000 -0.10000 0 13
|
0.00000 -0.10000 0 13
|
||||||
|
@ -26,13 +26,11 @@ galera_encrypt_tmp_files : Get error failed to enable encryption of temporary fi
|
|||||||
galera_ftwrl : MDEV-21525 galera.galera_ftwrl
|
galera_ftwrl : MDEV-21525 galera.galera_ftwrl
|
||||||
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
|
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
|
||||||
galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges
|
galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges
|
||||||
galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges
|
|
||||||
galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk
|
galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk
|
||||||
galera_mdl_race : MDEV-21524 galera.galera_mdl_race
|
galera_mdl_race : MDEV-21524 galera.galera_mdl_race
|
||||||
galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
|
galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
|
||||||
galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb
|
galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb
|
||||||
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
|
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim
|
||||||
galera_split_brain : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges
|
|
||||||
galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade
|
galera_ssl_upgrade : MDEV-19950 Galera test failure on galera_ssl_upgrade
|
||||||
galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key
|
galera_sst_mariabackup_encrypt_with_key : MDEV-21484 galera_sst_mariabackup_encrypt_with_key
|
||||||
galera_toi_ddl_nonconflicting : MDEV-21518 galera.galera_toi_ddl_nonconflicting
|
galera_toi_ddl_nonconflicting : MDEV-21518 galera.galera_toi_ddl_nonconflicting
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
connection node_2;
|
||||||
|
connection node_1;
|
||||||
connection node_1;
|
connection node_1;
|
||||||
connection node_2;
|
connection node_2;
|
||||||
connection node_1;
|
connection node_1;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
connection node_2;
|
||||||
|
connection node_1;
|
||||||
connection node_1;
|
connection node_1;
|
||||||
connection node_2;
|
connection node_2;
|
||||||
call mtr.add_suppression("WSREP: TO isolation failed for: ");
|
call mtr.add_suppression("WSREP: TO isolation failed for: ");
|
||||||
@ -6,7 +8,7 @@ connection node_2;
|
|||||||
Killing server ...
|
Killing server ...
|
||||||
connection node_1;
|
connection node_1;
|
||||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||||
ERROR 40001: WSREP replication failed. Check your wsrep connection state and retry the query.
|
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||||
connection node_2;
|
connection node_2;
|
||||||
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
|
||||||
disconnect node_2;
|
disconnect node_2;
|
||||||
|
@ -4,12 +4,21 @@ VARIABLE_VALUE = 'Synced'
|
|||||||
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
||||||
VARIABLE_VALUE = 2
|
VARIABLE_VALUE = 2
|
||||||
1
|
1
|
||||||
|
connection node_1;
|
||||||
|
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
|
||||||
|
connection node_2;
|
||||||
|
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
|
||||||
|
connection node_1;
|
||||||
|
connection node_2;
|
||||||
|
connection node_1;
|
||||||
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
||||||
VARIABLE_VALUE = 2
|
VARIABLE_VALUE = 2
|
||||||
1
|
1
|
||||||
|
connection node_2;
|
||||||
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
||||||
VARIABLE_VALUE = 2
|
VARIABLE_VALUE = 2
|
||||||
1
|
1
|
||||||
|
connection node_1;
|
||||||
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
||||||
VARIABLE_VALUE = 2
|
VARIABLE_VALUE = 2
|
||||||
1
|
1
|
||||||
|
@ -32,6 +32,17 @@ SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t
|
|||||||
AUTO_INCREMENT = 1
|
AUTO_INCREMENT = 1
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
|
connection node_1;
|
||||||
|
TRUNCATE TABLE mysql.user;
|
||||||
|
ERROR 42S02: Table 'mysql.user' doesn't exist
|
||||||
|
TRUNCATE TABLE performance_schema.threads;
|
||||||
|
ERROR HY000: Invalid performance_schema usage
|
||||||
|
TRUNCATE TABLE information_schema.tables;
|
||||||
|
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
|
||||||
|
TRUNCATE TABLE mysql.innodb_index_stats;
|
||||||
|
TRUNCATE TABLE foo.bar;
|
||||||
|
ERROR 42S02: Table 'foo.bar' doesn't exist
|
||||||
|
TRUNCATE TABLE t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
DROP TABLE t3;
|
DROP TABLE t3;
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
connection node_2;
|
||||||
|
connection node_1;
|
||||||
|
call mtr.add_suppression("WSREP: Unknown parameter 'a'");
|
||||||
|
call mtr.add_suppression("WSREP: Set options returned 7");
|
||||||
|
SET GLOBAL wsrep_provider_options=NULL;
|
||||||
|
ERROR HY000: Incorrect arguments to SET
|
||||||
|
SET GLOBAL wsrep_provider_options='';
|
||||||
|
SET GLOBAL wsrep_provider_options=' ';
|
||||||
|
SET GLOBAL wsrep_provider_options='a=1';
|
||||||
|
ERROR HY000: Incorrect arguments to SET
|
@ -26,18 +26,13 @@ call mtr.add_suppression("WSREP: TO isolation failed for: ");
|
|||||||
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
||||||
|
|
||||||
# Reset the master and restart the slave so that post-test checks can run
|
# Reset the master and restart the slave so that post-test checks can run
|
||||||
|
|
||||||
|
|
||||||
--connection node_2
|
--connection node_2
|
||||||
--source include/start_mysqld.inc
|
--source include/start_mysqld.inc
|
||||||
--sleep 5
|
|
||||||
--source include/wait_until_connected_again.inc
|
--source include/wait_until_connected_again.inc
|
||||||
|
|
||||||
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
|
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
|
||||||
--source include/wait_condition.inc
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
--sleep 10
|
|
||||||
|
|
||||||
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
|
||||||
--source include/wait_until_connected_again.inc
|
--source include/wait_until_connected_again.inc
|
||||||
|
|
||||||
@ -46,4 +41,3 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
|
|||||||
--source include/auto_increment_offset_restore.inc
|
--source include/auto_increment_offset_restore.inc
|
||||||
|
|
||||||
--source include/galera_end.inc
|
--source include/galera_end.inc
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
!include ../galera_2nodes.cnf
|
!include ../galera_2nodes.cnf
|
||||||
|
|
||||||
[mysqld.1]
|
[mysqld.1]
|
||||||
wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem'
|
wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
|
||||||
|
|
||||||
[mysqld.2]
|
[mysqld.2]
|
||||||
wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem'
|
wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem'
|
||||||
|
@ -6,15 +6,31 @@
|
|||||||
|
|
||||||
--source include/galera_cluster.inc
|
--source include/galera_cluster.inc
|
||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
|
--source include/have_ssl_communication.inc
|
||||||
|
|
||||||
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
|
SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
|
||||||
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
|
||||||
|
|
||||||
|
--connection node_1
|
||||||
|
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
|
||||||
|
--connection node_2
|
||||||
|
call mtr.add_suppression("WSREP: write_handler(): protocol is shutdown.*");
|
||||||
|
|
||||||
|
# Setup galera ports
|
||||||
|
--connection node_1
|
||||||
|
--source suite/galera/include/galera_base_port.inc
|
||||||
|
--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
|
||||||
|
|
||||||
|
--connection node_2
|
||||||
|
--source suite/galera/include/galera_base_port.inc
|
||||||
|
--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
|
||||||
|
|
||||||
# 2. Restart node #1 with a socket.ssl_ca that includes both the new and the old certificate
|
# 2. Restart node #1 with a socket.ssl_ca that includes both the new and the old certificate
|
||||||
|
|
||||||
--connection node_1
|
--connection node_1
|
||||||
--source include/shutdown_mysqld.inc
|
--source include/shutdown_mysqld.inc
|
||||||
--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/cakey.pem
|
--let $restart_noprint = 1
|
||||||
|
--let $start_mysqld_params = --wsrep-cluster-address=gcomm://127.0.0.1:$NODE_GALERAPORT_2 --wsrep_provider_options=base_port=$NODE_GALERAPORT_1;socket.ssl=yes;socket.ssl_ca=$MYSQL_TEST_DIR/std_data/galera-upgrade-ca-cert.pem;socket.ssl_cert=$MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=$MYSQL_TEST_DIR/std_data/galera-key.pem
|
||||||
--source include/start_mysqld.inc
|
--source include/start_mysqld.inc
|
||||||
--source include/wait_until_connected_again.inc
|
--source include/wait_until_connected_again.inc
|
||||||
|
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
--source include/galera_cluster.inc
|
--source include/galera_cluster.inc
|
||||||
--source include/have_innodb.inc
|
--source include/have_perfschema.inc
|
||||||
|
|
||||||
#
|
#
|
||||||
# Simple case
|
# Simple case
|
||||||
#
|
#
|
||||||
@ -57,6 +56,23 @@ TRUNCATE TABLE t4;
|
|||||||
--connection node_2
|
--connection node_2
|
||||||
SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t3', 't4');
|
SELECT AUTO_INCREMENT = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME IN ('t3', 't4');
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# MDEV-24865 : Server crashes when truncate mysql user table
|
||||||
|
#
|
||||||
|
--connection node_1
|
||||||
|
|
||||||
|
--error ER_NO_SUCH_TABLE
|
||||||
|
TRUNCATE TABLE mysql.user;
|
||||||
|
--error ER_WRONG_PERFSCHEMA_USAGE
|
||||||
|
TRUNCATE TABLE performance_schema.threads;
|
||||||
|
--error ER_DBACCESS_DENIED_ERROR
|
||||||
|
TRUNCATE TABLE information_schema.tables;
|
||||||
|
TRUNCATE TABLE mysql.innodb_index_stats;
|
||||||
|
--error ER_NO_SUCH_TABLE
|
||||||
|
TRUNCATE TABLE foo.bar;
|
||||||
|
TRUNCATE TABLE t1;
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
DROP TABLE t3;
|
DROP TABLE t3;
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
--source include/galera_cluster.inc
|
||||||
|
|
||||||
|
call mtr.add_suppression("WSREP: Unknown parameter 'a'");
|
||||||
|
call mtr.add_suppression("WSREP: Set options returned 7");
|
||||||
|
|
||||||
|
--error ER_WRONG_ARGUMENTS
|
||||||
|
SET GLOBAL wsrep_provider_options=NULL;
|
||||||
|
SET GLOBAL wsrep_provider_options='';
|
||||||
|
SET GLOBAL wsrep_provider_options=' ';
|
||||||
|
--error ER_WRONG_ARGUMENTS
|
||||||
|
SET GLOBAL wsrep_provider_options='a=1';
|
@ -20,6 +20,7 @@ galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0
|
|||||||
galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query
|
galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query
|
||||||
galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query
|
galera_load_data_ist : MDEV-24639 galera_3nodes.galera_load_data_ist MTR failed with SIGABRT: query 'reap' failed: 2013: Lost connection to MySQL server during query
|
||||||
galera_pc_bootstrap : MDEV-24650 galera_pc_bootstrap MTR failed: Could not execute 'check-testcase' before testcase
|
galera_pc_bootstrap : MDEV-24650 galera_pc_bootstrap MTR failed: Could not execute 'check-testcase' before testcase
|
||||||
|
galera_safe_to_bootstrap : MDEV-24097 galera_3nodes.galera_safe_to_bootstrap MTR sporadaically fails: Failed to start mysqld or mysql_shutdown failed
|
||||||
galera_slave_options_do : MDEV-8798
|
galera_slave_options_do : MDEV-8798
|
||||||
galera_slave_options_ignore : MDEV-8798
|
galera_slave_options_ignore : MDEV-8798
|
||||||
galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed
|
galera_vote_rejoin_mysqldump : MDEV-24481: galera_3nodes.galera_vote_rejoin_mysqldump MTR failed: mysql_shutdown failed
|
||||||
|
@ -14,16 +14,10 @@ SET DEBUG_SYNC = 'now SIGNAL dml_pause';
|
|||||||
SET DEBUG_SYNC = 'now WAIT_FOR dml_restart';
|
SET DEBUG_SYNC = 'now WAIT_FOR dml_restart';
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920;
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO t1 SELECT * FROM t1;
|
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688;
|
||||||
INSERT INTO t1 SELECT * FROM t1;
|
|
||||||
INSERT INTO t1 SELECT * FROM t1;
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
SET DEBUG_SYNC = 'now SIGNAL dml_done';
|
SET DEBUG_SYNC = 'now SIGNAL dml_done';
|
||||||
connect con2, localhost,root,,test;
|
connect con2, localhost,root,,test;
|
||||||
|
@ -70,6 +70,27 @@ ERROR HY000: Tablespace has been discarded for table `t`
|
|||||||
ALTER TABLE t FORCE;
|
ALTER TABLE t FORCE;
|
||||||
ERROR HY000: Tablespace has been discarded for table `t`
|
ERROR HY000: Tablespace has been discarded for table `t`
|
||||||
DROP TABLE t;
|
DROP TABLE t;
|
||||||
|
#
|
||||||
|
# MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a))
|
||||||
|
ENGINE=InnoDB;
|
||||||
|
ALTER TABLE t1 CHANGE COLUMN a u INT;
|
||||||
|
SELECT sf.* FROM information_schema.innodb_sys_fields sf
|
||||||
|
INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id
|
||||||
|
INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id
|
||||||
|
WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos;
|
||||||
|
INDEX_ID NAME POS
|
||||||
|
ID b 0
|
||||||
|
ID c 0
|
||||||
|
ID u 1
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# End of 10.2 tests
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Check that innodb supports transactional=1
|
||||||
|
#
|
||||||
create table t1 (a int) transactional=1 engine=aria;
|
create table t1 (a int) transactional=1 engine=aria;
|
||||||
create table t2 (a int) transactional=1 engine=innodb;
|
create table t2 (a int) transactional=1 engine=innodb;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
@ -86,6 +107,9 @@ alter table t1 engine=innodb;
|
|||||||
alter table t1 add column b int;
|
alter table t1 add column b int;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
#
|
#
|
||||||
|
# End of 10.4 tests
|
||||||
|
#
|
||||||
|
#
|
||||||
# MDEV-21748 ASAN use-after-poison in PageBulk::insertPage()
|
# MDEV-21748 ASAN use-after-poison in PageBulk::insertPage()
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 (pk TIMESTAMP PRIMARY KEY, a TIMESTAMP NULL UNIQUE)
|
CREATE TABLE t1 (pk TIMESTAMP PRIMARY KEY, a TIMESTAMP NULL UNIQUE)
|
||||||
|
@ -492,11 +492,18 @@ DROP TABLE t1;
|
|||||||
DROP PROCEDURE get_index_id;
|
DROP PROCEDURE get_index_id;
|
||||||
DROP PROCEDURE get_table_id;
|
DROP PROCEDURE get_table_id;
|
||||||
create table t (a varchar(100)) engine=innodb;
|
create table t (a varchar(100)) engine=innodb;
|
||||||
select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
|
select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
|
||||||
|
from information_schema.innodb_sys_columns sc
|
||||||
|
inner join information_schema.innodb_sys_tables st
|
||||||
|
on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
|
||||||
name pos mtype prtype len
|
name pos mtype prtype len
|
||||||
a 0 1 524303 100
|
a 0 1 524303 100
|
||||||
alter table t modify a varchar(110), algorithm=inplace;
|
alter table t modify a varchar(110), algorithm=inplace;
|
||||||
select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
|
select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
|
||||||
|
from information_schema.innodb_sys_columns sc
|
||||||
|
inner join information_schema.innodb_sys_tables st
|
||||||
|
on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
|
||||||
name pos mtype prtype len
|
name pos mtype prtype len
|
||||||
a 0 1 524303 110
|
a 0 1 524303 110
|
||||||
drop table t;
|
drop table t;
|
||||||
|
# End of 10.2 tests
|
||||||
|
@ -27,17 +27,11 @@ SET DEBUG_SYNC = 'now WAIT_FOR dml_restart';
|
|||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_81920;
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
|
||||||
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_16384;
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
INSERT INTO t1 SELECT * FROM t1;
|
INSERT INTO t1 SELECT '','','','','','','','' FROM seq_1_to_114688;
|
||||||
INSERT INTO t1 SELECT * FROM t1;
|
|
||||||
INSERT INTO t1 SELECT * FROM t1;
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
SET DEBUG_SYNC = 'now SIGNAL dml_done';
|
SET DEBUG_SYNC = 'now SIGNAL dml_done';
|
||||||
|
@ -80,9 +80,26 @@ ALTER TABLE t ENGINE INNODB;
|
|||||||
ALTER TABLE t FORCE;
|
ALTER TABLE t FORCE;
|
||||||
DROP TABLE t;
|
DROP TABLE t;
|
||||||
|
|
||||||
#
|
--echo #
|
||||||
# Check that innodb supports transactional=1
|
--echo # MDEV-24763 ALTER TABLE fails to rename a column in SYS_FIELDS
|
||||||
#
|
--echo #
|
||||||
|
CREATE TABLE t1 (a INT, b TEXT, c INT, PRIMARY KEY(b(9)), INDEX(c,a))
|
||||||
|
ENGINE=InnoDB;
|
||||||
|
ALTER TABLE t1 CHANGE COLUMN a u INT;
|
||||||
|
--replace_column 1 ID
|
||||||
|
SELECT sf.* FROM information_schema.innodb_sys_fields sf
|
||||||
|
INNER JOIN information_schema.innodb_sys_indexes si ON sf.index_id=si.index_id
|
||||||
|
INNER JOIN information_schema.innodb_sys_tables st ON si.table_id=st.table_id
|
||||||
|
WHERE st.name='test/t1' ORDER BY sf.index_id,sf.pos;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 10.2 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Check that innodb supports transactional=1
|
||||||
|
--echo #
|
||||||
|
|
||||||
create table t1 (a int) transactional=1 engine=aria;
|
create table t1 (a int) transactional=1 engine=aria;
|
||||||
create table t2 (a int) transactional=1 engine=innodb;
|
create table t2 (a int) transactional=1 engine=innodb;
|
||||||
@ -92,6 +109,10 @@ alter table t1 engine=innodb;
|
|||||||
alter table t1 add column b int;
|
alter table t1 add column b int;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 10.4 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-21748 ASAN use-after-poison in PageBulk::insertPage()
|
--echo # MDEV-21748 ASAN use-after-poison in PageBulk::insertPage()
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -361,7 +361,15 @@ DROP PROCEDURE get_table_id;
|
|||||||
|
|
||||||
# LEN must increase here
|
# LEN must increase here
|
||||||
create table t (a varchar(100)) engine=innodb;
|
create table t (a varchar(100)) engine=innodb;
|
||||||
select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
|
select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
|
||||||
|
from information_schema.innodb_sys_columns sc
|
||||||
|
inner join information_schema.innodb_sys_tables st
|
||||||
|
on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
|
||||||
alter table t modify a varchar(110), algorithm=inplace;
|
alter table t modify a varchar(110), algorithm=inplace;
|
||||||
select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
|
select sc.name, sc.pos, sc.mtype, sc.prtype, sc.len
|
||||||
|
from information_schema.innodb_sys_columns sc
|
||||||
|
inner join information_schema.innodb_sys_tables st
|
||||||
|
on sc.table_id=st.table_id where st.name='test/t' and sc.name='a';
|
||||||
drop table t;
|
drop table t;
|
||||||
|
|
||||||
|
--echo # End of 10.2 tests
|
||||||
|
@ -1 +0,0 @@
|
|||||||
--innodb_fast_shutdown=0
|
|
@ -1,49 +0,0 @@
|
|||||||
# Bug #60049 Verify that purge leaves no garbage in unique secondary indexes
|
|
||||||
# This test requires a fresh server start-up and a slow shutdown.
|
|
||||||
# This was a suspected bug (not a bug).
|
|
||||||
|
|
||||||
-- source include/not_embedded.inc
|
|
||||||
-- source include/have_innodb.inc
|
|
||||||
-- source include/have_innodb_16k.inc
|
|
||||||
|
|
||||||
-- disable_query_log
|
|
||||||
call mtr.add_suppression('\\[ERROR\\] InnoDB: Table `mysql`.`innodb_(table|index)_stats` not found');
|
|
||||||
call mtr.add_suppression('\\[ERROR\\] InnoDB: Fetch of persistent statistics requested for table `mysql`.`gtid_executed`');
|
|
||||||
|
|
||||||
let $create1 = query_get_value(SHOW CREATE TABLE mysql.innodb_table_stats, Create Table, 1);
|
|
||||||
let $create2 = query_get_value(SHOW CREATE TABLE mysql.innodb_index_stats, Create Table, 1);
|
|
||||||
DROP TABLE mysql.innodb_index_stats;
|
|
||||||
DROP TABLE mysql.innodb_table_stats;
|
|
||||||
-- enable_query_log
|
|
||||||
|
|
||||||
CREATE TABLE t(a INT)ENGINE=InnoDB STATS_PERSISTENT=0;
|
|
||||||
RENAME TABLE t TO u;
|
|
||||||
DROP TABLE u;
|
|
||||||
SELECT @@innodb_fast_shutdown;
|
|
||||||
let $MYSQLD_DATADIR=`select @@datadir`;
|
|
||||||
|
|
||||||
--source include/shutdown_mysqld.inc
|
|
||||||
|
|
||||||
# Check the tail of ID_IND (SYS_TABLES.ID)
|
|
||||||
let IBDATA1=$MYSQLD_DATADIR/ibdata1;
|
|
||||||
perl;
|
|
||||||
my $file = $ENV{'IBDATA1'};
|
|
||||||
open(FILE, "<$file") || die "Unable to open $file";
|
|
||||||
# Read DICT_HDR_TABLE_IDS, the root page number of ID_IND (SYS_TABLES.ID).
|
|
||||||
seek(FILE, 7*16384+38+36, 0) || die "Unable to seek $file";
|
|
||||||
die unless read(FILE, $_, 4) == 4;
|
|
||||||
my $sys_tables_id_root = unpack("N", $_);
|
|
||||||
print "Last record of ID_IND root page ($sys_tables_id_root):\n";
|
|
||||||
# This should be the last record in ID_IND. Dump it in hexadecimal.
|
|
||||||
seek(FILE, $sys_tables_id_root*16384 + 152, 0) || die "Unable to seek $file";
|
|
||||||
read(FILE, $_, 32) || die "Unable to read $file";
|
|
||||||
close(FILE);
|
|
||||||
print unpack("H*", $_), "\n";
|
|
||||||
EOF
|
|
||||||
|
|
||||||
--source include/start_mysqld.inc
|
|
||||||
|
|
||||||
-- disable_query_log
|
|
||||||
USE mysql;
|
|
||||||
eval $create1;
|
|
||||||
eval $create2;
|
|
@ -1,7 +1,7 @@
|
|||||||
# This test case will test R-tree purge.
|
# This test case will test R-tree purge.
|
||||||
|
|
||||||
--source include/innodb_page_size.inc
|
--source include/innodb_page_size.inc
|
||||||
# Valgrind takes too much time on PB2 even in the --big-test runs.
|
--source include/have_sequence.inc
|
||||||
--source include/not_valgrind.inc
|
--source include/not_valgrind.inc
|
||||||
|
|
||||||
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||||
@ -16,9 +16,7 @@ set @p=point(1,1);
|
|||||||
let $n=200;
|
let $n=200;
|
||||||
while ($n) {
|
while ($n) {
|
||||||
begin;
|
begin;
|
||||||
insert into t values(@p,@p),(@p,@p);
|
insert into t select @p,@p from seq_1_to_130;
|
||||||
insert into t select @p,@p
|
|
||||||
from t a,t b,t c,t d,t e,t f,t g;
|
|
||||||
delete from t;
|
delete from t;
|
||||||
commit;
|
commit;
|
||||||
dec $n;
|
dec $n;
|
||||||
|
@ -22,4 +22,8 @@ n
|
|||||||
connection master;
|
connection master;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
connection slave;
|
connection slave;
|
||||||
|
connection master;
|
||||||
|
CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='',
|
||||||
|
MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
|
||||||
|
CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
|
||||||
include/rpl_end.inc
|
include/rpl_end.inc
|
||||||
|
@ -101,4 +101,11 @@ connection master;
|
|||||||
drop table t1;
|
drop table t1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--connection master
|
||||||
|
# MDEV-22741: *SAN: ERROR: AddressSanitizer: use-after-poison on address in
|
||||||
|
# instrings/strmake.c:36 from change_master (on optimized builds)
|
||||||
|
CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='',
|
||||||
|
MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
|
||||||
|
CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
|
||||||
|
|
||||||
--source include/rpl_end.inc
|
--source include/rpl_end.inc
|
||||||
|
@ -132,16 +132,7 @@ drop user test@localhost;
|
|||||||
#
|
#
|
||||||
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
|
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
|
||||||
SET @@global.wsrep_sst_auth= 'user:pass';
|
SET @@global.wsrep_sst_auth= 'user:pass';
|
||||||
SELECT @@global.wsrep_sst_auth;
|
|
||||||
@@global.wsrep_sst_auth
|
|
||||||
********
|
|
||||||
SET @@global.wsrep_sst_auth= '';
|
SET @@global.wsrep_sst_auth= '';
|
||||||
SELECT @@global.wsrep_sst_auth;
|
|
||||||
@@global.wsrep_sst_auth
|
|
||||||
NULL
|
|
||||||
SET @@global.wsrep_sst_auth= NULL;
|
SET @@global.wsrep_sst_auth= NULL;
|
||||||
SELECT @@global.wsrep_sst_auth;
|
|
||||||
@@global.wsrep_sst_auth
|
|
||||||
NULL
|
|
||||||
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
|
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
|
||||||
# End of test.
|
# End of test.
|
||||||
|
@ -139,11 +139,8 @@ drop user test@localhost;
|
|||||||
--echo #
|
--echo #
|
||||||
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
|
SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
|
||||||
SET @@global.wsrep_sst_auth= 'user:pass';
|
SET @@global.wsrep_sst_auth= 'user:pass';
|
||||||
SELECT @@global.wsrep_sst_auth;
|
|
||||||
SET @@global.wsrep_sst_auth= '';
|
SET @@global.wsrep_sst_auth= '';
|
||||||
SELECT @@global.wsrep_sst_auth;
|
|
||||||
SET @@global.wsrep_sst_auth= NULL;
|
SET @@global.wsrep_sst_auth= NULL;
|
||||||
SELECT @@global.wsrep_sst_auth;
|
|
||||||
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
|
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
|
||||||
|
|
||||||
--source include/galera_wait_ready.inc
|
--source include/galera_wait_ready.inc
|
||||||
|
@ -9370,8 +9370,9 @@ bool Item_default_value::fix_fields(THD *thd, Item **items)
|
|||||||
memcpy((void *)def_field, (void *)field_arg->field,
|
memcpy((void *)def_field, (void *)field_arg->field,
|
||||||
field_arg->field->size_of());
|
field_arg->field->size_of());
|
||||||
def_field->reset_fields();
|
def_field->reset_fields();
|
||||||
// If non-constant default value expression
|
// If non-constant default value expression or a blob
|
||||||
if (def_field->default_value && def_field->default_value->flags)
|
if (def_field->default_value &&
|
||||||
|
(def_field->default_value->flags || def_field->flags & BLOB_FLAG))
|
||||||
{
|
{
|
||||||
uchar *newptr= (uchar*) thd->alloc(1+def_field->pack_length());
|
uchar *newptr= (uchar*) thd->alloc(1+def_field->pack_length());
|
||||||
if (!newptr)
|
if (!newptr)
|
||||||
|
@ -278,7 +278,11 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
|
|||||||
{
|
{
|
||||||
if (sl->tvc)
|
if (sl->tvc)
|
||||||
{
|
{
|
||||||
wrap_tvc_into_select(thd, sl);
|
if (!(sl= wrap_tvc_into_select(thd, sl)))
|
||||||
|
{
|
||||||
|
res= TRUE;
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +386,7 @@ bool Item_subselect::mark_as_eliminated_processor(void *arg)
|
|||||||
bool Item_subselect::eliminate_subselect_processor(void *arg)
|
bool Item_subselect::eliminate_subselect_processor(void *arg)
|
||||||
{
|
{
|
||||||
unit->item= NULL;
|
unit->item= NULL;
|
||||||
unit->exclude_from_tree();
|
unit->exclude();
|
||||||
eliminated= TRUE;
|
eliminated= TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -450,6 +454,26 @@ bool Item_subselect::mark_as_dependent(THD *thd, st_select_lex *select,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
@brief
|
||||||
|
Update the table bitmaps for the outer references used within a subquery
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool Item_subselect::update_table_bitmaps_processor(void *arg)
|
||||||
|
{
|
||||||
|
List_iterator<Ref_to_outside> it(upper_refs);
|
||||||
|
Ref_to_outside *upper;
|
||||||
|
|
||||||
|
while ((upper= it++))
|
||||||
|
{
|
||||||
|
if (upper->item &&
|
||||||
|
upper->item->walk(&Item::update_table_bitmaps_processor, FALSE, arg))
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Adjust attributes after our parent select has been merged into grandparent
|
Adjust attributes after our parent select has been merged into grandparent
|
||||||
|
|
||||||
|
@ -256,6 +256,7 @@ public:
|
|||||||
@retval FALSE otherwise
|
@retval FALSE otherwise
|
||||||
*/
|
*/
|
||||||
bool is_expensive_processor(void *arg) override { return is_expensive(); }
|
bool is_expensive_processor(void *arg) override { return is_expensive(); }
|
||||||
|
bool update_table_bitmaps_processor(void *arg) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the SELECT_LEX structure associated with this Item.
|
Get the SELECT_LEX structure associated with this Item.
|
||||||
@ -277,7 +278,7 @@ public:
|
|||||||
Item* build_clone(THD *thd) override { return 0; }
|
Item* build_clone(THD *thd) override { return 0; }
|
||||||
Item* get_copy(THD *thd) override { return 0; }
|
Item* get_copy(THD *thd) override { return 0; }
|
||||||
|
|
||||||
bool wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl);
|
st_select_lex *wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl);
|
||||||
|
|
||||||
friend class select_result_interceptor;
|
friend class select_result_interceptor;
|
||||||
friend class Item_in_optimizer;
|
friend class Item_in_optimizer;
|
||||||
|
17
sql/lock.cc
17
sql/lock.cc
@ -746,6 +746,9 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
|
|||||||
- GET_LOCK_STORE_LOCKS : Store lock info in TABLE
|
- GET_LOCK_STORE_LOCKS : Store lock info in TABLE
|
||||||
- GET_LOCK_SKIP_SEQUENCES : Ignore sequences (for temporary unlock)
|
- GET_LOCK_SKIP_SEQUENCES : Ignore sequences (for temporary unlock)
|
||||||
- GET_LOCK_ON_THD : Store lock in thd->mem_root
|
- GET_LOCK_ON_THD : Store lock in thd->mem_root
|
||||||
|
|
||||||
|
Temporary tables are not locked (as these are single user), except for
|
||||||
|
TRANSACTIONAL_TMP_TABLES as locking is needed to handle transactions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags)
|
MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags)
|
||||||
@ -762,8 +765,8 @@ MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags)
|
|||||||
{
|
{
|
||||||
TABLE *t= table_ptr[i];
|
TABLE *t= table_ptr[i];
|
||||||
|
|
||||||
if (t->s->tmp_table != NON_TRANSACTIONAL_TMP_TABLE &&
|
if ((likely(!t->s->tmp_table) ||
|
||||||
t->s->tmp_table != INTERNAL_TMP_TABLE &&
|
(t->s->tmp_table == TRANSACTIONAL_TMP_TABLE)) &&
|
||||||
(!(flags & GET_LOCK_SKIP_SEQUENCES) || t->s->sequence == 0))
|
(!(flags & GET_LOCK_SKIP_SEQUENCES) || t->s->sequence == 0))
|
||||||
{
|
{
|
||||||
lock_count+= t->file->lock_count();
|
lock_count+= t->file->lock_count();
|
||||||
@ -792,13 +795,13 @@ MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint flags)
|
|||||||
|
|
||||||
for (i=0 ; i < count ; i++)
|
for (i=0 ; i < count ; i++)
|
||||||
{
|
{
|
||||||
TABLE *table;
|
TABLE *table= table_ptr[i];
|
||||||
enum thr_lock_type lock_type;
|
enum thr_lock_type lock_type;
|
||||||
THR_LOCK_DATA **locks_start;
|
THR_LOCK_DATA **locks_start;
|
||||||
table= table_ptr[i];
|
|
||||||
if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE ||
|
if (!((likely(!table->s->tmp_table) ||
|
||||||
table->s->tmp_table == INTERNAL_TMP_TABLE ||
|
(table->s->tmp_table == TRANSACTIONAL_TMP_TABLE)) &&
|
||||||
((flags & GET_LOCK_SKIP_SEQUENCES) && table->s->sequence))
|
(!(flags & GET_LOCK_SKIP_SEQUENCES) || table->s->sequence == 0)))
|
||||||
continue;
|
continue;
|
||||||
lock_type= table->reginfo.lock_type;
|
lock_type= table->reginfo.lock_type;
|
||||||
DBUG_ASSERT(lock_type != TL_WRITE_DEFAULT && lock_type != TL_READ_DEFAULT);
|
DBUG_ASSERT(lock_type != TL_WRITE_DEFAULT && lock_type != TL_READ_DEFAULT);
|
||||||
|
@ -6591,8 +6591,9 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
|
|||||||
|
|
||||||
MDL_REQUEST_INIT(&mdl_request, MDL_key::BACKUP, "", "", MDL_BACKUP_COMMIT,
|
MDL_REQUEST_INIT(&mdl_request, MDL_key::BACKUP, "", "", MDL_BACKUP_COMMIT,
|
||||||
MDL_EXPLICIT);
|
MDL_EXPLICIT);
|
||||||
thd->mdl_context.acquire_lock(&mdl_request,
|
if (thd->mdl_context.acquire_lock(&mdl_request,
|
||||||
thd->variables.lock_wait_timeout);
|
thd->variables.lock_wait_timeout))
|
||||||
|
DBUG_RETURN(1);
|
||||||
thd->backup_commit_lock= &mdl_request;
|
thd->backup_commit_lock= &mdl_request;
|
||||||
|
|
||||||
if ((res= thd->wait_for_prior_commit()))
|
if ((res= thd->wait_for_prior_commit()))
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
||||||
|
|
||||||
#include "mariadb.h"
|
#include "mariadb.h"
|
||||||
|
#include "my_dbug.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
//#include "sys_vars.h"
|
//#include "sys_vars.h"
|
||||||
@ -120,8 +121,8 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
|||||||
my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig);
|
my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
segfaulted = 1;
|
segfaulted = 1;
|
||||||
|
DBUG_PRINT("error", ("handling fatal signal"));
|
||||||
|
|
||||||
curr_time= my_time(0);
|
curr_time= my_time(0);
|
||||||
localtime_r(&curr_time, &tm);
|
localtime_r(&curr_time, &tm);
|
||||||
|
@ -9052,6 +9052,16 @@ static bool print_grants_for_role(THD *thd, ACL_ROLE * role)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void append_auto_expiration_policy(ACL_USER *acl_user, String *r) {
|
||||||
|
if (!acl_user->password_lifetime)
|
||||||
|
r->append(STRING_WITH_LEN(" PASSWORD EXPIRE NEVER"));
|
||||||
|
else if (acl_user->password_lifetime > 0)
|
||||||
|
{
|
||||||
|
r->append(STRING_WITH_LEN(" PASSWORD EXPIRE INTERVAL "));
|
||||||
|
r->append_longlong(acl_user->password_lifetime);
|
||||||
|
r->append(STRING_WITH_LEN(" DAY"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
|
bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
|
||||||
{
|
{
|
||||||
@ -9111,14 +9121,8 @@ bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
|
|||||||
|
|
||||||
if (acl_user->password_expired)
|
if (acl_user->password_expired)
|
||||||
result.append(STRING_WITH_LEN(" PASSWORD EXPIRE"));
|
result.append(STRING_WITH_LEN(" PASSWORD EXPIRE"));
|
||||||
else if (!acl_user->password_lifetime)
|
else
|
||||||
result.append(STRING_WITH_LEN(" PASSWORD EXPIRE NEVER"));
|
append_auto_expiration_policy(acl_user, &result);
|
||||||
else if (acl_user->password_lifetime > 0)
|
|
||||||
{
|
|
||||||
result.append(STRING_WITH_LEN(" PASSWORD EXPIRE INTERVAL "));
|
|
||||||
result.append_longlong(acl_user->password_lifetime);
|
|
||||||
result.append(STRING_WITH_LEN(" DAY"));
|
|
||||||
}
|
|
||||||
|
|
||||||
protocol->prepare_for_resend();
|
protocol->prepare_for_resend();
|
||||||
protocol->store(result.ptr(), result.length(), result.charset());
|
protocol->store(result.ptr(), result.length(), result.charset());
|
||||||
@ -9126,6 +9130,28 @@ bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
|
|||||||
{
|
{
|
||||||
error= true;
|
error= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* MDEV-24114 - PASSWORD EXPIRE and PASSWORD EXPIRE [NEVER | INTERVAL X DAY]
|
||||||
|
are two different mechanisms. To make sure a tool can restore the state
|
||||||
|
of a user account, including both the manual expiration state of the
|
||||||
|
account and the automatic expiration policy attached to it, we should
|
||||||
|
print two statements here, a CREATE USER (printed above) and an ALTER USER */
|
||||||
|
if (acl_user->password_expired && acl_user->password_lifetime > -1) {
|
||||||
|
result.length(0);
|
||||||
|
result.append("ALTER USER ");
|
||||||
|
append_identifier(thd, &result, username, strlen(username));
|
||||||
|
result.append('@');
|
||||||
|
append_identifier(thd, &result, acl_user->host.hostname,
|
||||||
|
acl_user->hostname_length);
|
||||||
|
append_auto_expiration_policy(acl_user, &result);
|
||||||
|
protocol->prepare_for_resend();
|
||||||
|
protocol->store(result.ptr(), result.length(), result.charset());
|
||||||
|
if (protocol->write())
|
||||||
|
{
|
||||||
|
error= true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my_eof(thd);
|
my_eof(thd);
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
@ -1454,7 +1454,9 @@ bool Sql_cmd_optimize_table::execute(THD *thd)
|
|||||||
/*
|
/*
|
||||||
Presumably, OPTIMIZE and binlog writing doesn't require synchronization
|
Presumably, OPTIMIZE and binlog writing doesn't require synchronization
|
||||||
*/
|
*/
|
||||||
|
thd->get_stmt_da()->set_overwrite_status(true);
|
||||||
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
|
thd->get_stmt_da()->set_overwrite_status(false);
|
||||||
}
|
}
|
||||||
m_lex->first_select_lex()->table_list.first= first_table;
|
m_lex->first_select_lex()->table_list.first= first_table;
|
||||||
m_lex->query_tables= first_table;
|
m_lex->query_tables= first_table;
|
||||||
@ -1486,7 +1488,9 @@ bool Sql_cmd_repair_table::execute(THD *thd)
|
|||||||
/*
|
/*
|
||||||
Presumably, REPAIR and binlog writing doesn't require synchronization
|
Presumably, REPAIR and binlog writing doesn't require synchronization
|
||||||
*/
|
*/
|
||||||
|
thd->get_stmt_da()->set_overwrite_status(true);
|
||||||
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
res= write_bin_log(thd, TRUE, thd->query(), thd->query_length());
|
||||||
|
thd->get_stmt_da()->set_overwrite_status(false);
|
||||||
}
|
}
|
||||||
m_lex->first_select_lex()->table_list.first= first_table;
|
m_lex->first_select_lex()->table_list.first= first_table;
|
||||||
m_lex->query_tables= first_table;
|
m_lex->query_tables= first_table;
|
||||||
|
@ -530,7 +530,7 @@ struct LEX_MASTER_INFO
|
|||||||
}
|
}
|
||||||
|
|
||||||
host= user= password= log_file_name= ssl_key= ssl_cert= ssl_ca=
|
host= user= password= log_file_name= ssl_key= ssl_cert= ssl_ca=
|
||||||
ssl_capath= ssl_cipher= relay_log_name= 0;
|
ssl_capath= ssl_cipher= ssl_crl= ssl_crlpath= relay_log_name= NULL;
|
||||||
pos= relay_log_pos= server_id= port= connect_retry= 0;
|
pos= relay_log_pos= server_id= port= connect_retry= 0;
|
||||||
heartbeat_period= 0;
|
heartbeat_period= 0;
|
||||||
ssl= ssl_verify_server_cert= heartbeat_opt=
|
ssl= ssl_verify_server_cert= heartbeat_opt=
|
||||||
|
@ -1172,22 +1172,6 @@ JOIN::prepare(TABLE_LIST *tables_init, COND *conds_init, uint og_num,
|
|||||||
FALSE, SELECT_ACL, SELECT_ACL, FALSE))
|
FALSE, SELECT_ACL, SELECT_ACL, FALSE))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
/*
|
|
||||||
Permanently remove redundant parts from the query if
|
|
||||||
1) This is a subquery
|
|
||||||
2) This is the first time this query is optimized (since the
|
|
||||||
transformation is permanent
|
|
||||||
3) Not normalizing a view. Removal should take place when a
|
|
||||||
query involving a view is optimized, not when the view
|
|
||||||
is created
|
|
||||||
*/
|
|
||||||
if (select_lex->master_unit()->item && // 1)
|
|
||||||
select_lex->first_cond_optimization && // 2)
|
|
||||||
!thd->lex->is_view_context_analysis()) // 3)
|
|
||||||
{
|
|
||||||
remove_redundant_subquery_clauses(select_lex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* System Versioning: handle FOR SYSTEM_TIME clause. */
|
/* System Versioning: handle FOR SYSTEM_TIME clause. */
|
||||||
if (select_lex->vers_setup_conds(thd, tables_list) < 0)
|
if (select_lex->vers_setup_conds(thd, tables_list) < 0)
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
@ -1269,6 +1253,23 @@ JOIN::prepare(TABLE_LIST *tables_init, COND *conds_init, uint og_num,
|
|||||||
&hidden_group_fields,
|
&hidden_group_fields,
|
||||||
&select_lex->select_n_reserved))
|
&select_lex->select_n_reserved))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Permanently remove redundant parts from the query if
|
||||||
|
1) This is a subquery
|
||||||
|
2) This is the first time this query is optimized (since the
|
||||||
|
transformation is permanent
|
||||||
|
3) Not normalizing a view. Removal should take place when a
|
||||||
|
query involving a view is optimized, not when the view
|
||||||
|
is created
|
||||||
|
*/
|
||||||
|
if (select_lex->master_unit()->item && // 1)
|
||||||
|
select_lex->first_cond_optimization && // 2)
|
||||||
|
!thd->lex->is_view_context_analysis()) // 3)
|
||||||
|
{
|
||||||
|
remove_redundant_subquery_clauses(select_lex);
|
||||||
|
}
|
||||||
|
|
||||||
/* Resolve the ORDER BY that was skipped, then remove it. */
|
/* Resolve the ORDER BY that was skipped, then remove it. */
|
||||||
if (skip_order_by && select_lex !=
|
if (skip_order_by && select_lex !=
|
||||||
select_lex->master_unit()->global_parameters())
|
select_lex->master_unit()->global_parameters())
|
||||||
|
@ -8657,6 +8657,16 @@ bool get_schema_tables_result(JOIN *join,
|
|||||||
if (table_list->schema_table->fill_table == 0)
|
if (table_list->schema_table->fill_table == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Do not fill in tables thare are marked as JT_CONST as these will never
|
||||||
|
be read and they also don't have a tab->read_record.table set!
|
||||||
|
This can happen with queries like
|
||||||
|
SELECT * FROM t1 LEFT JOIN (t1 AS t1b JOIN INFORMATION_SCHEMA.ROUTINES)
|
||||||
|
ON (t1b.a IS NULL);
|
||||||
|
*/
|
||||||
|
if (tab->type == JT_CONST)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* skip I_S optimizations specific to get_all_tables */
|
/* skip I_S optimizations specific to get_all_tables */
|
||||||
if (lex->describe &&
|
if (lex->describe &&
|
||||||
(table_list->schema_table->fill_table != get_all_tables))
|
(table_list->schema_table->fill_table != get_all_tables))
|
||||||
|
@ -1021,14 +1021,14 @@ public:
|
|||||||
|
|
||||||
void store_stat_fields()
|
void store_stat_fields()
|
||||||
{
|
{
|
||||||
char buff[MAX_FIELD_WIDTH];
|
StringBuffer<MAX_FIELD_WIDTH> val;
|
||||||
String val(buff, sizeof(buff), &my_charset_bin);
|
|
||||||
|
|
||||||
MY_BITMAP *old_map= dbug_tmp_use_all_columns(stat_table, &stat_table->read_set);
|
MY_BITMAP *old_map= dbug_tmp_use_all_columns(stat_table, &stat_table->read_set);
|
||||||
for (uint i= COLUMN_STAT_MIN_VALUE; i <= COLUMN_STAT_HISTOGRAM; i++)
|
for (uint i= COLUMN_STAT_MIN_VALUE; i <= COLUMN_STAT_HISTOGRAM; i++)
|
||||||
{
|
{
|
||||||
Field *stat_field= stat_table->field[i];
|
Field *stat_field= stat_table->field[i];
|
||||||
if (table_field->collected_stats->is_null(i))
|
Column_statistics *stats= table_field->collected_stats;
|
||||||
|
if (stats->is_null(i))
|
||||||
stat_field->set_null();
|
stat_field->set_null();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1041,47 +1041,37 @@ public:
|
|||||||
and move this implementation there
|
and move this implementation there
|
||||||
*/
|
*/
|
||||||
if (table_field->type() == MYSQL_TYPE_BIT)
|
if (table_field->type() == MYSQL_TYPE_BIT)
|
||||||
stat_field->store(table_field->collected_stats->min_value->val_int(),true);
|
stat_field->store(stats->min_value->val_int(),true);
|
||||||
else
|
else
|
||||||
{
|
stats->min_value->store_to_statistical_minmax_field(stat_field, &val);
|
||||||
Field *field= table_field->collected_stats->min_value;
|
|
||||||
field->store_to_statistical_minmax_field(stat_field, &val);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COLUMN_STAT_MAX_VALUE:
|
case COLUMN_STAT_MAX_VALUE:
|
||||||
{
|
{
|
||||||
if (table_field->type() == MYSQL_TYPE_BIT)
|
if (table_field->type() == MYSQL_TYPE_BIT)
|
||||||
stat_field->store(table_field->collected_stats->max_value->val_int(),true);
|
stat_field->store(stats->max_value->val_int(),true);
|
||||||
else
|
else
|
||||||
{
|
stats->max_value->store_to_statistical_minmax_field(stat_field, &val);
|
||||||
Field *field= table_field->collected_stats->max_value;
|
|
||||||
field->store_to_statistical_minmax_field(stat_field, &val);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COLUMN_STAT_NULLS_RATIO:
|
case COLUMN_STAT_NULLS_RATIO:
|
||||||
stat_field->store(table_field->collected_stats->get_nulls_ratio());
|
stat_field->store(stats->get_nulls_ratio());
|
||||||
break;
|
break;
|
||||||
case COLUMN_STAT_AVG_LENGTH:
|
case COLUMN_STAT_AVG_LENGTH:
|
||||||
stat_field->store(table_field->collected_stats->get_avg_length());
|
stat_field->store(stats->get_avg_length());
|
||||||
break;
|
break;
|
||||||
case COLUMN_STAT_AVG_FREQUENCY:
|
case COLUMN_STAT_AVG_FREQUENCY:
|
||||||
stat_field->store(table_field->collected_stats->get_avg_frequency());
|
stat_field->store(stats->get_avg_frequency());
|
||||||
break;
|
break;
|
||||||
case COLUMN_STAT_HIST_SIZE:
|
case COLUMN_STAT_HIST_SIZE:
|
||||||
stat_field->store(table_field->collected_stats->histogram.get_size());
|
stat_field->store(stats->histogram.get_size());
|
||||||
break;
|
break;
|
||||||
case COLUMN_STAT_HIST_TYPE:
|
case COLUMN_STAT_HIST_TYPE:
|
||||||
stat_field->store(table_field->collected_stats->histogram.get_type() +
|
stat_field->store(stats->histogram.get_type() + 1);
|
||||||
1);
|
|
||||||
break;
|
break;
|
||||||
case COLUMN_STAT_HISTOGRAM:
|
case COLUMN_STAT_HISTOGRAM:
|
||||||
const char * col_histogram=
|
stat_field->store((char *)stats->histogram.get_values(),
|
||||||
(const char *) (table_field->collected_stats->histogram.get_values());
|
stats->histogram.get_size(), &my_charset_bin);
|
||||||
stat_field->store(col_histogram,
|
|
||||||
table_field->collected_stats->histogram.get_size(),
|
|
||||||
&my_charset_bin);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1139,14 +1129,20 @@ public:
|
|||||||
{
|
{
|
||||||
Field *field= table_field->read_stats->min_value;
|
Field *field= table_field->read_stats->min_value;
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
field->store_from_statistical_minmax_field(stat_field, &val);
|
if (table_field->type() == MYSQL_TYPE_BIT)
|
||||||
|
field->store(stat_field->val_int(), true);
|
||||||
|
else
|
||||||
|
field->store_from_statistical_minmax_field(stat_field, &val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COLUMN_STAT_MAX_VALUE:
|
case COLUMN_STAT_MAX_VALUE:
|
||||||
{
|
{
|
||||||
Field *field= table_field->read_stats->max_value;
|
Field *field= table_field->read_stats->max_value;
|
||||||
field->set_notnull();
|
field->set_notnull();
|
||||||
field->store_from_statistical_minmax_field(stat_field, &val);
|
if (table_field->type() == MYSQL_TYPE_BIT)
|
||||||
|
field->store(stat_field->val_int(), true);
|
||||||
|
else
|
||||||
|
field->store_from_statistical_minmax_field(stat_field, &val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COLUMN_STAT_NULLS_RATIO:
|
case COLUMN_STAT_NULLS_RATIO:
|
||||||
@ -2101,20 +2097,24 @@ void create_min_max_statistical_fields_for_table_share(THD *thd,
|
|||||||
int alloc_statistics_for_table(THD* thd, TABLE *table)
|
int alloc_statistics_for_table(THD* thd, TABLE *table)
|
||||||
{
|
{
|
||||||
Field **field_ptr;
|
Field **field_ptr;
|
||||||
uint fields;
|
|
||||||
|
|
||||||
DBUG_ENTER("alloc_statistics_for_table");
|
DBUG_ENTER("alloc_statistics_for_table");
|
||||||
|
|
||||||
|
uint columns= 0;
|
||||||
|
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||||
|
{
|
||||||
|
if (bitmap_is_set(table->read_set, (*field_ptr)->field_index))
|
||||||
|
columns++;
|
||||||
|
}
|
||||||
|
|
||||||
Table_statistics *table_stats=
|
Table_statistics *table_stats=
|
||||||
(Table_statistics *) alloc_root(&table->mem_root,
|
(Table_statistics *) alloc_root(&table->mem_root,
|
||||||
sizeof(Table_statistics));
|
sizeof(Table_statistics));
|
||||||
|
|
||||||
fields= table->s->fields ;
|
|
||||||
Column_statistics_collected *column_stats=
|
Column_statistics_collected *column_stats=
|
||||||
(Column_statistics_collected *) alloc_root(&table->mem_root,
|
(Column_statistics_collected *) alloc_root(&table->mem_root,
|
||||||
sizeof(Column_statistics_collected) *
|
sizeof(Column_statistics_collected) *
|
||||||
(fields+1));
|
columns);
|
||||||
|
|
||||||
uint keys= table->s->keys;
|
uint keys= table->s->keys;
|
||||||
Index_statistics *index_stats=
|
Index_statistics *index_stats=
|
||||||
@ -2125,16 +2125,6 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
|
|||||||
ulonglong *idx_avg_frequency= (ulonglong*) alloc_root(&table->mem_root,
|
ulonglong *idx_avg_frequency= (ulonglong*) alloc_root(&table->mem_root,
|
||||||
sizeof(ulonglong) * key_parts);
|
sizeof(ulonglong) * key_parts);
|
||||||
|
|
||||||
if (table->file->ha_rnd_init(TRUE))
|
|
||||||
DBUG_RETURN(1);
|
|
||||||
table->file->ha_rnd_end();
|
|
||||||
|
|
||||||
uint columns= 0;
|
|
||||||
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
|
||||||
{
|
|
||||||
if (bitmap_is_set(table->read_set, (*field_ptr)->field_index))
|
|
||||||
columns++;
|
|
||||||
}
|
|
||||||
uint hist_size= thd->variables.histogram_size;
|
uint hist_size= thd->variables.histogram_size;
|
||||||
Histogram_type hist_type= (Histogram_type) (thd->variables.histogram_type);
|
Histogram_type hist_type= (Histogram_type) (thd->variables.histogram_type);
|
||||||
uchar *histogram= NULL;
|
uchar *histogram= NULL;
|
||||||
@ -2156,19 +2146,17 @@ int alloc_statistics_for_table(THD* thd, TABLE *table)
|
|||||||
table_stats->idx_avg_frequency= idx_avg_frequency;
|
table_stats->idx_avg_frequency= idx_avg_frequency;
|
||||||
table_stats->histograms= histogram;
|
table_stats->histograms= histogram;
|
||||||
|
|
||||||
memset(column_stats, 0, sizeof(Column_statistics) * (fields+1));
|
memset(column_stats, 0, sizeof(Column_statistics) * columns);
|
||||||
|
|
||||||
for (field_ptr= table->field; *field_ptr; field_ptr++, column_stats++)
|
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||||
{
|
{
|
||||||
(*field_ptr)->collected_stats= column_stats;
|
|
||||||
(*field_ptr)->collected_stats->max_value= NULL;
|
|
||||||
(*field_ptr)->collected_stats->min_value= NULL;
|
|
||||||
if (bitmap_is_set(table->read_set, (*field_ptr)->field_index))
|
if (bitmap_is_set(table->read_set, (*field_ptr)->field_index))
|
||||||
{
|
{
|
||||||
column_stats->histogram.set_size(hist_size);
|
column_stats->histogram.set_size(hist_size);
|
||||||
column_stats->histogram.set_type(hist_type);
|
column_stats->histogram.set_type(hist_type);
|
||||||
column_stats->histogram.set_values(histogram);
|
column_stats->histogram.set_values(histogram);
|
||||||
histogram+= hist_size;
|
histogram+= hist_size;
|
||||||
|
(*field_ptr)->collected_stats= column_stats++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2663,7 +2651,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
|
|||||||
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||||
{
|
{
|
||||||
table_field= *field_ptr;
|
table_field= *field_ptr;
|
||||||
if (!bitmap_is_set(table->read_set, table_field->field_index))
|
if (!table_field->collected_stats)
|
||||||
continue;
|
continue;
|
||||||
table_field->collected_stats->init(thd, table_field);
|
table_field->collected_stats->init(thd, table_field);
|
||||||
}
|
}
|
||||||
@ -2688,7 +2676,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
|
|||||||
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||||
{
|
{
|
||||||
table_field= *field_ptr;
|
table_field= *field_ptr;
|
||||||
if (!bitmap_is_set(table->read_set, table_field->field_index))
|
if (!table_field->collected_stats)
|
||||||
continue;
|
continue;
|
||||||
if ((rc= table_field->collected_stats->add()))
|
if ((rc= table_field->collected_stats->add()))
|
||||||
break;
|
break;
|
||||||
@ -2718,7 +2706,7 @@ int collect_statistics_for_table(THD *thd, TABLE *table)
|
|||||||
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
for (field_ptr= table->field; *field_ptr; field_ptr++)
|
||||||
{
|
{
|
||||||
table_field= *field_ptr;
|
table_field= *field_ptr;
|
||||||
if (!bitmap_is_set(table->read_set, table_field->field_index))
|
if (!table_field->collected_stats)
|
||||||
continue;
|
continue;
|
||||||
bitmap_set_bit(table->write_set, table_field->field_index);
|
bitmap_set_bit(table->write_set, table_field->field_index);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
@ -2822,7 +2810,7 @@ int update_statistics_for_table(THD *thd, TABLE *table)
|
|||||||
for (Field **field_ptr= table->field; *field_ptr; field_ptr++)
|
for (Field **field_ptr= table->field; *field_ptr; field_ptr++)
|
||||||
{
|
{
|
||||||
Field *table_field= *field_ptr;
|
Field *table_field= *field_ptr;
|
||||||
if (!bitmap_is_set(table->read_set, table_field->field_index))
|
if (!table_field->collected_stats)
|
||||||
continue;
|
continue;
|
||||||
restore_record(stat_table, s->default_values);
|
restore_record(stat_table, s->default_values);
|
||||||
column_stat.set_key_fields(table_field);
|
column_stat.set_key_fields(table_field);
|
||||||
@ -3757,6 +3745,7 @@ double get_column_range_cardinality(Field *field,
|
|||||||
if (!table->stats_is_read)
|
if (!table->stats_is_read)
|
||||||
return tab_records;
|
return tab_records;
|
||||||
|
|
||||||
|
THD *thd= table->in_use;
|
||||||
double col_nulls= tab_records * col_stats->get_nulls_ratio();
|
double col_nulls= tab_records * col_stats->get_nulls_ratio();
|
||||||
|
|
||||||
double col_non_nulls= tab_records - col_nulls;
|
double col_non_nulls= tab_records - col_nulls;
|
||||||
@ -3787,7 +3776,7 @@ double get_column_range_cardinality(Field *field,
|
|||||||
col_stats->min_max_values_are_provided())
|
col_stats->min_max_values_are_provided())
|
||||||
{
|
{
|
||||||
Histogram *hist= &col_stats->histogram;
|
Histogram *hist= &col_stats->histogram;
|
||||||
if (hist->is_available())
|
if (hist->is_usable(thd))
|
||||||
{
|
{
|
||||||
store_key_image_to_rec(field, (uchar *) min_endp->key,
|
store_key_image_to_rec(field, (uchar *) min_endp->key,
|
||||||
field->key_length());
|
field->key_length());
|
||||||
@ -3831,10 +3820,10 @@ double get_column_range_cardinality(Field *field,
|
|||||||
max_mp_pos= 1.0;
|
max_mp_pos= 1.0;
|
||||||
|
|
||||||
Histogram *hist= &col_stats->histogram;
|
Histogram *hist= &col_stats->histogram;
|
||||||
if (!hist->is_available())
|
if (hist->is_usable(thd))
|
||||||
sel= (max_mp_pos - min_mp_pos);
|
|
||||||
else
|
|
||||||
sel= hist->range_selectivity(min_mp_pos, max_mp_pos);
|
sel= hist->range_selectivity(min_mp_pos, max_mp_pos);
|
||||||
|
else
|
||||||
|
sel= (max_mp_pos - min_mp_pos);
|
||||||
res= col_non_nulls * sel;
|
res= col_non_nulls * sel;
|
||||||
set_if_bigger(res, col_stats->get_avg_frequency());
|
set_if_bigger(res, col_stats->get_avg_frequency());
|
||||||
}
|
}
|
||||||
|
@ -239,6 +239,17 @@ public:
|
|||||||
|
|
||||||
bool is_available() { return get_size() > 0 && get_values(); }
|
bool is_available() { return get_size() > 0 && get_values(); }
|
||||||
|
|
||||||
|
/*
|
||||||
|
This function checks that histograms should be usable only when
|
||||||
|
1) the level of optimizer_use_condition_selectivity > 3
|
||||||
|
2) histograms have been collected
|
||||||
|
*/
|
||||||
|
bool is_usable(THD *thd)
|
||||||
|
{
|
||||||
|
return thd->variables.optimizer_use_condition_selectivity > 3 &&
|
||||||
|
is_available();
|
||||||
|
}
|
||||||
|
|
||||||
void set_value(uint i, double val)
|
void set_value(uint i, double val)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -427,20 +427,23 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
|
|||||||
bool hton_can_recreate;
|
bool hton_can_recreate;
|
||||||
|
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
if (WSREP(thd))
|
if (WSREP(thd) && wsrep_thd_is_local(thd))
|
||||||
{
|
{
|
||||||
wsrep::key_array keys;
|
wsrep::key_array keys;
|
||||||
wsrep_append_fk_parent_table(thd, table_ref, &keys);
|
/* Do not start TOI if table is not found */
|
||||||
if (keys.empty())
|
if (!wsrep_append_fk_parent_table(thd, table_ref, &keys))
|
||||||
{
|
{
|
||||||
WSREP_TO_ISOLATION_BEGIN_IF(table_ref->db.str, table_ref->table_name.str, NULL)
|
if (keys.empty())
|
||||||
{
|
{
|
||||||
DBUG_RETURN(TRUE);
|
WSREP_TO_ISOLATION_BEGIN_IF(table_ref->db.str, table_ref->table_name.str, NULL)
|
||||||
}
|
{
|
||||||
} else {
|
DBUG_RETURN(TRUE);
|
||||||
WSREP_TO_ISOLATION_BEGIN_FK_TABLES(NULL, NULL, table_ref, &keys)
|
}
|
||||||
{
|
} else {
|
||||||
DBUG_RETURN(TRUE);
|
WSREP_TO_ISOLATION_BEGIN_FK_TABLES(NULL, NULL, table_ref, &keys)
|
||||||
|
{
|
||||||
|
DBUG_RETURN(TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -372,6 +372,13 @@ int table_value_constr::save_explain_data_intern(THD *thd,
|
|||||||
if (select_lex->master_unit()->derived)
|
if (select_lex->master_unit()->derived)
|
||||||
explain->connection_type= Explain_node::EXPLAIN_NODE_DERIVED;
|
explain->connection_type= Explain_node::EXPLAIN_NODE_DERIVED;
|
||||||
|
|
||||||
|
for (SELECT_LEX_UNIT *unit= select_lex->first_inner_unit();
|
||||||
|
unit;
|
||||||
|
unit= unit->next_unit())
|
||||||
|
{
|
||||||
|
explain->add_child(unit->first_select()->select_number);
|
||||||
|
}
|
||||||
|
|
||||||
output->add_node(explain);
|
output->add_node(explain);
|
||||||
|
|
||||||
if (select_lex->is_top_level_node())
|
if (select_lex->is_top_level_node())
|
||||||
@ -396,9 +403,14 @@ bool table_value_constr::optimize(THD *thd)
|
|||||||
thd->lex->explain && // for "SET" command in SPs.
|
thd->lex->explain && // for "SET" command in SPs.
|
||||||
(!thd->lex->explain->get_select(select_lex->select_number)))
|
(!thd->lex->explain->get_select(select_lex->select_number)))
|
||||||
{
|
{
|
||||||
return save_explain_data_intern(thd, thd->lex->explain);
|
if (save_explain_data_intern(thd, thd->lex->explain))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
if (select_lex->optimize_unflattened_subqueries(true))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -811,11 +823,12 @@ st_select_lex *wrap_tvc_with_tail(THD *thd, st_select_lex *tvc_sl)
|
|||||||
SELECT * FROM (VALUES (v1), ... (vn)) tvc_x
|
SELECT * FROM (VALUES (v1), ... (vn)) tvc_x
|
||||||
and replaces the subselect with the result of the transformation.
|
and replaces the subselect with the result of the transformation.
|
||||||
|
|
||||||
@retval false if successfull
|
@retval wrapping select if successful
|
||||||
true otherwise
|
0 otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Item_subselect::wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl)
|
st_select_lex *
|
||||||
|
Item_subselect::wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl)
|
||||||
{
|
{
|
||||||
LEX *lex= thd->lex;
|
LEX *lex= thd->lex;
|
||||||
/* SELECT_LEX object where the transformation is performed */
|
/* SELECT_LEX object where the transformation is performed */
|
||||||
@ -826,12 +839,12 @@ bool Item_subselect::wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl)
|
|||||||
if (engine->engine_type() == subselect_engine::SINGLE_SELECT_ENGINE)
|
if (engine->engine_type() == subselect_engine::SINGLE_SELECT_ENGINE)
|
||||||
((subselect_single_select_engine *) engine)->change_select(wrapper_sl);
|
((subselect_single_select_engine *) engine)->change_select(wrapper_sl);
|
||||||
lex->current_select= wrapper_sl;
|
lex->current_select= wrapper_sl;
|
||||||
return false;
|
return wrapper_sl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lex->current_select= parent_select;
|
lex->current_select= parent_select;
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3050,14 +3050,18 @@ bool multi_update::send_eof()
|
|||||||
DBUG_ASSERT(trans_safe || !updated ||
|
DBUG_ASSERT(trans_safe || !updated ||
|
||||||
thd->transaction->stmt.modified_non_trans_table);
|
thd->transaction->stmt.modified_non_trans_table);
|
||||||
|
|
||||||
if (likely(local_error != 0))
|
if (unlikely(local_error))
|
||||||
error_handled= TRUE; // to force early leave from ::abort_result_set()
|
|
||||||
|
|
||||||
if (unlikely(local_error > 0)) // if the above log write did not fail ...
|
|
||||||
{
|
{
|
||||||
/* Safety: If we haven't got an error before (can happen in do_updates) */
|
error_handled= TRUE; // to force early leave from ::abort_result_set()
|
||||||
my_message(ER_UNKNOWN_ERROR, "An error occurred in multi-table update",
|
if (thd->killed == NOT_KILLED && !thd->get_stmt_da()->is_set())
|
||||||
MYF(0));
|
{
|
||||||
|
/*
|
||||||
|
No error message was sent and query was not killed (in which case
|
||||||
|
mysql_execute_command() will send the error mesage).
|
||||||
|
*/
|
||||||
|
my_message(ER_UNKNOWN_ERROR, "An error occurred in multi-table update",
|
||||||
|
MYF(0));
|
||||||
|
}
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class engine_option_value;
|
|||||||
struct ha_index_option_struct;
|
struct ha_index_option_struct;
|
||||||
|
|
||||||
typedef struct st_key {
|
typedef struct st_key {
|
||||||
uint key_length; /* Tot length of key */
|
uint key_length; /* total length of user defined key parts */
|
||||||
ulong flags; /* dupp key and pack flags */
|
ulong flags; /* dupp key and pack flags */
|
||||||
uint user_defined_key_parts; /* How many key_parts */
|
uint user_defined_key_parts; /* How many key_parts */
|
||||||
uint usable_key_parts; /* Should normally be = user_defined_key_parts */
|
uint usable_key_parts; /* Should normally be = user_defined_key_parts */
|
||||||
|
@ -2943,7 +2943,8 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||||||
key_part->key_part_flag|= field->key_part_flag();
|
key_part->key_part_flag|= field->key_part_flag();
|
||||||
uint16 key_part_length_bytes= field->key_part_length_bytes();
|
uint16 key_part_length_bytes= field->key_part_length_bytes();
|
||||||
key_part->store_length+= key_part_length_bytes;
|
key_part->store_length+= key_part_length_bytes;
|
||||||
keyinfo->key_length+= key_part_length_bytes;
|
if (i < keyinfo->user_defined_key_parts)
|
||||||
|
keyinfo->key_length+= key_part_length_bytes;
|
||||||
|
|
||||||
if (i == 0 && key != primary_key)
|
if (i == 0 && key != primary_key)
|
||||||
field->flags |= (((keyinfo->flags & HA_NOSAME ||
|
field->flags |= (((keyinfo->flags & HA_NOSAME ||
|
||||||
@ -3037,7 +3038,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||||||
|
|
||||||
set_if_bigger(share->max_key_length,keyinfo->key_length+
|
set_if_bigger(share->max_key_length,keyinfo->key_length+
|
||||||
keyinfo->user_defined_key_parts);
|
keyinfo->user_defined_key_parts);
|
||||||
share->total_key_length+= keyinfo->key_length;
|
|
||||||
/*
|
/*
|
||||||
MERGE tables do not have unique indexes. But every key could be
|
MERGE tables do not have unique indexes. But every key could be
|
||||||
an unique index on the underlying MyISAM table. (Bug #10400)
|
an unique index on the underlying MyISAM table. (Bug #10400)
|
||||||
|
@ -815,7 +815,7 @@ struct TABLE_SHARE
|
|||||||
uint rec_buff_length; /* Size of table->record[] buffer */
|
uint rec_buff_length; /* Size of table->record[] buffer */
|
||||||
uint keys, key_parts;
|
uint keys, key_parts;
|
||||||
uint ext_key_parts; /* Total number of key parts in extended keys */
|
uint ext_key_parts; /* Total number of key parts in extended keys */
|
||||||
uint max_key_length, max_unique_length, total_key_length;
|
uint max_key_length, max_unique_length;
|
||||||
uint uniques; /* Number of UNIQUE index */
|
uint uniques; /* Number of UNIQUE index */
|
||||||
uint db_create_options; /* Create options from database */
|
uint db_create_options; /* Create options from database */
|
||||||
uint db_options_in_use; /* Options in use */
|
uint db_options_in_use; /* Options in use */
|
||||||
|
@ -1261,10 +1261,17 @@ void wsrep_keys_free(wsrep_key_arr_t* key_arr)
|
|||||||
key_arr->keys_len= 0;
|
key_arr->keys_len= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/*!
|
||||||
|
* @param thd thread
|
||||||
|
* @param tables list of tables
|
||||||
|
* @param keys prepared keys
|
||||||
|
|
||||||
|
* @return true if parent table append was successfull, otherwise false.
|
||||||
|
*/
|
||||||
|
bool
|
||||||
wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* keys)
|
wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* keys)
|
||||||
{
|
{
|
||||||
if (!WSREP(thd) || !WSREP_CLIENT(thd)) return;
|
bool fail= false;
|
||||||
TABLE_LIST *table;
|
TABLE_LIST *table;
|
||||||
|
|
||||||
thd->release_transactional_locks();
|
thd->release_transactional_locks();
|
||||||
@ -1275,6 +1282,8 @@ wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* key
|
|||||||
open_tables(thd, &tables, &counter, MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL))
|
open_tables(thd, &tables, &counter, MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL))
|
||||||
{
|
{
|
||||||
WSREP_DEBUG("unable to open table for FK checks for %s", thd->query());
|
WSREP_DEBUG("unable to open table for FK checks for %s", thd->query());
|
||||||
|
fail= true;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (table= tables; table; table= table->next_local)
|
for (table= tables; table; table= table->next_local)
|
||||||
@ -1296,14 +1305,18 @@ wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* tables, wsrep::key_array* key
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
/* close the table and release MDL locks */
|
/* close the table and release MDL locks */
|
||||||
close_thread_tables(thd);
|
close_thread_tables(thd);
|
||||||
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
|
thd->mdl_context.rollback_to_savepoint(mdl_savepoint);
|
||||||
for (table= tables; table; table= table->next_local)
|
for (table= tables; table; table= table->next_local)
|
||||||
{
|
{
|
||||||
table->table= NULL;
|
table->table= NULL;
|
||||||
|
table->next_global= NULL;
|
||||||
table->mdl_request.ticket= NULL;
|
table->mdl_request.ticket= NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -216,7 +216,7 @@ wsrep_sync_wait_upto (THD* thd, wsrep_gtid_t* upto, int timeout);
|
|||||||
extern void wsrep_last_committed_id (wsrep_gtid_t* gtid);
|
extern void wsrep_last_committed_id (wsrep_gtid_t* gtid);
|
||||||
extern int wsrep_check_opts();
|
extern int wsrep_check_opts();
|
||||||
extern void wsrep_prepend_PATH (const char* path);
|
extern void wsrep_prepend_PATH (const char* path);
|
||||||
void wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* table, wsrep::key_array* keys);
|
extern bool wsrep_append_fk_parent_table(THD* thd, TABLE_LIST* table, wsrep::key_array* keys);
|
||||||
|
|
||||||
/* Other global variables */
|
/* Other global variables */
|
||||||
extern wsrep_seqno_t wsrep_locked_seqno;
|
extern wsrep_seqno_t wsrep_locked_seqno;
|
||||||
|
@ -772,8 +772,20 @@ static size_t estimate_cmd_len (bool* extra_args)
|
|||||||
char c;
|
char c;
|
||||||
while ((c = *arg++) != 0)
|
while ((c = *arg++) != 0)
|
||||||
{
|
{
|
||||||
/* A whitespace or a single quote requires double quotation marks: */
|
/*
|
||||||
if (isspace(c) || c == '\'')
|
Space, single quote, ampersand, and I/O redirection characters
|
||||||
|
require text to be enclosed in double quotes:
|
||||||
|
*/
|
||||||
|
if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
|
||||||
|
#ifdef __WIN__
|
||||||
|
c == '>' || c == '<')
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
The semicolon is used to separate shell commands, so it must be
|
||||||
|
enclosed in double quotes as well:
|
||||||
|
*/
|
||||||
|
c == '>' || c == '<' || c == ';')
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
quotation= true;
|
quotation= true;
|
||||||
}
|
}
|
||||||
@ -796,10 +808,19 @@ static size_t estimate_cmd_len (bool* extra_args)
|
|||||||
while ((c = *arg++) != 0)
|
while ((c = *arg++) != 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
A whitespace or a single quote requires double
|
Space, single quote, ampersand, and I/O redirection characters
|
||||||
quotation marks:
|
require text to be enclosed in double quotes:
|
||||||
*/
|
*/
|
||||||
if (isspace(c) || c == '\'')
|
if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
|
||||||
|
#ifdef __WIN__
|
||||||
|
c == '>' || c == '<')
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
The semicolon is used to separate shell commands, so it must be
|
||||||
|
enclosed in double quotes as well:
|
||||||
|
*/
|
||||||
|
c == '>' || c == '<' || c == ';')
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
quotation= true;
|
quotation= true;
|
||||||
}
|
}
|
||||||
@ -880,8 +901,20 @@ static void copy_orig_argv (char* cmd_str)
|
|||||||
char c;
|
char c;
|
||||||
while ((c = *arg_scan++) != 0)
|
while ((c = *arg_scan++) != 0)
|
||||||
{
|
{
|
||||||
/* A whitespace or a single quote requires double quotation marks: */
|
/*
|
||||||
if (isspace(c) || c == '\'')
|
Space, single quote, ampersand, and I/O redirection characters
|
||||||
|
require text to be enclosed in double quotes:
|
||||||
|
*/
|
||||||
|
if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
|
||||||
|
#ifdef __WIN__
|
||||||
|
c == '>' || c == '<')
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
The semicolon is used to separate shell commands, so it must be
|
||||||
|
enclosed in double quotes as well:
|
||||||
|
*/
|
||||||
|
c == '>' || c == '<' || c == ';')
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
quotation= true;
|
quotation= true;
|
||||||
}
|
}
|
||||||
@ -955,10 +988,19 @@ static void copy_orig_argv (char* cmd_str)
|
|||||||
while ((c = *arg_scan++) != 0)
|
while ((c = *arg_scan++) != 0)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
A whitespace or a single quote requires double
|
Space, single quote, ampersand, and I/O redirection characters
|
||||||
quotation marks:
|
require text to be enclosed in double quotes:
|
||||||
*/
|
*/
|
||||||
if (isspace(c) || c == '\'')
|
if (isspace(c) || c == '\'' || c == '&' || c == '|' ||
|
||||||
|
#ifdef __WIN__
|
||||||
|
c == '>' || c == '<')
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
The semicolon is used to separate shell commands, so it must be
|
||||||
|
enclosed in double quotes as well:
|
||||||
|
*/
|
||||||
|
c == '>' || c == '<' || c == ';')
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
quotation= true;
|
quotation= true;
|
||||||
}
|
}
|
||||||
|
@ -497,15 +497,21 @@ bool wsrep_provider_options_check(sys_var *self, THD* thd, set_var* var)
|
|||||||
|
|
||||||
bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type)
|
bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type)
|
||||||
{
|
{
|
||||||
enum wsrep::provider::status ret=
|
if (wsrep_provider_options)
|
||||||
Wsrep_server_state::instance().provider().options(wsrep_provider_options);
|
|
||||||
if (ret)
|
|
||||||
{
|
{
|
||||||
WSREP_ERROR("Set options returned %d", ret);
|
enum wsrep::provider::status ret=
|
||||||
refresh_provider_options();
|
Wsrep_server_state::instance().provider().options(wsrep_provider_options);
|
||||||
return true;
|
if (ret)
|
||||||
|
{
|
||||||
|
WSREP_ERROR("Set options returned %d", ret);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return refresh_provider_options();
|
||||||
}
|
}
|
||||||
return refresh_provider_options();
|
err:
|
||||||
|
refresh_provider_options();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wsrep_provider_options_init(const char* value)
|
void wsrep_provider_options_init(const char* value)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2008, Google Inc.
|
Copyright (c) 2008, Google Inc.
|
||||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
Copyright (c) 2017, 2021, MariaDB Corporation.
|
||||||
|
|
||||||
Portions of this file contain modifications contributed and copyrighted by
|
Portions of this file contain modifications contributed and copyrighted by
|
||||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||||
@ -707,6 +707,12 @@ btr_search_update_hash_ref(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index != cursor->index) {
|
||||||
|
ut_ad(index->id == cursor->index->id);
|
||||||
|
btr_search_drop_page_hash_index(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ut_ad(block->page.id().space() == index->table->space_id);
|
ut_ad(block->page.id().space() == index->table->space_id);
|
||||||
ut_ad(index == cursor->index);
|
ut_ad(index == cursor->index);
|
||||||
ut_ad(!dict_index_is_ibuf(index));
|
ut_ad(!dict_index_is_ibuf(index));
|
||||||
@ -1276,12 +1282,13 @@ retry:
|
|||||||
rw_lock_s_lock(&part->latch);
|
rw_lock_s_lock(&part->latch);
|
||||||
assert_block_ahi_valid(block);
|
assert_block_ahi_valid(block);
|
||||||
|
|
||||||
if (!block->index || !btr_search_enabled) {
|
dict_index_t* index = block->index;
|
||||||
|
|
||||||
|
if (!index || !btr_search_enabled) {
|
||||||
rw_lock_s_unlock(&part->latch);
|
rw_lock_s_unlock(&part->latch);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dict_index_t* index = block->index;
|
|
||||||
#ifdef MYSQL_INDEX_DISABLE_AHI
|
#ifdef MYSQL_INDEX_DISABLE_AHI
|
||||||
ut_ad(!index->disable_ahi);
|
ut_ad(!index->disable_ahi);
|
||||||
#endif
|
#endif
|
||||||
@ -1732,6 +1739,7 @@ btr_search_move_or_delete_hash_entries(
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
||||||
if (new_block->index) {
|
if (new_block->index) {
|
||||||
|
drop_exit:
|
||||||
btr_search_drop_page_hash_index(block);
|
btr_search_drop_page_hash_index(block);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1740,6 +1748,10 @@ btr_search_move_or_delete_hash_entries(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index->freed()) {
|
||||||
|
goto drop_exit;
|
||||||
|
}
|
||||||
|
|
||||||
rw_lock_s_lock(ahi_latch);
|
rw_lock_s_lock(ahi_latch);
|
||||||
|
|
||||||
if (block->index) {
|
if (block->index) {
|
||||||
@ -1801,6 +1813,11 @@ void btr_search_update_hash_on_delete(btr_cur_t* cursor)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index != cursor->index) {
|
||||||
|
btr_search_drop_page_hash_index(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ut_ad(block->page.id().space() == index->table->space_id);
|
ut_ad(block->page.id().space() == index->table->space_id);
|
||||||
ut_a(index == cursor->index);
|
ut_a(index == cursor->index);
|
||||||
ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0);
|
ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0);
|
||||||
@ -1871,6 +1888,12 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (index != cursor->index) {
|
||||||
|
ut_ad(index->id == cursor->index->id);
|
||||||
|
btr_search_drop_page_hash_index(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ut_a(cursor->index == index);
|
ut_a(cursor->index == index);
|
||||||
ut_ad(!dict_index_is_ibuf(index));
|
ut_ad(!dict_index_is_ibuf(index));
|
||||||
rw_lock_x_lock(ahi_latch);
|
rw_lock_x_lock(ahi_latch);
|
||||||
@ -1959,6 +1982,12 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch)
|
|||||||
#ifdef MYSQL_INDEX_DISABLE_AHI
|
#ifdef MYSQL_INDEX_DISABLE_AHI
|
||||||
ut_a(!index->disable_ahi);
|
ut_a(!index->disable_ahi);
|
||||||
#endif
|
#endif
|
||||||
|
if (index != cursor->index) {
|
||||||
|
ut_ad(index->id == cursor->index->id);
|
||||||
|
btr_search_drop_page_hash_index(block);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ut_a(index == cursor->index);
|
ut_a(index == cursor->index);
|
||||||
ut_ad(!dict_index_is_ibuf(index));
|
ut_ad(!dict_index_is_ibuf(index));
|
||||||
|
|
||||||
|
@ -8903,6 +8903,7 @@ innobase_rename_column_try(
|
|||||||
const char* to)
|
const char* to)
|
||||||
{
|
{
|
||||||
dberr_t error;
|
dberr_t error;
|
||||||
|
bool clust_has_prefixes = false;
|
||||||
|
|
||||||
DBUG_ENTER("innobase_rename_column_try");
|
DBUG_ENTER("innobase_rename_column_try");
|
||||||
|
|
||||||
@ -8962,6 +8963,39 @@ innobase_rename_column_try(
|
|||||||
if (error != DB_SUCCESS) {
|
if (error != DB_SUCCESS) {
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!has_prefixes || !clust_has_prefixes
|
||||||
|
|| f.prefix_len) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For secondary indexes, the
|
||||||
|
has_prefixes check can be 'polluted'
|
||||||
|
by PRIMARY KEY column prefix. Try also
|
||||||
|
the simpler encoding of SYS_FIELDS.POS. */
|
||||||
|
info = pars_info_create();
|
||||||
|
|
||||||
|
pars_info_add_ull_literal(info, "indexid", index->id);
|
||||||
|
pars_info_add_int4_literal(info, "nth", i);
|
||||||
|
pars_info_add_str_literal(info, "new", to);
|
||||||
|
|
||||||
|
error = que_eval_sql(
|
||||||
|
info,
|
||||||
|
"PROCEDURE RENAME_SYS_FIELDS_PROC () IS\n"
|
||||||
|
"BEGIN\n"
|
||||||
|
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
|
||||||
|
"WHERE INDEX_ID=:indexid\n"
|
||||||
|
"AND POS=:nth;\n"
|
||||||
|
"END;\n",
|
||||||
|
FALSE, trx);
|
||||||
|
|
||||||
|
if (error != DB_SUCCESS) {
|
||||||
|
goto err_exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index == dict_table_get_first_index(ctx.old_table)) {
|
||||||
|
clust_has_prefixes = has_prefixes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ KEY `d` (`d`)
|
|||||||
INSERT INTO t1 VALUES (100, 'aaabbb', UNIX_TIMESTAMP(), 200);
|
INSERT INTO t1 VALUES (100, 'aaabbb', UNIX_TIMESTAMP(), 200);
|
||||||
EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(d);
|
EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(d);
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 index NULL d 11 NULL # Using index
|
1 SIMPLE t1 index NULL d 9 NULL # Using index
|
||||||
# segfault here without the fix
|
# segfault here without the fix
|
||||||
SELECT COUNT(*) FROM t1 FORCE INDEX(d);
|
SELECT COUNT(*) FROM t1 FORCE INDEX(d);
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
|
@ -546,7 +546,7 @@ pk key1 col1
|
|||||||
explain
|
explain
|
||||||
select key1 from t30;
|
select key1 from t30;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t30 index NULL key1 20 NULL # Using index
|
1 SIMPLE t30 index NULL key1 18 NULL # Using index
|
||||||
select key1 from t30;
|
select key1 from t30;
|
||||||
key1
|
key1
|
||||||
row1-key
|
row1-key
|
||||||
@ -618,7 +618,7 @@ row3 row3-key row3-data
|
|||||||
explain
|
explain
|
||||||
select * from t30 order by key1 limit 3;
|
select * from t30 order by key1 limit 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t30 index NULL key1 20 NULL #
|
1 SIMPLE t30 index NULL key1 18 NULL #
|
||||||
select * from t30 order by key1 limit 3;
|
select * from t30 order by key1 limit 3;
|
||||||
pk key1 col1
|
pk key1 col1
|
||||||
row1 row1-key row1-data
|
row1 row1-key row1-data
|
||||||
@ -627,7 +627,7 @@ row3 row3-key row3-data
|
|||||||
explain
|
explain
|
||||||
select * from t30 order by key1 desc limit 3;
|
select * from t30 order by key1 desc limit 3;
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t30 index NULL key1 20 NULL #
|
1 SIMPLE t30 index NULL key1 18 NULL #
|
||||||
select * from t30 order by key1 desc limit 3;
|
select * from t30 order by key1 desc limit 3;
|
||||||
pk key1 col1
|
pk key1 col1
|
||||||
row5 row5-key row5-data
|
row5 row5-key row5-data
|
||||||
|
@ -177,9 +177,8 @@ Note 1265 Data truncated for column 'a' at row 2
|
|||||||
insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
|
insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1264 Out of range value for column 'a' at row 1
|
Warning 1264 Out of range value for column 'a' at row 1
|
||||||
Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2
|
Warning 1264 Out of range value for column 'a' at row 2
|
||||||
Note 1265 Data truncated for column 'a' at row 3
|
Note 1265 Data truncated for column 'a' at row 3
|
||||||
Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4
|
|
||||||
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
|
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
|
||||||
Warnings:
|
Warnings:
|
||||||
Warning 1265 Data truncated for column 'a' at row 1
|
Warning 1265 Data truncated for column 'a' at row 1
|
||||||
@ -210,7 +209,7 @@ a
|
|||||||
99999999.99
|
99999999.99
|
||||||
0.00
|
0.00
|
||||||
99999999.99
|
99999999.99
|
||||||
0.00
|
99999999.99
|
||||||
0.00
|
0.00
|
||||||
0.00
|
0.00
|
||||||
123.40
|
123.40
|
||||||
|
@ -921,20 +921,75 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed)
|
|||||||
if (endp+1 < end_of_string && (*endp == 'e' || *endp == 'E'))
|
if (endp+1 < end_of_string && (*endp == 'e' || *endp == 'E'))
|
||||||
{
|
{
|
||||||
int str_error;
|
int str_error;
|
||||||
longlong exponent= my_strtoll10(endp+1, (char**) &end_of_string,
|
const char *end_of_exponent= end_of_string;
|
||||||
|
longlong exponent= my_strtoll10(endp+1, (char**) &end_of_exponent,
|
||||||
&str_error);
|
&str_error);
|
||||||
|
|
||||||
if (end_of_string != endp +1) /* If at least one digit */
|
if (end_of_exponent != endp +1) /* If at least one digit */
|
||||||
{
|
{
|
||||||
*end= (char*) end_of_string;
|
*end= (char*) end_of_exponent;
|
||||||
if (str_error > 0)
|
if (str_error > 0)
|
||||||
{
|
{
|
||||||
|
if (str_error == MY_ERRNO_ERANGE)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Exponent is:
|
||||||
|
- a huge positive number that does not fit into ulonglong
|
||||||
|
- a huge negative number that does not fit into longlong
|
||||||
|
Skip all remaining digits.
|
||||||
|
*/
|
||||||
|
for ( ; end_of_exponent < end_of_string &&
|
||||||
|
my_isdigit(&my_charset_latin1, *end_of_exponent)
|
||||||
|
; end_of_exponent++)
|
||||||
|
{ }
|
||||||
|
*end= (char*) end_of_exponent;
|
||||||
|
if (exponent == ~0)
|
||||||
|
{
|
||||||
|
if (!decimal_is_zero(to))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Non-zero mantissa and a huge positive exponent that
|
||||||
|
does not fit into ulonglong, e.g.:
|
||||||
|
1e111111111111111111111
|
||||||
|
*/
|
||||||
|
error= E_DEC_OVERFLOW;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Zero mantissa and a huge positive exponent that
|
||||||
|
does not fit into ulonglong, e.g.:
|
||||||
|
0e111111111111111111111
|
||||||
|
Return zero without warnings.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
Huge negative exponent that does not fit into longlong, e.g.
|
||||||
|
1e-111111111111111111111
|
||||||
|
0e-111111111111111111111
|
||||||
|
Return zero without warnings.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
goto fatal_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Some other error, e.g. MY_ERRNO_EDOM
|
||||||
|
*/
|
||||||
error= E_DEC_BAD_NUM;
|
error= E_DEC_BAD_NUM;
|
||||||
goto fatal_error;
|
goto fatal_error;
|
||||||
}
|
}
|
||||||
if (exponent > INT_MAX/2 || (str_error == 0 && exponent < 0))
|
if (exponent > INT_MAX/2 || (str_error == 0 && exponent < 0))
|
||||||
{
|
{
|
||||||
error= E_DEC_OVERFLOW;
|
/*
|
||||||
|
The exponent fits into ulonglong, but it's still huge, e.g.
|
||||||
|
1e1111111111
|
||||||
|
*/
|
||||||
|
if (!decimal_is_zero(to))
|
||||||
|
error= E_DEC_OVERFLOW;
|
||||||
goto fatal_error;
|
goto fatal_error;
|
||||||
}
|
}
|
||||||
if (exponent < INT_MIN/2 && error != E_DEC_OVERFLOW)
|
if (exponent < INT_MIN/2 && error != E_DEC_OVERFLOW)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SET(HEIDISQL_BASE_NAME "HeidiSQL_11.0_32_Portable")
|
SET(HEIDISQL_BASE_NAME "HeidiSQL_11.2_32_Portable")
|
||||||
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
|
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
|
||||||
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
|
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
|
||||||
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
|
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user