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
9f56dd73
Commit
9f56dd73
authored
Feb 11, 2019
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.3 into 10.4
parents
3a269a8b
4e7ee166
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
274 additions
and
71 deletions
+274
-71
mysql-test/suite/innodb/r/alter_varchar_change.result
mysql-test/suite/innodb/r/alter_varchar_change.result
+9
-9
mysql-test/suite/innodb/r/instant_alter_import.result
mysql-test/suite/innodb/r/instant_alter_import.result
+72
-0
mysql-test/suite/innodb/t/alter_varchar_change.test
mysql-test/suite/innodb/t/alter_varchar_change.test
+9
-9
mysql-test/suite/innodb/t/instant_alter_import.test
mysql-test/suite/innodb/t/instant_alter_import.test
+84
-0
mysys/my_fopen.c
mysys/my_fopen.c
+1
-4
plugin/user_variables/mysql-test/user_variables/basic.result
plugin/user_variables/mysql-test/user_variables/basic.result
+1
-1
plugin/user_variables/user_variables.cc
plugin/user_variables/user_variables.cc
+1
-1
sql/ha_sequence.cc
sql/ha_sequence.cc
+1
-1
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+41
-20
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+18
-16
storage/innobase/row/row0import.cc
storage/innobase/row/row0import.cc
+32
-6
storage/innobase/row/row0mysql.cc
storage/innobase/row/row0mysql.cc
+5
-4
No files found.
mysql-test/suite/innodb/r/alter_varchar_change.result
View file @
9f56dd73
...
...
@@ -15,7 +15,7 @@ SET @idx1_id = 0;
CREATE TABLE t1(f1 INT NOT NULL,
f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
CALL get_table_id("test/t1", @tbl_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
ALTER TABLE t1 MODIFY f2 VARCHAR(200)
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
SELECT @tbl1_id = @tbl_id;
@tbl1_id = @tbl_id
...
...
@@ -32,7 +32,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
f2 VARCHAR(100),
INDEX idx(f2))ENGINE=InnoDB;
CALL get_table_id("test/t1", @tbl_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
ALTER TABLE t1 MODIFY f2 VARCHAR(200)
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
SELECT @tbl1_id = @tbl_id;
@tbl1_id = @tbl_id
...
...
@@ -49,7 +49,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100),
INDEX idx(f2, f3), index idx1(f3, f2))ENGINE=InnoDB;
CALL get_table_id("test/t1", @tbl_id);
CALL get_index_id(@tbl_id, "idx", @idx_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150);
ALTER TABLE t1 MODIFY f2 VARCHAR(200), MODIFY f3 VARCHAR(150)
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
SELECT @tbl1_id = @tbl_id;
...
...
@@ -72,7 +72,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100),
INDEX idx(f2(40)))ENGINE=InnoDB;
CALL get_table_id("test/t1", @tbl_id);
CALL get_index_id(@tbl_id, "idx", @idx_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
ALTER TABLE t1 MODIFY f2 VARCHAR(200)
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
SELECT @tbl1_id = @tbl_id;
...
...
@@ -93,7 +93,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
f2 VARCHAR(100), FULLTEXT idx(f2))ENGINE=InnoDB;
CALL get_table_id("test/t1", @tbl_id);
CALL get_index_id(@tbl_id, "idx", @idx_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(200);
ALTER TABLE t1 MODIFY f2 VARCHAR(200)
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
SELECT @tbl1_id = @tbl_id;
...
...
@@ -117,7 +117,7 @@ INDEX idx(f3))ENGINE=InnoDB;
INSERT INTO t1(f1, f2) VALUES(1, repeat('a', 40));
CALL get_table_id("test/t1", @tbl_id);
CALL get_index_id(@tbl_id, "idx", @idx_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(100);
ALTER TABLE t1 MODIFY f2 VARCHAR(100)
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
SELECT @tbl1_id = @tbl_id;
...
...
@@ -163,7 +163,7 @@ f2 VARCHAR(100),
INDEX idx(f2(10)))ENGINE=InnoDB;
CALL get_table_id("test/t1", @tbl_id);
CALL get_index_id(@tbl_id, "idx", @idx_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10));
ALTER TABLE t1 MODIFY f2 VARCHAR(200), DROP INDEX idx, ADD INDEX idx(f2(10))
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
CALL get_index_id(@tbl1_id, "idx", @idx1_id);
SELECT @tbl1_id = @tbl_id;
...
...
@@ -251,7 +251,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
f2 VARCHAR(100),
INDEX idx(f2))ENGINE=InnoDB;
CALL get_table_id("test/t1", @tbl_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
SELECT @tbl1_id = @tbl_id;
@tbl1_id = @tbl_id
...
...
@@ -267,7 +267,7 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100) PRIMARY KEY)ENGINE=InnoDB;
CALL get_table_id("test/t1", @tbl_id);
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT;
ALTER TABLE t1 MODIFY f2 VARCHAR(200), ADD COLUMN f3 INT
, ALGORITHM=INSTANT
;
CALL get_table_id("test/t1", @tbl1_id);
SELECT @tbl1_id = @tbl_id;
@tbl1_id = @tbl_id
...
...
mysql-test/suite/innodb/r/instant_alter_import.result
0 → 100644
View file @
9f56dd73
set default_storage_engine=innodb;
#
# MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
#
create table t2 (x int, z int default 41);
alter table t2 discard tablespace;
create table t1 (x int);
insert into t1 values (1);
alter table t1 add z int default 42, algorithm instant;
select * from t1;
x z
1 42
flush tables t1 for export;
unlock tables;
# The metadata has to be updated to instant ADD COLUMN.
alter table t2 import tablespace;
select * from t2;
x z
1 42
insert into t2 set x=2;
select * from t2;
x z
1 42
2 41
alter table t1 discard tablespace;
flush tables t2 for export;
unlock tables;
# Both the metadata and the data file used instant ADD COLUMN.
alter table t1 import tablespace;
select * from t1;
x z
1 42
2 41
drop table t2;
create table t2 select * from t1;
alter table t1 discard tablespace;
flush tables t2 for export;
unlock tables;
# The instant ADD COLUMN has to be removed from the metadata.
alter table t1 import tablespace;
select * from t1;
x z
1 42
2 41
# Remove metadata for instant DROP COLUMN, then import
alter table t1 drop x, add column x int first, algorithm instant;
select * from t1;
x z
NULL 42
NULL 41
alter table t1 discard tablespace;
alter table t1 import tablespace;
select * from t1;
x z
1 42
2 41
# Import a data file that contains instant DROP COLUMN metadata
alter table t2 drop x;
alter table t1 drop x, force;
alter table t1 discard tablespace;
flush tables t2 for export;
unlock tables;
alter table t1 import tablespace;
ERROR HY000: Schema mismatch (Index field count 4 doesn't match tablespace metadata file value 5)
select * from t1;
ERROR HY000: Tablespace has been discarded for table `t1`
alter table t1 import tablespace;
ERROR HY000: Internal error: Cannot reset LSNs in table `test`.`t1` : Unsupported
select * from t1;
ERROR HY000: Tablespace has been discarded for table `t1`
drop table t2;
drop table t1;
mysql-test/suite/innodb/t/alter_varchar_change.test
View file @
9f56dd73
...
...
@@ -26,7 +26,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
f2
VARCHAR
(
100
)
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
)
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
SELECT
@
tbl1_id
=
@
tbl_id
;
...
...
@@ -39,7 +39,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
INDEX
idx
(
f2
))
ENGINE
=
InnoDB
;
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
)
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
SELECT
@
tbl1_id
=
@
tbl_id
;
...
...
@@ -51,7 +51,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100), f3 VARCHAR(100),
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
CALL
get_index_id
(
@
tbl_id
,
"idx"
,
@
idx_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
),
MODIFY
f3
VARCHAR
(
150
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
),
MODIFY
f3
VARCHAR
(
150
)
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
CALL
get_index_id
(
@
tbl1_id
,
"idx"
,
@
idx1_id
);
...
...
@@ -65,7 +65,7 @@ CREATE TABLE t1(f1 INT NOT NULL, f2 VARCHAR(100),
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
CALL
get_index_id
(
@
tbl_id
,
"idx"
,
@
idx_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
)
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
CALL
get_index_id
(
@
tbl1_id
,
"idx"
,
@
idx1_id
);
...
...
@@ -80,7 +80,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
CALL
get_index_id
(
@
tbl_id
,
"idx"
,
@
idx_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
)
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
CALL
get_index_id
(
@
tbl1_id
,
"idx"
,
@
idx1_id
);
...
...
@@ -98,7 +98,7 @@ INSERT INTO t1(f1, f2) VALUES(1, repeat('a', 40));
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
CALL
get_index_id
(
@
tbl_id
,
"idx"
,
@
idx_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
100
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
100
)
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
CALL
get_index_id
(
@
tbl1_id
,
"idx"
,
@
idx1_id
);
...
...
@@ -129,7 +129,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
CALL
get_index_id
(
@
tbl_id
,
"idx"
,
@
idx_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
),
DROP
INDEX
idx
,
ADD
INDEX
idx
(
f2
(
10
));
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
),
DROP
INDEX
idx
,
ADD
INDEX
idx
(
f2
(
10
))
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
CALL
get_index_id
(
@
tbl1_id
,
"idx"
,
@
idx1_id
);
...
...
@@ -192,7 +192,7 @@ CREATE TABLE t1(f1 INT NOT NULL,
INDEX
idx
(
f2
))
ENGINE
=
InnoDB
;
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
),
ADD
COLUMN
f3
INT
;
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
),
ADD
COLUMN
f3
INT
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
SELECT
@
tbl1_id
=
@
tbl_id
;
...
...
@@ -202,7 +202,7 @@ DROP TABLE t1;
CREATE
TABLE
t1
(
f1
INT
NOT
NULL
,
f2
VARCHAR
(
100
)
PRIMARY
KEY
)
ENGINE
=
InnoDB
;
CALL
get_table_id
(
"test/t1"
,
@
tbl_id
);
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
),
ADD
COLUMN
f3
INT
;
ALTER
TABLE
t1
MODIFY
f2
VARCHAR
(
200
),
ADD
COLUMN
f3
INT
,
ALGORITHM
=
INSTANT
;
CALL
get_table_id
(
"test/t1"
,
@
tbl1_id
);
SELECT
@
tbl1_id
=
@
tbl_id
;
...
...
mysql-test/suite/innodb/t/instant_alter_import.test
0 → 100644
View file @
9f56dd73
--
source
include
/
have_innodb
.
inc
set
default_storage_engine
=
innodb
;
--
echo
#
--
echo
# MDEV-18295 IMPORT TABLESPACE fails with instant-altered tables
--
echo
#
create
table
t2
(
x
int
,
z
int
default
41
);
alter
table
t2
discard
tablespace
;
create
table
t1
(
x
int
);
insert
into
t1
values
(
1
);
alter
table
t1
add
z
int
default
42
,
algorithm
instant
;
select
*
from
t1
;
flush
tables
t1
for
export
;
--
let
$MYSQLD_DATADIR
=
`select @@datadir`
--
move_file
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
unlock
tables
;
--
echo
# The metadata has to be updated to instant ADD COLUMN.
alter
table
t2
import
tablespace
;
select
*
from
t2
;
insert
into
t2
set
x
=
2
;
select
*
from
t2
;
alter
table
t1
discard
tablespace
;
flush
tables
t2
for
export
;
--
move_file
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
unlock
tables
;
--
echo
# Both the metadata and the data file used instant ADD COLUMN.
alter
table
t1
import
tablespace
;
select
*
from
t1
;
drop
table
t2
;
create
table
t2
select
*
from
t1
;
alter
table
t1
discard
tablespace
;
flush
tables
t2
for
export
;
--
move_file
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
unlock
tables
;
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
$MYSQLD_DATADIR
/
test
/
t1b
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
$MYSQLD_DATADIR
/
test
/
t1b
.
ibd
--
echo
# The instant ADD COLUMN has to be removed from the metadata.
alter
table
t1
import
tablespace
;
select
*
from
t1
;
--
echo
# Remove metadata for instant DROP COLUMN, then import
alter
table
t1
drop
x
,
add
column
x
int
first
,
algorithm
instant
;
select
*
from
t1
;
alter
table
t1
discard
tablespace
;
--
move_file
$MYSQLD_DATADIR
/
test
/
t1b
.
cfg
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
--
move_file
$MYSQLD_DATADIR
/
test
/
t1b
.
ibd
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
alter
table
t1
import
tablespace
;
select
*
from
t1
;
--
echo
# Import a data file that contains instant DROP COLUMN metadata
alter
table
t2
drop
x
;
alter
table
t1
drop
x
,
force
;
alter
table
t1
discard
tablespace
;
flush
tables
t2
for
export
;
--
move_file
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
unlock
tables
;
--
error
ER_TABLE_SCHEMA_MISMATCH
alter
table
t1
import
tablespace
;
--
error
ER_TABLESPACE_DISCARDED
select
*
from
t1
;
--
remove_file
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
--
error
ER_INTERNAL_ERROR
alter
table
t1
import
tablespace
;
--
error
ER_TABLESPACE_DISCARDED
select
*
from
t1
;
drop
table
t2
;
drop
table
t1
;
mysys/my_fopen.c
View file @
9f56dd73
...
...
@@ -171,10 +171,7 @@ int my_fclose(FILE *fd, myf MyFlags)
my_file_info
[
file
].
type
=
UNOPEN
;
}
#ifndef _WIN32
do
{
err
=
fclose
(
fd
);
}
while
(
err
==
-
1
&&
errno
==
EINTR
);
err
=
fclose
(
fd
);
#else
err
=
my_win_fclose
(
fd
);
#endif
...
...
plugin/user_variables/mysql-test/user_variables/basic.result
View file @
9f56dd73
...
...
@@ -7,7 +7,7 @@ PLUGIN_AUTHOR Sergey Vojtovich
PLUGIN_DESCRIPTION User-defined variables
PLUGIN_LICENSE GPL
LOAD_OPTION ON
PLUGIN_MATURITY
Gamma
PLUGIN_MATURITY
Stable
SHOW CREATE TABLE INFORMATION_SCHEMA.USER_VARIABLES;
Table Create Table
user_variables CREATE TEMPORARY TABLE `user_variables` (
...
...
plugin/user_variables/user_variables.cc
View file @
9f56dd73
...
...
@@ -135,6 +135,6 @@ maria_declare_plugin(user_variables)
NULL
,
NULL
,
"1.0"
,
MariaDB_PLUGIN_MATURITY_
GAMMA
MariaDB_PLUGIN_MATURITY_
STABLE
}
maria_declare_plugin_end
;
sql/ha_sequence.cc
View file @
9f56dd73
...
...
@@ -443,6 +443,6 @@ maria_declare_plugin(sql_sequence)
NULL
,
/* status variables */
NULL
,
/* system variables */
"1.0"
,
/* string version */
MariaDB_PLUGIN_MATURITY_
ALPHA
/* maturity */
MariaDB_PLUGIN_MATURITY_
STABLE
/* maturity */
}
maria_declare_plugin_end
;
storage/innobase/handler/ha_innodb.cc
View file @
9f56dd73
...
...
@@ -4,7 +4,7 @@ Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 201
8
, MariaDB Corporation.
Copyright (c) 2013, 201
9
, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
...
...
@@ -12717,10 +12717,7 @@ ha_innobase::discard_or_import_tablespace(
DBUG_RETURN
(
HA_ERR_TABLE_READONLY
);
}
dict_table_t
*
dict_table
=
m_prebuilt
->
table
;
if
(
dict_table
->
is_temporary
())
{
if
(
m_prebuilt
->
table
->
is_temporary
())
{
ib_senderrf
(
m_prebuilt
->
trx
->
mysql_thd
,
IB_LOG_LEVEL_ERROR
,
ER_CANNOT_DISCARD_TEMPORARY_TABLE
);
...
...
@@ -12728,11 +12725,11 @@ ha_innobase::discard_or_import_tablespace(
DBUG_RETURN
(
HA_ERR_TABLE_NEEDS_UPGRADE
);
}
if
(
dict_
table
->
space
==
fil_system
.
sys_space
)
{
if
(
m_prebuilt
->
table
->
space
==
fil_system
.
sys_space
)
{
ib_senderrf
(
m_prebuilt
->
trx
->
mysql_thd
,
IB_LOG_LEVEL_ERROR
,
ER_TABLE_IN_SYSTEM_TABLESPACE
,
dict_
table
->
name
.
m_name
);
m_prebuilt
->
table
->
name
.
m_name
);
DBUG_RETURN
(
HA_ERR_TABLE_NEEDS_UPGRADE
);
}
...
...
@@ -12741,7 +12738,7 @@ ha_innobase::discard_or_import_tablespace(
/* Obtain an exclusive lock on the table. */
dberr_t
err
=
row_mysql_lock_table
(
m_prebuilt
->
trx
,
dict_
table
,
LOCK_X
,
m_prebuilt
->
trx
,
m_prebuilt
->
table
,
LOCK_X
,
discard
?
"setting table lock for DISCARD TABLESPACE"
:
"setting table lock for IMPORT TABLESPACE"
);
...
...
@@ -12754,32 +12751,32 @@ ha_innobase::discard_or_import_tablespace(
user may want to set the DISCARD flag in order to IMPORT
a new tablespace. */
if
(
!
dict_
table
->
is_readable
())
{
if
(
!
m_prebuilt
->
table
->
is_readable
())
{
ib_senderrf
(
m_prebuilt
->
trx
->
mysql_thd
,
IB_LOG_LEVEL_WARN
,
ER_TABLESPACE_MISSING
,
dict_
table
->
name
.
m_name
);
m_prebuilt
->
table
->
name
.
m_name
);
}
err
=
row_discard_tablespace_for_mysql
(
dict_
table
->
name
.
m_name
,
m_prebuilt
->
trx
);
m_prebuilt
->
table
->
name
.
m_name
,
m_prebuilt
->
trx
);
}
else
if
(
dict_
table
->
is_readable
())
{
}
else
if
(
m_prebuilt
->
table
->
is_readable
())
{
/* Commit the transaction in order to
release the table lock. */
trx_commit_for_mysql
(
m_prebuilt
->
trx
);
ib
::
error
()
<<
"Unable to import tablespace "
<<
dict_
table
->
name
<<
" because it already"
<<
m_prebuilt
->
table
->
name
<<
" because it already"
" exists. Please DISCARD the tablespace"
" before IMPORT."
;
ib_senderrf
(
m_prebuilt
->
trx
->
mysql_thd
,
IB_LOG_LEVEL_ERROR
,
ER_TABLESPACE_EXISTS
,
dict_
table
->
name
.
m_name
);
ER_TABLESPACE_EXISTS
,
m_prebuilt
->
table
->
name
.
m_name
);
DBUG_RETURN
(
HA_ERR_TABLE_EXIST
);
}
else
{
err
=
row_import_for_mysql
(
dict_
table
,
m_prebuilt
);
err
=
row_import_for_mysql
(
m_prebuilt
->
table
,
m_prebuilt
);
if
(
err
==
DB_SUCCESS
)
{
...
...
@@ -12795,12 +12792,35 @@ ha_innobase::discard_or_import_tablespace(
/* Commit the transaction in order to release the table lock. */
trx_commit_for_mysql
(
m_prebuilt
->
trx
);
if
(
err
==
DB_SUCCESS
&&
!
discard
&&
dict_stats_is_persistent_enabled
(
dict_table
))
{
if
(
discard
||
err
!=
DB_SUCCESS
)
{
DBUG_RETURN
(
convert_error_code_to_mysql
(
err
,
m_prebuilt
->
table
->
flags
,
NULL
));
}
/* Evict and reload the table definition in order to invoke
btr_cur_instant_init(). */
table_id_t
id
=
m_prebuilt
->
table
->
id
;
ut_ad
(
id
);
mutex_enter
(
&
dict_sys
->
mutex
);
dict_table_close
(
m_prebuilt
->
table
,
TRUE
,
FALSE
);
dict_table_remove_from_cache
(
m_prebuilt
->
table
);
m_prebuilt
->
table
=
dict_table_open_on_id
(
id
,
TRUE
,
DICT_TABLE_OP_NORMAL
);
mutex_exit
(
&
dict_sys
->
mutex
);
if
(
!
m_prebuilt
->
table
)
{
err
=
DB_TABLE_NOT_FOUND
;
}
else
{
if
(
const
Field
*
ai
=
table
->
found_next_number_field
)
{
initialize_auto_increment
(
m_prebuilt
->
table
,
ai
);
}
dict_stats_init
(
m_prebuilt
->
table
);
}
if
(
dict_stats_is_persistent_enabled
(
m_prebuilt
->
table
))
{
dberr_t
ret
;
/* Adjust the persistent statistics. */
ret
=
dict_stats_update
(
dict_
table
,
ret
=
dict_stats_update
(
m_prebuilt
->
table
,
DICT_STATS_RECALC_PERSISTENT
);
if
(
ret
!=
DB_SUCCESS
)
{
...
...
@@ -12810,11 +12830,12 @@ ha_innobase::discard_or_import_tablespace(
ER_ALTER_INFO
,
"Error updating stats for table '%s'"
" after table rebuild: %s"
,
dict_table
->
name
.
m_name
,
ut_strerr
(
ret
));
m_prebuilt
->
table
->
name
.
m_name
,
ut_strerr
(
ret
));
}
}
DBUG_RETURN
(
convert_error_code_to_mysql
(
err
,
dict_table
->
flags
,
NULL
)
);
DBUG_RETURN
(
0
);
}
/**
...
...
storage/innobase/handler/handler0alter.cc
View file @
9f56dd73
...
...
@@ -1465,12 +1465,25 @@ instant_alter_column_possible(
const
TABLE
*
table
,
const
TABLE
*
altered_table
)
{
if
(
ha_alter_info
->
handler_flags
&
(
ALTER_STORED_COLUMN_ORDER
|
ALTER_DROP_STORED_COLUMN
|
ALTER_ADD_STORED_BASE_COLUMN
))
{
#if 1 // MDEV-17459: adjust fts_fetch_doc_from_rec() and friends; remove this
if
(
ib_table
.
fts
)
{
return
false
;
}
if
(
ib_table
.
fts
)
return
false
;
#endif
#if 1 // MDEV-17468: fix bugs with indexed virtual columns & remove this
for
(
const
dict_index_t
*
index
=
ib_table
.
indexes
.
start
;
index
;
index
=
index
->
indexes
.
next
)
{
if
(
index
->
has_virtual
())
{
ut_ad
(
ib_table
.
n_v_cols
);
return
false
;
}
}
#endif
const
dict_index_t
*
index
=
ib_table
.
indexes
.
start
;
}
const
dict_index_t
*
const
pk
=
ib_table
.
indexes
.
start
;
ut_ad
(
pk
->
is_primary
());
ut_ad
(
!
pk
->
has_virtual
());
if
(
ha_alter_info
->
handler_flags
&
ALTER_ADD_STORED_BASE_COLUMN
)
{
List_iterator_fast
<
Create_field
>
cf_it
(
ha_alter_info
->
alter_info
->
create_list
);
...
...
@@ -1478,21 +1491,11 @@ instant_alter_column_possible(
while
(
const
Create_field
*
cf
=
cf_it
++
)
{
n_add
+=
!
cf
->
field
;
}
if
(
index
->
n_fields
>=
REC_MAX_N_USER_FIELDS
+
DATA_N_SYS_COLS
if
(
pk
->
n_fields
>=
REC_MAX_N_USER_FIELDS
+
DATA_N_SYS_COLS
-
n_add
)
{
return
false
;
}
}
#if 1 // MDEV-17468: fix bugs with indexed virtual columns & remove this
ut_ad
(
index
->
is_primary
());
ut_ad
(
!
index
->
has_virtual
());
while
((
index
=
index
->
indexes
.
next
)
!=
NULL
)
{
if
(
index
->
has_virtual
())
{
ut_ad
(
ib_table
.
n_v_cols
);
return
false
;
}
}
#endif
// Making table system-versioned instantly is not implemented yet.
if
(
ha_alter_info
->
handler_flags
&
ALTER_ADD_SYSTEM_VERSIONING
)
{
return
false
;
...
...
@@ -1559,7 +1562,6 @@ instant_alter_column_possible(
return
false
;
}
const
dict_index_t
*
pk
=
ib_table
.
indexes
.
start
;
Field
**
af
=
altered_table
->
field
;
Field
**
const
end
=
altered_table
->
field
+
altered_table
->
s
->
fields
;
...
...
storage/innobase/row/row0import.cc
View file @
9f56dd73
...
...
@@ -1829,13 +1829,39 @@ PageConverter::update_index_page(
if
(
dict_index_is_clust
(
m_index
->
m_srv_index
))
{
if
(
page_is_root
(
page
))
{
dict_index_t
*
index
=
const_cast
<
dict_index_t
*>
(
m_index
->
m_srv_index
);
/* Preserve the PAGE_ROOT_AUTO_INC. */
if
(
m_index
->
m_srv_index
->
table
->
supports_instant
()
&&
btr_cur_instant_root_init
(
const_cast
<
dict_index_t
*>
(
m_index
->
m_srv_index
),
page
))
{
return
(
DB_CORRUPTION
);
if
(
index
->
table
->
supports_instant
())
{
if
(
btr_cur_instant_root_init
(
index
,
page
))
{
return
(
DB_CORRUPTION
);
}
if
(
index
->
n_core_fields
>
index
->
n_fields
)
{
/* Some columns have been dropped.
Refuse to IMPORT TABLESPACE for now.
NOTE: This is not an accurate check.
Columns could have been both
added and dropped instantly.
For an accurate check, we must read
the metadata BLOB page pointed to
by the leftmost leaf page.
But we would have to read
those pages in a special way,
bypassing the buffer pool! */
return
DB_UNSUPPORTED
;
}
/* Provisionally set all instantly
added columns to be DEFAULT NULL. */
for
(
unsigned
i
=
index
->
n_core_fields
;
i
<
index
->
n_fields
;
i
++
)
{
dict_col_t
*
col
=
index
->
fields
[
i
].
col
;
col
->
def_val
.
len
=
UNIV_SQL_NULL
;
col
->
def_val
.
data
=
NULL
;
}
}
}
else
{
/* Clear PAGE_MAX_TRX_ID so that it can be
...
...
storage/innobase/row/row0mysql.cc
View file @
9f56dd73
...
...
@@ -3079,13 +3079,14 @@ row_discard_tablespace(
table
->
flags2
|=
DICT_TF2_DISCARDED
;
dict_table_change_id_in_cache
(
table
,
new_id
);
/* Reset the root page numbers. */
dict_index_t
*
index
=
UT_LIST_GET_FIRST
(
table
->
indexes
);
if
(
index
)
index
->
clear_instant_alter
();
for
(
dict_index_t
*
index
=
UT_LIST_GET_FIRST
(
table
->
indexes
);
index
!=
0
;
index
=
UT_LIST_GET_NEXT
(
indexes
,
index
))
{
/* Reset the root page numbers. */
for
(;
index
;
index
=
UT_LIST_GET_NEXT
(
indexes
,
index
))
{
index
->
page
=
FIL_NULL
;
}
/* If the tablespace did not already exist or we couldn't
write to it, we treat that as a successful DISCARD. It is
unusable anyway. */
...
...
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