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
fd6dfb3b
Commit
fd6dfb3b
authored
Oct 30, 2019
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'github/10.1' into 10.2
parents
6680b049
31385576
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
8 deletions
+41
-8
mysql-test/suite/innodb/r/stat_tables.result
mysql-test/suite/innodb/r/stat_tables.result
+15
-0
mysql-test/suite/innodb/t/stat_tables.test
mysql-test/suite/innodb/t/stat_tables.test
+17
-0
sql/sql_class.h
sql/sql_class.h
+4
-0
sql/sql_statistics.cc
sql/sql_statistics.cc
+5
-8
No files found.
mysql-test/suite/innodb/r/stat_tables.result
0 → 100644
View file @
fd6dfb3b
rename table mysql.table_stats to mysql.table_stats_save;
flush tables;
set use_stat_tables= PREFERABLY;
create table t1 (a int) engine=InnoDB;
start transaction;
insert t1 values (1);
insert t1 values (2);
commit;
select * from t1;
a
1
2
drop table t1;
rename table mysql.table_stats_save to mysql.table_stats;
flush tables;
mysql-test/suite/innodb/t/stat_tables.test
0 → 100644
View file @
fd6dfb3b
source
include
/
have_innodb
.
inc
;
#
# MDEV-20354 All but last insert ignored in InnoDB tables when table locked
#
rename
table
mysql
.
table_stats
to
mysql
.
table_stats_save
;
flush
tables
;
set
use_stat_tables
=
PREFERABLY
;
create
table
t1
(
a
int
)
engine
=
InnoDB
;
start
transaction
;
insert
t1
values
(
1
);
insert
t1
values
(
2
);
commit
;
select
*
from
t1
;
drop
table
t1
;
rename
table
mysql
.
table_stats_save
to
mysql
.
table_stats
;
flush
tables
;
sql/sql_class.h
View file @
fd6dfb3b
...
...
@@ -1579,12 +1579,16 @@ class Open_tables_backup: public Open_tables_state
/**
@class Sub_statement_state
@brief Used to save context when executing a function or trigger
operations on stat tables aren't technically a sub-statement, but they are
similar in a sense that they cannot change the transaction status.
*/
/* Defines used for Sub_statement_state::in_sub_stmt */
#define SUB_STMT_TRIGGER 1
#define SUB_STMT_FUNCTION 2
#define SUB_STMT_STAT_TABLES 4
class
Sub_statement_state
...
...
sql/sql_statistics.cc
View file @
fd6dfb3b
...
...
@@ -258,10 +258,8 @@ index_stat_def= {INDEX_STAT_N_FIELDS, index_stat_fields, 4, index_stat_pk_col};
Open all statistical tables and lock them
*/
static
inline
int
open_stat_tables
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Open_tables_backup
*
backup
,
bool
for_write
)
static
int
open_stat_tables
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Open_tables_backup
*
backup
,
bool
for_write
)
{
int
rc
;
...
...
@@ -269,12 +267,14 @@ inline int open_stat_tables(THD *thd, TABLE_LIST *tables,
thd
->
push_internal_handler
(
&
deh
);
init_table_list_for_stat_tables
(
tables
,
for_write
);
init_mdl_requests
(
tables
);
thd
->
in_sub_stmt
|=
SUB_STMT_STAT_TABLES
;
rc
=
open_system_tables_for_read
(
thd
,
tables
,
backup
);
thd
->
in_sub_stmt
&=
~
SUB_STMT_STAT_TABLES
;
thd
->
pop_internal_handler
();
/* If the number of tables changes, we should revise the check below. */
DBUG_ASSERT
(
STATISTICS_TABLES
==
3
);
compile_time_assert
(
STATISTICS_TABLES
==
3
);
if
(
!
rc
&&
(
stat_table_intact
.
check
(
tables
[
TABLE_STAT
].
table
,
&
table_stat_def
)
||
...
...
@@ -3276,10 +3276,7 @@ int read_statistics_for_tables(THD *thd, TABLE_LIST *tables)
DBUG_RETURN
(
0
);
if
(
open_stat_tables
(
thd
,
stat_tables
,
&
open_tables_backup
,
FALSE
))
{
thd
->
clear_error
();
DBUG_RETURN
(
1
);
}
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_global
)
{
...
...
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