Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
6692b5f7
Commit
6692b5f7
authored
Nov 01, 2017
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.1 into 10.2
parents
c3b641ee
892cf2de
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
124 additions
and
113 deletions
+124
-113
mysql-test/suite/encryption/r/encryption_force.result
mysql-test/suite/encryption/r/encryption_force.result
+2
-2
mysql-test/suite/encryption/r/filekeys_encfile.result
mysql-test/suite/encryption/r/filekeys_encfile.result
+1
-1
mysql-test/suite/encryption/r/filekeys_encfile_file.result
mysql-test/suite/encryption/r/filekeys_encfile_file.result
+1
-1
mysql-test/suite/encryption/r/innodb-encryption-alter.result
mysql-test/suite/encryption/r/innodb-encryption-alter.result
+2
-3
mysql-test/suite/encryption/r/innodb-spatial-index.result
mysql-test/suite/encryption/r/innodb-spatial-index.result
+1
-1
mysql-test/suite/encryption/t/encryption_force.test
mysql-test/suite/encryption/t/encryption_force.test
+2
-4
mysql-test/suite/encryption/t/filekeys_goodtest.inc
mysql-test/suite/encryption/t/filekeys_goodtest.inc
+1
-3
mysql-test/suite/encryption/t/innodb-encryption-alter.test
mysql-test/suite/encryption/t/innodb-encryption-alter.test
+1
-3
mysql-test/suite/encryption/t/innodb-spatial-index.test
mysql-test/suite/encryption/t/innodb-spatial-index.test
+1
-3
mysql-test/suite/innodb/r/innodb-page_compression_tables.result
...test/suite/innodb/r/innodb-page_compression_tables.result
+2
-3
mysql-test/suite/innodb/r/innodb-table-online.result
mysql-test/suite/innodb/r/innodb-table-online.result
+2
-1
mysql-test/suite/innodb/t/innodb-page_compression_tables.test
...l-test/suite/innodb/t/innodb-page_compression_tables.test
+1
-3
mysql-test/suite/innodb/t/innodb-table-online.test
mysql-test/suite/innodb/t/innodb-table-online.test
+2
-1
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+43
-39
storage/xtradb/handler/handler0alter.cc
storage/xtradb/handler/handler0alter.cc
+46
-42
storage/xtradb/trx/trx0trx.cc
storage/xtradb/trx/trx0trx.cc
+3
-2
storage/xtradb/trx/trx0undo.cc
storage/xtradb/trx/trx0undo.cc
+13
-1
No files found.
mysql-test/suite/encryption/r/encryption_force.result
View file @
6692b5f7
...
@@ -34,11 +34,11 @@ t4 CREATE TABLE `t4` (
...
@@ -34,11 +34,11 @@ t4 CREATE TABLE `t4` (
PARTITION BY HASH (`a`)
PARTITION BY HASH (`a`)
PARTITIONS 2
PARTITIONS 2
alter table t1 encrypted=no;
alter table t1 encrypted=no;
ERROR HY000:
Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ERROR HY000:
Table storage engine 'InnoDB' does not support the create option 'ENCRYPTED'
alter table t2 encrypted=yes;
alter table t2 encrypted=yes;
alter table t3 encrypted=default;
alter table t3 encrypted=default;
alter table t4 encrypted=no;
alter table t4 encrypted=no;
ERROR HY000:
Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ERROR HY000:
Table storage engine 'InnoDB' does not support the create option 'ENCRYPTED'
show create table t1;
show create table t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
...
...
mysql-test/suite/encryption/r/filekeys_encfile.result
View file @
6692b5f7
...
@@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` (
...
@@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` (
`b` char(200) DEFAULT NULL
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2
alter table t1 encryption_key_id=3;
alter table t1 encryption_key_id=3;
ERROR HY000:
Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ERROR HY000:
Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
show create table t1;
show create table t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
...
...
mysql-test/suite/encryption/r/filekeys_encfile_file.result
View file @
6692b5f7
...
@@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` (
...
@@ -14,7 +14,7 @@ t1 CREATE TABLE `t1` (
`b` char(200) DEFAULT NULL
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `encryption_key_id`=2
alter table t1 encryption_key_id=3;
alter table t1 encryption_key_id=3;
ERROR HY000:
Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ERROR HY000:
Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
show create table t1;
show create table t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
...
...
mysql-test/suite/encryption/r/innodb-encryption-alter.result
View file @
6692b5f7
...
@@ -41,11 +41,10 @@ CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNOD
...
@@ -41,11 +41,10 @@ CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNOD
Warnings:
Warnings:
Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 1 when encryption is disabled
Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 1 when encryption is disabled
ALTER TABLE t1 ENCRYPTION_KEY_ID=99;
ALTER TABLE t1 ENCRYPTION_KEY_ID=99;
ERROR HY000:
Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ERROR HY000:
Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
SHOW WARNINGS;
SHOW WARNINGS;
Level Code Message
Level Code Message
Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
set innodb_default_encryption_key_id = 1;
set innodb_default_encryption_key_id = 1;
drop table t1,t2;
drop table t1,t2;
mysql-test/suite/encryption/r/innodb-spatial-index.result
View file @
6692b5f7
...
@@ -5,7 +5,7 @@ ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
...
@@ -5,7 +5,7 @@ ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB;
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB;
ALTER TABLE t1 ENCRYPTED=YES;
ALTER TABLE t1 ENCRYPTED=YES;
ERROR HY000:
Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ERROR HY000:
Table storage engine 'InnoDB' does not support the create option 'ENCRYPTED'
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=YES ENGINE=INNODB;
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=YES ENGINE=INNODB;
...
...
mysql-test/suite/encryption/t/encryption_force.test
View file @
6692b5f7
...
@@ -22,13 +22,11 @@ show create table t2;
...
@@ -22,13 +22,11 @@ show create table t2;
show
create
table
t3
;
show
create
table
t3
;
show
create
table
t4
;
show
create
table
t4
;
--
replace_regex
/
#sql-[0-9a-f_]*/#sql-temporary/
--
error
ER_ILLEGAL_HA_CREATE_OPTION
--
error
ER_CANT_CREATE_TABLE
alter
table
t1
encrypted
=
no
;
alter
table
t1
encrypted
=
no
;
alter
table
t2
encrypted
=
yes
;
alter
table
t2
encrypted
=
yes
;
alter
table
t3
encrypted
=
default
;
alter
table
t3
encrypted
=
default
;
--
replace_regex
/
#sql-[0-9a-f_]*/#sql-temporary/
--
error
ER_ILLEGAL_HA_CREATE_OPTION
--
error
ER_CANT_CREATE_TABLE
alter
table
t4
encrypted
=
no
;
alter
table
t4
encrypted
=
no
;
show
create
table
t1
;
show
create
table
t1
;
...
...
mysql-test/suite/encryption/t/filekeys_goodtest.inc
View file @
6692b5f7
...
@@ -7,8 +7,7 @@ insert t1 values (12345, repeat('1234567890', 20));
...
@@ -7,8 +7,7 @@ insert t1 values (12345, repeat('1234567890', 20));
alter
table
t1
encryption_key_id
=
2
;
alter
table
t1
encryption_key_id
=
2
;
show
create
table
t1
;
show
create
table
t1
;
--
replace_regex
/
#sql-[0-9a-f_]*/#sql-temporary/
--
error
ER_ILLEGAL_HA_CREATE_OPTION
--
error
ER_CANT_CREATE_TABLE
alter
table
t1
encryption_key_id
=
3
;
alter
table
t1
encryption_key_id
=
3
;
show
create
table
t1
;
show
create
table
t1
;
alter
table
t1
encryption_key_id
=
33
;
alter
table
t1
encryption_key_id
=
33
;
...
@@ -17,4 +16,3 @@ alter table t1 encryption_key_id=4;
...
@@ -17,4 +16,3 @@ alter table t1 encryption_key_id=4;
show
create
table
t1
;
show
create
table
t1
;
drop
table
t1
;
drop
table
t1
;
mysql-test/suite/encryption/t/innodb-encryption-alter.test
View file @
6692b5f7
...
@@ -27,10 +27,8 @@ DROP TABLE t1;
...
@@ -27,10 +27,8 @@ DROP TABLE t1;
CREATE
TABLE
t1
(
pk
INT
PRIMARY
KEY
AUTO_INCREMENT
,
c
VARCHAR
(
256
))
ENGINE
=
INNODB
;
CREATE
TABLE
t1
(
pk
INT
PRIMARY
KEY
AUTO_INCREMENT
,
c
VARCHAR
(
256
))
ENGINE
=
INNODB
;
SHOW
CREATE
TABLE
t1
;
SHOW
CREATE
TABLE
t1
;
CREATE
TABLE
t2
(
pk
INT
PRIMARY
KEY
AUTO_INCREMENT
,
c
VARCHAR
(
256
))
ENGINE
=
INNODB
ENCRYPTED
=
NO
ENCRYPTION_KEY_ID
=
1
;
CREATE
TABLE
t2
(
pk
INT
PRIMARY
KEY
AUTO_INCREMENT
,
c
VARCHAR
(
256
))
ENGINE
=
INNODB
ENCRYPTED
=
NO
ENCRYPTION_KEY_ID
=
1
;
--
replace_regex
/
#sql-[0-9a-f_]*/#sql-temporary/
--
error
ER_ILLEGAL_HA_CREATE_OPTION
--
error
1005
ALTER
TABLE
t1
ENCRYPTION_KEY_ID
=
99
;
ALTER
TABLE
t1
ENCRYPTION_KEY_ID
=
99
;
--
replace_regex
/
#sql-[0-9a-f_]*/#sql-temporary/
SHOW
WARNINGS
;
SHOW
WARNINGS
;
set
innodb_default_encryption_key_id
=
1
;
set
innodb_default_encryption_key_id
=
1
;
...
...
mysql-test/suite/encryption/t/innodb-spatial-index.test
View file @
6692b5f7
...
@@ -20,10 +20,8 @@ ENCRYPTED=YES;
...
@@ -20,10 +20,8 @@ ENCRYPTED=YES;
#
#
CREATE
TABLE
t1
(
pk
INT
PRIMARY
KEY
AUTO_INCREMENT
,
CREATE
TABLE
t1
(
pk
INT
PRIMARY
KEY
AUTO_INCREMENT
,
c
VARCHAR
(
256
),
coordinate
POINT
NOT
NULL
,
SPATIAL
index
(
coordinate
))
ENGINE
=
INNODB
;
c
VARCHAR
(
256
),
coordinate
POINT
NOT
NULL
,
SPATIAL
index
(
coordinate
))
ENGINE
=
INNODB
;
--
replace_regex
/
#sql-[0-9a-f_]*`/#sql-temporary`/
--
error
ER_ILLEGAL_HA_CREATE_OPTION
--
error
ER_CANT_CREATE_TABLE
ALTER
TABLE
t1
ENCRYPTED
=
YES
;
ALTER
TABLE
t1
ENCRYPTED
=
YES
;
--
replace_regex
/
#sql-[0-9a-f_]*`/#sql-temporary`/
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#
...
...
mysql-test/suite/innodb/r/innodb-page_compression_tables.result
View file @
6692b5f7
...
@@ -36,12 +36,11 @@ innodb_redundant CREATE TABLE `innodb_redundant` (
...
@@ -36,12 +36,11 @@ innodb_redundant CREATE TABLE `innodb_redundant` (
`b` char(200) DEFAULT NULL
`b` char(200) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
alter table innodb_redundant page_compressed=1;
alter table innodb_redundant page_compressed=1;
ERROR HY000:
Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
ERROR HY000:
Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED'
show warnings;
show warnings;
Level Code Message
Level Code Message
Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT
Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
Error 1478 Table storage engine 'InnoDB' does not support the create option 'PAGE_COMPRESSED'
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
show create table innodb_redundant;
show create table innodb_redundant;
Table Create Table
Table Create Table
innodb_redundant CREATE TABLE `innodb_redundant` (
innodb_redundant CREATE TABLE `innodb_redundant` (
...
...
mysql-test/suite/innodb/r/innodb-table-online.result
View file @
6692b5f7
...
@@ -235,7 +235,8 @@ t1 CREATE TABLE `t1` (
...
@@ -235,7 +235,8 @@ t1 CREATE TABLE `t1` (
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
ALTER TABLE t1 ROW_FORMAT=REDUNDANT;
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done';
SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done';
SET lock_wait_timeout = 10;
SET lock_wait_timeout = 10;
ALTER TABLE t1 ROW_FORMAT=COMPACT, ALGORITHM = INPLACE;
ALTER TABLE t1 ROW_FORMAT=COMPACT
PAGE_COMPRESSED = YES PAGE_COMPRESSION_LEVEL = 1, ALGORITHM = INPLACE;
# session default
# session default
connection default;
connection default;
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
INSERT INTO t1 SELECT 80 + c1, c2, c3 FROM t1;
...
...
mysql-test/suite/innodb/t/innodb-page_compression_tables.test
View file @
6692b5f7
...
@@ -26,10 +26,8 @@ create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row
...
@@ -26,10 +26,8 @@ create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row
show
warnings
;
show
warnings
;
create
table
innodb_redundant
(
c1
bigint
not
null
,
b
char
(
200
))
engine
=
innodb
row_format
=
redundant
;
create
table
innodb_redundant
(
c1
bigint
not
null
,
b
char
(
200
))
engine
=
innodb
row_format
=
redundant
;
show
create
table
innodb_redundant
;
show
create
table
innodb_redundant
;
--
replace_regex
/
#sql-[0-9a-f_]*`/#sql-temporary`/
--
error
ER_ILLEGAL_HA_CREATE_OPTION
--
error
1005
alter
table
innodb_redundant
page_compressed
=
1
;
alter
table
innodb_redundant
page_compressed
=
1
;
--
replace_regex
/
#sql-[0-9a-f_]*`/#sql-temporary`/
show
warnings
;
show
warnings
;
show
create
table
innodb_redundant
;
show
create
table
innodb_redundant
;
alter
table
innodb_redundant
row_format
=
compact
page_compressed
=
1
;
alter
table
innodb_redundant
row_format
=
compact
page_compressed
=
1
;
...
...
mysql-test/suite/innodb/t/innodb-table-online.test
View file @
6692b5f7
...
@@ -215,7 +215,8 @@ SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done
...
@@ -215,7 +215,8 @@ SET DEBUG_SYNC = 'row_log_table_apply1_before SIGNAL rebuilt2 WAIT_FOR dml2_done
# Ensure that the ALTER TABLE will be executed even with some concurrent DML.
# Ensure that the ALTER TABLE will be executed even with some concurrent DML.
SET
lock_wait_timeout
=
10
;
SET
lock_wait_timeout
=
10
;
--
send
--
send
ALTER
TABLE
t1
ROW_FORMAT
=
COMPACT
,
ALGORITHM
=
INPLACE
;
ALTER
TABLE
t1
ROW_FORMAT
=
COMPACT
PAGE_COMPRESSED
=
YES
PAGE_COMPRESSION_LEVEL
=
1
,
ALGORITHM
=
INPLACE
;
# Generate some log (delete-mark, delete-unmark, insert etc.)
# Generate some log (delete-mark, delete-unmark, insert etc.)
# while the index creation is blocked. Some of this may run
# while the index creation is blocked. Some of this may run
...
...
storage/innobase/handler/handler0alter.cc
View file @
6692b5f7
...
@@ -390,23 +390,34 @@ innobase_spatial_exist(
...
@@ -390,23 +390,34 @@ innobase_spatial_exist(
return
(
false
);
return
(
false
);
}
}
/*******************************************************************//**
/** Determine if ALTER TABLE needs to rebuild the table.
Determine if ALTER TABLE needs to rebuild the table.
@param ha_alter_info the DDL operation
@param ha_alter_info the DDL operation
@param table metadata before ALTER TABLE
@param altered_table MySQL original table
@return whether it is necessary to rebuild the table */
@return whether it is necessary to rebuild the table */
static
MY_ATTRIBUTE
((
nonnull
,
warn_unused_result
))
static
MY_ATTRIBUTE
((
nonnull
,
warn_unused_result
))
bool
bool
innobase_need_rebuild
(
innobase_need_rebuild
(
/*==================*/
const
Alter_inplace_info
*
ha_alter_info
,
const
Alter_inplace_info
*
ha_alter_info
,
const
TABLE
*
altered_
table
)
const
TABLE
*
table
)
{
{
Alter_inplace_info
::
HA_ALTER_FLAGS
alter_inplace_flags
=
Alter_inplace_info
::
HA_ALTER_FLAGS
alter_inplace_flags
=
ha_alter_info
->
handler_flags
&
~
(
INNOBASE_INPLACE_IGNORE
);
ha_alter_info
->
handler_flags
&
~
INNOBASE_INPLACE_IGNORE
;
if
(
alter_inplace_flags
&
Alter_inplace_info
::
CHANGE_CREATE_OPTION
)
{
const
ha_table_option_struct
&
alt_opt
=
*
ha_alter_info
->
create_info
->
option_struct
;
const
ha_table_option_struct
&
opt
=
*
table
->
s
->
option_struct
;
if
(
alt_opt
.
page_compressed
!=
opt
.
page_compressed
||
alt_opt
.
page_compression_level
!=
opt
.
page_compression_level
||
alt_opt
.
encryption
!=
opt
.
encryption
||
alt_opt
.
encryption_key_id
!=
opt
.
encryption_key_id
)
{
return
(
true
);
}
}
if
(
alter_inplace_flags
if
(
alter_inplace_flags
==
Alter_inplace_info
::
CHANGE_CREATE_OPTION
==
Alter_inplace_info
::
CHANGE_CREATE_OPTION
&&
!
(
ha_alter_info
->
create_info
->
used_fields
&&
!
(
ha_alter_info
->
create_info
->
used_fields
&
(
HA_CREATE_USED_ROW_FORMAT
&
(
HA_CREATE_USED_ROW_FORMAT
|
HA_CREATE_USED_KEY_BLOCK_SIZE
)))
{
|
HA_CREATE_USED_KEY_BLOCK_SIZE
)))
{
...
@@ -416,7 +427,7 @@ innobase_need_rebuild(
...
@@ -416,7 +427,7 @@ innobase_need_rebuild(
return
(
false
);
return
(
false
);
}
}
return
(
!!
(
ha_alter_info
->
handler
_flags
&
INNOBASE_ALTER_REBUILD
));
return
(
!!
(
alter_inplace
_flags
&
INNOBASE_ALTER_REBUILD
));
}
}
/** Check if virtual column in old and new table are in order, excluding
/** Check if virtual column in old and new table are in order, excluding
...
@@ -571,28 +582,6 @@ ha_innobase::check_if_supported_inplace_alter(
...
@@ -571,28 +582,6 @@ ha_innobase::check_if_supported_inplace_alter(
update_thd
();
update_thd
();
/* Change on engine specific table options require rebuild of the
table */
if
(
ha_alter_info
->
handler_flags
&
Alter_inplace_info
::
CHANGE_CREATE_OPTION
)
{
ha_table_option_struct
*
new_options
=
ha_alter_info
->
create_info
->
option_struct
;
ha_table_option_struct
*
old_options
=
table
->
s
->
option_struct
;
if
(
new_options
->
page_compressed
!=
old_options
->
page_compressed
||
new_options
->
page_compression_level
!=
old_options
->
page_compression_level
)
{
ha_alter_info
->
unsupported_reason
=
innobase_get_err_msg
(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
);
DBUG_RETURN
(
HA_ALTER_INPLACE_NOT_SUPPORTED
);
}
if
(
new_options
->
encryption
!=
old_options
->
encryption
||
new_options
->
encryption_key_id
!=
old_options
->
encryption_key_id
)
{
ha_alter_info
->
unsupported_reason
=
innobase_get_err_msg
(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
);
DBUG_RETURN
(
HA_ALTER_INPLACE_NOT_SUPPORTED
);
}
}
if
(
ha_alter_info
->
handler_flags
if
(
ha_alter_info
->
handler_flags
&
~
(
INNOBASE_INPLACE_IGNORE
&
~
(
INNOBASE_INPLACE_IGNORE
|
INNOBASE_ALTER_NOREBUILD
|
INNOBASE_ALTER_NOREBUILD
...
@@ -4501,7 +4490,6 @@ prepare_inplace_alter_table_dict(
...
@@ -4501,7 +4490,6 @@ prepare_inplace_alter_table_dict(
to rebuild the table with a temporary name. */
to rebuild the table with a temporary name. */
if
(
new_clustered
)
{
if
(
new_clustered
)
{
fil_space_crypt_t
*
crypt_data
;
const
char
*
new_table_name
const
char
*
new_table_name
=
dict_mem_create_temporary_tablename
(
=
dict_mem_create_temporary_tablename
(
ctx
->
heap
,
ctx
->
heap
,
...
@@ -4515,13 +4503,29 @@ prepare_inplace_alter_table_dict(
...
@@ -4515,13 +4503,29 @@ prepare_inplace_alter_table_dict(
uint32_t
key_id
=
FIL_DEFAULT_ENCRYPTION_KEY
;
uint32_t
key_id
=
FIL_DEFAULT_ENCRYPTION_KEY
;
fil_encryption_t
mode
=
FIL_ENCRYPTION_DEFAULT
;
fil_encryption_t
mode
=
FIL_ENCRYPTION_DEFAULT
;
fil_space_t
*
space
=
fil_space_acquire
(
ctx
->
prebuilt
->
table
->
space
);
if
(
fil_space_t
*
space
crypt_data
=
space
->
crypt_data
;
=
fil_space_acquire
(
ctx
->
prebuilt
->
table
->
space
))
{
fil_space_release
(
space
);
if
(
const
fil_space_crypt_t
*
crypt_data
=
space
->
crypt_data
)
{
key_id
=
crypt_data
->
key_id
;
mode
=
crypt_data
->
encryption
;
}
fil_space_release
(
space
);
}
if
(
crypt_data
)
{
if
(
ha_alter_info
->
handler_flags
key_id
=
crypt_data
->
key_id
;
&
Alter_inplace_info
::
CHANGE_CREATE_OPTION
)
{
mode
=
crypt_data
->
encryption
;
const
ha_table_option_struct
&
alt_opt
=
*
ha_alter_info
->
create_info
->
option_struct
;
const
ha_table_option_struct
&
opt
=
*
old_table
->
s
->
option_struct
;
if
(
alt_opt
.
encryption
!=
opt
.
encryption
||
alt_opt
.
encryption_key_id
!=
opt
.
encryption_key_id
)
{
key_id
=
alt_opt
.
encryption_key_id
;
mode
=
fil_encryption_t
(
alt_opt
.
encryption
);
}
}
}
if
(
innobase_check_foreigns
(
if
(
innobase_check_foreigns
(
...
...
storage/xtradb/handler/handler0alter.cc
View file @
6692b5f7
...
@@ -212,32 +212,44 @@ innobase_fulltext_exist(
...
@@ -212,32 +212,44 @@ innobase_fulltext_exist(
return
(
false
);
return
(
false
);
}
}
/*******************************************************************//**
/** Determine if ALTER TABLE needs to rebuild the table.
Determine if ALTER TABLE needs to rebuild the table.
@param ha_alter_info the DDL operation
@param ha_alter_info the DDL operation
@param table metadata before ALTER TABLE
@param altered_table MySQL original table
@return whether it is necessary to rebuild the table */
@return whether it is necessary to rebuild the table */
static
MY_ATTRIBUTE
((
nonnull
,
warn_unused_result
))
static
MY_ATTRIBUTE
((
nonnull
,
warn_unused_result
))
bool
bool
innobase_need_rebuild
(
innobase_need_rebuild
(
/*==================*/
const
Alter_inplace_info
*
ha_alter_info
,
const
Alter_inplace_info
*
ha_alter_info
,
const
TABLE
*
altered_
table
)
const
TABLE
*
table
)
{
{
Alter_inplace_info
::
HA_ALTER_FLAGS
alter_inplace_flags
=
Alter_inplace_info
::
HA_ALTER_FLAGS
alter_inplace_flags
=
ha_alter_info
->
handler_flags
&
~
(
INNOBASE_INPLACE_IGNORE
);
ha_alter_info
->
handler_flags
&
~
INNOBASE_INPLACE_IGNORE
;
if
(
alter_inplace_flags
&
Alter_inplace_info
::
CHANGE_CREATE_OPTION
)
{
const
ha_table_option_struct
&
alt_opt
=
*
ha_alter_info
->
create_info
->
option_struct
;
const
ha_table_option_struct
&
opt
=
*
table
->
s
->
option_struct
;
if
(
alt_opt
.
page_compressed
!=
opt
.
page_compressed
||
alt_opt
.
page_compression_level
!=
opt
.
page_compression_level
||
alt_opt
.
encryption
!=
opt
.
encryption
||
alt_opt
.
encryption_key_id
!=
opt
.
encryption_key_id
)
{
return
(
true
);
}
}
if
(
alter_inplace_flags
if
(
alter_inplace_flags
==
Alter_inplace_info
::
CHANGE_CREATE_OPTION
==
Alter_inplace_info
::
CHANGE_CREATE_OPTION
&&
!
(
ha_alter_info
->
create_info
->
used_fields
&&
!
(
ha_alter_info
->
create_info
->
used_fields
&
(
HA_CREATE_USED_ROW_FORMAT
&
(
HA_CREATE_USED_ROW_FORMAT
|
HA_CREATE_USED_KEY_BLOCK_SIZE
)))
{
|
HA_CREATE_USED_KEY_BLOCK_SIZE
)))
{
/* Any other CHANGE_CREATE_OPTION than changing
/* Any other CHANGE_CREATE_OPTION than changing
ROW_FORMAT or KEY_BLOCK_SIZE is ignored. */
ROW_FORMAT or KEY_BLOCK_SIZE can be done without
rebuilding the table. */
return
(
false
);
return
(
false
);
}
}
return
(
!!
(
ha_alter_info
->
handler
_flags
&
INNOBASE_ALTER_REBUILD
));
return
(
!!
(
alter_inplace
_flags
&
INNOBASE_ALTER_REBUILD
));
}
}
/** Check if InnoDB supports a particular alter table in-place
/** Check if InnoDB supports a particular alter table in-place
...
@@ -287,29 +299,6 @@ ha_innobase::check_if_supported_inplace_alter(
...
@@ -287,29 +299,6 @@ ha_innobase::check_if_supported_inplace_alter(
update_thd
();
update_thd
();
trx_search_latch_release_if_reserved
(
prebuilt
->
trx
);
trx_search_latch_release_if_reserved
(
prebuilt
->
trx
);
/* Change on engine specific table options require rebuild of the
table */
if
(
ha_alter_info
->
handler_flags
&
Alter_inplace_info
::
CHANGE_CREATE_OPTION
)
{
ha_table_option_struct
*
new_options
=
ha_alter_info
->
create_info
->
option_struct
;
ha_table_option_struct
*
old_options
=
table
->
s
->
option_struct
;
if
(
new_options
->
page_compressed
!=
old_options
->
page_compressed
||
new_options
->
page_compression_level
!=
old_options
->
page_compression_level
||
new_options
->
atomic_writes
!=
old_options
->
atomic_writes
)
{
ha_alter_info
->
unsupported_reason
=
innobase_get_err_msg
(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
);
DBUG_RETURN
(
HA_ALTER_INPLACE_NOT_SUPPORTED
);
}
if
(
new_options
->
encryption
!=
old_options
->
encryption
||
new_options
->
encryption_key_id
!=
old_options
->
encryption_key_id
)
{
ha_alter_info
->
unsupported_reason
=
innobase_get_err_msg
(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
);
DBUG_RETURN
(
HA_ALTER_INPLACE_NOT_SUPPORTED
);
}
}
if
(
ha_alter_info
->
handler_flags
if
(
ha_alter_info
->
handler_flags
&
~
(
INNOBASE_INPLACE_IGNORE
&
~
(
INNOBASE_INPLACE_IGNORE
|
INNOBASE_ALTER_NOREBUILD
|
INNOBASE_ALTER_NOREBUILD
...
@@ -589,7 +578,7 @@ ha_innobase::check_if_supported_inplace_alter(
...
@@ -589,7 +578,7 @@ ha_innobase::check_if_supported_inplace_alter(
operation is possible. */
operation is possible. */
}
else
if
(((
ha_alter_info
->
handler_flags
}
else
if
(((
ha_alter_info
->
handler_flags
&
Alter_inplace_info
::
ADD_PK_INDEX
)
&
Alter_inplace_info
::
ADD_PK_INDEX
)
||
innobase_need_rebuild
(
ha_alter_info
,
table
))
||
innobase_need_rebuild
(
ha_alter_info
,
table
))
&&
(
innobase_fulltext_exist
(
altered_table
)))
{
&&
(
innobase_fulltext_exist
(
altered_table
)))
{
/* Refuse to rebuild the table online, if
/* Refuse to rebuild the table online, if
fulltext indexes are to survive the rebuild. */
fulltext indexes are to survive the rebuild. */
...
@@ -2870,7 +2859,6 @@ prepare_inplace_alter_table_dict(
...
@@ -2870,7 +2859,6 @@ prepare_inplace_alter_table_dict(
to rebuild the table with a temporary name. */
to rebuild the table with a temporary name. */
if
(
new_clustered
)
{
if
(
new_clustered
)
{
fil_space_crypt_t
*
crypt_data
;
const
char
*
new_table_name
const
char
*
new_table_name
=
dict_mem_create_temporary_tablename
(
=
dict_mem_create_temporary_tablename
(
ctx
->
heap
,
ctx
->
heap
,
...
@@ -2881,13 +2869,29 @@ prepare_inplace_alter_table_dict(
...
@@ -2881,13 +2869,29 @@ prepare_inplace_alter_table_dict(
ulint
key_id
=
FIL_DEFAULT_ENCRYPTION_KEY
;
ulint
key_id
=
FIL_DEFAULT_ENCRYPTION_KEY
;
fil_encryption_t
mode
=
FIL_ENCRYPTION_DEFAULT
;
fil_encryption_t
mode
=
FIL_ENCRYPTION_DEFAULT
;
fil_space_t
*
space
=
fil_space_acquire
(
ctx
->
prebuilt
->
table
->
space
);
if
(
fil_space_t
*
space
crypt_data
=
space
->
crypt_data
;
=
fil_space_acquire
(
ctx
->
prebuilt
->
table
->
space
))
{
fil_space_release
(
space
);
if
(
const
fil_space_crypt_t
*
crypt_data
=
space
->
crypt_data
)
{
key_id
=
crypt_data
->
key_id
;
mode
=
crypt_data
->
encryption
;
}
fil_space_release
(
space
);
}
if
(
crypt_data
)
{
if
(
ha_alter_info
->
handler_flags
key_id
=
crypt_data
->
key_id
;
&
Alter_inplace_info
::
CHANGE_CREATE_OPTION
)
{
mode
=
crypt_data
->
encryption
;
const
ha_table_option_struct
&
alt_opt
=
*
ha_alter_info
->
create_info
->
option_struct
;
const
ha_table_option_struct
&
opt
=
*
old_table
->
s
->
option_struct
;
if
(
alt_opt
.
encryption
!=
opt
.
encryption
||
alt_opt
.
encryption_key_id
!=
opt
.
encryption_key_id
)
{
key_id
=
alt_opt
.
encryption_key_id
;
mode
=
fil_encryption_t
(
alt_opt
.
encryption
);
}
}
}
if
(
innobase_check_foreigns
(
if
(
innobase_check_foreigns
(
...
...
storage/xtradb/trx/trx0trx.cc
View file @
6692b5f7
...
@@ -480,8 +480,9 @@ trx_free_prepared(
...
@@ -480,8 +480,9 @@ trx_free_prepared(
trx_t
*
trx
)
/*!< in, own: trx object */
trx_t
*
trx
)
/*!< in, own: trx object */
{
{
ut_a
(
trx_state_eq
(
trx
,
TRX_STATE_PREPARED
)
ut_a
(
trx_state_eq
(
trx
,
TRX_STATE_PREPARED
)
||
(
trx_state_eq
(
trx
,
TRX_STATE_ACTIVE
)
||
(
trx
->
is_recovered
&&
trx
->
is_recovered
&&
(
trx_state_eq
(
trx
,
TRX_STATE_ACTIVE
)
||
trx_state_eq
(
trx
,
TRX_STATE_COMMITTED_IN_MEMORY
))
&&
(
srv_read_only_mode
&&
(
srv_read_only_mode
||
srv_apply_log_only
||
srv_apply_log_only
||
srv_force_recovery
>=
SRV_FORCE_NO_TRX_UNDO
)));
||
srv_force_recovery
>=
SRV_FORCE_NO_TRX_UNDO
)));
...
...
storage/xtradb/trx/trx0undo.cc
View file @
6692b5f7
/*****************************************************************************
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation.
All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
the terms of the GNU General Public License as published by the Free Software
...
@@ -2015,6 +2015,12 @@ trx_undo_free_prepared(
...
@@ -2015,6 +2015,12 @@ trx_undo_free_prepared(
switch
(
trx
->
update_undo
->
state
)
{
switch
(
trx
->
update_undo
->
state
)
{
case
TRX_UNDO_PREPARED
:
case
TRX_UNDO_PREPARED
:
break
;
break
;
case
TRX_UNDO_CACHED
:
case
TRX_UNDO_TO_FREE
:
case
TRX_UNDO_TO_PURGE
:
ut_ad
(
trx_state_eq
(
trx
,
TRX_STATE_COMMITTED_IN_MEMORY
));
/* fall through */
case
TRX_UNDO_ACTIVE
:
case
TRX_UNDO_ACTIVE
:
/* lock_trx_release_locks() assigns
/* lock_trx_release_locks() assigns
trx->is_recovered=false */
trx->is_recovered=false */
...
@@ -2033,6 +2039,12 @@ trx_undo_free_prepared(
...
@@ -2033,6 +2039,12 @@ trx_undo_free_prepared(
switch
(
trx
->
insert_undo
->
state
)
{
switch
(
trx
->
insert_undo
->
state
)
{
case
TRX_UNDO_PREPARED
:
case
TRX_UNDO_PREPARED
:
break
;
break
;
case
TRX_UNDO_CACHED
:
case
TRX_UNDO_TO_FREE
:
case
TRX_UNDO_TO_PURGE
:
ut_ad
(
trx_state_eq
(
trx
,
TRX_STATE_COMMITTED_IN_MEMORY
));
/* fall through */
case
TRX_UNDO_ACTIVE
:
case
TRX_UNDO_ACTIVE
:
/* lock_trx_release_locks() assigns
/* lock_trx_release_locks() assigns
trx->is_recovered=false */
trx->is_recovered=false */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment