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
31c950cc
Commit
31c950cc
authored
Jun 26, 2018
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.1 into 10.2
parents
0e937f30
c6392d52
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
188 additions
and
9 deletions
+188
-9
mysql-test/r/statistics.result
mysql-test/r/statistics.result
+21
-0
mysql-test/suite/parts/r/alter_data_directory_innodb.result
mysql-test/suite/parts/r/alter_data_directory_innodb.result
+65
-0
mysql-test/suite/parts/t/alter_data_directory_innodb.test
mysql-test/suite/parts/t/alter_data_directory_innodb.test
+46
-0
mysql-test/t/statistics.test
mysql-test/t/statistics.test
+26
-0
sql/ha_partition.cc
sql/ha_partition.cc
+2
-1
sql/handler.h
sql/handler.h
+9
-1
sql/log_event.cc
sql/log_event.cc
+0
-4
sql/sql_statistics.cc
sql/sql_statistics.cc
+3
-3
storage/innobase/handler/ha_innodb.h
storage/innobase/handler/ha_innodb.h
+3
-0
storage/innobase/handler/handler0alter.cc
storage/innobase/handler/handler0alter.cc
+7
-0
storage/xtradb/handler/handler0alter.cc
storage/xtradb/handler/handler0alter.cc
+6
-0
No files found.
mysql-test/r/statistics.result
View file @
31c950cc
...
@@ -1682,6 +1682,27 @@ set use_stat_tables=@save_use_stat_tables;
...
@@ -1682,6 +1682,27 @@ set use_stat_tables=@save_use_stat_tables;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1,t2;
drop table t1,t2;
#
#
# MDEV-16507: statistics for temporary tables should not be used
#
SET
@save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
SET @@use_stat_tables = preferably ;
SET @@optimizer_use_condition_selectivity = 4;
CREATE TABLE t1 (
TIMESTAMP TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP
);
SET @had_t1_table= @@warning_count != 0;
CREATE TEMPORARY TABLE tmp_t1 LIKE t1;
INSERT INTO tmp_t1 VALUES (now());
INSERT INTO t1 SELECT * FROM tmp_t1 WHERE @had_t1_table=0;
DROP TABLE t1;
SET
use_stat_tables=@save_use_stat_tables;
SET
optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
# End of 10.0 tests
#
# MDEV-9590: Always print "Engine-independent statistic" warnings and
# MDEV-9590: Always print "Engine-independent statistic" warnings and
# might be filtering columns unintentionally from engines
# might be filtering columns unintentionally from engines
#
#
...
...
mysql-test/suite/parts/r/alter_data_directory_innodb.result
0 → 100644
View file @
31c950cc
#
# MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir
#
CREATE TABLE t (
a INT NOT NULL
) ENGINE=INNODB
PARTITION BY HASH (a) (
PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here/' ENGINE = INNODB
);
INSERT INTO t VALUES (1);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY HASH (`a`)
(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB)
ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY HASH (`a`)
(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB)
ALTER TABLE t DROP PRIMARY KEY, ALGORITHM=COPY;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY HASH (`a`)
(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB)
SET @TMP = @@GLOBAL.INNODB_FILE_PER_TABLE;
SET GLOBAL INNODB_FILE_PER_TABLE=OFF;
ALTER TABLE t ADD PRIMARY KEY pk(a), ALGORITHM=INPLACE;
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY HASH (`a`)
(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB)
SET GLOBAL INNODB_FILE_PER_TABLE=@TMP;
ALTER TABLE t REORGANIZE PARTITION p1,p2 INTO (
PARTITION p1 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB,
PARTITION p2 DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/' ENGINE = INNODB
);
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY HASH (`a`)
(PARTITION `p1` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB,
PARTITION `p2` DATA DIRECTORY = 'MYSQLTEST_VARDIR/tmp/partitions_here' ENGINE = InnoDB)
DROP TABLE t;
mysql-test/suite/parts/t/alter_data_directory_innodb.test
0 → 100644
View file @
31c950cc
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_partition
.
inc
--
echo
#
--
echo
# MDEV-15953 Alter InnoDB Partitioned Table Moves Files (which were originally not in the datadir) to the datadir
--
echo
#
mkdir
$MYSQLTEST_VARDIR
/
tmp
/
partitions_here
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
CREATE
TABLE
t
(
a
INT
NOT
NULL
)
ENGINE
=
INNODB
PARTITION
BY
HASH
(
a
)
(
PARTITION
p1
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/tmp/partitions_here/'
ENGINE
=
INNODB
,
PARTITION
p2
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/tmp/partitions_here/'
ENGINE
=
INNODB
);
INSERT
INTO
t
VALUES
(
1
);
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
ALTER
TABLE
t
ADD
PRIMARY
KEY
pk
(
a
),
ALGORITHM
=
INPLACE
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
ALTER
TABLE
t
DROP
PRIMARY
KEY
,
ALGORITHM
=
COPY
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
SET
@
TMP
=
@@
GLOBAL
.
INNODB_FILE_PER_TABLE
;
SET
GLOBAL
INNODB_FILE_PER_TABLE
=
OFF
;
ALTER
TABLE
t
ADD
PRIMARY
KEY
pk
(
a
),
ALGORITHM
=
INPLACE
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
SET
GLOBAL
INNODB_FILE_PER_TABLE
=@
TMP
;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
eval
ALTER
TABLE
t
REORGANIZE
PARTITION
p1
,
p2
INTO
(
PARTITION
p1
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
ENGINE
=
INNODB
,
PARTITION
p2
DATA
DIRECTORY
=
'$MYSQLTEST_VARDIR/tmp/partitions_somewhere_else/'
ENGINE
=
INNODB
);
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
SHOW
CREATE
TABLE
t
;
DROP
TABLE
t
;
rmdir
$MYSQLTEST_VARDIR
/
tmp
/
partitions_here
/
test
;
rmdir
$MYSQLTEST_VARDIR
/
tmp
/
partitions_here
;
mysql-test/t/statistics.test
View file @
31c950cc
...
@@ -818,6 +818,32 @@ set use_stat_tables=@save_use_stat_tables;
...
@@ -818,6 +818,32 @@ set use_stat_tables=@save_use_stat_tables;
set
optimizer_use_condition_selectivity
=
@
save_optimizer_use_condition_selectivity
;
set
optimizer_use_condition_selectivity
=
@
save_optimizer_use_condition_selectivity
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
--
echo
#
--
echo
# MDEV-16507: statistics for temporary tables should not be used
--
echo
#
SET
@
save_optimizer_use_condition_selectivity
=
@@
optimizer_use_condition_selectivity
;
SET
@@
use_stat_tables
=
preferably
;
SET
@@
optimizer_use_condition_selectivity
=
4
;
CREATE
TABLE
t1
(
TIMESTAMP
TIMESTAMP
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
);
SET
@
had_t1_table
=
@@
warning_count
!=
0
;
CREATE
TEMPORARY
TABLE
tmp_t1
LIKE
t1
;
INSERT
INTO
tmp_t1
VALUES
(
now
());
INSERT
INTO
t1
SELECT
*
FROM
tmp_t1
WHERE
@
had_t1_table
=
0
;
DROP
TABLE
t1
;
SET
use_stat_tables
=@
save_use_stat_tables
;
SET
optimizer_use_condition_selectivity
=
@
save_optimizer_use_condition_selectivity
;
--
echo
# End of 10.0 tests
--
echo
#
--
echo
#
--
echo
# MDEV-9590: Always print "Engine-independent statistic" warnings and
--
echo
# MDEV-9590: Always print "Engine-independent statistic" warnings and
--
echo
# might be filtering columns unintentionally from engines
--
echo
# might be filtering columns unintentionally from engines
...
...
sql/ha_partition.cc
View file @
31c950cc
...
@@ -5079,7 +5079,8 @@ int ha_partition::rnd_pos_by_record(uchar *record)
...
@@ -5079,7 +5079,8 @@ int ha_partition::rnd_pos_by_record(uchar *record)
if
(
unlikely
(
get_part_for_delete
(
record
,
m_rec0
,
m_part_info
,
&
m_last_part
)))
if
(
unlikely
(
get_part_for_delete
(
record
,
m_rec0
,
m_part_info
,
&
m_last_part
)))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
DBUG_RETURN
(
handler
::
rnd_pos_by_record
(
record
));
int
err
=
m_file
[
m_last_part
]
->
rnd_pos_by_record
(
record
);
DBUG_RETURN
(
err
);
}
}
...
...
sql/handler.h
View file @
31c950cc
...
@@ -3230,9 +3230,17 @@ class handler :public Sql_alloc
...
@@ -3230,9 +3230,17 @@ class handler :public Sql_alloc
*/
*/
virtual
int
rnd_pos_by_record
(
uchar
*
record
)
virtual
int
rnd_pos_by_record
(
uchar
*
record
)
{
{
int
error
;
DBUG_ASSERT
(
table_flags
()
&
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
);
DBUG_ASSERT
(
table_flags
()
&
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION
);
error
=
ha_rnd_init
(
false
);
if
(
error
!=
0
)
return
error
;
position
(
record
);
position
(
record
);
return
rnd_pos
(
record
,
ref
);
error
=
ha_rnd_pos
(
record
,
ref
);
ha_rnd_end
();
return
error
;
}
}
virtual
int
read_first_row
(
uchar
*
buf
,
uint
primary_key
);
virtual
int
read_first_row
(
uchar
*
buf
,
uint
primary_key
);
public:
public:
...
...
sql/log_event.cc
View file @
31c950cc
...
@@ -13109,10 +13109,6 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
...
@@ -13109,10 +13109,6 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
int
error
;
int
error
;
DBUG_PRINT
(
"info"
,(
"locating record using primary key (position)"
));
DBUG_PRINT
(
"info"
,(
"locating record using primary key (position)"
));
if
(
!
table
->
file
->
inited
&&
(
error
=
table
->
file
->
ha_rnd_init_with_error
(
0
)))
DBUG_RETURN
(
error
);
error
=
table
->
file
->
ha_rnd_pos_by_record
(
table
->
record
[
0
]);
error
=
table
->
file
->
ha_rnd_pos_by_record
(
table
->
record
[
0
]);
if
(
error
)
if
(
error
)
{
{
...
...
sql/sql_statistics.cc
View file @
31c950cc
...
@@ -3101,7 +3101,7 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
...
@@ -3101,7 +3101,7 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_global
)
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_global
)
{
{
if
(
!
tl
->
is_view_or_derived
()
&&
tl
->
table
)
if
(
!
tl
->
is_view_or_derived
()
&&
!
is_temporary_table
(
tl
)
&&
tl
->
table
)
{
{
TABLE_SHARE
*
table_share
=
tl
->
table
->
s
;
TABLE_SHARE
*
table_share
=
tl
->
table
->
s
;
if
(
table_share
&&
if
(
table_share
&&
...
@@ -3113,7 +3113,7 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
...
@@ -3113,7 +3113,7 @@ bool statistics_for_tables_is_needed(THD *thd, TABLE_LIST *tables)
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_global
)
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_global
)
{
{
if
(
!
tl
->
is_view_or_derived
()
&&
tl
->
table
)
if
(
!
tl
->
is_view_or_derived
()
&&
!
is_temporary_table
(
tl
)
&&
tl
->
table
)
{
{
TABLE_SHARE
*
table_share
=
tl
->
table
->
s
;
TABLE_SHARE
*
table_share
=
tl
->
table
->
s
;
if
(
table_share
&&
if
(
table_share
&&
...
@@ -3242,7 +3242,7 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
...
@@ -3242,7 +3242,7 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_global
)
for
(
TABLE_LIST
*
tl
=
tables
;
tl
;
tl
=
tl
->
next_global
)
{
{
if
(
!
tl
->
is_view_or_derived
()
&&
tl
->
table
)
if
(
!
tl
->
is_view_or_derived
()
&&
!
is_temporary_table
(
tl
)
&&
tl
->
table
)
{
{
TABLE_SHARE
*
table_share
=
tl
->
table
->
s
;
TABLE_SHARE
*
table_share
=
tl
->
table
->
s
;
if
(
table_share
&&
if
(
table_share
&&
...
...
storage/innobase/handler/ha_innodb.h
View file @
31c950cc
...
@@ -745,6 +745,9 @@ class create_table_info_t
...
@@ -745,6 +745,9 @@ class create_table_info_t
ulint
flags
()
const
ulint
flags
()
const
{
return
(
m_flags
);
}
{
return
(
m_flags
);
}
/** Update table flags. */
void
flags_set
(
ulint
flags
)
{
m_flags
|=
flags
;
}
/** Get table flags2. */
/** Get table flags2. */
ulint
flags2
()
const
ulint
flags2
()
const
{
return
(
m_flags2
);
}
{
return
(
m_flags2
);
}
...
...
storage/innobase/handler/handler0alter.cc
View file @
31c950cc
...
@@ -5727,6 +5727,13 @@ ha_innobase::prepare_inplace_alter_table(
...
@@ -5727,6 +5727,13 @@ ha_innobase::prepare_inplace_alter_table(
goto
err_exit_no_heap
;
goto
err_exit_no_heap
;
}
}
if
(
info
.
flags2
()
&
DICT_TF2_USE_FILE_PER_TABLE
)
{
/* Preserve the DATA DIRECTORY attribute, because it
currently cannot be changed during ALTER TABLE. */
info
.
flags_set
(
m_prebuilt
->
table
->
flags
&
1U
<<
DICT_TF_POS_DATA_DIR
);
}
max_col_len
=
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG
(
info
.
flags
());
max_col_len
=
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG
(
info
.
flags
());
/* Check each index's column length to make sure they do not
/* Check each index's column length to make sure they do not
...
...
storage/xtradb/handler/handler0alter.cc
View file @
31c950cc
...
@@ -3693,6 +3693,12 @@ ha_innobase::prepare_inplace_alter_table(
...
@@ -3693,6 +3693,12 @@ ha_innobase::prepare_inplace_alter_table(
goto
err_exit_no_heap
;
goto
err_exit_no_heap
;
}
}
/* Preserve this flag, because it currenlty can't be changed during
ALTER TABLE*/
if
(
flags2
&
DICT_TF2_USE_TABLESPACE
)
{
flags
|=
prebuilt
->
table
->
flags
&
1U
<<
DICT_TF_POS_DATA_DIR
;
}
max_col_len
=
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG
(
flags
);
max_col_len
=
DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG
(
flags
);
/* Check each index's column length to make sure they do not
/* Check each index's column length to make sure they do not
...
...
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