Merge branch '11.0' into 11.1

This commit is contained in:
Sergei Golubchik 2023-09-29 13:58:47 +02:00
commit 05d850d4b3
32 changed files with 397 additions and 147 deletions

1
.gitignore vendored
View file

@ -187,6 +187,7 @@ sql-bench/innotest1b.pl
sql-bench/innotest2.pl
sql-bench/innotest2a.pl
sql-bench/innotest2b.pl
sql-bench/output
sql-bench/run-all-tests.pl
sql-bench/server-cfg.pl
sql-bench/test-ATIS.pl

View file

@ -33,8 +33,9 @@ MACRO (CHECK_LIBFMT)
#include <fmt/format-inl.h>
#include <iostream>
int main() {
int answer= 42;
fmt::format_args::format_arg arg=
fmt::detail::make_arg<fmt::format_context>(42);
fmt::detail::make_arg<fmt::format_context>(answer);
std::cout << fmt::vformat(\"The answer is {}.\",
fmt::format_args(&arg, 1));
}" HAVE_SYSTEM_LIBFMT)

View file

@ -219,9 +219,7 @@ enum ha_extra_function {
/** Start writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_BEGIN_ALTER_COPY,
/** Finish writing rows during ALTER TABLE...ALGORITHM=COPY. */
HA_EXTRA_END_ALTER_COPY,
/** IGNORE is being used for the insert statement */
HA_EXTRA_IGNORE_INSERT
HA_EXTRA_END_ALTER_COPY
};
/* Compatible option, to be deleted in 6.0 */

View file

@ -4,4 +4,4 @@
log-bin=mysqld-bin
log-slave-updates
binlog-format=ROW
wsrep-replicate-myisam=ON
wsrep_mode=REPLICATE_MYISAM

View file

@ -0,0 +1,2 @@
423a424
> ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.

View file

@ -28,6 +28,7 @@ DROP DATABASE db1;
#
# End of 10.6 tests
#
SET foreign_key_checks=0, unique_checks=0;
#
# MDEV-30796 Auto_increment values not updated after bulk
# insert operation
@ -35,7 +36,21 @@ DROP DATABASE db1;
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`f2` int(11) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
# restart
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`f2` int(11) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1(f2) VALUES(5);
SELECT max(f1) FROM t1;
max(f1)

View file

@ -435,6 +435,14 @@ CREATE TABLE t1 (pk int primary key, c01 text, c02 text, c03 text,
SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT;
--replace_result 1982 8126 4030 8126
ALTER TABLE t1 FORCE;
let $page_size= `SELECT @@innodb_page_size`;
let $error_code = 0;
if ($page_size == 4096) {
let $error_code = ER_TOO_BIG_ROWSIZE;
}
--error $error_code
INSERT IGNORE INTO t1 VALUES
(1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)),
(2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107));

View file

@ -42,6 +42,7 @@ DROP DATABASE db1;
--echo # End of 10.6 tests
--echo #
SET foreign_key_checks=0, unique_checks=0;
--echo #
--echo # MDEV-30796 Auto_increment values not updated after bulk
--echo # insert operation
@ -49,7 +50,9 @@ DROP DATABASE db1;
CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT,
f2 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 2), (25, 3), (2, 4);
SHOW CREATE TABLE t1;
--source include/restart_mysqld.inc
SHOW CREATE TABLE t1;
INSERT INTO t1(f2) VALUES(5);
SELECT max(f1) FROM t1;
DROP TABLE t1;

View file

@ -4,13 +4,13 @@ package My::Suite::Vault;
use strict;
return "Hashicorp Vault key management utility not found"
unless `sh -c "command -v vault"`;
return "You need to set the value of the VAULT_ADDR variable"
unless $ENV{VAULT_ADDR};
return "You need to set the value of the VAULT_TOKEN variable"
unless $ENV{VAULT_TOKEN};
return "Hashicorp Vault key management utility not found"
unless `sh -c "command -v vault"`;
bless {};

View file

@ -3187,3 +3187,18 @@ SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1);
d
00000000-0000-0000-0000-111111111111
DROP TABLE t1;
#
# MDEV-31719 Wrong result of: WHERE inet6_column IN ('','::1')
#
CREATE TABLE t1 (a UUID);
INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
SELECT * FROM t1 WHERE a IN ('','00000000-0000-0000-0000-000000000001');
a
Warnings:
Warning 1292 Incorrect uuid value: ''
SELECT * FROM t1 WHERE a='';
a
Warnings:
Warning 1292 Incorrect uuid value: ''
Warning 1292 Incorrect uuid value: ''
DROP TABLE t1;

View file

@ -1682,3 +1682,14 @@ SELECT * FROM t1 ORDER BY d;
SELECT * FROM t1 WHERE d <= ALL (SELECT * FROM t1);
SELECT * FROM t1 WHERE d >= ALL (SELECT * FROM t1);
DROP TABLE t1;
--echo #
--echo # MDEV-31719 Wrong result of: WHERE inet6_column IN ('','::1')
--echo #
CREATE TABLE t1 (a UUID);
INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000000');
SELECT * FROM t1 WHERE a IN ('','00000000-0000-0000-0000-000000000001');
SELECT * FROM t1 WHERE a='';
DROP TABLE t1;

View file

@ -25,7 +25,7 @@
# All options to this script is passed to all test program.
# useful options:
# --fast --force --lock-tables
# --server ==> mysql (default) / mSQL / Pg (postgres) / Solid
# --server ==> mariadb (default) / mysql / Pg (postgres) / Oracle
# --user ==> the user with permission to create / drop / select
# --pass ==> password for the user
# --cmp ==> Compare --server with one of the others (mysql/mSQL/Pg/Solid)

View file

@ -37,7 +37,7 @@ sub get_server
{
my ($name,$host,$database,$odbc,$machine,$socket,$connect_options)=@_;
my ($server);
if ($name =~ /mysql/i)
if ($name =~ /mysql/i || $name =~ /mariadb/i)
{ $server=new db_MySQL($host, $database, $machine, $socket,$connect_options); }
elsif ($name =~ /pg/i)
{ $server= new db_Pg($host,$database); }
@ -77,7 +77,7 @@ sub get_server
{ $server= new db_interbase($host,$database); }
else
{
die "Unknown sql server name used: $name\nUse one of: Access, Adabas, AdabasD, Empress, FrontBase, Oracle, Informix, InterBase, DB2, mSQL, Mimer, MS-SQL, MySQL, Pg, Solid, SAPDB or Sybase.\nIf the connection is done trough ODBC the name must end with _ODBC\n";
die "Unknown sql server name used: $name\nUse one of: Access, Adabas, AdabasD, Empress, FrontBase, Oracle, Informix, InterBase, DB2, mSQL, MariaDB, Mimer, MS-SQL, MySQL, Pg, Solid, SAPDB or Sybase.\nIf the connection is done trough ODBC the name must end with _ODBC\n";
}
if ($name =~ /_ODBC$/i || defined($odbc) && $odbc)
{
@ -98,12 +98,12 @@ sub get_server
sub all_servers
{
return ["Access", "Adabas", "DB2", "Empress", "FrontBase", "Oracle",
"Informix", "InterBase", "Mimer", "mSQL", "MS-SQL", "MySQL", "Pg","SAPDB",
"Solid", "Sybase"];
"Informix", "InterBase", "MariaDB", "Mimer", "mSQL", "MS-SQL", "MySQL",
"Pg","SAPDB", "Solid", "Sybase"];
}
#############################################################################
# First the configuration for MySQL off course :-)
# First the configuration for MariaDB / MySQL off course :-)
#############################################################################
package db_MySQL;
@ -165,6 +165,7 @@ sub new
$limits{'max_text_size'} = 1000000; # Good enough for tests
$limits{'multi_drop'} = 1; # Drop table can take many tables
$limits{'order_by_position'} = 1; # Can use 'ORDER BY 1'
$limits{'order_by_null'} = 1; # Can use 'ORDER BY NULL'
$limits{'order_by_unused'} = 1;
$limits{'query_size'} = 1000000; # Max size with default buffers.
$limits{'select_without_from'}= 1; # Can do 'select 1';
@ -224,7 +225,7 @@ sub version
if ($sth->execute && (@row = $sth->fetchrow_array))
{
$row[0] =~ s/-/ /g; # To get better tables with long names
$version="MySQL $row[0]";
$version="$row[0]";
}
$sth->finish;
@ -283,7 +284,6 @@ sub create
}
foreach $field (@$fields)
{
# $field =~ s/ decimal/ double(10,2)/i;
$field =~ s/ big_decimal/ double(10,2)/i;
$query.= $field . ',';
}
@ -604,12 +604,14 @@ sub new
$self->{'transactions'} = 1; # Transactions enabled
$self->{"vacuum"} = 1;
$limits{'join_optimizer'} = 1; # Can optimize FROM tables
# load_data_infile could use function 'insert_file', but I could not get it to
# work because of permissions problems. Disabling for now.
$limits{'load_data_infile'} = 0;
$limits{'NEG'} = 1;
$limits{'alter_add_multi_col'}= 0; # alter_add_multi_col ?
$limits{'alter_add_multi_col'}= 1;
$limits{'alter_table'} = 1;
$limits{'alter_table_dropcol'}= 0;
$limits{'alter_table_dropcol'}= 1;
$limits{'alter_table_after'} = 0; # Have ALTER TABLE .. AFTER other_column
$limits{'column_alias'} = 1;
$limits{'func_extra_%'} = 1;
$limits{'func_extra_if'} = 0;
@ -649,7 +651,7 @@ sub new
$limits{'working_all_fields'} = 1;
$limits{'working_blobs'} = 1; # If big varchar/blobs works
$limits{'multi_distinct'} = 1; # allows select count(distinct a),count(distinct b)..
$limits{'insert_multi_value'} = 1; # Have INSERT ... values (1,2),(3,4)
return $self;
}
@ -657,21 +659,20 @@ sub new
sub version
{
my ($version,$dir);
$version = "PostgreSQL version ???";
foreach $dir ($ENV{'PGDATA'},"/usr/local/pgsql/data", "/usr/local/pg/data")
my ($self)=@_;
my ($dbh,$sth,$version,@row);
$dbh=$self->connect();
$sth = $dbh->prepare("select VERSION()") or die $DBI::errstr;
$version="PostgreSQL ?";
if ($sth->execute && (@row = $sth->fetchrow_array))
{
if ($dir && -e "$dir/PG_VERSION")
{
$version= `cat $dir/PG_VERSION`;
if ($? == 0)
{
chomp($version);
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return "PostgreSQL $version";
}
}
$row[0] =~ s/-/ /g; # To get better tables with long names
$version="PostgreSQL $row[0]";
}
$sth->finish;
$dbh->disconnect;
$version .= "/ODBC" if ($self->{'data_source'} =~ /:ODBC:/);
return $version;
}
@ -707,9 +708,6 @@ sub create
$field =~ s/int\(\d*\)/int/;
$field =~ s/float\(\d*,\d*\)/float/;
$field =~ s/ double/ float/;
# $field =~ s/ decimal/ float/i;
# $field =~ s/ big_decimal/ float/i;
# $field =~ s/ date/ int/i;
# Pg doesn't have blob, it has text instead
$field =~ s/ blob/ text/;
$query.= $field . ',';
@ -718,13 +716,14 @@ sub create
push(@queries,$query);
foreach $index (@$index)
{
$index =~ s/primary key/unique index primary_key/i;
if ($index =~ /^unique.*\(([^\(]*)\)$/i)
if ($index =~ /primary key/ || $index =~ /PRIMARY KEY/)
{
# original: $indfield="using btree (" .$1.")";
# using btree doesn´t seem to work with Postgres anymore; it creates
# the table and adds the index, but it isn´t unique
$indfield=" (" .$1.")";
$query= substr($query, 0, length($query)-1) . ", $index )";
next;
}
elsif ($index =~ /^unique.*\(([^\(]*)\)$/i)
{
$indfield=" (" .$1.")";
$in="unique index";
$table="index_$nr"; $nr++;
}
@ -752,52 +751,14 @@ sub insert_file {
# Syntax:
# copy [binary] <class_name> [with oids]
# {to|from} {<filename>|stdin|stdout} [using delimiters <delim>]
print "The ascii files aren't correct for postgres ....!!!\n";
$command = "copy $dbname from '$file' using delimiters ','";
$command = "copy $dbname from '$file' using delimiters ',' QUOTE ''''";
print "$command\n";
$sth = $dbh->do($command) or die $DBI::errstr;
return $sth;
}
#
# As postgreSQL wants A % B instead of standard mod(A,B) we have to map
# This will not handle all cases, but as the benchmarks doesn't use functions
# inside MOD() the following should work
#
# PostgreSQL cant handle count(*) or even count(1), but it can handle
# count(1+1) sometimes. ==> this is solved in PostgreSQL 6.3
#
# PostgreSQL 6.5 is supporting MOD.
sub query {
my($self,$sql) = @_;
my(@select,$change);
# if you use PostgreSQL 6.x and x is lower as 5 then uncomment the line below.
# $sql =~ s/mod\(([^,]*),([^\)]*)\)/\($1 % $2\)/gi;
#
# if you use PostgreSQL 6.1.x uncomment the lines below
# if ($sql =~ /select\s+count\(\*\)\s+from/i) {
# }
# elsif ($sql =~ /count\(\*\)/i)
# {
# if ($sql =~ /select\s+(.*)\s+from/i)
# {
# @select = split(/,/,$1);
# if ($select[0] =~ /(.*)\s+as\s+\w+$/i)
# {
# $change = $1;
# }
# else
# {
# $change = $select[0];
# }
# }
# if (($change =~ /count/i) || ($change eq "")) {
# $change = "1+1";
# }
# $sql =~ s/count\(\*\)/count($change)/gi;
# }
# till here.
return $sql;
}
@ -849,10 +810,8 @@ sub vacuum
}
else
{
# $dbh->do("vacuum pg_attributes") || die "Got error: $DBI::errstr when executing 'vacuum'\n";
# $dbh->do("vacuum pg_index") || die "Got error: $DBI::errstr when executing 'vacuum'\n";
$dbh->do("vacuum analyze") || die "Got error: $DBI::errstr when executing 'vacuum analyze'\n";
$dbh->do("vacuum") || die "Got error: $DBI::errstr when executing 'vacuum'\n";
$dbh->do("vacuum analyze") || die "Got error: $DBI::errstr when executing 'vacuum analyze'\n";
$dbh->do("vacuum") || die "Got error: $DBI::errstr when executing 'vacuum'\n";
}
$end_time=new Benchmark;
print "Time for book-keeping (1): " .

View file

@ -220,7 +220,7 @@ print "Retrieving data\n";
"select category,count(*) from aircraft where engines=2 group by category having count(*)>4",3,$limits->{'group_functions'} && $limits->{'having_with_group'},
"select flight_number,range_miles,fare_class FROM aircraft,flight,flight_class WHERE flight.flight_code=flight_class.flight_code AND flight.aircraft_code=aircraft.aircraft_code AND range_miles<>0 AND (stops=1 OR stops=2) GROUP BY flight_number,range_miles,fare_class",150,$limits->{'group_functions'},
"select distinct from_airport.time_zone_code,to_airport.time_zone_code,(FLOOR(arrival_time/100)*60+MOD(arrival_time,100)-FLOOR(departure_time/100)*60-MOD(departure_time,100)-time_elapsed)/60 AS time_zone_diff FROM flight,airport AS from_airport,airport AS to_airport WHERE flight.from_airport=from_airport.airport_code AND flight.to_airport=to_airport.airport_code GROUP BY from_airport.time_zone_code,to_airport.time_zone_code,arrival_time,departure_time,time_elapsed",21,$limits->{'func_odbc_mod'} && $limits->{'func_odbc_floor'} && $limits->{'group_functions'},
"select DISTINCT from_airport.time_zone_code,to_airport.time_zone_code,MOD((FLOOR(arrival_time/100)*60+MOD(arrival_time,100)-FLOOR(departure_time/100)*60-MOD(departure_time,100)-time_elapsed)/60+36,24)-12 AS time_zone_diff FROM flight,airport AS from_airport,airport AS to_airport WHERE flight.from_airport=from_airport.airport_code AND flight.to_airport=to_airport.airport_code and MOD((FLOOR(arrival_time/100)*60+MOD(arrival_time,100)-FLOOR(departure_time/100)*60-MOD(departure_time,100)-time_elapsed)/60+36,24)-12 < 10",14,$limits->{'func_odbc_mod'} && $limits->{'func_odbc_floor'} && $limits->{'group_functions'},
"select DISTINCT from_airport.time_zone_code,to_airport.time_zone_code,MOD(CAST((FLOOR(arrival_time/100)*60+MOD(arrival_time,100)-FLOOR(departure_time/100)*60-MOD(departure_time,100)-time_elapsed)/60+36 AS INTEGER),24)-12 AS time_zone_diff FROM flight,airport AS from_airport,airport AS to_airport WHERE flight.from_airport=from_airport.airport_code AND flight.to_airport=to_airport.airport_code and MOD(CAST((FLOOR(arrival_time/100)*60+MOD(arrival_time,100)-FLOOR(departure_time/100)*60-MOD(departure_time,100)-time_elapsed)/60+36 AS INTEGER),24)-12 < 10",14,$limits->{'func_odbc_mod'} && $limits->{'func_odbc_floor'} && $limits->{'group_functions'},
"select from_airport,to_airport,range_miles,time_elapsed FROM aircraft,flight WHERE aircraft.aircraft_code=flight.aircraft_code AND to_airport NOT LIKE from_airport AND range_miles<>0 AND time_elapsed<>0 GROUP BY from_airport,to_airport,range_miles,time_elapsed",409,$limits->{'group_functions'} && $limits->{'like_with_column'},
"SELECT airport.country_name,state.state_name,city.city_name,airport_service.direction FROM airport_service,state,airport,city WHERE airport_service.city_code=city.city_code AND airport_service.airport_code=airport.airport_code AND state.state_code=airport.state_code AND state.state_code=city.state_code AND airport.state_code=city.state_code AND airport.country_name=city.country_name AND airport.country_name=state.country_name AND city.time_zone_code=airport.time_zone_code GROUP BY airport.country_name,state.state_name,city.city_name,airport_service.direction ORDER BY state_name",11,$limits->{'group_functions'},
"SELECT airport.country_name,state.state_name,city.city_name,airport_service.direction FROM airport_service,state,airport,city WHERE airport_service.city_code=city.city_code AND airport_service.airport_code=airport.airport_code AND state.state_code=airport.state_code AND state.state_code=city.state_code AND airport.state_code=city.state_code AND airport.country_name=city.country_name AND airport.country_name=state.country_name AND city.time_zone_code=airport.time_zone_code GROUP BY airport.country_name,state.state_name,city.city_name,airport_service.direction ORDER BY state_name DESC",11,$limits->{'group_functions'},
@ -369,7 +369,7 @@ sub init_data
@class_of_service=
$server->create("class_of_service",
["class_code char(2) NOT NULL",
"`rank` tinyint(2) NOT NULL",
"rank tinyint(2) NOT NULL",
"class_description char(80) NOT NULL"],
["PRIMARY KEY (class_code)"]);
@code_description=

View file

@ -39,6 +39,7 @@ $small_loop_count=10; # Loop for full table retrieval
$range_loop_count=$small_loop_count*50;
$many_keys_loop_count=$opt_loop_count;
$opt_read_key_loop_count=$opt_loop_count;
$many_key_update=10000;
$pwd = cwd(); $pwd = "." if ($pwd eq '');
require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";
@ -49,16 +50,19 @@ if ($opt_small_test)
$many_keys_loop_count=$opt_loop_count/10;
$range_loop_count=10;
$opt_read_key_loop_count=10;
$many_key_update=10;
}
elsif ($opt_small_tables)
{
$opt_loop_count=10000; # number of rows/3
$many_keys_loop_count=$opt_loop_count;
$opt_read_key_loop_count=10;
$many_key_update=10;
}
elsif ($opt_small_key_tables)
{
$many_keys_loop_count/=10;
$many_key_update/=10;
}
if ($opt_loop_count < 100)
@ -101,13 +105,16 @@ $dbh = $server->connect();
#### Create needed tables
####
goto keys_test if ($opt_stage == 2);
goto select_test if ($opt_skip_create);
print "Creating tables\n";
$dbh->do("drop table bench1" . $server->{'drop_attr'});
$dbh->do("drop table bench2" . $server->{'drop_attr'});
$dbh->do("drop table bench3" . $server->{'drop_attr'});
goto keys_test if ($opt_stage == 2);
goto keys_test2 if ($opt_stage == 3);
print "Creating tables\n";
do_many($dbh,$server->create("bench1",
["id int NOT NULL",
"id2 int NOT NULL",
@ -1590,6 +1597,181 @@ if ($limits->{'insert_multi_value'})
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
#
# Test insert and update on a table with a lot of different keys
#
keys_test2:
$keys=min($limits->{'max_index'},8); # 8 is more than enough
print "Insert into table with $many_keys_loop_count rows, $keys keys and with simple primary key\n";
@fields=();
@keys=();
# Make keys on the most important types
@types=(0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1); # A 1 for each char field
push(@fields,"field1 integer not null");
push(@fields,"field2 integer not null");
push(@fields,"field3 char(16) not null");
push(@fields,"field4 varchar(64) not null");
push(@fields,"field5 float not null");
push(@fields,"field6 double not null");
push(@fields,"field7 integer not null");
for ($i=8 ; $i <= 16 ; $i++)
{
push(@fields,"field$i varchar(16) not null");
}
$query="primary key (field1) ";
push (@keys,$query);
# Create other keys
for ($i=2 ; $i <= $keys ; $i++)
{
push(@keys,"index index$i (field$i)");
}
do_many($dbh,$server->create("bench1",\@fields,\@keys));
if ($opt_lock_tables)
{
$dbh->do("LOCK TABLES bench1 WRITE") || die $DBI::errstr;
}
$loop_time=new Benchmark;
if ($opt_fast && $server->{transactions})
{
$dbh->{AutoCommit} = 0;
}
$fields=$#fields+1;
if (($opt_fast || $opt_fast_insert) && $server->{'limits'}->{'insert_multi_value'})
{
$query_size=$server->{'limits'}->{'query_size'};
$query="insert into bench1 values ";
$res=$query;
for ($i=1; $i <= $many_keys_loop_count; $i++)
{
$id= $i;
$rand=$random[$i];
$tmp="($id,$id,'test$rand','ABCDEF$rand',$rand.0,$rand.0,$rand,";
for ($j=8; $j <= $fields ; $j++)
{
$tmp.= ($types[$j] == 0) ? "$rand," : "'$rand',";
}
substr($tmp,-1)=")";
if (length($tmp)+length($res) < $query_size)
{
$res.= $tmp . ",";
}
else
{
$sth = $dbh->do(substr($res,0,length($res)-1)) or die "$DBI::errstr";
$res=$query . $tmp . ",";
}
}
$sth = $dbh->do(substr($res,0,length($res)-1)) or die $DBI::errstr;
}
else
{
for ($i=1; $i <= $many_keys_loop_count; $i++)
{
$id= $i;
$rand=$random[$i];
$query="insert into bench1 values ($id,$id,'test$rand','ABCDEF$rand',$rand.0,$rand.0,$rand,";
for ($j=8; $j <= $fields ; $j++)
{
$query.= ($types[$j] == 0) ? "$rand," : "'$rand',";
}
substr($query,-1)=")";
print "query1: $query\n" if ($opt_debug);
$dbh->do($query) or die "Got error $DBI::errstr with query: $query\n";
}
}
if ($opt_fast && $server->{transactions})
{
$dbh->commit;
$dbh->{AutoCommit} = 1;
}
$end_time=new Benchmark;
print "Time for insert_many_keys ($many_keys_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
if ($opt_fast && defined($server->{vacuum}))
{
if ($opt_lock_tables)
{
do_query($dbh,"UNLOCK TABLES");
}
$server->vacuum(1,\$dbh,"bench1");
if ($opt_lock_tables)
{
$sth = $dbh->do("LOCK TABLES bench1 WRITE") || die $DBI::errstr;
}
}
#
# Testing of update of table with many keys
#
$loop_time=new Benchmark;
for ($i=0 ; $i< $many_key_update; $i++)
{
$tmp= ($i*11 % $many_keys_loop_count)+1;
$query="update bench1 set field7=$i where field1=$tmp";
$dbh->do($query) or die "Got error $DBI::errstr with query $query\n";
}
$end_time=new Benchmark;
print "Time for many_key_update_of_key_with_primary ($many_key_update): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
$loop_time=new Benchmark;
for ($i=0 ; $i< $many_key_update; $i++)
{
$tmp= ($i*11 % $many_keys_loop_count)+1;
$query="update bench1 set field7=$i+1 where field2=$tmp";
$dbh->do($query) or die "Got error $DBI::errstr with query $query\n";
}
$end_time=new Benchmark;
print "Time for many_key_update_of_key_with_secondary ($many_key_update): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
$loop_time=new Benchmark;
for ($i=0 ; $i< $many_key_update; $i++)
{
$tmp= ($i*11 % $many_keys_loop_count)+2;
$query="update bench1 set field8='hello', field9='world' where field1=$tmp";
$dbh->do($query) or die "Got error $DBI::errstr with query $query\n";
}
$end_time=new Benchmark;
print "Time for many_key_update_of_field_with_primary ($many_key_update): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
$loop_time=new Benchmark;
for ($i=0 ; $i< $many_key_update; $i++)
{
$tmp= ($i*11 % $many_keys_loop_count)+3;
$query="update bench1 set field8='world', field9='hello' where field2=$tmp";
$dbh->do($query) or die "Got error $DBI::errstr with query $query\n";
}
$end_time=new Benchmark;
print "Time for many_key_update_of_field_with_secondary ($many_key_update): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
$loop_time=new Benchmark;
$sth = $dbh->do("drop table bench1" . $server->{'drop_attr'}) or die $DBI::errstr;
$end_time=new Benchmark;
print "Time for drop table(1): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
####
#### End of benchmark
####

View file

@ -336,6 +336,29 @@ if ($limits->{'group_functions'})
print "Time for count_group ($i:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
$loop_time=new Benchmark;
$rows=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
$rows+=fetch_all_rows($dbh,"select grp_no_key,count(*) from bench1 group by grp_no_key order by grp_no_key");
}
$end_time=new Benchmark;
print "Time for count_group_order_group ($i:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
if ($limits->{'order_by_null'})
{
$loop_time=new Benchmark;
$rows=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
$rows+=fetch_all_rows($dbh,"select grp_no_key,count(*) from bench1 group by grp_no_key order by null");
}
$end_time=new Benchmark;
print "Time for count_group_order_null ($i:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
}
$loop_time=new Benchmark;
$rows=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
@ -344,7 +367,7 @@ if ($limits->{'group_functions'})
}
$end_time=new Benchmark;
print "Time for count_group_with_order ($i:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
if ($limits->{'group_distinct_functions'})

View file

@ -34,18 +34,7 @@ $select_current_full_facts="
A2.fromdate=(select MAX(fromdate) from
elim_attr2 where id=A2.id);
";
$select_current_full_facts="
select
F.id, A1.attr1, A2.attr2
from
elim_facts F
left join elim_attr1 A1 on A1.id=F.id
left join elim_attr2 A2 on A2.id=F.id and
A2.fromdate=(select MAX(fromdate) from
elim_attr2 where id=F.id);
";
# TODO: same as above but for some given date also?
# TODO:
# TODO: same as above but for some given date also?
####
@ -62,6 +51,7 @@ $start_time=new Benchmark;
goto select_test if ($opt_skip_create);
print "Creating tables\n";
$dbh->do("drop view elim_current_facts");
$dbh->do("drop table elim_facts" . $server->{'drop_attr'});
$dbh->do("drop table elim_attr1" . $server->{'drop_attr'});
$dbh->do("drop table elim_attr2" . $server->{'drop_attr'});
@ -76,7 +66,7 @@ do_many($dbh,$server->create("elim_attr1",
["id integer",
"attr1 integer"],
["primary key (id)",
"key (attr1)"]));
"index ix_attr1 (attr1)"]));
# Attribute2, time-versioned
do_many($dbh,$server->create("elim_attr2",
@ -84,7 +74,7 @@ do_many($dbh,$server->create("elim_attr2",
"attr2 integer",
"fromdate date"],
["primary key (id, fromdate)",
"key (attr2,fromdate)"]));
"index ix_attr2 (attr2,fromdate)"]));
#NOTE: ignoring: if ($limits->{'views'})
$dbh->do("drop view elim_current_facts");
@ -304,8 +294,8 @@ if ($opt_lock_tables)
}
if (!$opt_skip_delete)
{
do_query($dbh,"drop table elim_facts, elim_attr1, elim_attr2" . $server->{'drop_attr'});
$dbh->do("drop view elim_current_facts");
do_query($dbh,"drop table elim_facts, elim_attr1, elim_attr2" . $server->{'drop_attr'});
}
if ($opt_fast && defined($server->{vacuum}))

View file

@ -45,13 +45,6 @@ if ($opt_small_test || $opt_small_tables)
$opt_medium_loop_count/=10;
}
if (!$server->{transactions} && !$opt_force)
{
print "Test skipped because the database doesn't support transactions\n";
exit(0);
}
####
#### Connect and start timeing
####
@ -90,7 +83,10 @@ $dbh->{AutoCommit} = 0;
### Test insert perfomance
###
test_insert("bench1","insert_commit",0);
if ($server->{transactions})
{
test_insert("bench1","insert_commit",0);
}
test_insert("bench2","insert_autocommit",1);
sub test_insert
@ -130,6 +126,7 @@ print "Test transactions rollback performance\n" if($opt_debug);
# then doing a rollback on these
#
if ($server->{transactions})
{
my ($id,$rev_id,$grp,$region,$end,$loop_time,$end_time,$commit_loop,$count);
@ -171,6 +168,7 @@ print "Test transactions rollback performance\n" if($opt_debug);
# then doing a rollback on these
#
if ($server->{transactions})
{
my ($id,$loop_time,$end_time,$commit_loop,$count);
@ -208,6 +206,7 @@ print "Test transactions rollback performance\n" if($opt_debug);
# then doing a rollback on these
#
if ($server->{transactions})
{
my ($id,$loop_time,$end_time,$commit_loop,$count);
@ -241,7 +240,10 @@ print "Test transactions rollback performance\n" if($opt_debug);
### Test update perfomance
###
test_update("bench1","update_commit",0);
if ($server->{transactions})
{
test_update("bench1","update_commit",0);
}
test_update("bench2","update_autocommit",1);
sub test_update
@ -267,7 +269,10 @@ sub test_update
### Test delete perfomance
###
test_delete("bench1","delete_commit",0);
if ($server->{transactions})
{
test_delete("bench1","delete_commit",0);
}
test_delete("bench2","delete_autocommit",1);
sub test_delete

View file

@ -9479,7 +9479,6 @@ int ha_partition::extra(enum ha_extra_function operation)
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
case HA_EXTRA_BEGIN_ALTER_COPY:
case HA_EXTRA_END_ALTER_COPY:
case HA_EXTRA_IGNORE_INSERT:
DBUG_RETURN(loop_partitions(extra_cb, &operation));
default:
{

View file

@ -1407,11 +1407,24 @@ namespace fmt {
*/
String *Item_func_sformat::val_str(String *res)
{
/*
A union that stores a numeric format arg value.
fmt::detail::make_arg does not accept temporaries, so all of its numeric
args are temporarily stored in the fmt_args array.
See: https://github.com/fmtlib/fmt/issues/3596
*/
union Format_arg_store {
longlong val_int;
float val_float;
double val_double;
};
DBUG_ASSERT(fixed());
using ctx= fmt::format_context;
String *fmt_arg= NULL;
String *parg= NULL;
fmt::format_args::format_arg *vargs= NULL;
using ctx= fmt::format_context;
String *fmt_arg= NULL;
String *parg= NULL;
fmt::format_args::format_arg *vargs= NULL;
Format_arg_store *fmt_args= NULL;
null_value= true;
if (!(fmt_arg= args[0]->val_str(res)))
@ -1420,25 +1433,39 @@ String *Item_func_sformat::val_str(String *res)
if (!(vargs= new fmt::format_args::format_arg[arg_count - 1]))
return NULL;
if (!(fmt_args= new Format_arg_store[arg_count - 1]))
{
delete [] vargs;
return NULL;
}
/* Creates the array of arguments for vformat */
for (uint carg= 1; carg < arg_count; carg++)
{
switch (args[carg]->result_type())
{
case INT_RESULT:
vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_int());
fmt_args[carg-1].val_int= args[carg]->val_int();
vargs[carg-1]= fmt::detail::make_arg<ctx>(fmt_args[carg-1].val_int);
break;
case DECIMAL_RESULT: // TODO
case REAL_RESULT:
if (args[carg]->field_type() == MYSQL_TYPE_FLOAT)
vargs[carg-1]= fmt::detail::make_arg<ctx>((float)args[carg]->val_real());
{
fmt_args[carg-1].val_float= (float)args[carg]->val_real();
vargs[carg-1]= fmt::detail::make_arg<ctx>(fmt_args[carg-1].val_float);
}
else
vargs[carg-1]= fmt::detail::make_arg<ctx>(args[carg]->val_real());
{
fmt_args[carg-1].val_double= args[carg]->val_real();
vargs[carg-1]= fmt::detail::make_arg<ctx>(fmt_args[carg-1].val_double);
}
break;
case STRING_RESULT:
if (!(parg= args[carg]->val_str(&val_arg[carg-1])))
{
delete [] vargs;
delete [] fmt_args;
return NULL;
}
vargs[carg-1]= fmt::detail::make_arg<ctx>(*parg);
@ -1448,6 +1475,7 @@ String *Item_func_sformat::val_str(String *res)
default:
DBUG_ASSERT(0);
delete [] vargs;
delete [] fmt_args;
return NULL;
}
}
@ -1471,6 +1499,7 @@ String *Item_func_sformat::val_str(String *res)
null_value= true;
}
delete [] vargs;
delete [] fmt_args;
return null_value ? NULL : res;
}

View file

@ -8326,6 +8326,13 @@ mysqld_get_one_option(const struct my_option *opt, const char *argument,
case OPT_SERVER_ID:
::server_id= global_system_variables.server_id;
break;
case OPT_SEQURE_FILE_PRIV:
if (argument == disabled_my_option)
{
my_free(opt_secure_file_priv);
opt_secure_file_priv= 0;
}
break;
case OPT_LOWER_CASE_TABLE_NAMES:
lower_case_table_names_used= 1;
break;

View file

@ -854,6 +854,7 @@ enum options_mysqld
OPT_MYSQL_COMPATIBILITY,
OPT_TLS_VERSION,
OPT_MYSQL_TO_BE_IMPLEMENTED,
OPT_SEQURE_FILE_PRIV,
OPT_which_is_always_the_last
};
#endif

View file

@ -2222,9 +2222,6 @@ int write_record(THD *thd, TABLE *table, COPY_INFO *info, select_result *sink)
goto after_trg_or_ignored_err;
}
/* Notify the engine about insert ignore operation */
if (info->handle_duplicates == DUP_ERROR && info->ignore)
table->file->extra(HA_EXTRA_IGNORE_INSERT);
after_trg_n_copied_inc:
info->copied++;
thd->record_first_successful_insert_id_in_cur_stmt(table->file->insert_id_for_cur_row);

View file

@ -11843,9 +11843,6 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
}
else
{
/* In case of alter ignore, notify the engine about it. */
if (ignore)
to->file->extra(HA_EXTRA_IGNORE_INSERT);
DEBUG_SYNC(thd, "copy_data_between_tables_before");
found_count++;
mysql_stage_set_work_completed(thd->m_stage_progress_psi, found_count);

View file

@ -3404,7 +3404,7 @@ static Sys_var_charptr_fscs Sys_secure_file_priv(
"Limit LOAD DATA, SELECT ... OUTFILE, and LOAD_FILE() to files "
"within specified directory",
PREALLOCATED READ_ONLY GLOBAL_VAR(opt_secure_file_priv),
CMD_LINE(REQUIRED_ARG), DEFAULT(0));
CMD_LINE(REQUIRED_ARG, OPT_SEQURE_FILE_PRIV), DEFAULT(0));
static bool check_server_id(sys_var *self, THD *thd, set_var *var)
{

View file

@ -10255,7 +10255,6 @@ bool TR_table::update(ulonglong start_id, ulonglong end_id)
table->file->print_error(error, MYF(0));
/* extra() is used to apply the bulk insert operation
on mysql/transaction_registry table */
table->file->extra(HA_EXTRA_IGNORE_INSERT);
return error;
}

View file

@ -15593,13 +15593,6 @@ ha_innobase::extra(
case HA_EXTRA_RESET_STATE:
reset_template();
trx->duplicates = 0;
/* fall through */
case HA_EXTRA_IGNORE_INSERT:
/* HA_EXTRA_IGNORE_INSERT is very similar to
HA_EXTRA_IGNORE_DUP_KEY, but with one crucial difference:
we want !trx->duplicates for INSERT IGNORE so that
row_ins_duplicate_error_in_clust() will acquire a
shared lock instead of an exclusive lock. */
stmt_boundary:
trx->bulk_insert_apply();
trx->end_bulk_insert(*m_prebuilt->table);

View file

@ -532,6 +532,13 @@ public:
{
return bulk_store && is_bulk_insert();
}
/** Free bulk insert operation */
void clear_bulk_buffer()
{
delete bulk_store;
bulk_store= nullptr;
}
};
/** Collection of persistent tables and their first modification

View file

@ -283,10 +283,10 @@ row_merge_insert_index_tuples(
ut_stage_alter_t* stage= nullptr,
merge_file_t* blob_file= nullptr);
/******************************************************//**
Encode an index record. */
/** Encode an index record.
@return size of the record */
static MY_ATTRIBUTE((nonnull))
void
ulint
row_merge_buf_encode(
/*=================*/
byte** b, /*!< in/out: pointer to
@ -317,6 +317,7 @@ row_merge_buf_encode(
entry->fields, n_fields);
*b += size;
return size;
}
static MY_ATTRIBUTE((malloc, nonnull))
@ -1177,7 +1178,13 @@ dberr_t row_merge_buf_write(const row_merge_buf_t *buf,
}
}
row_merge_buf_encode(&b, index, entry, n_fields);
ulint rec_size= row_merge_buf_encode(
&b, index, entry, n_fields);
if (blob_file && rec_size > srv_page_size) {
err = DB_TOO_BIG_RECORD;
goto func_exit;
}
ut_ad(b < &block[srv_sort_buf_size]);
DBUG_LOG("ib_merge_sort",
@ -5337,7 +5344,7 @@ func_exit:
if (err != DB_SUCCESS)
trx->error_info= index;
else if (index->is_primary() && table->persistent_autoinc)
btr_write_autoinc(index, table->autoinc);
btr_write_autoinc(index, table->autoinc - 1);
err= btr_bulk.finish(err);
return err;
}
@ -5390,6 +5397,7 @@ bulk_rollback:
if (t.second.get_first() < low_limit)
low_limit= t.second.get_first();
delete t.second.bulk_store;
t.second.bulk_store= nullptr;
}
}
trx_savept_t bulk_save{low_limit};

View file

@ -146,7 +146,10 @@ inline void trx_t::rollback_low(trx_savept_t *savept)
trx_mod_tables_t::iterator j= i++;
ut_ad(j->second.valid());
if (j->second.rollback(limit))
{
j->second.clear_bulk_buffer();
mod_tables.erase(j);
}
else if (!apply_online_log)
apply_online_log= j->first->is_active_ddl();
}

View file

@ -596,9 +596,6 @@ static const char *mrn_inspect_extra_function(enum ha_extra_function operation)
inspected = "HA_EXTRA_NO_AUTOINC_LOCKING";
break;
#endif
case HA_EXTRA_IGNORE_INSERT:
inspected = "HA_EXTRA_IGNORE_INSERT";
break;
}
return inspected;
}

View file

@ -9,7 +9,7 @@ IF(ESSENTIALS)
ENDIF()
ELSE()
SET(CPACK_COMPONENTS_USED
"Server;Client;Development;SharedLibraries;Documentation;Readme;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management;rocksdb-engine;backup;VCCRT")
"Server;Client;Development;SharedLibraries;Documentation;Readme;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management;rocksdb-engine;Backup;VCCRT")
ENDIF()
SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents")