Skip to content

Commit 9554342

Browse files
committed
Merge branch '10.1' into pull-request-97
Merge downstream Debian packaging (MDEV-6284)
2 parents 5448df0 + 4070ce0 commit 9554342

File tree

306 files changed

+8618
-2027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+8618
-2027
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
MYSQL_VERSION_MAJOR=10
22
MYSQL_VERSION_MINOR=1
3-
MYSQL_VERSION_PATCH=7
3+
MYSQL_VERSION_PATCH=8
44
MYSQL_VERSION_EXTRA=

config.h.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
#cmakedefine HAVE_SYS_UTSNAME_H 1
8888
#cmakedefine HAVE_SYS_STAT_H 1
8989
#cmakedefine HAVE_SYS_STREAM_H 1
90+
#cmakedefine HAVE_SYS_SYSCALL_H 1
9091
#cmakedefine HAVE_SYS_TERMCAP_H 1
9192
#cmakedefine HAVE_SYS_TIMEB_H 1
9293
#cmakedefine HAVE_SYS_TIMES_H 1

configure.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ CHECK_INCLUDE_FILES ("sys/types.h;sys/shm.h" HAVE_SYS_SHM_H)
228228
CHECK_INCLUDE_FILES (sys/socket.h HAVE_SYS_SOCKET_H)
229229
CHECK_INCLUDE_FILES (sys/stat.h HAVE_SYS_STAT_H)
230230
CHECK_INCLUDE_FILES (sys/stream.h HAVE_SYS_STREAM_H)
231+
CHECK_INCLUDE_FILES (sys/syscall.h HAVE_SYS_SYSCALL_H)
231232
CHECK_INCLUDE_FILES (sys/termcap.h HAVE_SYS_TERMCAP_H)
232233
CHECK_INCLUDE_FILES ("curses.h;term.h" HAVE_TERM_H)
233234
CHECK_INCLUDE_FILES (asm/termbits.h HAVE_ASM_TERMBITS_H)

debian/additions/my.cnf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ innodb_flush_method = O_DIRECT
156156
#
157157
[galera]
158158
# Mandatory settings
159+
#wsrep_on=ON
159160
#wsrep_provider=
160161
#wsrep_cluster_address=
161162
#binlog_format=row

extra/innochecksum.cc

Lines changed: 133 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
6262
#include "fsp0fsp.h" /* fsp_flags_get_page_size() &
6363
fsp_flags_get_zip_size() */
6464
#include "ut0crc32.h" /* ut_crc32_init() */
65+
#include "fsp0pagecompress.h" /* fil_get_compression_alg_name */
6566

6667
#ifdef UNIV_NONINL
6768
# include "fsp0fsp.ic"
@@ -109,6 +110,8 @@ int n_fil_page_type_xdes;
109110
int n_fil_page_type_blob;
110111
int n_fil_page_type_zblob;
111112
int n_fil_page_type_other;
113+
int n_fil_page_type_page_compressed;
114+
int n_fil_page_type_page_compressed_encrypted;
112115

113116
int n_fil_page_max_index_id;
114117

@@ -152,6 +155,8 @@ struct per_index_stats {
152155

153156
std::map<unsigned long long, per_index_stats> index_ids;
154157

158+
bool encrypted = false;
159+
155160
/* Get the page size of the filespace from the filespace header. */
156161
static
157162
my_bool
@@ -197,6 +202,8 @@ get_page_size(
197202
{
198203
compressed= true;
199204
}
205+
206+
200207
return TRUE;
201208
}
202209

@@ -515,6 +522,18 @@ parse_page(
515522
}
516523
n_fil_page_type_zblob++;
517524
break;
525+
case FIL_PAGE_PAGE_COMPRESSED:
526+
if (per_page_details) {
527+
printf("FIL_PAGE_PAGE_COMPRESSED\n");
528+
}
529+
n_fil_page_type_page_compressed++;
530+
break;
531+
case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED:
532+
if (per_page_details) {
533+
printf("FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED\n");
534+
}
535+
n_fil_page_type_page_compressed_encrypted++;
536+
break;
518537
default:
519538
if (per_page_details) {
520539
printf("FIL_PAGE_TYPE_OTHER\n");
@@ -604,6 +623,8 @@ print_stats()
604623
printf("%d\tFIL_PAGE_TYPE_XDES\n", n_fil_page_type_xdes);
605624
printf("%d\tFIL_PAGE_TYPE_BLOB\n", n_fil_page_type_blob);
606625
printf("%d\tFIL_PAGE_TYPE_ZBLOB\n", n_fil_page_type_zblob);
626+
printf("%d\tFIL_PAGE_PAGE_COMPRESSED\n", n_fil_page_type_page_compressed);
627+
printf("%d\tFIL_PAGE_PAGE_COMPRESSED_ENCRYPTED\n", n_fil_page_type_page_compressed_encrypted);
607628
printf("%d\tother\n", n_fil_page_type_other);
608629
printf("%d\tmax index_id\n", n_fil_page_max_index_id);
609630
printf("undo type: %d insert, %d update, %d other\n",
@@ -791,7 +812,9 @@ int main(int argc, char **argv)
791812
while (!feof(f))
792813
{
793814
int page_ok = 1;
815+
794816
bytes= fread(buf, 1, physical_page_size, f);
817+
795818
if (!bytes && feof(f))
796819
{
797820
print_stats();
@@ -809,58 +832,126 @@ int main(int argc, char **argv)
809832
return 1;
810833
}
811834

812-
if (compressed) {
813-
/* compressed pages */
814-
if (!page_zip_verify_checksum(buf, physical_page_size)) {
815-
fprintf(stderr, "Fail; page %lu invalid (fails compressed page checksum).\n", ct);
816-
if (!skip_corrupt)
817-
{
818-
free(big_buf);
819-
free(big_xdes);
820-
return 1;
821-
}
822-
page_ok = 0;
823-
}
835+
ulint page_type = mach_read_from_2(buf+FIL_PAGE_TYPE);
836+
ulint key_version = mach_read_from_4(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
837+
838+
if (key_version && page_type != FIL_PAGE_PAGE_COMPRESSED) {
839+
encrypted = true;
824840
} else {
841+
encrypted = false;
842+
}
843+
844+
ulint comp_method = 0;
825845

826-
/* check the "stored log sequence numbers" */
827-
logseq= mach_read_from_4(buf + FIL_PAGE_LSN + 4);
828-
logseqfield= mach_read_from_4(buf + logical_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM + 4);
846+
if (encrypted) {
847+
comp_method = mach_read_from_2(buf+FIL_PAGE_DATA+FIL_PAGE_COMPRESSED_SIZE);
848+
} else {
849+
comp_method = mach_read_from_8(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
850+
}
851+
852+
ulint comp_size = mach_read_from_2(buf+FIL_PAGE_DATA);
853+
ib_uint32_t encryption_checksum = mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
854+
855+
856+
if (page_type == FIL_PAGE_PAGE_COMPRESSED) {
857+
/* Page compressed tables do not have any checksum */
829858
if (debug)
830-
printf("page %lu: log sequence number: first = %lu; second = %lu\n", ct, logseq, logseqfield);
831-
if (logseq != logseqfield)
832-
{
833-
fprintf(stderr, "Fail; page %lu invalid (fails log sequence number check)\n", ct);
834-
if (!skip_corrupt)
835-
{
836-
free(big_buf);
837-
free(big_xdes);
838-
return 1;
859+
fprintf(stderr, "Page %lu page compressed with method %s real_size %lu\n", ct,
860+
fil_get_compression_alg_name(comp_method), comp_size);
861+
page_ok = 1;
862+
} else if (compressed) {
863+
/* compressed pages */
864+
ulint crccsum = page_zip_calc_checksum(buf, physical_page_size, SRV_CHECKSUM_ALGORITHM_CRC32);
865+
ulint icsum = page_zip_calc_checksum(buf, physical_page_size, SRV_CHECKSUM_ALGORITHM_INNODB);
866+
867+
if (debug) {
868+
if (key_version != 0) {
869+
fprintf(stderr,
870+
"Page %lu encrypted key_version %lu calculated = %lu; crc32 = %lu; recorded = %u\n",
871+
ct, key_version, icsum, crccsum, encryption_checksum);
872+
}
873+
}
874+
875+
if (encrypted) {
876+
if (encryption_checksum != 0 && crccsum != encryption_checksum && icsum != encryption_checksum) {
877+
if (debug)
878+
fprintf(stderr, "page %lu: compressed: calculated = %lu; crc32 = %lu; recorded = %u\n",
879+
ct, icsum, crccsum, encryption_checksum);
880+
fprintf(stderr, "Fail; page %lu invalid (fails compressed page checksum).\n", ct);
881+
}
882+
} else {
883+
if (!page_zip_verify_checksum(buf, physical_page_size)) {
884+
fprintf(stderr, "Fail; page %lu invalid (fails compressed page checksum).\n", ct);
885+
if (!skip_corrupt)
886+
{
887+
free(big_buf);
888+
free(big_xdes);
889+
return 1;
890+
}
891+
page_ok = 0;
892+
}
893+
}
894+
} else {
895+
if (key_version != 0) {
896+
/* Encrypted page */
897+
if (debug) {
898+
if (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
899+
fprintf(stderr,
900+
"Page %lu page compressed with method %s real_size %lu and encrypted key_version %lu checksum %u\n",
901+
ct, fil_get_compression_alg_name(comp_method), comp_size, key_version, encryption_checksum);
902+
} else {
903+
fprintf(stderr,
904+
"Page %lu encrypted key_version %lu checksum %u\n",
905+
ct, key_version, encryption_checksum);
906+
}
839907
}
840-
page_ok = 0;
841908
}
842909

843-
/* check old method of checksumming */
844-
oldcsum= buf_calc_page_old_checksum(buf);
845-
oldcsumfield= mach_read_from_4(buf + logical_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM);
846-
if (debug)
847-
printf("page %lu: old style: calculated = %lu; recorded = %lu\n", ct, oldcsum, oldcsumfield);
848-
if (oldcsumfield != mach_read_from_4(buf + FIL_PAGE_LSN) && oldcsumfield != oldcsum)
849-
{
850-
fprintf(stderr, "Fail; page %lu invalid (fails old style checksum)\n", ct);
851-
if (!skip_corrupt)
910+
/* Page compressed tables do not contain FIL tailer */
911+
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED && page_type != FIL_PAGE_PAGE_COMPRESSED) {
912+
/* check the "stored log sequence numbers" */
913+
logseq= mach_read_from_4(buf + FIL_PAGE_LSN + 4);
914+
logseqfield= mach_read_from_4(buf + logical_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM + 4);
915+
if (debug)
916+
printf("page %lu: log sequence number: first = %lu; second = %lu\n", ct, logseq, logseqfield);
917+
if (logseq != logseqfield)
852918
{
853-
free(big_buf);
854-
free(big_xdes);
855-
return 1;
919+
fprintf(stderr, "Fail; page %lu invalid (fails log sequence number check)\n", ct);
920+
if (!skip_corrupt)
921+
{
922+
free(big_buf);
923+
free(big_xdes);
924+
return 1;
925+
}
926+
page_ok = 0;
927+
}
928+
929+
/* check old method of checksumming */
930+
oldcsum= buf_calc_page_old_checksum(buf);
931+
oldcsumfield= mach_read_from_4(buf + logical_page_size - FIL_PAGE_END_LSN_OLD_CHKSUM);
932+
if (debug)
933+
printf("page %lu: old style: calculated = %lu; recorded = %lu\n", ct, oldcsum, oldcsumfield);
934+
if (oldcsumfield != mach_read_from_4(buf + FIL_PAGE_LSN) && oldcsumfield != oldcsum)
935+
{
936+
fprintf(stderr, "Fail; page %lu invalid (fails old style checksum)\n", ct);
937+
if (!skip_corrupt)
938+
{
939+
free(big_buf);
940+
free(big_xdes);
941+
return 1;
942+
}
943+
page_ok = 0;
856944
}
857-
page_ok = 0;
858945
}
859946

860947
/* now check the new method */
861948
csum= buf_calc_page_new_checksum(buf);
862949
crc32= buf_calc_page_crc32(buf);
863950
csumfield= mach_read_from_4(buf + FIL_PAGE_SPACE_OR_CHKSUM);
951+
952+
if (key_version)
953+
csumfield = encryption_checksum;
954+
864955
if (debug)
865956
printf("page %lu: new style: calculated = %lu; crc32 = %lu; recorded = %lu\n",
866957
ct, csum, crc32, csumfield);
@@ -903,7 +994,10 @@ int main(int argc, char **argv)
903994
continue;
904995
}
905996

906-
parse_page(buf, xdes);
997+
/* Can't parse compressed or/and encrypted pages */
998+
if (page_type != FIL_PAGE_PAGE_COMPRESSED && !encrypted) {
999+
parse_page(buf, xdes);
1000+
}
9071001

9081002
if (verbose)
9091003
{

include/my_base.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,9 @@ enum ha_base_keytype {
501501
#define HA_ERR_DISK_FULL 189
502502
#define HA_ERR_INCOMPATIBLE_DEFINITION 190
503503
#define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191 /* Too many words in a phrase */
504-
#define HA_ERR_LAST 191 /* Copy of last error nr */
504+
#define HA_ERR_DECRYPTION_FAILED 192 /* Table encrypted but
505+
decypt failed */
506+
#define HA_ERR_LAST 192 /* Copy of last error nr */
505507

506508
/* Number of different errors */
507509
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)

include/my_handler_errors.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ static const char *handler_error_messages[]=
9494
"Operation was interrupted by end user (probably kill command?)",
9595
"Disk full",
9696
"Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine. You have to dump and restore the table to fix this",
97-
"Too many words in a FTS phrase or proximity search"
97+
"Too many words in a FTS phrase or proximity search",
98+
"Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match."
9899
};
99100

100101
#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */

mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ eval CREATE TABLE t1 (
7777
#
7878
c28 DATE,
7979
c29 DATETIME,
80-
c30 TIMESTAMP,
80+
c30 TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
8181
c31 TIME,
8282
c32 YEAR,
8383
#

mysql-test/extra/rpl_tests/rpl_extra_col_slave.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,8 @@ sync_slave_with_master;
398398
STOP SLAVE;
399399
RESET SLAVE;
400400
eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
401-
d TIMESTAMP,
401+
d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
402+
ON UPDATE CURRENT_TIMESTAMP,
402403
e INT NOT NULL,
403404
f text not null,
404405
g text,

mysql-test/include/ctype_numconv.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ create table t2 as select concat(a) from t1;
11661166
show create table t2;
11671167
drop table t1, t2;
11681168

1169-
create table t1 (a timestamp);
1169+
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
11701170
insert into t1 values (0);
11711171
insert into t1 values (20010203040506);
11721172
insert into t1 values (19800203040506);
@@ -1478,7 +1478,7 @@ select hex(a) from v1;
14781478
drop table t1;
14791479
drop view v1;
14801480

1481-
create table t1 (a timestamp);
1481+
create table t1 (a timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP);
14821482
insert into t1 values (0);
14831483
insert into t1 values (20010203040506);
14841484
insert into t1 values (19800203040506);

0 commit comments

Comments
 (0)