Skip to content

Commit

Permalink
Merge 11.1 into 11.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jun 28, 2023
2 parents dbc3429 + 8290a46 commit 2867894
Show file tree
Hide file tree
Showing 86 changed files with 1,983 additions and 1,096 deletions.
2 changes: 1 addition & 1 deletion BUILD/FINISH.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fi

commands=""
# git clean -fdX removes all ignored (build) files
if test -d .git
if test -d .git && test -d libmariadb/CMakeFiles
then
commands="\
git clean -fdX
Expand Down
2 changes: 1 addition & 1 deletion BUILD/SETUP.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ elif [ "x$warning_mode" = "xmaintainer" ]; then
debug_extra_cflags="-g3"
else
# Both C and C++ warnings
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing -Wimplicit-fallthrough=2 -Wformat-security -Wvla"
warnings="-Wall -Wextra -Wunused -Wwrite-strings -Wno-uninitialized -Wno-strict-aliasing -Wformat-security -Wvla"

# For more warnings, uncomment the following line
# warnings="$warnings -Wshadow"
Expand Down
43 changes: 27 additions & 16 deletions client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <sslopt-vars.h>
#include <../scripts/mariadb_fix_privilege_tables_sql.c>

#define VER "2.0"
#define VER "2.1"
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */

#ifdef HAVE_SYS_WAIT_H
Expand All @@ -37,7 +37,7 @@

static int phase = 0;
static int info_file= -1;
static const int phases_total = 7;
static const int phases_total = 8;
static char mysql_path[FN_REFLEN];
static char mysqlcheck_path[FN_REFLEN];

Expand Down Expand Up @@ -989,7 +989,7 @@ static my_bool is_mysql()

static int run_mysqlcheck_views(void)
{
const char *upgrade_views="--process-views=YES";
const char *upgrade_views="--process-views=UPGRADE";
if (upgrade_from_mysql)
{
/*
Expand Down Expand Up @@ -1129,8 +1129,9 @@ static my_bool from_before_10_1()
}


static void uninstall_plugins(void)
static int uninstall_plugins(void)
{
verbose("Phase %d/%d: uninstalling plugins", ++phase, phases_total);
if (ds_plugin_data_types.length)
{
char *plugins= ds_plugin_data_types.str;
Expand All @@ -1147,7 +1148,10 @@ static void uninstall_plugins(void)
next= get_line(next);
}
}
return 0;
}


/**
@brief Install plugins for missing data types
@details Check for entries with "Unknown data type" in I_S.TABLES,
Expand Down Expand Up @@ -1196,6 +1200,8 @@ static int install_used_plugin_data_types(void)
dynstr_free(&ds_result);
return 0;
}


/*
Check for entries with "Unknown storage engine" in I_S.TABLES,
try to load plugins for these tables if available (MDEV-11942)
Expand Down Expand Up @@ -1246,6 +1252,7 @@ static int install_used_engines(void)
return 0;
}


static int check_slave_repositories(void)
{
DYNAMIC_STRING ds_result;
Expand Down Expand Up @@ -1373,6 +1380,13 @@ static int run_sql_fix_privilege_tables(void)
}


static int flush_privileges(void)
{
verbose("Phase %d/%d: Running 'FLUSH PRIVILEGES'", ++phase, phases_total);
return run_query("FLUSH PRIVILEGES", NULL, TRUE);
}


/**
Check if the server version matches with the server version mysql_upgrade
was compiled with.
Expand Down Expand Up @@ -1402,10 +1416,11 @@ static int check_version_match(void)

if (calc_server_version((char *) version_str) != MYSQL_VERSION_ID)
{
fprintf(stderr, "Error: Server version (%s) does not match with the "
"version of\nthe server (%s) with which this program was built/"
"distributed. You can\nuse --skip-version-check to skip this "
"check.\n", version_str, MYSQL_SERVER_VERSION);
fprintf(stderr, "Error: Server version (%s)\n"
"does not match the version of the server (%s)\n"
"with which this program was built/distributed. You can\n"
"use --skip-version-check to skip this check.\n",
version_str, MYSQL_SERVER_VERSION);
return 1;
}
return 0;
Expand Down Expand Up @@ -1493,18 +1508,14 @@ int main(int argc, char **argv)
if (run_mysqlcheck_upgrade(TRUE) ||
install_used_engines() ||
install_used_plugin_data_types() ||
run_mysqlcheck_views() ||
run_sql_fix_privilege_tables() ||
run_mysqlcheck_views() ||
run_mysqlcheck_fixnames() ||
run_mysqlcheck_upgrade(FALSE) ||
check_slave_repositories())
check_slave_repositories() ||
uninstall_plugins() ||
flush_privileges())
die("Upgrade failed" );

uninstall_plugins();
verbose("Phase %d/%d: Running 'FLUSH PRIVILEGES'", ++phase, phases_total);
if (run_query("FLUSH PRIVILEGES", NULL, TRUE))
die("Upgrade failed" );

verbose("OK");

/* Finish writing indicating upgrade has been performed */
Expand Down
15 changes: 10 additions & 5 deletions client/mysqlcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ const char *operation_name[]=
"???", "check", "repair", "analyze", "optimize", "fix names"
};

typedef enum { DO_VIEWS_NO, DO_VIEWS_YES, DO_VIEWS_FROM_MYSQL } enum_do_views;
const char *do_views_opts[]= {"NO", "YES", "UPGRADE_FROM_MYSQL", NullS};
typedef enum { DO_VIEWS_NO, DO_VIEWS_YES, DO_UPGRADE, DO_VIEWS_FROM_MYSQL } enum_do_views;
const char *do_views_opts[]= {"NO", "YES", "UPGRADE", "UPGRADE_FROM_MYSQL",
NullS};
TYPELIB do_views_typelib= { array_elements(do_views_opts) - 1, "",
do_views_opts, NULL };
static ulong opt_do_views= DO_VIEWS_NO;
Expand Down Expand Up @@ -213,8 +214,9 @@ static struct my_option my_long_options[] =
{"process-views", 0,
"Perform the requested operation (check or repair) on views. "
"One of: NO, YES (correct the checksum, if necessary, add the "
"mariadb-version field), UPGRADE_FROM_MYSQL (same as YES and toggle "
"the algorithm MERGE<->TEMPTABLE.", &opt_do_views, &opt_do_views,
"mariadb-version field), UPGRADE (run from mariadb-upgrade), "
"UPGRADE_FROM_MYSQL (same as YES and toggle the algorithm "
"MERGE<->TEMPTABLE.", &opt_do_views, &opt_do_views,
&do_views_typelib, GET_ENUM, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"process-tables", 0, "Perform the requested operation on tables.",
&opt_do_tables, &opt_do_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
Expand Down Expand Up @@ -915,7 +917,10 @@ static int handle_request_for_tables(char *tables, size_t length,
op= opt_write_binlog ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
if (view)
{
if (opt_do_views == DO_VIEWS_FROM_MYSQL) end = strmov(end, " FROM MYSQL");
if (opt_do_views == DO_VIEWS_FROM_MYSQL)
end = strmov(end, " FROM MYSQL");
else if (opt_do_views == DO_UPGRADE)
end = strmov(end, " FOR UPGRADE");
}
else
{
Expand Down
18 changes: 18 additions & 0 deletions debian/mariadb-server.mariadb.init
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,24 @@ sanity_checks() {

# check for diskspace shortage
datadir=`mariadbd_get_param datadir`

# If datadir location is not changed int configuration
# then it's not printed with /usr/sbin/mariadbd --print-defaults
# then we use 'sane' default.
if [ -z "$datadir"]
then
datadir="/var/lib/mysql"
fi

# Check if there datadir location is available and
# fail if it's not
if [ ! -d "$datadir" ]
then
log_failure_msg "$0: ERROR: Can't locate MariaDB installation location $datadir"
echo "ERROR: Can't locate MariaDB installation location $datadir" | $ERR_LOGGER
exit 1
fi

# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024
# 4096 blocks is then lower than 4 MB
df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$datadir" | tail -n 1)"
Expand Down
2 changes: 1 addition & 1 deletion libmariadb
30 changes: 16 additions & 14 deletions mysql-test/main/ctype_upgrade.result
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ DROP TABLE mysql050614_xxx_croatian_ci;
# Checking mysql_upgrade
#
# Running mysql_upgrade
Phase 1/7: Checking and upgrading mysql database
Phase 1/8: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
Expand Down Expand Up @@ -258,8 +258,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Phase 2/8: Installing used storage engines... Skipped
Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK
sys.host_summary OK
sys.host_summary_by_file_io OK
Expand Down Expand Up @@ -361,9 +362,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Phase 5/8: Fixing table and database names
Phase 6/8: Checking and upgrading tables
Processing databases
information_schema
mtr
Expand All @@ -384,11 +384,12 @@ test.maria050313_ucs2_croatian_ci_def OK
test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK
Phase 7/7: Running 'FLUSH PRIVILEGES'
Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK
# Running mysql_upgrade for the second time
# This should report OK for all tables
Phase 1/7: Checking and upgrading mysql database
Phase 1/8: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats OK
Expand Down Expand Up @@ -419,8 +420,9 @@ mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
Phase 2/8: Installing used storage engines... Skipped
Phase 3/8: Running 'mysql_fix_privilege_tables'
Phase 4/8: Fixing views
mysql.user OK
sys.host_summary OK
sys.host_summary_by_file_io OK
Expand Down Expand Up @@ -522,9 +524,8 @@ sys.x$wait_classes_global_by_latency OK
sys.x$waits_by_host_by_latency OK
sys.x$waits_by_user_by_latency OK
sys.x$waits_global_by_latency OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Phase 5/8: Fixing table and database names
Phase 6/8: Checking and upgrading tables
Processing databases
information_schema
mtr
Expand All @@ -539,7 +540,8 @@ test.maria050313_utf8_croatian_ci OK
test.maria050533_xxx_croatian_ci OK
test.maria100004_xxx_croatian_ci OK
test.mysql050614_xxx_croatian_ci OK
Phase 7/7: Running 'FLUSH PRIVILEGES'
Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK
SHOW CREATE TABLE maria050313_ucs2_croatian_ci_def;
Table Create Table
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/main/explain_json.result
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index
explain select count(distinct a1,a2,b) from t1 where a1 >= "" and (a2 >= 'b') and (b = 'a');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 1 Using where; Using index for group-by
1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_2 147 NULL 17 Using where; Using index for group-by
explain format=json select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a');
EXPLAIN
{
Expand Down Expand Up @@ -1438,11 +1438,11 @@ EXPLAIN
"table_name": "t1",
"access_type": "range",
"possible_keys": ["idx_t1_0", "idx_t1_1", "idx_t1_2"],
"key": "idx_t1_1",
"key": "idx_t1_2",
"key_length": "147",
"used_key_parts": ["a1", "a2", "b"],
"loops": 1,
"rows": 1,
"rows": 17,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.b = 'a' and t1.a1 >= '' and t1.a2 >= 'b'",
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/flush_logs_not_windows.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

source include/not_windows.inc;
source include/not_embedded.inc;
source include/not_as_root.inc;

#
# MDEV-17710 "unknown error" with FLUSH LOGS if log directory is not writeable
#
Expand Down
24 changes: 0 additions & 24 deletions mysql-test/main/group_min_max.result
Original file line number Diff line number Diff line change
Expand Up @@ -4238,30 +4238,6 @@ a b s1
2 2 t2:t2a-null;min_t3_b:t3b-null
3 3 t2:1;min_t3_b:3
drop table t1,t2,t3;
#
# MDEV-31380: Assertion `s->table->opt_range_condition_rows <= s->found_records' failed
# (assertion in 10.6+, DBL_MAX costs in 10.5)
#
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a), KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_100;
SET
@tmp=@@optimizer_use_condition_selectivity,
optimizer_use_condition_selectivity = 1,
@tmp2=@@optimizer_trace,
optimizer_trace=1;
SELECT DISTINCT * FROM t1 WHERE a IN (1, 2);
a b
1 1
2 2
select
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100
from information_schema.optimizer_trace;
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100
1
set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
drop table t1;
#
# End of 10.5 tests
#
Expand Down
26 changes: 1 addition & 25 deletions mysql-test/main/group_min_max.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
--source include/default_optimizer_switch.inc
--source include/have_sequence.inc
--source include/have_innodb.inc
--source include/have_sequence.inc

#
# TODO:
# Add queries with:
Expand Down Expand Up @@ -1867,30 +1867,6 @@ from t1;

drop table t1,t2,t3;

--echo #
--echo # MDEV-31380: Assertion `s->table->opt_range_condition_rows <= s->found_records' failed
--echo # (assertion in 10.6+, DBL_MAX costs in 10.5)
--echo #

CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a), KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_100;

SET
@tmp=@@optimizer_use_condition_selectivity,
optimizer_use_condition_selectivity = 1,
@tmp2=@@optimizer_trace,
optimizer_trace=1;

SELECT DISTINCT * FROM t1 WHERE a IN (1, 2);

select
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100
from information_schema.optimizer_trace;

set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
drop table t1;

--echo #
--echo # End of 10.5 tests
--echo #
Expand Down
Loading

0 comments on commit 2867894

Please sign in to comment.