Skip to content

Commit 4d4865d

Browse files
committed
Merge 10.4 into 10.5
2 parents 6c165b4 + 4b959bd commit 4d4865d

29 files changed

+265
-145
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ ENDIF()
197197
OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF)
198198

199199
INCLUDE(check_compiler_flag)
200+
INCLUDE(check_linker_flag)
200201

201202
OPTION(WITH_ASAN "Enable address sanitizer" OFF)
202203

@@ -250,7 +251,7 @@ OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protec
250251
IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN)
251252
# security-enhancing flags
252253
MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC")
253-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wl,-z,relro,-z,now")
254+
MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now")
254255
MY_CHECK_AND_SET_COMPILER_FLAG("-fstack-protector --param=ssp-buffer-size=4")
255256
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
256257
ENDIF()

cmake/check_linker_flag.cmake

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
include(CheckCXXSourceCompiles)
2+
3+
FUNCTION(MY_CHECK_AND_SET_LINKER_FLAG flag_to_set)
4+
# Let's avoid expensive compiler tests on Windows:
5+
IF(WIN32)
6+
RETURN()
7+
ENDIF()
8+
STRING(REGEX REPLACE "[-,= +]" "_" result "HAVE_LINK_FLAG_${flag_to_set}")
9+
SET(SAVE_CMAKE_REQUIRED_LINK_OPTIONS "${CMAKE_REQUIRED_LINK_OPTIONS}")
10+
STRING(REGEX REPLACE "^-Wno-" "-W" flag_to_check ${flag_to_set})
11+
SET(CMAKE_REQUIRED_LINK_OPTIONS ${CMAKE_REQUIRED_LINK_OPTIONS} ${flag_to_check})
12+
CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result})
13+
SET(CMAKE_REQUIRED_LINK_OPTIONS "${SAVE_CMAKE_REQUIRED_LINK_OPTIONS}")
14+
IF (${result})
15+
FOREACH(linktype SHARED MODULE EXE)
16+
IF(ARGN)
17+
FOREACH(type ${ARGN})
18+
SET(CMAKE_${linktype}_LINKER_FLAGS_${type}
19+
"${CMAKE_${linktype}_LINKER_FLAGS_${type}} ${flag_to_set}" PARENT_SCOPE)
20+
ENDFOREACH()
21+
ELSE()
22+
SET(CMAKE_${linktype}_LINKER_FLAGS
23+
"${CMAKE_${linktype}_LINKER_FLAGS} ${flag_to_set}" PARENT_SCOPE)
24+
ENDIF()
25+
ENDFOREACH()
26+
ENDIF()
27+
ENDFUNCTION()

mysql-test/main/partition_explicit_prune.result

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,6 +1897,24 @@ ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
18971897
SELECT * FROM t1 PARTITION (p0);
18981898
i
18991899
UNLOCK TABLES;
1900+
DROP TABLE t1;
1901+
#
1902+
# MDEV-18371 Server crashes in ha_innobase::cmp_ref upon UPDATE with PARTITION clause.
1903+
#
1904+
CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE=InnoDB PARTITION BY KEY(b) PARTITIONS 4;
1905+
INSERT INTO t1 VALUES (3,0),(8,2),(7,8),(3,4),(2,4),(0,7),(4,3),(3,6);
1906+
FLUSH TABLES;
1907+
UPDATE t1 PARTITION (p3,p1) SET a = 2 WHERE a = 3;
1908+
SELECT * FROM t1;
1909+
a b
1910+
2 0
1911+
7 8
1912+
2 4
1913+
2 4
1914+
0 7
1915+
4 3
1916+
8 2
1917+
2 6
19001918
DROP TABLE t1, t2;
19011919
#
19021920
# MDEV-18982: INSERT using explicit patition pruning with column list

mysql-test/main/partition_explicit_prune.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,18 @@ SELECT * FROM t1 PARTITION (p0);
874874
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
875875
SELECT * FROM t1 PARTITION (p0);
876876
UNLOCK TABLES;
877+
DROP TABLE t1;
878+
879+
--echo #
880+
--echo # MDEV-18371 Server crashes in ha_innobase::cmp_ref upon UPDATE with PARTITION clause.
881+
--echo #
882+
883+
CREATE TABLE t1 (a INT, b INT, KEY (a)) ENGINE=InnoDB PARTITION BY KEY(b) PARTITIONS 4;
884+
INSERT INTO t1 VALUES (3,0),(8,2),(7,8),(3,4),(2,4),(0,7),(4,3),(3,6);
885+
FLUSH TABLES;
886+
UPDATE t1 PARTITION (p3,p1) SET a = 2 WHERE a = 3;
887+
SELECT * FROM t1;
888+
877889

878890
# Cleanup
879891
DROP TABLE t1, t2;

mysql-test/main/stat_tables_innodb.result

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,4 +926,28 @@ set global innodb_stats_persistent= @innodb_stats_persistent_save;
926926
set global innodb_stats_persistent_sample_pages=
927927
@innodb_stats_persistent_sample_pages_save;
928928
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
929+
#
930+
# MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows.
931+
#
932+
CREATE TABLE t1(a INT) ENGINE=INNODB;
933+
INSERT INTO t1 SELECT 1 FROM seq_1_to_60000;
934+
SET @save_use_stat_tables= @@use_stat_tables;
935+
SET use_stat_tables= preferably;
936+
SELECT count(*) FROM t1;
937+
count(*)
938+
60000
939+
CREATE INDEX idx ON t1(a);
940+
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES (idx);
941+
Table Op Msg_type Msg_text
942+
test.t1 analyze status Engine-independent statistics collected
943+
test.t1 analyze status OK
944+
SELECT * FROM mysql.index_stats where table_name='t1';
945+
db_name table_name index_name prefix_arity avg_frequency
946+
test t1 idx 1 60000.0000
947+
SELECT * FROM mysql.column_stats where table_name='t1';
948+
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
949+
test t1 a 1 1 0.0000 4.0000 60000.0000 0 NULL NULL
950+
SET use_stat_tables= @save_use_stat_tables;
951+
DROP TABLE t1;
952+
# end of 10.1 tests
929953
SET SESSION DEFAULT_STORAGE_ENGINE=DEFAULT;

mysql-test/main/stat_tables_innodb.test

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
--source include/have_innodb.inc
2+
--source include/have_sequence.inc
23

34
SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
45

@@ -18,4 +19,23 @@ set global innodb_stats_persistent_sample_pages=
1819

1920
set optimizer_switch=@save_optimizer_switch_for_stat_tables_test;
2021

22+
--echo #
23+
--echo # MDEV-22851: Engine independent index statistics are incorrect for large tables on Windows.
24+
--echo #
25+
26+
CREATE TABLE t1(a INT) ENGINE=INNODB;
27+
INSERT INTO t1 SELECT 1 FROM seq_1_to_60000;
28+
29+
SET @save_use_stat_tables= @@use_stat_tables;
30+
SET use_stat_tables= preferably;
31+
SELECT count(*) FROM t1;
32+
CREATE INDEX idx ON t1(a);
33+
ANALYZE TABLE t1 PERSISTENT FOR COLUMNS (a) INDEXES (idx);
34+
SELECT * FROM mysql.index_stats where table_name='t1';
35+
SELECT * FROM mysql.column_stats where table_name='t1';
36+
SET use_stat_tables= @save_use_stat_tables;
37+
DROP TABLE t1;
38+
39+
--echo # end of 10.1 tests
40+
2141
SET SESSION DEFAULT_STORAGE_ENGINE=DEFAULT;
Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,38 @@
11
--- instant_alter_convert.result
22
+++ instant_alter_convert,utf8.result
3-
@@ -37,7 +37,7 @@
4-
test.t check status OK
3+
@@ -38,7 +38,7 @@
4+
best.t check status OK
55
call check_table('t');
66
name mtype prtype len
77
-a 2 800FE 200
88
+a 13 2100FE 600
99
# CHAR enlargement
10-
alter table t modify a char(220), algorithm=instant;
11-
select count(a) from t where a = @bigval;
12-
@@ -51,7 +51,7 @@
13-
test.t check status OK
10+
alter table t modify a char(220);
11+
affected rows: 2
12+
@@ -54,7 +54,7 @@
13+
best.t check status OK
1414
call check_table('t');
1515
name mtype prtype len
1616
-a 2 800FE 220
1717
+a 13 2100FE 660
18+
ALTER TABLE t CHANGE COLUMN a a CHAR(230) BINARY;
19+
affected rows: 2
20+
info: Records: 2 Duplicates: 0 Warnings: 0
21+
@@ -69,7 +69,7 @@
22+
best.t check status OK
23+
call check_table('t');
24+
name mtype prtype len
25+
-a 13 2F00FE 230
26+
+a 13 5300FE 690
1827
# Convert from VARCHAR to a bigger CHAR
19-
alter table t modify a varchar(200), algorithm=instant;
20-
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
21-
@@ -72,7 +72,7 @@
22-
test.t check status OK
28+
alter table t modify a varchar(200);
29+
affected rows: 2
30+
@@ -92,7 +92,7 @@
31+
best.t check status OK
2332
call check_table('t');
2433
name mtype prtype len
2534
-a 2 800FE 255
2635
+a 13 2100FE 765
2736
# BINARY/VARBINARY test
2837
create or replace table t (a varbinary(300));
29-
alter table t modify a binary(255), algorithm=instant;
38+
insert into t values(NULL);
Binary file not shown.

mysql-test/suite/innodb/t/instant_alter_extend.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ select a, length(a) from t where a = 'z';
6464
check table t extended;
6565
call check_table('t');
6666

67+
--enable_info
68+
ALTER TABLE t CHANGE COLUMN a a CHAR(230) BINARY;
69+
ALTER TABLE t ADD COLUMN b INT FIRST;
70+
ALTER TABLE t DROP b;
71+
--disable_info
72+
73+
check table t extended;
74+
call check_table('t');
75+
6776
--echo # Convert from VARCHAR to a bigger CHAR
6877
--enable_info
6978
alter table t modify a varchar(200);

sql/ha_partition.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5712,8 +5712,9 @@ extern "C" int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2)
57125712
{
57135713
return res;
57145714
}
5715-
if ((res= file->m_file[0]->cmp_ref(ref1 + PARTITION_BYTES_IN_POS + file->m_rec_length,
5716-
ref2 + PARTITION_BYTES_IN_POS + file->m_rec_length)))
5715+
if ((res= file->get_open_file_sample()->cmp_ref(ref1 +
5716+
PARTITION_BYTES_IN_POS + file->m_rec_length,
5717+
ref2 + PARTITION_BYTES_IN_POS + file->m_rec_length)))
57175718
{
57185719
return res;
57195720
}
@@ -9744,7 +9745,7 @@ uint8 ha_partition::table_cache_type()
97449745
{
97459746
DBUG_ENTER("ha_partition::table_cache_type");
97469747

9747-
DBUG_RETURN(m_file[0]->table_cache_type());
9748+
DBUG_RETURN(get_open_file_sample()->table_cache_type());
97489749
}
97499750

97509751

0 commit comments

Comments
 (0)