Skip to content

Commit

Permalink
Merge 10.5 into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Dec 13, 2022
2 parents 04efe13 + 1dc2f35 commit a8a5c8a
Show file tree
Hide file tree
Showing 178 changed files with 1,980 additions and 473 deletions.
12 changes: 8 additions & 4 deletions BUILD/FINISH.sh
Expand Up @@ -62,11 +62,15 @@ commands="$commands
path=`dirname $0`
. \"$path/autorun.sh\""

if [ -z "$just_clean" ]
if [ -z "$just_clean"]
then
commands="$commands
git submodule update
CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" $configure"
if test -d .git
then
commands="$commands
git submodule update"
fi
commands="$commands
CC=\"$CC\" CFLAGS=\"$cflags\" CXX=\"$CXX\" CXXFLAGS=\"$cxxflags\" CXXLDFLAGS=\"$CXXLDFLAGS\" $configure"
fi

if [ -z "$just_configure" -a -z "$just_clean" ]
Expand Down
12 changes: 12 additions & 0 deletions include/mysql/plugin.h
Expand Up @@ -204,6 +204,18 @@ struct system_status_var;
typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);


static inline
struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
mysql_show_var_func func_arg)
{
struct st_mysql_show_var tmp;
tmp.name= name;
tmp.value= (void*) func_arg;
tmp.type= SHOW_FUNC;
return tmp;
};


/*
Constants for plugin flags.
*/
Expand Down
10 changes: 10 additions & 0 deletions include/mysql/plugin_audit.h.pp
Expand Up @@ -491,6 +491,16 @@
};
struct system_status_var;
typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
static inline
struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
mysql_show_var_func func_arg)
{
struct st_mysql_show_var tmp;
tmp.name= name;
tmp.value= (void*) func_arg;
tmp.type= SHOW_FUNC;
return tmp;
};
struct st_mysql_sys_var;
struct st_mysql_value;
typedef int (*mysql_var_check_func)(THD* thd,
Expand Down
10 changes: 10 additions & 0 deletions include/mysql/plugin_auth.h.pp
Expand Up @@ -491,6 +491,16 @@
};
struct system_status_var;
typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
static inline
struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
mysql_show_var_func func_arg)
{
struct st_mysql_show_var tmp;
tmp.name= name;
tmp.value= (void*) func_arg;
tmp.type= SHOW_FUNC;
return tmp;
};
struct st_mysql_sys_var;
struct st_mysql_value;
typedef int (*mysql_var_check_func)(THD* thd,
Expand Down
10 changes: 10 additions & 0 deletions include/mysql/plugin_data_type.h.pp
Expand Up @@ -491,6 +491,16 @@
};
struct system_status_var;
typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
static inline
struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
mysql_show_var_func func_arg)
{
struct st_mysql_show_var tmp;
tmp.name= name;
tmp.value= (void*) func_arg;
tmp.type= SHOW_FUNC;
return tmp;
};
struct st_mysql_sys_var;
struct st_mysql_value;
typedef int (*mysql_var_check_func)(THD* thd,
Expand Down
10 changes: 10 additions & 0 deletions include/mysql/plugin_encryption.h.pp
Expand Up @@ -491,6 +491,16 @@
};
struct system_status_var;
typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
static inline
struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
mysql_show_var_func func_arg)
{
struct st_mysql_show_var tmp;
tmp.name= name;
tmp.value= (void*) func_arg;
tmp.type= SHOW_FUNC;
return tmp;
};
struct st_mysql_sys_var;
struct st_mysql_value;
typedef int (*mysql_var_check_func)(THD* thd,
Expand Down
10 changes: 10 additions & 0 deletions include/mysql/plugin_ftparser.h.pp
Expand Up @@ -491,6 +491,16 @@
};
struct system_status_var;
typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
static inline
struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
mysql_show_var_func func_arg)
{
struct st_mysql_show_var tmp;
tmp.name= name;
tmp.value= (void*) func_arg;
tmp.type= SHOW_FUNC;
return tmp;
};
struct st_mysql_sys_var;
struct st_mysql_value;
typedef int (*mysql_var_check_func)(THD* thd,
Expand Down
10 changes: 10 additions & 0 deletions include/mysql/plugin_function.h.pp
Expand Up @@ -491,6 +491,16 @@
};
struct system_status_var;
typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
static inline
struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
mysql_show_var_func func_arg)
{
struct st_mysql_show_var tmp;
tmp.name= name;
tmp.value= (void*) func_arg;
tmp.type= SHOW_FUNC;
return tmp;
};
struct st_mysql_sys_var;
struct st_mysql_value;
typedef int (*mysql_var_check_func)(THD* thd,
Expand Down
10 changes: 10 additions & 0 deletions include/mysql/plugin_password_validation.h.pp
Expand Up @@ -491,6 +491,16 @@
};
struct system_status_var;
typedef int (*mysql_show_var_func)(THD*, struct st_mysql_show_var*, void *, struct system_status_var *status_var, enum enum_var_type);
static inline
struct st_mysql_show_var SHOW_FUNC_ENTRY(const char *name,
mysql_show_var_func func_arg)
{
struct st_mysql_show_var tmp;
tmp.name= name;
tmp.value= (void*) func_arg;
tmp.type= SHOW_FUNC;
return tmp;
};
struct st_mysql_sys_var;
struct st_mysql_value;
typedef int (*mysql_var_check_func)(THD* thd,
Expand Down
15 changes: 6 additions & 9 deletions libmysqld/lib_sql.cc
Expand Up @@ -515,7 +515,6 @@ int init_embedded_server(int argc, char **argv, char **groups)
*/
int *argcp;
char ***argvp;
int fake_argc = 1;
char *fake_argv[] = { (char *)"", 0 };
const char *fake_groups[] = { "server", "embedded", 0 };
my_bool acl_error;
Expand All @@ -528,16 +527,14 @@ int init_embedded_server(int argc, char **argv, char **groups)
if (init_early_variables())
return 1;

if (argc)
if (!argc)
{
argcp= &argc;
argvp= (char***) &argv;
}
else
{
argcp= &fake_argc;
argvp= (char ***) &fake_argv;
argc= 1;
argv= fake_argv;
}
argcp= &argc;
argvp= &argv;

if (!groups)
groups= (char**) fake_groups;

Expand Down
15 changes: 4 additions & 11 deletions mysql-test/README-gcov
Expand Up @@ -2,14 +2,7 @@ To be able to see the level of coverage with the current test suite,
do the following:

- Make sure gcov is installed
- Compile the MySQL distribution with BUILD/compile-pentium64-gcov (if your
machine does not have a pentium CPU, hack this script, or just live with
the pentium-specific stuff)
- In the mysql-test directory, run this command: ./mysql-test-run -gcov
- To see the level of coverage for a given source file:
grep -1 source_file_name ../mysql-test-gcov.msg
- To see which lines are not yet covered, look at source_file_name.gcov in
the source tree. You can find this by doing something like:
find source-directory -name "mysqld.cc.gcov"
Then think hard about a test case that will cover those lines, and write
one!
- Compile the MariaDB distribution with -DENABLE_GCOV=1
- In the mysql-test directory, run this command: `./mysql-test-run --gcov`
- see var/last_changes.dgcov for the coverage of uncommitted code
- see `./dgcov -h` for more options
57 changes: 39 additions & 18 deletions mysql-test/dgcov.pl
Expand Up @@ -36,6 +36,7 @@
my %cov;
my $file_no=0;

Getopt::Long::Configure ("bundling");
GetOptions
("v|verbose+" => \$opt_verbose,
"h|help" => \$opt_help,
Expand All @@ -62,13 +63,16 @@
my $cmd;
if ($opt_purge)
{
$cmd= "find . -name '*.da' -o -name '*.gcda' -o -name '*.gcov' -o ".
$cmd= "find . -name '*.da' -o -name '*.gcda*' -o -name '*.gcov' -o ".
"-name '*.dgcov' | xargs rm -f ''";
logv "Running: $cmd";
system($cmd)==0 or die "system($cmd): $? $!";
exit 0;
}

my $gcc_version= `gcc -dumpversion`;
$gcc_version=~ s/^(\d+).*$/$1/ or die "Cannot parse gcc -dumpversion: $gcc_version";

find(\&gcov_one_file, $root);
find(\&write_coverage, $root) if $opt_generate;
exit 0 if $opt_only_gcov;
Expand Down Expand Up @@ -167,26 +171,43 @@ sub gcov_one_file {
{
return;
}
for my $gcov_file (<$_*.gcov>) {
open FH, '<', "$gcov_file_path" or die "open(<$gcov_file_path): $!";
my $fname;
while (<FH>) {
chomp;
if (/^function:/) {
next;
}
if (/^file:/) {
$fname=realpath(-f $' ? $' : $root.$');
next;
# now, read the generated file
if ($gcc_version <9){
for my $gcov_file (<$_*.gcov>) {
open FH, '<', "$gcov_file_path" or die "open(<$gcov_file_path): $!";
my $fname;
while (<FH>) {
chomp;
if (/^function:/) {
next;
}
if (/^file:/) {
$fname=realpath(-f $' ? $' : $root.$');
next;
}
next if /^lcount:\d+,-\d+/; # whatever that means
unless (/^lcount:(\d+),(\d+)/ and $fname) {
warn "unknown line '$_' in $gcov_file_path";
next;
}
$cov{$fname}->{$1}+=$2;
}
next if /^lcount:\d+,-\d+/; # whatever that means
unless (/^lcount:(\d+),(\d+)/ and $fname) {
warn "unknown line '$_' in $gcov_file";
next;
close(FH);
}
} else {
require IO::Uncompress::Gunzip;
require JSON::PP;
no warnings 'once';
my $gcov_file_json;
s/\.gcda$// if $gcc_version >= 11;
IO::Uncompress::Gunzip::gunzip("$_.gcov.json.gz", \$gcov_file_json)
or die "gunzip($_.gcov.json.gz): $IO::Uncompress::Gunzip::GunzipError";
my $obj= JSON::PP::decode_json $gcov_file_json;
for my $file (@{$obj->{files}}) {
for my $line (@{$file->{lines}}){
$cov{$file->{file}}->{$line->{line_number}}+= $line->{count};
}
$cov{$fname}->{$1}+=$2;
}
close(FH);
}
}

Expand Down
6 changes: 6 additions & 0 deletions mysql-test/include/have_file_key_management.inc
Expand Up @@ -2,3 +2,9 @@ if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'file
{
--skip Test requires file_key_management plugin
}

#
# This file is only included when using encryption. As all encryption test are
# very slow with valgrind, lets disable these if not run with --big
#
--source include/no_valgrind_without_big.inc
2 changes: 0 additions & 2 deletions mysql-test/include/master-slave.inc
@@ -1,5 +1,3 @@
--source include/no_valgrind_without_big.inc

# ==== Purpose ====
#
# Configure two servers to be replication master and slave.
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/lib/My/Debugger.pm
Expand Up @@ -147,7 +147,7 @@ sub do_args($$$$$) {
my $v = $debuggers{$k};

# on windows mtr args are quoted (for system), otherwise not (for exec)
sub quote($) { $_[0] =~ /[; ]/ ? "\"$_[0]\"" : $_[0] }
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]) }
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/main/bad_startup_options.test
@@ -1,3 +1,6 @@
# mysqld refuses to run as root normally.
--source include/not_as_root.inc

--source include/not_embedded.inc
--source include/have_ssl_communication.inc

Expand Down
4 changes: 2 additions & 2 deletions mysql-test/main/fix_priv_tables.result
Expand Up @@ -17,7 +17,7 @@ GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost;
SHOW GRANTS FOR 'select_only_c1'@'localhost';
Grants for select_only_c1@localhost
GRANT USAGE ON *.* TO `select_only_c1`@`localhost`
GRANT SELECT (c1) ON `testdb`.`v1` TO `select_only_c1`@`localhost`
GRANT SELECT (`c1`) ON `testdb`.`v1` TO `select_only_c1`@`localhost`

"after fix privs"
SHOW GRANTS FOR 'show_view_tbl'@'localhost';
Expand All @@ -28,7 +28,7 @@ GRANT CREATE VIEW, SHOW VIEW ON `testdb`.`v1` TO `show_view_tbl`@`localhost`
SHOW GRANTS FOR 'select_only_c1'@'localhost';
Grants for select_only_c1@localhost
GRANT USAGE ON *.* TO `select_only_c1`@`localhost`
GRANT SELECT (c1) ON `testdb`.`v1` TO `select_only_c1`@`localhost`
GRANT SELECT (`c1`) ON `testdb`.`v1` TO `select_only_c1`@`localhost`

DROP USER 'show_view_tbl'@'localhost';
DROP USER 'select_only_c1'@'localhost';
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/main/func_encrypt_ucs2.result
Expand Up @@ -9,11 +9,11 @@ CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED)
0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '\xFFT\xDCiK\x92j\xE6\xFC'
SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)));
CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)))
SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))) as a;
a
4
SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED);
CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED)
SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED) as a;
a
0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'test'
5 changes: 2 additions & 3 deletions mysql-test/main/func_encrypt_ucs2.test
Expand Up @@ -8,8 +8,7 @@
SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)));
SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED);

#enable after fix MDEV-28643, MDEV-27871
--disable_view_protocol
SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)));
SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED);
SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))) as a;
SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED) as a;
--enable_view_protocol
3 changes: 3 additions & 0 deletions mysql-test/main/gis-json.result
Expand Up @@ -58,6 +58,9 @@ Warning 4038 Syntax error in JSON text in argument 1 to function 'st_geomfromgeo
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'))
POINT(102 0.5)
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'));
st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'))
POINT(102 0.5)
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));
st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'))
GEOMETRYCOLLECTION(POINT(102 0.5))
Expand Down
1 change: 1 addition & 0 deletions mysql-test/main/gis-json.test
Expand Up @@ -26,6 +26,7 @@ SELECT st_astext(st_geomfromgeojson('{"type""point"}'));
#enable after fix MDEV-27871
--disable_view_protocol
SELECT st_astext(st_geomfromgeojson('{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] } }'));
SELECT st_astext(st_geomfromgeojson('{ "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "type": "Feature" }'));
SELECT st_astext(st_geomfromgeojson('{ "type": "FeatureCollection", "features": [{ "type": "Feature", "geometry": { "type": "Point", "coordinates": [102.0, 0.5] }, "properties": { "prop0": "value0" } }]}'));


Expand Down

0 comments on commit a8a5c8a

Please sign in to comment.