Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Barkov committed Apr 3, 2017
2 parents f00a314 + c07bb70 commit 015868e
Show file tree
Hide file tree
Showing 29 changed files with 409 additions and 646 deletions.
2 changes: 1 addition & 1 deletion libmariadb
4 changes: 4 additions & 0 deletions mysql-test/r/check_constraint.result
Expand Up @@ -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`
4 changes: 2 additions & 2 deletions mysql-test/suite/innodb/r/log_file.result
Expand Up @@ -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 /Expected to open 3 undo tablespaces but was able to find only 1 undo tablespaces/ in mysqld.1.err
FOUND /InnoDB: Unable to open undo tablespace.*undo002/ in mysqld.1.err
bak_ib_logfile0
bak_ib_logfile1
bak_ib_logfile2
Expand Down Expand Up @@ -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 /Expected to open 3 undo tablespaces but was able to find only 0 undo tablespaces/ in mysqld.1.err
FOUND /InnoDB: Unable to open undo tablespace.*undo001/ in mysqld.1.err
bak_ib_logfile0
bak_ib_logfile1
bak_ib_logfile2
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/innodb/t/log_file.test
Expand Up @@ -41,7 +41,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;
Expand Down Expand Up @@ -172,7 +172,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
Expand All @@ -184,7 +184,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
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/innodb_zip/disabled.def
@@ -1 +1 @@
cmp_per_index: MDEV-11629

17 changes: 11 additions & 6 deletions mysql-test/suite/innodb_zip/r/cmp_per_index.result
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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;
2 changes: 2 additions & 0 deletions mysql-test/suite/innodb_zip/t/cmp_per_index.opt
@@ -0,0 +1,2 @@
--innodb_log_compressed_pages=on
--innodb_cmp_per_index_reset
6 changes: 0 additions & 6 deletions mysql-test/suite/vcol/r/wrong_arena.result
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/suite/vcol/t/wrong_arena.test
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions mysql-test/t/check_constraint.test
Expand Up @@ -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));
2 changes: 1 addition & 1 deletion mysql-test/t/mdev-504.test
@@ -1,5 +1,5 @@
--source include/not_valgrind.inc
--disable_ps_protocol
--source include/no_protocol.inc

SET GLOBAL net_write_timeout = 900;

Expand Down
6 changes: 3 additions & 3 deletions plugin/aws_key_management/CMakeLists.txt
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion sql/sql_show.cc
Expand Up @@ -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);
}


Expand Down
8 changes: 5 additions & 3 deletions sql/sql_yacc.yy
Expand Up @@ -5985,8 +5985,8 @@ field_list_item:
;

column_def:
field_spec opt_check_constraint
{ $$= $1; $$->check_constraint= $2; }
field_spec
{ $$= $1; }
| field_spec references
{ $$= $1; }
;
Expand Down Expand Up @@ -6124,11 +6124,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;

Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/handler/ha_innodb.cc
Expand Up @@ -22140,7 +22140,7 @@ innobase_undo_logs_init_default_max()
{
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;
}

/****************************************************************************
Expand Down
6 changes: 2 additions & 4 deletions storage/innobase/include/srv0srv.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
32 changes: 15 additions & 17 deletions storage/innobase/include/trx0rseg.h
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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 */
Expand Down
49 changes: 18 additions & 31 deletions storage/innobase/include/trx0sys.h
Expand Up @@ -75,17 +75,10 @@ Creates and initializes the transaction system at the database creation. */
void
trx_sys_create_sys_pages(void);
/*==========================*/
/****************************************************************//**
Looks for a free slot for a rollback segment in the trx system file copy.
@return slot index or ULINT_UNDEFINED if not found */
/** @return an unallocated rollback segment slot in the TRX_SYS header
@retval ULINT_UNDEFINED if not found */
ulint
trx_sysf_rseg_find_free(
/*====================*/
mtr_t* mtr, /*!< in/out: mtr */
bool include_tmp_slots, /*!< in: if true, report slots reserved
for temp-tablespace as free slots. */
ulint nth_free_slots); /*!< in: allocate nth free slot.
0 means next free slot. */
trx_sysf_rseg_find_free(mtr_t* mtr);
/**********************************************************************//**
Gets a pointer to the transaction system file copy and x-locks its page.
@return pointer to system file copy, page x-locked */
Expand Down Expand Up @@ -160,14 +153,6 @@ trx_sys_get_max_trx_id(void);
extern uint trx_rseg_n_slots_debug;
#endif

/*****************************************************************//**
Check if slot-id is reserved slot-id for noredo rsegs. */
UNIV_INLINE
bool
trx_sys_is_noredo_rseg_slot(
/*========================*/
ulint slot_id); /*!< in: slot_id to check */

/*****************************************************************//**
Writes a trx id to an index page. In case that the id size changes in
some future version, this function should be used instead of
Expand Down Expand Up @@ -319,16 +304,10 @@ trx_sys_file_format_max_set(
ulint format_id, /*!< in: file format id */
const char** name); /*!< out: max file format name or
NULL if not needed. */
/*********************************************************************
Creates the rollback segments
@return number of rollback segments that are active. */
ulint
trx_sys_create_rsegs(
/*=================*/
ulint n_spaces, /*!< number of tablespaces for UNDO logs */
ulint n_rsegs, /*!< number of rollback segments to create */
ulint n_tmp_rsegs); /*!< number of rollback segments reserved for
temp-tables. */
/** Create the rollback segments.
@return whether the creation succeeded */
bool
trx_sys_create_rsegs();
/*****************************************************************//**
Get the number of transaction in the system, independent of their state.
@return count of transactions in trx_sys_t::trx_list */
Expand Down Expand Up @@ -556,13 +535,15 @@ struct trx_sys_t {
transactions which exist or existed */
#endif /* UNIV_DEBUG */

char pad1[64]; /*!< To avoid false sharing */
/** Avoid false sharing */
const char pad1[CACHE_LINE_SIZE];
trx_ut_list_t rw_trx_list; /*!< List of active and committed in
memory read-write transactions, sorted
on trx id, biggest first. Recovered
transactions are always on this list. */

char pad2[64]; /*!< To avoid false sharing */
/** Avoid false sharing */
const char pad2[CACHE_LINE_SIZE];
trx_ut_list_t mysql_trx_list; /*!< List of transactions created
for MySQL. All user transactions are
on mysql_trx_list. The rw_trx_list
Expand All @@ -582,7 +563,13 @@ struct trx_sys_t {
to ensure right order of removal and
consistent snapshot. */

char pad3[64]; /*!< To avoid false sharing */
/** Avoid false sharing */
const char pad3[CACHE_LINE_SIZE];
/** Temporary rollback segments */
trx_rseg_t* temp_rsegs[TRX_SYS_N_RSEGS];
/** Avoid false sharing */
const char pad4[CACHE_LINE_SIZE];

trx_rseg_t* rseg_array[TRX_SYS_N_RSEGS];
/*!< Pointer array to rollback
segments; NULL if slot not in use;
Expand Down
12 changes: 0 additions & 12 deletions storage/innobase/include/trx0sys.ic
Expand Up @@ -191,18 +191,6 @@ trx_write_trx_id(
mach_write_to_6(ptr, id);
}

/*****************************************************************//**
Check if slot-id is reserved slot-id for noredo rsegs. */
UNIV_INLINE
bool
trx_sys_is_noredo_rseg_slot(
/*========================*/
ulint slot_id) /*!< in: slot_id to check */
{
/* Slots allocated from temp-tablespace are no-redo slots. */
return(slot_id > 0 && slot_id < (srv_tmp_undo_logs + 1));
}

/*****************************************************************//**
Reads a trx id from an index page. In case that the id size changes in
some future version, this function should be used instead of
Expand Down

0 comments on commit 015868e

Please sign in to comment.