Skip to content
Permalink
Browse files

Merge 10.2 into bb-10.2-mariarocks

  • Loading branch information...
spetrunia committed Apr 3, 2017
2 parents 5c66eb5 + c07bb70 commit 5e0ed6912ff6c9c5204b413ef9ea6bb9e3fd4047
@@ -140,3 +140,7 @@ create table t1 (a int, b int, check(a>0));
alter table t1 drop column a;
ERROR 42S22: Unknown column 'a' in 'CHECK'
drop table t1;
create table t1 (a int check (@b in (select user from mysql.user)));
ERROR HY000: Function or expression 'select ...' cannot be used in the CHECK clause of `a`
create table t1 (a int check (a > @b));
ERROR HY000: Function or expression '@b' cannot be used in the CHECK clause of `a`
@@ -121,3 +121,12 @@ a
2
#cleanup
DROP TABLE t1, pid_table;
#
# MDEV-12416 OOM in create_virtual_tmp_table() makes the server crash
#
CREATE FUNCTION f1(a INT) RETURNS INT RETURN a;
SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
SELECT f1(1);
Got one of the listed errors
DROP FUNCTION f1;
SET SESSION debug_dbug=DEFAULT;
@@ -207,7 +207,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /Expected to open 3 undo tablespaces but was able to find only 1 undo tablespaces/ in mysqld.1.err
FOUND 1 /InnoDB: Unable to open undo tablespace.*undo002/ in mysqld.1.err
bak_ib_logfile0
bak_ib_logfile1
bak_ib_logfile2
@@ -244,7 +244,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /Expected to open 3 undo tablespaces but was able to find only 0 undo tablespaces/ in mysqld.1.err
FOUND 1 /InnoDB: Unable to open undo tablespace.*undo001/ in mysqld.1.err
bak_ib_logfile0
bak_ib_logfile1
bak_ib_logfile2
@@ -40,7 +40,7 @@ AND support IN ('YES', 'DEFAULT', 'ENABLED');
--let $ibp=$ibp --innodb-data-file-path=ibdata1:16M;ibdata2:10M:autoextend

--echo # Start mysqld without the possibility to create innodb_undo_tablespaces
--let $restart_parameters= $ibp --innodb-undo-tablespaces=3
--let $restart_parameters= $ibp
--mkdir $bugdir/undo002
--source include/restart_mysqld.inc
eval $check_no_innodb;
@@ -171,7 +171,7 @@ let SEARCH_PATTERN=undo tablespace .*undo003.* exists\. Creating system tablespa
--source include/start_mysqld.inc
eval $check_no_innodb;
--source include/shutdown_mysqld.inc
let SEARCH_PATTERN=Expected to open 3 undo tablespaces but was able to find only 1 undo tablespaces;
let SEARCH_PATTERN=InnoDB: Unable to open undo tablespace.*undo002;
--source include/search_pattern_in_file.inc
# clean up & Restore
--source ../include/log_file_cleanup.inc
@@ -183,7 +183,7 @@ let SEARCH_PATTERN=Expected to open 3 undo tablespaces but was able to find only
--source include/start_mysqld.inc
eval $check_no_innodb;
--source include/shutdown_mysqld.inc
let SEARCH_PATTERN=Expected to open 3 undo tablespaces but was able to find only 0 undo tablespaces;
let SEARCH_PATTERN=InnoDB: Unable to open undo tablespace.*undo001;
--source include/search_pattern_in_file.inc

# clean up & Restore
@@ -1 +1 @@
cmp_per_index: MDEV-11629

@@ -39,13 +39,13 @@ BEGIN;
COMMIT;
ALTER TABLE t DROP INDEX c;
GRANT USAGE ON *.* TO 'tuser01'@'localhost' IDENTIFIED BY 'cDJvI9s_Uq';
Warnings:
Level Warning
Code 1287
Message Using GRANT for creating new user is deprecated and will be removed in future release. Create new user with CREATE USER statement.
FLUSH PRIVILEGES;
connect con1,localhost,tuser01,cDJvI9s_Uq,;
connection con1;
SELECT * FROM information_schema.innodb_cmp_per_index;
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
connection default;
disconnect con1;
DROP USER 'tuser01'@'localhost';
SELECT
database_name,
@@ -70,7 +70,6 @@ index_name PRIMARY
compress_ops 65
compress_ops_ok 65
uncompress_ops 0
# restart
SET GLOBAL innodb_cmp_per_index_enabled=ON;
SELECT COUNT(*) FROM t;
COUNT(*) 128
@@ -86,9 +85,15 @@ FROM information_schema.innodb_cmp_per_index
ORDER BY 1, 2, 3;
database_name test
table_name t
index_name b
compress_ops 0
compress_ops_ok 0
uncompress_ops 6
database_name test
table_name t
index_name PRIMARY
compress_ops 0
compress_ops_ok 0
uncompress_ops 9
uncompress_ops 5
DROP TABLE t;
SET GLOBAL innodb_cmp_per_index_enabled=default;
@@ -0,0 +1,2 @@
--innodb_log_compressed_pages=on
--innodb_cmp_per_index_reset
@@ -40,12 +40,6 @@ connection default;
select * from t1;
a b c d e
2010-10-10 10:10:10 1 0 0 NULL
Warnings:
Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '2'
Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '2'
drop table t1;
connect con1, localhost, root;
create table t1 (a datetime,
@@ -16,11 +16,15 @@ create table t1 (a datetime,
);
show create table t1;
connect con1, localhost, root;
disable_warnings;
insert t1 (a) values ('2010-10-10 10:10:10');
enable_warnings;
select * from t1;
disconnect con1;
connection default;
disable_warnings;
select * from t1;
enable_warnings;
drop table t1;

connect con1, localhost, root;
@@ -86,3 +86,11 @@ create table t1 (a int, b int, check(a>0));
--error ER_BAD_FIELD_ERROR
alter table t1 drop column a;
drop table t1;

#
# MDEV-12421 Check constraint with query crashes server and renders DB unusable
#
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t1 (a int check (@b in (select user from mysql.user)));
--error ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED
create table t1 (a int check (a > @b));
@@ -148,3 +148,17 @@ SELECT a FROM t1 ORDER BY rand(1);

--echo #cleanup
DROP TABLE t1, pid_table;



--echo #
--echo # MDEV-12416 OOM in create_virtual_tmp_table() makes the server crash
--echo #

CREATE FUNCTION f1(a INT) RETURNS INT RETURN a;
SET SESSION debug_dbug="+d,simulate_create_virtual_tmp_table_out_of_memory";
# May fail with either ER_OUT_OF_RESOURCES or EE_OUTOFMEMORY
--error ER_OUT_OF_RESOURCES, 5
SELECT f1(1);
DROP FUNCTION f1;
SET SESSION debug_dbug=DEFAULT;
@@ -1,5 +1,5 @@
--source include/not_valgrind.inc
--disable_ps_protocol
--source include/no_protocol.inc

SET GLOBAL net_write_timeout = 900;

@@ -137,8 +137,8 @@ ELSE()
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/aws_sdk_cpp/include)
ENDIF()

MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc
COMPONENT aws-key-management)
ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
TARGET_LINK_LIBRARIES(aws_key_management ${AWS_SDK_LIBS})
MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc
LINK_LIBRARIES ${AWS_SDK_LIBS}
COMPONENT aws-key-management)
@@ -1993,7 +1993,7 @@ class Virtual_tmp_table: public TABLE
This is needed to avoid memory leaks, as some fields can be BLOB
variants and thus can have String onboard. Strings must be destructed
as they store data not the heap (not on MEM_ROOT).
as they store data on the heap (not on MEM_ROOT).
*/
void destruct_fields()
{
@@ -2025,6 +2025,7 @@ class Virtual_tmp_table: public TABLE
@param thd - Current thread.
*/
static void *operator new(size_t size, THD *thd) throw();
static void operator delete(void *ptr, size_t size) { TRASH(ptr, size); }

Virtual_tmp_table(THD *thd)
{
@@ -2035,7 +2036,8 @@ class Virtual_tmp_table: public TABLE

~Virtual_tmp_table()
{
destruct_fields();
if (s)
destruct_fields();
}

/**
@@ -2120,6 +2122,17 @@ create_virtual_tmp_table(THD *thd, List<Column_definition> &field_list)
Virtual_tmp_table *table;
if (!(table= new(thd) Virtual_tmp_table(thd)))
return NULL;

/*
If "simulate_create_virtual_tmp_table_out_of_memory" debug option
is enabled, we now enable "simulate_out_of_memory". This effectively
makes table->init() fail on OOM inside multi_alloc_root().
This is done to test that ~Virtual_tmp_table() called from the "delete"
below correcly handles OOM.
*/
DBUG_EXECUTE_IF("simulate_create_virtual_tmp_table_out_of_memory",
DBUG_SET("+d,simulate_out_of_memory"););

if (table->init(field_list.elements) ||
table->add(field_list) ||
table->open())
@@ -4667,7 +4667,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE *table,
table_list.view= (LEX*) share->is_view;
res= schema_table->process_table(thd, &table_list, table,
res, db_name, table_name);
free_root(&tbl.mem_root, MYF(0));
closefrm(&tbl);
}


@@ -6013,8 +6013,8 @@ field_list_item:
;

column_def:
field_spec opt_check_constraint
{ $$= $1; $$->check_constraint= $2; }
field_spec
{ $$= $1; }
| field_spec references
{ $$= $1; }
;
@@ -6152,11 +6152,13 @@ field_spec:
lex->init_last_field(f, $1.str, NULL);
$<create_field>$= f;
}
field_type_or_serial
field_type_or_serial opt_check_constraint
{
LEX *lex=Lex;
$$= $<create_field>2;

$$->check_constraint= $4;

if ($$->check(thd))
MYSQL_YYABORT;

{
MYSQL_SYSVAR_NAME(undo_logs).max_val
= MYSQL_SYSVAR_NAME(undo_logs).def_val
= static_cast<unsigned long>(srv_available_undo_logs);
= srv_available_undo_logs;
}

/****************************************************************************
@@ -334,9 +334,6 @@ extern my_bool srv_undo_log_truncate;
/* Enables or disables this prefix optimization. Disabled by default. */
extern my_bool srv_prefix_index_cluster_optimization;

/** UNDO logs not redo logged, these logs reside in the temp tablespace.*/
extern const ulong srv_tmp_undo_logs;

/** Default size of UNDO tablespace while it is created new. */
extern const ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES;

@@ -518,7 +515,8 @@ extern uint srv_spin_wait_delay;
extern ibool srv_priority_boost;

extern ulint srv_truncated_status_writes;
extern ulint srv_available_undo_logs;
/** Number of initialized rollback segments for persistent undo log */
extern ulong srv_available_undo_logs;

#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG
extern my_bool srv_ibuf_disable_background_merge;
@@ -85,16 +85,6 @@ trx_rsegf_undo_find_free(
/*=====================*/
trx_rsegf_t* rsegf, /*!< in: rollback segment header */
mtr_t* mtr); /*!< in: mtr */
/** Get a rollback segment.
@param[in] id rollback segment id
@return rollback segment */
UNIV_INLINE
trx_rseg_t*
trx_rseg_get_on_id(ulint id)
{
ut_a(id < TRX_SYS_N_RSEGS);
return(trx_sys->rseg_array[id]);
}

/** Creates a rollback segment header.
This function is called only when a new rollback segment is created in
@@ -119,14 +109,14 @@ trx_rseg_array_init();
void
trx_rseg_mem_free(trx_rseg_t* rseg);

/*********************************************************************
Creates a rollback segment. */
/** Create a persistent rollback segment.
@param[in] space_id system or undo tablespace id */
trx_rseg_t*
trx_rseg_create(
/*============*/
ulint space_id, /*!< in: id of UNDO tablespace */
ulint nth_free_slot); /*!< in: allocate nth free slot.
0 means next free slots. */
trx_rseg_create(ulint space_id);

/** Create the temporary rollback segments. */
void
trx_temp_rseg_create();

/********************************************************************
Get the number of unique rollback tablespaces in use except space id 0.
@@ -205,6 +195,14 @@ struct trx_rseg_t {
/** If true, then skip allocating this rseg as it reside in
UNDO-tablespace marked for truncate. */
bool skip_allocation;

/** @return whether the rollback segment is persistent */
bool is_persistent() const
{
ut_ad(space == SRV_TMP_SPACE_ID
|| space <= srv_undo_tablespaces);
return(space != SRV_TMP_SPACE_ID);
}
};

/* Undo log segment slot in a rollback segment header */

0 comments on commit 5e0ed69

Please sign in to comment.
You can’t perform that action at this time.