Skip to content

Commit

Permalink
Merge branch '10.1' into 10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Sep 24, 2018
2 parents 76098f4 + 1fc5a6f commit 5ae8fce
Show file tree
Hide file tree
Showing 73 changed files with 1,662 additions and 574 deletions.
4 changes: 3 additions & 1 deletion CREDITS
Expand Up @@ -10,9 +10,11 @@ Microsoft https://microsoft.com/ (2017)
Tencent Cloud https://cloud.tencent.com (2017)
Development Bank of Singapore https://dbs.com (2016)
IBM https://www.ibm.com (2017)
Tencent Games http://game.qq.com/ (2018)
Visma https://visma.com (2015)
Acronis http://acronis.com (2016)
Acronis https://acronis.com (2016)
Nexedi https://www.nexedi.com (2016)
Percona https://www.percona.com (2018)
Tencent Game DBA http://tencentdba.com/about (2016)
Tencent TDSQL http://tdsql.org (2016)
Verkkokauppa.com https://www.verkkokauppa.com (2015)
Expand Down
35 changes: 33 additions & 2 deletions extra/mariabackup/xtrabackup.cc
Expand Up @@ -694,6 +694,38 @@ static void backup_truncate_fail()
: " Use --lock-ddl-per-table to lock all tables before backup.");
}


/*
Retrieve default data directory, to be used with --copy-back.
On Windows, default datadir is ..\data, relative to the
directory where mariabackup.exe is located(usually "bin")
Elsewhere, the compiled-in constant MYSQL_DATADIR is used.
*/
static char *get_default_datadir() {
static char ddir[] = MYSQL_DATADIR;
#ifdef _WIN32
static char buf[MAX_PATH];
DWORD size = (DWORD)sizeof(buf) - 1;
if (GetModuleFileName(NULL, buf, size) <= size)
{
char *p;
if ((p = strrchr(buf, '\\')))
{
*p = 0;
if ((p = strrchr(buf, '\\')))
{
strncpy(p + 1, "data", buf + MAX_PATH - p);
return buf;
}
}
}
#endif
return ddir;
}


/* ======== Date copying thread context ======== */

typedef struct {
Expand Down Expand Up @@ -6313,8 +6345,7 @@ static int main_low(char** argv)

if (xtrabackup_copy_back || xtrabackup_move_back) {
if (!check_if_param_set("datadir")) {
msg("Error: datadir must be specified.\n");
return(EXIT_FAILURE);
mysql_data_home = get_default_datadir();
}
if (!copy_back())
return(EXIT_FAILURE);
Expand Down
4 changes: 3 additions & 1 deletion mysql-test/r/contributors.result
Expand Up @@ -8,12 +8,14 @@ MariaDB Corporation https://mariadb.com Founding member, Platinum Sponsor of the
Visma https://visma.com Gold Sponsor of the MariaDB Foundation
DBS https://dbs.com Gold Sponsor of the MariaDB Foundation
IBM https://www.ibm.com Gold Sponsor of the MariaDB Foundation
Tencent Games http://game.qq.com/ Gold Sponsor of the MariaDB Foundation
Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation
Acronis http://www.acronis.com Silver Sponsor of the MariaDB Foundation
Acronis https://www.acronis.com Silver Sponsor of the MariaDB Foundation
Verkkokauppa.com https://www.verkkokauppa.com Bronze Sponsor of the MariaDB Foundation
Virtuozzo https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation
Tencent Game DBA http://tencentdba.com/about Bronze Sponsor of the MariaDB Foundation
Tencent TDSQL http://tdsql.org Bronze Sponsor of the MariaDB Foundation
Percona https://www.percona.com/ Bronze Sponsor of the MariaDB Foundation
Google USA Sponsoring encryption, parallel replication and GTID
Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc
Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction
Expand Down
15 changes: 15 additions & 0 deletions mysql-test/r/create_or_replace.result
Expand Up @@ -479,6 +479,21 @@ UNLOCK TABLES;
DROP FUNCTION f1;
DROP TABLE t1;
#
# MDEV-14410 - Assertion `table->pos_in_locked_tables == __null ||
# table->pos_in_locked_tables->table == table' failed in
# mark_used_tables_as_free_for_reuse
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT);
CREATE TABLE t3 (c INT);
CREATE TRIGGER tr1 BEFORE INSERT ON t3 FOR EACH ROW INSERT INTO t1 VALUES ();
CREATE TRIGGER tr2 BEFORE INSERT ON t2 FOR EACH ROW INSERT INTO t3 SELECT * FROM t1;
LOCK TABLE t1 WRITE, t2 WRITE;
CREATE OR REPLACE TABLE t1 (i INT);
UNLOCK TABLES;
INSERT INTO t2 VALUES (1);
DROP TABLE t1, t2, t3;
#
# MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
# Locked_tables_list::unlock_locked_tables
#
Expand Down
158 changes: 158 additions & 0 deletions mysql-test/r/func_time.result
Expand Up @@ -2803,6 +2803,164 @@ PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli'))
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '-3S\xFA\xDE?\x00\x00\xCA\xB3\xEEE\xA4\xD1\xC1\xA8'
#
# MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result
#
SELECT
MAKETIME(1e10,0,0),
MAKETIME(-1e10,0,0),
MAKETIME(1e50,0,0),
MAKETIME(-1e50,0,0),
MAKETIME(COALESCE(1e50),0,0),
MAKETIME(COALESCE(-1e50),0,0);
MAKETIME(1e10,0,0) 838:59:59
MAKETIME(-1e10,0,0) -838:59:59
MAKETIME(1e50,0,0) 838:59:59
MAKETIME(-1e50,0,0) -838:59:59
MAKETIME(COALESCE(1e50),0,0) 838:59:59
MAKETIME(COALESCE(-1e50),0,0) -838:59:59
Warnings:
Level Warning
Code 1292
Message Truncated incorrect time value: '10000000000:00:00'
Level Warning
Code 1292
Message Truncated incorrect time value: '-10000000000:00:00'
Level Warning
Code 1292
Message Truncated incorrect time value: '9223372036854775807:00:00'
Level Warning
Code 1292
Message Truncated incorrect time value: '-9223372036854775808:00:00'
Level Warning
Code 1292
Message Truncated incorrect time value: '9223372036854775807:00:00'
Level Warning
Code 1292
Message Truncated incorrect time value: '-9223372036854775808:00:00'
CREATE TABLE t1 (a FLOAT);
INSERT INTO t1 VALUES (1e30),(-1e30);
SELECT MAKETIME(a,0,0) FROM t1;
MAKETIME(a,0,0)
838:59:59
-838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '9223372036854775807:00:00'
Warning 1292 Truncated incorrect time value: '-9223372036854775808:00:00'
DROP TABLE t1;
#
# MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result
#
SELECT MAKETIME(900,0,0);
MAKETIME(900,0,0)
838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.1);
MAKETIME(900,0,0.1)
838:59:59.9
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.11);
MAKETIME(900,0,0.11)
838:59:59.99
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.111);
MAKETIME(900,0,0.111)
838:59:59.999
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.1111);
MAKETIME(900,0,0.1111)
838:59:59.9999
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.11111);
MAKETIME(900,0,0.11111)
838:59:59.99999
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.111111);
MAKETIME(900,0,0.111111)
838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.1111111);
MAKETIME(900,0,0.1111111)
838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.11111111);
MAKETIME(900,0,0.11111111)
838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,0.111111111);
MAKETIME(900,0,0.111111111)
838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:00'
SELECT MAKETIME(900,0,EXP(1));
MAKETIME(900,0,EXP(1))
838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '900:00:02'
SELECT MAKETIME(-900,0,0);
MAKETIME(-900,0,0)
-838:59:59
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.1);
MAKETIME(-900,0,0.1)
-838:59:59.9
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.11);
MAKETIME(-900,0,0.11)
-838:59:59.99
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.111);
MAKETIME(-900,0,0.111)
-838:59:59.999
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.1111);
MAKETIME(-900,0,0.1111)
-838:59:59.9999
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.11111);
MAKETIME(-900,0,0.11111)
-838:59:59.99999
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.111111);
MAKETIME(-900,0,0.111111)
-838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.1111111);
MAKETIME(-900,0,0.1111111)
-838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.11111111);
MAKETIME(-900,0,0.11111111)
-838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,0.111111111);
MAKETIME(-900,0,0.111111111)
-838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:00'
SELECT MAKETIME(-900,0,EXP(1));
MAKETIME(-900,0,EXP(1))
-838:59:59.999999
Warnings:
Warning 1292 Truncated incorrect time value: '-900:00:02'
#
# End of 5.5 tests
#
#
Expand Down
32 changes: 32 additions & 0 deletions mysql-test/r/grant.result
Expand Up @@ -2666,6 +2666,38 @@ disconnect conn2;
disconnect conn3;
DROP USER foo@'127.0.0.1';
# End of Bug#12766319
create user foo@localhost;
create database foodb;
grant create routine on foodb.* to foo@localhost;
connect con1,localhost,foo;
create procedure fooproc() select 'i am fooproc';
show grants;
Grants for foo@localhost
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost'
GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'localhost'
disconnect con1;
connection default;
rename table mysql.procs_priv to mysql.procs_priv1;
flush privileges;
show grants for foo@localhost;
Grants for foo@localhost
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost'
rename table mysql.procs_priv1 to mysql.procs_priv;
show grants for foo@localhost;
Grants for foo@localhost
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost'
flush privileges;
show grants for foo@localhost;
Grants for foo@localhost
GRANT USAGE ON *.* TO 'foo'@'localhost'
GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost'
GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'localhost'
drop user foo@localhost;
drop procedure fooproc;
drop database foodb;
#
# Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
# DATABASE SECURITY
Expand Down
26 changes: 26 additions & 0 deletions mysql-test/r/sp-security.result
Expand Up @@ -710,6 +710,32 @@ connection default;
disconnect con2;
DROP USER user2@localhost;
DROP DATABASE db1;
create user foo@local_ost;
create user foo@`local\_ost`;
update mysql.user set plugin='foobar' where host='local\\_ost';
flush privileges;
create database foodb;
grant create routine on foodb.* to foo@local_ost;
connect con1,localhost,foo;
select user(), current_user();
user() current_user()
foo@localhost foo@local_ost
show grants;
Grants for foo@local_ost
GRANT USAGE ON *.* TO 'foo'@'local_ost'
GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'local_ost'
create procedure fooproc() select 'i am fooproc';
show grants;
Grants for foo@local_ost
GRANT USAGE ON *.* TO 'foo'@'local_ost'
GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'local_ost'
GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'local_ost'
disconnect con1;
connection default;
drop user foo@local_ost;
drop user foo@`local\_ost`;
drop procedure fooproc;
drop database foodb;
#
# Test for bug#12602983 - User without privilege on routine can discover
# its existence by executing "select non_existing_func();" or by
Expand Down
53 changes: 0 additions & 53 deletions mysql-test/r/stat_tables.result
Expand Up @@ -591,59 +591,6 @@ id select_type table type possible_keys key key_len ref rows Extra
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set use_stat_tables=@save_use_stat_tables;
#
# MDEV-16757: manual addition of min/max statistics for BLOB
#
SET use_stat_tables= PREFERABLY;
CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT);
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze Warning Engine-independent statistics are not collected for column 't'
test.t1 analyze status OK
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
DELETE FROM mysql.column_stats
WHERE db_name='test' AND table_name='t1' AND column_name='t';
INSERT INTO mysql.column_stats VALUES
('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL);
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL
SELECT pk FROM t1;
pk
1
2
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
#
# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE
#
SET use_stat_tables= PREFERABLY;
CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32));
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
SELECT * FROM t1;
pk c
1 foo
2 bar
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL
CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7));
SELECT * FROM t1;
pk a
SELECT * FROM mysql.column_stats;
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
DROP TABLE t1;
set use_stat_tables=@save_use_stat_tables;
#
# MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column
#
SET use_stat_tables= PREFERABLY;
Expand Down

0 comments on commit 5ae8fce

Please sign in to comment.