Skip to content

Commit 1c7209e

Browse files
committed
Merge 10.6 into 10.11
2 parents 84dd243 + 82d7419 commit 1c7209e

File tree

71 files changed

+809
-445
lines changed

Some content is hidden

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

71 files changed

+809
-445
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ scripts/mysqld_safe
134134
scripts/mysqldumpslow
135135
scripts/mysqlhotcopy
136136
scripts/mytop
137+
scripts/print_ddl_recovery_log.pl
137138
scripts/wsrep_sst_backup
138139
scripts/wsrep_sst_common
139140
scripts/wsrep_sst_mysqldump

client/mysqlcheck.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,9 @@ static int disable_binlog()
898898
}
899899

900900

901+
/* Ok as mysqlcheck is not multi threaded */
902+
PRAGMA_DISABLE_CHECK_STACK_FRAME
903+
901904
static int handle_request_for_tables(char *tables, size_t length,
902905
my_bool view, my_bool dont_quote)
903906
{
@@ -1029,9 +1032,6 @@ static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen)
10291032
insert_dynamic(arr, (uchar*) buf);
10301033
}
10311034

1032-
/* Ok as mysqlcheck is not multi threaded */
1033-
PRAGMA_DISABLE_CHECK_STACK_FRAME
1034-
10351035
static void __attribute__((noinline)) print_result()
10361036
{
10371037
MYSQL_RES *res;

client/mysqlslap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,8 @@ int main(int argc, char **argv)
430430
return 0;
431431
}
432432

433+
PRAGMA_DISABLE_CHECK_STACK_FRAME
434+
433435
void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
434436
{
435437
unsigned int x;
@@ -525,6 +527,7 @@ void concurrency_loop(MYSQL *mysql, uint current, option_string *eptr)
525527
my_free(head_sptr);
526528

527529
}
530+
PRAGMA_REENABLE_CHECK_STACK_FRAME
528531

529532

530533
static struct my_option my_long_options[] =
@@ -2297,6 +2300,7 @@ statement_cleanup(statement *stmt)
22972300
}
22982301
}
22992302

2303+
PRAGMA_DISABLE_CHECK_STACK_FRAME
23002304

23012305
int
23022306
slap_connect(MYSQL *mysql)
@@ -2330,3 +2334,4 @@ slap_connect(MYSQL *mysql)
23302334

23312335
return 0;
23322336
}
2337+
PRAGMA_REENABLE_CHECK_STACK_FRAME

cmake/maintainer.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ SET(MY_WARNING_FLAGS
4141
-Wvla
4242
-Wwrite-strings
4343
-Wcast-function-type-strict
44+
-Wframe-larger-than=16384
4445
)
4546

4647
# Warning flags that are in testing before moving

extra/mariabackup/fil_cur.cc

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ xb_fil_cur_open(
209209
cursor->buf_size = XB_FIL_CUR_PAGES * cursor->page_size;
210210
cursor->buf = static_cast<byte*>(aligned_malloc(cursor->buf_size,
211211
srv_page_size));
212-
212+
cursor->tmp_page = static_cast<byte*>(aligned_malloc(srv_page_size,
213+
srv_page_size));
214+
cursor->tmp_frame = static_cast<byte*>(aligned_malloc(srv_page_size,
215+
srv_page_size));
213216
cursor->buf_read = 0;
214217
cursor->buf_npages = 0;
215218
cursor->buf_offset = 0;
@@ -237,15 +240,10 @@ xb_fil_cur_open(
237240
return(XB_FIL_CUR_SUCCESS);
238241
}
239242

240-
/* Stack usage 131224 with clang */
241-
PRAGMA_DISABLE_CHECK_STACK_FRAME
242-
243243
static bool page_is_corrupted(const byte *page, ulint page_no,
244244
const xb_fil_cur_t *cursor,
245245
const fil_space_t *space)
246246
{
247-
byte tmp_frame[UNIV_PAGE_SIZE_MAX];
248-
byte tmp_page[UNIV_PAGE_SIZE_MAX];
249247
const ulint page_size = cursor->page_size;
250248
uint16_t page_type = fil_page_get_type(page);
251249

@@ -308,42 +306,43 @@ static bool page_is_corrupted(const byte *page, ulint page_no,
308306
&& !opt_extended_validation)
309307
return false;
310308

311-
memcpy(tmp_page, page, page_size);
309+
memcpy(cursor->tmp_page, page, page_size);
312310

313311
if (!space->crypt_data
314312
|| space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED
315-
|| !fil_space_decrypt(space, tmp_frame, tmp_page)) {
313+
|| !fil_space_decrypt(space, cursor->tmp_frame,
314+
cursor->tmp_page)) {
316315
return true;
317316
}
318317

319318
if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
320-
return buf_page_is_corrupted(false, tmp_page,
319+
return buf_page_is_corrupted(false, cursor->tmp_page,
321320
space->flags);
322321
}
323322
}
324323

325324
if (page_type == FIL_PAGE_PAGE_COMPRESSED) {
326-
memcpy(tmp_page, page, page_size);
325+
memcpy(cursor->tmp_page, page, page_size);
327326
}
328327

329328
if (page_type == FIL_PAGE_PAGE_COMPRESSED
330329
|| page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
331-
ulint decomp = fil_page_decompress(tmp_frame, tmp_page,
330+
ulint decomp = fil_page_decompress(cursor->tmp_frame,
331+
cursor->tmp_page,
332332
space->flags);
333-
page_type = fil_page_get_type(tmp_page);
333+
page_type = fil_page_get_type(cursor->tmp_page);
334334

335335
return (!decomp
336336
|| (decomp != srv_page_size
337337
&& cursor->zip_size)
338338
|| page_type == FIL_PAGE_PAGE_COMPRESSED
339339
|| page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
340-
|| buf_page_is_corrupted(false, tmp_page,
340+
|| buf_page_is_corrupted(false, cursor->tmp_page,
341341
space->flags));
342342
}
343343

344344
return buf_page_is_corrupted(false, page, space->flags);
345345
}
346-
PRAGMA_REENABLE_CHECK_STACK_FRAME
347346

348347
/** Reads and verifies the next block of pages from the source
349348
file. Positions the cursor after the last read non-corrupted page.
@@ -507,7 +506,11 @@ xb_fil_cur_close(
507506
xb_fil_cur_t *cursor) /*!< in/out: source file cursor */
508507
{
509508
aligned_free(cursor->buf);
509+
aligned_free(cursor->tmp_page);
510+
aligned_free(cursor->tmp_frame);
510511
cursor->buf = NULL;
512+
cursor->tmp_page = NULL;
513+
cursor->tmp_frame = NULL;
511514

512515
if (cursor->node != NULL) {
513516
xb_fil_node_close_file(cursor->node);

extra/mariabackup/fil_cur.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ struct xb_fil_cur_t {
4646
xb_read_filt_t* read_filter; /*!< read filter */
4747
xb_read_filt_ctxt_t read_filter_ctxt;
4848
/*!< read filter context */
49-
byte* buf; /*!< read buffer */
49+
byte* buf; /*!< read buffer of XB_FIL_CUR_PAGES */
50+
byte* tmp_page; /*!< buffer for decrypting a page */
51+
byte* tmp_frame; /*!< buffer for decompressing a page */
5052
size_t buf_size; /*!< buffer size in bytes */
5153
size_t buf_read; /*!< number of read bytes in buffer
5254
after the last cursor read */

extra/mariabackup/xtrabackup.cc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,13 +1186,15 @@ static void backup_file_op_fail(uint32_t space_id, int type,
11861186
const byte* name, ulint len,
11871187
const byte* new_name, ulint new_len)
11881188
{
1189+
const char *error= "";
11891190
bool fail = false;
11901191
const std::string spacename{filename_to_spacename(name, len)};
11911192
switch (type) {
11921193
case FILE_CREATE:
11931194
msg("DDL tracking : create %" PRIu32 " \"%.*s\"",
11941195
space_id, int(len), name);
11951196
fail = !check_if_skip_table(spacename.c_str());
1197+
error= "create";
11961198
break;
11971199
case FILE_MODIFY:
11981200
break;
@@ -1202,22 +1204,29 @@ static void backup_file_op_fail(uint32_t space_id, int type,
12021204
fail = !check_if_skip_table(spacename.c_str())
12031205
|| !check_if_skip_table(
12041206
filename_to_spacename(new_name, new_len).c_str());
1207+
error= "rename";
12051208
break;
12061209
case FILE_DELETE:
12071210
fail = !check_if_skip_table(spacename.c_str())
12081211
&& !check_if_fts_table(spacename.c_str());
12091212
msg("DDL tracking : delete %" PRIu32 " \"%.*s\"",
12101213
space_id, int(len), name);
1214+
error= "delete";
12111215
break;
12121216
default:
12131217
ut_ad(0);
12141218
break;
12151219
}
12161220

12171221
if (fail) {
1218-
ut_a(opt_no_lock);
1219-
die("DDL operation detected in the late phase of backup."
1220-
"Backup is inconsistent. Remove --no-lock option to fix.");
1222+
if (opt_no_lock)
1223+
die("DDL operation detected in the late phase of backup while "
1224+
"executing %s on %s. "
1225+
"Backup is inconsistent. Remove --no-lock option to fix.",
1226+
error, name);
1227+
die("Unexpected DDL operation detected in the late phase of backup "
1228+
"while executing %s on %s. Backup is inconsistent.",
1229+
error, name);
12211230
}
12221231
}
12231232

include/my_attribute.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@
8383

8484
/* Define pragmas to disable warnings for stack frame checking */
8585

86-
#if defined(__clang__)
86+
#ifdef __GNUC__
8787
#define PRAGMA_DISABLE_CHECK_STACK_FRAME \
88-
_Pragma("clang diagnostic push") \
89-
_Pragma("clang diagnostic ignored \"-Wframe-larger-than=\"")
88+
_Pragma("GCC diagnostic push") \
89+
_Pragma("GCC diagnostic ignored \"-Wframe-larger-than=\"")
9090

9191
#define PRAGMA_REENABLE_CHECK_STACK_FRAME \
92-
_Pragma("clang diagnostic pop")
92+
_Pragma("GCC diagnostic pop")
9393

9494
#else
9595
#define PRAGMA_DISABLE_CHECK_STACK_FRAME

mysql-test/main/analyze.result

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,5 +453,56 @@ SELECT * FROM t1 WHERE f LIKE '2023%';
453453
f
454454
DROP TABLE t1;
455455
#
456+
# MDEV-36536 Add option to not collect statistics for long char/varchars
457+
#
458+
select @@session.analyze_max_length;
459+
@@session.analyze_max_length
460+
4294967295
461+
create table t1 (c0 char(2), c1 char(16), c2 char(64), v1 varchar(16), v2 varchar(1000), b1 blob, i1 int)
462+
character set utf8mb4 COLLATE utf8mb4_bin;
463+
insert into t1 values ("A", "A","A","A","A","A",1), ("B","B","B","B","B","B",1);
464+
ANALYZE TABLE t1 PERSISTENT FOR ALL;
465+
Table Op Msg_type Msg_text
466+
test.t1 analyze status Engine-independent statistics collected
467+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'b1'
468+
test.t1 analyze status OK
469+
select column_name from mysql.column_stats where table_name = 't1';
470+
column_name
471+
c0
472+
c1
473+
c2
474+
i1
475+
v1
476+
v2
477+
set @@session.analyze_max_length= 64;
478+
truncate table mysql.column_stats;
479+
ANALYZE TABLE t1 PERSISTENT FOR ALL;
480+
Table Op Msg_type Msg_text
481+
test.t1 analyze status Engine-independent statistics collected
482+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'c2'
483+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'v2'
484+
test.t1 analyze Warning Engine-independent statistics are not collected for column 'b1'
485+
test.t1 analyze status Table is already up to date
486+
select column_name from mysql.column_stats where table_name = 't1';
487+
column_name
488+
c0
489+
c1
490+
i1
491+
v1
492+
truncate table mysql.column_stats;
493+
ANALYZE TABLE t1 PERSISTENT for COLUMNS (c0,c2,v1,v2,i1) INDEXES ALL;
494+
Table Op Msg_type Msg_text
495+
test.t1 analyze status Engine-independent statistics collected
496+
test.t1 analyze status Table is already up to date
497+
select column_name from mysql.column_stats where table_name = 't1';
498+
column_name
499+
c0
500+
c2
501+
i1
502+
v1
503+
v2
504+
set @@session.analyze_max_length= default;
505+
drop table t1;
506+
#
456507
# End of 10.6 tests
457508
#

mysql-test/main/analyze.test

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,26 @@ ANALYZE TABLE t1 PERSISTENT FOR ALL;
306306
SELECT * FROM t1 WHERE f LIKE '2023%';
307307
DROP TABLE t1;
308308

309+
--echo #
310+
--echo # MDEV-36536 Add option to not collect statistics for long char/varchars
311+
--echo #
312+
313+
select @@session.analyze_max_length;
314+
create table t1 (c0 char(2), c1 char(16), c2 char(64), v1 varchar(16), v2 varchar(1000), b1 blob, i1 int)
315+
character set utf8mb4 COLLATE utf8mb4_bin;
316+
insert into t1 values ("A", "A","A","A","A","A",1), ("B","B","B","B","B","B",1);
317+
ANALYZE TABLE t1 PERSISTENT FOR ALL;
318+
select column_name from mysql.column_stats where table_name = 't1';
319+
set @@session.analyze_max_length= 64;
320+
truncate table mysql.column_stats;
321+
ANALYZE TABLE t1 PERSISTENT FOR ALL;
322+
select column_name from mysql.column_stats where table_name = 't1';
323+
truncate table mysql.column_stats;
324+
ANALYZE TABLE t1 PERSISTENT for COLUMNS (c0,c2,v1,v2,i1) INDEXES ALL;
325+
select column_name from mysql.column_stats where table_name = 't1';
326+
set @@session.analyze_max_length= default;
327+
drop table t1;
328+
309329
--echo #
310330
--echo # End of 10.6 tests
311331
--echo #

0 commit comments

Comments
 (0)