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
9b18f5a5
Commit
9b18f5a5
authored
May 11, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
MDEV-16142 Merge new release of InnoDB MySQL 5.7.22 to 10.2
parents
82f0dc35
0da98472
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
388 additions
and
26 deletions
+388
-26
mysql-test/suite/innodb/r/foreign_key.result
mysql-test/suite/innodb/r/foreign_key.result
+11
-0
mysql-test/suite/innodb/r/stored_fk.result
mysql-test/suite/innodb/r/stored_fk.result
+74
-0
mysql-test/suite/innodb/t/foreign_key.test
mysql-test/suite/innodb/t/foreign_key.test
+12
-0
mysql-test/suite/innodb/t/stored_fk.test
mysql-test/suite/innodb/t/stored_fk.test
+94
-0
mysql-test/suite/innodb/t/temporary_table.test
mysql-test/suite/innodb/t/temporary_table.test
+1
-0
mysql-test/suite/innodb_fts/r/fulltext_table_evict.result
mysql-test/suite/innodb_fts/r/fulltext_table_evict.result
+19
-0
mysql-test/suite/innodb_fts/t/fulltext_table_evict.test
mysql-test/suite/innodb_fts/t/fulltext_table_evict.test
+48
-0
storage/innobase/buf/buf0buf.cc
storage/innobase/buf/buf0buf.cc
+4
-1
storage/innobase/dict/dict0dict.cc
storage/innobase/dict/dict0dict.cc
+46
-1
storage/innobase/dict/dict0mem.cc
storage/innobase/dict/dict0mem.cc
+2
-1
storage/innobase/fts/fts0opt.cc
storage/innobase/fts/fts0opt.cc
+58
-20
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+4
-0
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+8
-2
storage/innobase/include/dict0dict.h
storage/innobase/include/dict0dict.h
+7
-1
No files found.
mysql-test/suite/innodb/r/foreign_key.result
View file @
9b18f5a5
...
...
@@ -306,3 +306,14 @@ id member_id
SELECT * FROM payment_method;
id member_id cardholder_address_id
DROP TABLE payment_method,address,member;
#
# Bug #26958695 INNODB NESTED STORED FIELD WITH CONSTRAINT KEY
# PRODUCE BROKEN TABLE (no bug in MariaDB)
#
create table t1(f1 int,f2 int, primary key(f1), key(f2, f1))engine=innodb;
create table t2(f1 int, f2 int as (2) stored, f3 int as (f2) stored,
foreign key(f1) references t1(f2) on update set NULL)
engine=innodb;
insert into t1 values(1, 1);
insert into t2(f1) values(1);
drop table t2, t1;
mysql-test/suite/innodb/r/stored_fk.result
0 → 100644
View file @
9b18f5a5
# Create statement with FK on base column of stored column
create table t1(f1 int, f2 int as(f1) stored,
foreign key(f1) references t2(f1) on delete cascade)engine=innodb;
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
# adding new stored column during alter table copy operation.
create table t1(f1 int primary key) engine=innodb;
create table t2(f1 int not null, f2 int as (f1) virtual,
foreign key(f1) references t1(f1) on update cascade)engine=innodb;
alter table t2 add column f3 int as (f1) stored, add column f4 int as (f1) virtual;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`f1` int(11) NOT NULL,
`f2` int(11) GENERATED ALWAYS AS (`f1`) VIRTUAL,
`f3` int(11) GENERATED ALWAYS AS (`f1`) STORED,
`f4` int(11) GENERATED ALWAYS AS (`f1`) VIRTUAL,
KEY `f1` (`f1`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
# adding foreign key constraint for base columns during alter copy.
create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb;
alter table t2 add foreign key(f1) references t1(f1) on update cascade, algorithm=copy;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`f1` int(11) NOT NULL,
`f2` int(11) GENERATED ALWAYS AS (`f1`) STORED,
KEY `f1` (`f1`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f1`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t2;
# adding foreign key constraint for base columns during online alter.
create table t2(f1 int not null, f2 int as (f1) stored) engine=innodb;
set foreign_key_checks = 0;
alter table t2 add foreign key(f1) references t1(f1) on update cascade, algorithm=inplace;
ERROR 0A000: Cannot add foreign key on the base column of stored column
drop table t2;
# adding stored column via online alter.
create table t2(f1 int not null,
foreign key(f1) references t1(f1) on update cascade)engine=innodb;
alter table t2 add column f2 int as (f1) stored, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
drop table t2, t1;
#
# BUG#26731689 FK ON TABLE WITH GENERATED COLS: ASSERTION POS < N_DEF
#
CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED, c INT,
d INT GENERATED ALWAYS AS (0) VIRTUAL, e INT) ENGINE=innodb;
CREATE TABLE t (a INT) ENGINE=innodb;
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't'
ALTER TABLE t ADD PRIMARY KEY(a);
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (e) REFERENCES t(a) ON UPDATE SET null;
DROP TABLE s,t;
CREATE TABLE s (a INT GENERATED ALWAYS AS (0) VIRTUAL,
b INT GENERATED ALWAYS AS (0) STORED, c INT) ENGINE=innodb;
CREATE TABLE t (a INT) ENGINE=innodb;
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't'
ALTER TABLE t ADD PRIMARY KEY(a);
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (c) REFERENCES t(a) ON UPDATE SET null;
DROP TABLE s,t;
CREATE TABLE s (a INT, b INT GENERATED ALWAYS AS (0) STORED) ENGINE=innodb;
CREATE TABLE t (a INT PRIMARY KEY) ENGINE=innodb;
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null;
DROP TABLE s,t;
CREATE TABLE s (a INT, b INT) ENGINE=innodb;
CREATE TABLE t (a INT) ENGINE=innodb;
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null;
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'c' in the referenced table 't'
ALTER TABLE t ADD PRIMARY KEY(a);
ALTER TABLE s ADD CONSTRAINT c FOREIGN KEY (a) REFERENCES t(a) ON UPDATE SET null;
DROP TABLE s,t;
mysql-test/suite/innodb/t/foreign_key.test
View file @
9b18f5a5
...
...
@@ -276,4 +276,16 @@ SELECT * FROM payment_method;
DROP
TABLE
payment_method
,
address
,
member
;
--
echo
#
--
echo
# Bug #26958695 INNODB NESTED STORED FIELD WITH CONSTRAINT KEY
--
echo
# PRODUCE BROKEN TABLE (no bug in MariaDB)
--
echo
#
create
table
t1
(
f1
int
,
f2
int
,
primary
key
(
f1
),
key
(
f2
,
f1
))
engine
=
innodb
;
create
table
t2
(
f1
int
,
f2
int
as
(
2
)
stored
,
f3
int
as
(
f2
)
stored
,
foreign
key
(
f1
)
references
t1
(
f2
)
on
update
set
NULL
)
engine
=
innodb
;
insert
into
t1
values
(
1
,
1
);
insert
into
t2
(
f1
)
values
(
1
);
drop
table
t2
,
t1
;
--
source
include
/
wait_until_count_sessions
.
inc
mysql-test/suite/innodb/t/stored_fk.test
0 → 100644
View file @
9b18f5a5
--
source
include
/
have_innodb
.
inc
--
echo
# Create statement with FK on base column of stored column
--
error
ER_CANT_CREATE_TABLE
create
table
t1
(
f1
int
,
f2
int
as
(
f1
)
stored
,
foreign
key
(
f1
)
references
t2
(
f1
)
on
delete
cascade
)
engine
=
innodb
;
--
echo
# adding new stored column during alter table copy operation.
create
table
t1
(
f1
int
primary
key
)
engine
=
innodb
;
create
table
t2
(
f1
int
not
null
,
f2
int
as
(
f1
)
virtual
,
foreign
key
(
f1
)
references
t1
(
f1
)
on
update
cascade
)
engine
=
innodb
;
# MySQL 5.7 would refuse this
#--error ER_ERROR_ON_RENAME
alter
table
t2
add
column
f3
int
as
(
f1
)
stored
,
add
column
f4
int
as
(
f1
)
virtual
;
show
create
table
t2
;
drop
table
t2
;
--
echo
# adding foreign key constraint for base columns during alter copy.
create
table
t2
(
f1
int
not
null
,
f2
int
as
(
f1
)
stored
)
engine
=
innodb
;
# MySQL 5.7 would refuse this
alter
table
t2
add
foreign
key
(
f1
)
references
t1
(
f1
)
on
update
cascade
,
algorithm
=
copy
;
show
create
table
t2
;
drop
table
t2
;
--
echo
# adding foreign key constraint for base columns during online alter.
create
table
t2
(
f1
int
not
null
,
f2
int
as
(
f1
)
stored
)
engine
=
innodb
;
set
foreign_key_checks
=
0
;
--
error
138
alter
table
t2
add
foreign
key
(
f1
)
references
t1
(
f1
)
on
update
cascade
,
algorithm
=
inplace
;
drop
table
t2
;
--
echo
# adding stored column via online alter.
create
table
t2
(
f1
int
not
null
,
foreign
key
(
f1
)
references
t1
(
f1
)
on
update
cascade
)
engine
=
innodb
;
--
error
ER_ALTER_OPERATION_NOT_SUPPORTED
alter
table
t2
add
column
f2
int
as
(
f1
)
stored
,
algorithm
=
inplace
;
drop
table
t2
,
t1
;
--
echo
#
--
echo
# BUG#26731689 FK ON TABLE WITH GENERATED COLS: ASSERTION POS < N_DEF
--
echo
#
CREATE
TABLE
s
(
a
INT
,
b
INT
GENERATED
ALWAYS
AS
(
0
)
STORED
,
c
INT
,
d
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
e
INT
)
ENGINE
=
innodb
;
CREATE
TABLE
t
(
a
INT
)
ENGINE
=
innodb
;
# This would fail. No corresponding index
--
error
ER_FK_NO_INDEX_PARENT
ALTER
TABLE
s
ADD
CONSTRAINT
c
FOREIGN
KEY
(
e
)
REFERENCES
t
(
a
)
ON
UPDATE
SET
null
;
ALTER
TABLE
t
ADD
PRIMARY
KEY
(
a
);
ALTER
TABLE
s
ADD
CONSTRAINT
c
FOREIGN
KEY
(
e
)
REFERENCES
t
(
a
)
ON
UPDATE
SET
null
;
DROP
TABLE
s
,
t
;
CREATE
TABLE
s
(
a
INT
GENERATED
ALWAYS
AS
(
0
)
VIRTUAL
,
b
INT
GENERATED
ALWAYS
AS
(
0
)
STORED
,
c
INT
)
ENGINE
=
innodb
;
CREATE
TABLE
t
(
a
INT
)
ENGINE
=
innodb
;
# This would fail. No corresponding index
--
error
ER_FK_NO_INDEX_PARENT
ALTER
TABLE
s
ADD
CONSTRAINT
c
FOREIGN
KEY
(
c
)
REFERENCES
t
(
a
)
ON
UPDATE
SET
null
;
ALTER
TABLE
t
ADD
PRIMARY
KEY
(
a
);
ALTER
TABLE
s
ADD
CONSTRAINT
c
FOREIGN
KEY
(
c
)
REFERENCES
t
(
a
)
ON
UPDATE
SET
null
;
DROP
TABLE
s
,
t
;
CREATE
TABLE
s
(
a
INT
,
b
INT
GENERATED
ALWAYS
AS
(
0
)
STORED
)
ENGINE
=
innodb
;
CREATE
TABLE
t
(
a
INT
PRIMARY
KEY
)
ENGINE
=
innodb
;
ALTER
TABLE
s
ADD
CONSTRAINT
c
FOREIGN
KEY
(
a
)
REFERENCES
t
(
a
)
ON
UPDATE
SET
null
;
DROP
TABLE
s
,
t
;
CREATE
TABLE
s
(
a
INT
,
b
INT
)
ENGINE
=
innodb
;
CREATE
TABLE
t
(
a
INT
)
ENGINE
=
innodb
;
# This would fail. No corresponding index
--
error
ER_FK_NO_INDEX_PARENT
ALTER
TABLE
s
ADD
CONSTRAINT
c
FOREIGN
KEY
(
a
)
REFERENCES
t
(
a
)
ON
UPDATE
SET
null
;
ALTER
TABLE
t
ADD
PRIMARY
KEY
(
a
);
ALTER
TABLE
s
ADD
CONSTRAINT
c
FOREIGN
KEY
(
a
)
REFERENCES
t
(
a
)
ON
UPDATE
SET
null
;
DROP
TABLE
s
,
t
;
mysql-test/suite/innodb/t/temporary_table.test
View file @
9b18f5a5
...
...
@@ -21,6 +21,7 @@ call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call
mtr
.
add_suppression
(
"innodb_temporary and innodb_system file names seem to be the same"
);
call
mtr
.
add_suppression
(
"Could not create the shared innodb_temporary"
);
call
mtr
.
add_suppression
(
"InnoDB: syntax error in file path"
);
call
mtr
.
add_suppression
(
"InnoDB: Unable to parse innodb_temp_data_file_path="
);
--
enable_query_log
let
$MYSQL_TMP_DIR
=
`select @@tmpdir`
;
...
...
mysql-test/suite/innodb_fts/r/fulltext_table_evict.result
0 → 100644
View file @
9b18f5a5
#
# Bug Bug #27304661 MYSQL CRASH DOING SYNC INDEX ]
# [FATAL] INNODB: SEMAPHORE WAIT HAS LASTED > 600
#
CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
f1 TEXT(500),
FULLTEXT idx (f1)
) ENGINE=InnoDB;
insert into t1 (f1) values ('fjdhfsjhf'),('dhjfhjshfj'),('dhjafjhfj');
set @save_table_definition_cache=@@global.table_definition_cache;
set @save_table_open_cache=@@global.table_open_cache;
set global table_definition_cache=400;
set global table_open_cache= 1024;
SET @save_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL DEBUG_DBUG="+d,crash_if_fts_table_is_evicted";
set @@global.table_definition_cache=@save_table_definition_cache;
set @@global.table_open_cache=@save_table_open_cache;
drop table t1;
mysql-test/suite/innodb_fts/t/fulltext_table_evict.test
0 → 100644
View file @
9b18f5a5
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_debug
.
inc
--
source
include
/
big_test
.
inc
--
echo
#
--
echo
# Bug Bug #27304661 MYSQL CRASH DOING SYNC INDEX ]
--
echo
# [FATAL] INNODB: SEMAPHORE WAIT HAS LASTED > 600
--
echo
#
CREATE
TABLE
t1
(
id
INT
UNSIGNED
AUTO_INCREMENT
NOT
NULL
PRIMARY
KEY
,
f1
TEXT
(
500
),
FULLTEXT
idx
(
f1
)
)
ENGINE
=
InnoDB
;
insert
into
t1
(
f1
)
values
(
'fjdhfsjhf'
),(
'dhjfhjshfj'
),(
'dhjafjhfj'
);
--
source
include
/
restart_mysqld
.
inc
set
@
save_table_definition_cache
=@@
global
.
table_definition_cache
;
set
@
save_table_open_cache
=@@
global
.
table_open_cache
;
set
global
table_definition_cache
=
400
;
set
global
table_open_cache
=
1024
;
SET
@
save_dbug
=
@@
GLOBAL
.
debug_dbug
;
SET
GLOBAL
DEBUG_DBUG
=
"+d,crash_if_fts_table_is_evicted"
;
#Create 1000 tables, try the best to evict t1 .
--
disable_query_log
let
$loop
=
1000
;
while
(
$loop
)
{
eval
create
table
t_
$loop
(
id
int
,
name
text
(
100
),
fulltext
idxt_
$loop
(
name
)
)
engine
=
innodb
;
dec
$loop
;
}
let
$loop
=
1000
;
while
(
$loop
)
{
eval
drop
table
t_
$loop
;
dec
$loop
;
}
SET
GLOBAL
DEBUG_DBUG
=
@
save_dbug
;
--
enable_query_log
set
@@
global
.
table_definition_cache
=@
save_table_definition_cache
;
set
@@
global
.
table_open_cache
=@
save_table_open_cache
;
drop
table
t1
;
storage/innobase/buf/buf0buf.cc
View file @
9b18f5a5
/*****************************************************************************
Copyright (c) 1995, 201
6
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1995, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2013, 2018, MariaDB Corporation.
...
...
@@ -2869,6 +2869,9 @@ buf_pool_resize()
=
buf_pool
->
n_chunks
;
warning
=
true
;
buf_pool
->
chunks_old
=
NULL
;
for
(
ulint
j
=
0
;
j
<
buf_pool
->
n_chunks_new
;
j
++
)
{
buf_pool_register_chunk
(
&
(
buf_pool
->
chunks
[
j
]));
}
goto
calc_buf_pool_size
;
}
...
...
storage/innobase/dict/dict0dict.cc
View file @
9b18f5a5
/*****************************************************************************
Copyright (c) 1996, 201
6
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1996, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2018, MariaDB Corporation.
...
...
@@ -1453,6 +1453,13 @@ dict_make_room_in_cache(
if
(
dict_table_can_be_evicted
(
table
))
{
DBUG_EXECUTE_IF
(
"crash_if_fts_table_is_evicted"
,
{
if
(
table
->
fts
&&
dict_table_has_fts_index
(
table
))
{
ut_ad
(
0
);
}
};);
dict_table_remove_from_cache_low
(
table
,
TRUE
);
++
n_evicted
;
...
...
@@ -2421,6 +2428,44 @@ dict_index_add_to_cache(
table
,
index
,
NULL
,
page_no
,
strict
));
}
/** Clears the virtual column's index list before index is
being freed.
@param[in] index Index being freed */
void
dict_index_remove_from_v_col_list
(
dict_index_t
*
index
)
{
/* Index is not completely formed */
if
(
!
index
->
cached
)
{
return
;
}
if
(
dict_index_has_virtual
(
index
))
{
const
dict_col_t
*
col
;
const
dict_v_col_t
*
vcol
;
for
(
ulint
i
=
0
;
i
<
dict_index_get_n_fields
(
index
);
i
++
)
{
col
=
dict_index_get_nth_col
(
index
,
i
);
if
(
dict_col_is_virtual
(
col
))
{
vcol
=
reinterpret_cast
<
const
dict_v_col_t
*>
(
col
);
/* This could be NULL, when we do add
virtual column, add index together. We do not
need to track this virtual column's index */
if
(
vcol
->
v_indexes
==
NULL
)
{
continue
;
}
dict_v_idx_list
::
iterator
it
;
for
(
it
=
vcol
->
v_indexes
->
begin
();
it
!=
vcol
->
v_indexes
->
end
();
++
it
)
{
dict_v_idx_t
v_index
=
*
it
;
if
(
v_index
.
index
==
index
)
{
vcol
->
v_indexes
->
erase
(
it
);
break
;
}
}
}
}
}
}
/** Adds an index to the dictionary cache, with possible indexing newly
added column.
@param[in,out] table table on which the index is
...
...
storage/innobase/dict/dict0mem.cc
View file @
9b18f5a5
/*****************************************************************************
Copyright (c) 1996, 201
6
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1996, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2018, MariaDB Corporation.
...
...
@@ -1034,6 +1034,7 @@ dict_mem_index_free(
UT_DELETE
(
index
->
rtr_track
->
rtr_active
);
}
dict_index_remove_from_v_col_list
(
index
);
mem_heap_free
(
index
->
heap
);
}
...
...
storage/innobase/fts/fts0opt.cc
View file @
9b18f5a5
/*****************************************************************************
Copyright (c) 2007, 201
7
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2007, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2016, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
...
...
@@ -41,6 +41,9 @@ Completed 2011/7/10 Sunny and Jimmy Yang
/** The FTS optimize thread's work queue. */
static
ib_wqueue_t
*
fts_optimize_wq
;
/** The FTS vector to store fts_slot_t */
static
ib_vector_t
*
fts_slots
;
/** Time to wait for a message. */
static
const
ulint
FTS_QUEUE_WAIT_IN_USECS
=
5000000
;
...
...
@@ -2976,9 +2979,6 @@ fts_optimize_thread(
/*================*/
void
*
arg
)
/*!< in: work queue*/
{
mem_heap_t
*
heap
;
ib_vector_t
*
tables
;
ib_alloc_t
*
heap_alloc
;
ulint
current
=
0
;
ibool
done
=
FALSE
;
ulint
n_tables
=
0
;
...
...
@@ -2988,10 +2988,10 @@ fts_optimize_thread(
ut_ad
(
!
srv_read_only_mode
);
my_thread_init
();
heap
=
mem_heap_create
(
sizeof
(
dict_table_t
*
)
*
64
);
heap_alloc
=
ib_heap_allocator_create
(
heap
);
ut_ad
(
fts_slots
);
tables
=
ib_vector_create
(
heap_alloc
,
sizeof
(
fts_slot_t
),
4
);
/* Assign number of tables added in fts_slots_t to n_tables */
n_tables
=
ib_vector_size
(
fts_slots
);
while
(
!
done
&&
srv_shutdown_state
==
SRV_SHUTDOWN_NONE
)
{
...
...
@@ -3005,10 +3005,10 @@ fts_optimize_thread(
fts_slot_t
*
slot
;
ut_a
(
ib_vector_size
(
table
s
)
>
0
);
ut_a
(
ib_vector_size
(
fts_slot
s
)
>
0
);
slot
=
static_cast
<
fts_slot_t
*>
(
ib_vector_get
(
table
s
,
current
));
ib_vector_get
(
fts_slot
s
,
current
));
/* Handle the case of empty slots. */
if
(
slot
->
state
!=
FTS_STATE_EMPTY
)
{
...
...
@@ -3021,8 +3021,8 @@ fts_optimize_thread(
++
current
;
/* Wrap around the counter. */
if
(
current
>=
ib_vector_size
(
table
s
))
{
n_optimize
=
fts_optimize_how_many
(
table
s
);
if
(
current
>=
ib_vector_size
(
fts_slot
s
))
{
n_optimize
=
fts_optimize_how_many
(
fts_slot
s
);
current
=
0
;
}
...
...
@@ -3036,7 +3036,7 @@ fts_optimize_thread(
/* Timeout ? */
if
(
msg
==
NULL
)
{
if
(
fts_is_sync_needed
(
table
s
))
{
if
(
fts_is_sync_needed
(
fts_slot
s
))
{
fts_need_sync
=
true
;
}
...
...
@@ -3057,7 +3057,7 @@ fts_optimize_thread(
case
FTS_MSG_ADD_TABLE
:
ut_a
(
!
done
);
if
(
fts_optimize_new_table
(
table
s
,
fts_slot
s
,
static_cast
<
dict_table_t
*>
(
msg
->
ptr
)))
{
++
n_tables
;
...
...
@@ -3067,7 +3067,7 @@ fts_optimize_thread(
case
FTS_MSG_OPTIMIZE_TABLE
:
if
(
!
done
)
{
fts_optimize_start_table
(
table
s
,
fts_slot
s
,
static_cast
<
dict_table_t
*>
(
msg
->
ptr
));
}
...
...
@@ -3075,7 +3075,7 @@ fts_optimize_thread(
case
FTS_MSG_DEL_TABLE
:
if
(
fts_optimize_del_table
(
table
s
,
static_cast
<
fts_msg_del_t
*>
(
fts_slot
s
,
static_cast
<
fts_msg_del_t
*>
(
msg
->
ptr
)))
{
--
n_tables
;
}
...
...
@@ -3098,7 +3098,7 @@ fts_optimize_thread(
mem_heap_free
(
msg
->
heap
);
if
(
!
done
)
{
n_optimize
=
fts_optimize_how_many
(
table
s
);
n_optimize
=
fts_optimize_how_many
(
fts_slot
s
);
}
else
{
n_optimize
=
0
;
}
...
...
@@ -3110,11 +3110,11 @@ fts_optimize_thread(
if
(
n_tables
>
0
)
{
ulint
i
;
for
(
i
=
0
;
i
<
ib_vector_size
(
table
s
);
i
++
)
{
for
(
i
=
0
;
i
<
ib_vector_size
(
fts_slot
s
);
i
++
)
{
fts_slot_t
*
slot
;
slot
=
static_cast
<
fts_slot_t
*>
(
ib_vector_get
(
table
s
,
i
));
ib_vector_get
(
fts_slot
s
,
i
));
if
(
slot
->
state
!=
FTS_STATE_EMPTY
)
{
fts_optimize_sync_table
(
slot
->
table_id
);
...
...
@@ -3122,7 +3122,7 @@ fts_optimize_thread(
}
}
ib_vector_free
(
table
s
);
ib_vector_free
(
fts_slot
s
);
ib
::
info
()
<<
"FTS optimize thread exiting."
;
...
...
@@ -3142,14 +3142,52 @@ void
fts_optimize_init
(
void
)
/*===================*/
{
mem_heap_t
*
heap
;
ib_alloc_t
*
heap_alloc
;
dict_table_t
*
table
;
ut_ad
(
!
srv_read_only_mode
);
/* For now we only support one optimize thread. */
ut_a
(
fts_optimize_wq
==
NULL
);
/* Create FTS optimize work queue */
fts_optimize_wq
=
ib_wqueue_create
();
fts_opt_shutdown_event
=
os_event_create
(
0
);
ut_a
(
fts_optimize_wq
!=
NULL
);
/* Create FTS vector to store fts_slot_t */
heap
=
mem_heap_create
(
sizeof
(
dict_table_t
*
)
*
64
);
heap_alloc
=
ib_heap_allocator_create
(
heap
);
fts_slots
=
ib_vector_create
(
heap_alloc
,
sizeof
(
fts_slot_t
),
4
);
/* Add fts tables to the fts_slots vector which were skipped during restart */
std
::
vector
<
dict_table_t
*>
table_vector
;
std
::
vector
<
dict_table_t
*>::
iterator
it
;
mutex_enter
(
&
dict_sys
->
mutex
);
for
(
table
=
UT_LIST_GET_FIRST
(
dict_sys
->
table_LRU
);
table
!=
NULL
;
table
=
UT_LIST_GET_NEXT
(
table_LRU
,
table
))
{
if
(
table
->
fts
&&
dict_table_has_fts_index
(
table
))
{
if
(
fts_optimize_new_table
(
fts_slots
,
table
)){
table_vector
.
push_back
(
table
);
}
}
}
/* It is better to call dict_table_prevent_eviction()
outside the above loop because it operates on
dict_sys->table_LRU list.*/
for
(
it
=
table_vector
.
begin
();
it
!=
table_vector
.
end
();
++
it
)
{
dict_table_prevent_eviction
(
*
it
);
}
mutex_exit
(
&
dict_sys
->
mutex
);
table_vector
.
clear
();
fts_opt_shutdown_event
=
os_event_create
(
0
);
last_check_sync_time
=
ut_time
();
os_thread_create
(
fts_optimize_thread
,
fts_optimize_wq
,
NULL
);
...
...
storage/innobase/handler/ha_innodb.cc
View file @
9b18f5a5
...
...
@@ -3932,6 +3932,8 @@ innobase_init(
/* Supports raw devices */
if
(
!
srv_sys_space
.
parse_params
(
innobase_data_file_path
,
true
))
{
ib
::
error
()
<<
"Unable to parse innodb_data_file_path="
<<
innobase_data_file_path
;
DBUG_RETURN
(
innobase_init_abort
());
}
...
...
@@ -3950,6 +3952,8 @@ innobase_init(
srv_tmp_space
.
set_flags
(
FSP_FLAGS_PAGE_SSIZE
());
if
(
!
srv_tmp_space
.
parse_params
(
innobase_temp_data_file_path
,
false
))
{
ib
::
error
()
<<
"Unable to parse innodb_temp_data_file_path="
<<
innobase_temp_data_file_path
;
DBUG_RETURN
(
innobase_init_abort
());
}
...
...
storage/innobase/handler/handler0alter.cc
View file @
9b18f5a5
...
...
@@ -5434,18 +5434,24 @@ alter_fill_stored_column(
dict_s_col_list
**
s_cols
,
mem_heap_t
**
s_heap
)
{
ulint
n_cols
=
altered_table
->
s
->
fields
;
ulint
n_cols
=
altered_table
->
s
->
fields
;
ulint
stored_col_no
=
0
;
for
(
ulint
i
=
0
;
i
<
n_cols
;
i
++
)
{
Field
*
field
=
altered_table
->
field
[
i
];
dict_s_col_t
s_col
;
if
(
!
innobase_is_v_fld
(
field
))
{
stored_col_no
++
;
}
if
(
!
innobase_is_s_fld
(
field
))
{
continue
;
}
ulint
num_base
=
0
;
dict_col_t
*
col
=
dict_table_get_nth_col
(
table
,
i
);
dict_col_t
*
col
=
dict_table_get_nth_col
(
table
,
stored_col_no
);
s_col
.
m_col
=
col
;
s_col
.
s_pos
=
i
;
...
...
storage/innobase/include/dict0dict.h
View file @
9b18f5a5
/*****************************************************************************
Copyright (c) 1996, 201
6
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 1996, 201
8
, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2018, MariaDB Corporation.
...
...
@@ -1121,6 +1121,12 @@ dict_index_add_to_cache(
ibool
strict
)
MY_ATTRIBUTE
((
warn_unused_result
));
/** Clears the virtual column's index list before index is being freed.
@param[in] index Index being freed */
void
dict_index_remove_from_v_col_list
(
dict_index_t
*
index
);
/** Adds an index to the dictionary cache, with possible indexing newly
added column.
@param[in] table table on which the index is
...
...
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