Skip to content

Commit 4b3c3e5

Browse files
committed
Merge 10.4 into 10.5
2 parents e7de50a + 96f4b4a commit 4b3c3e5

36 files changed

+800
-1191
lines changed

client/client_priv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright (c) 2001, 2012, Oracle and/or its affiliates.
3-
Copyright (c) 2009, 2020, MariaDB
3+
Copyright (c) 2009, 2022, MariaDB
44
55
This program is free software; you can redistribute it and/or modify
66
it under the terms of the GNU General Public License as published by
@@ -102,6 +102,7 @@ enum options_client
102102
OPT_IGNORE_DATA,
103103
OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS,
104104
OPT_CHECK_IF_UPGRADE_NEEDED,
105+
OPT_COMPATIBILTY_CLEARTEXT_PLUGIN,
105106
OPT_SHUTDOWN_WAIT_FOR_SLAVES,
106107
OPT_COPY_S3_TABLES,
107108
OPT_PRINT_TABLE_METADATA,

client/mysql.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,6 +1514,8 @@ static struct my_option my_long_options[] =
15141514
&delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
15151515
{"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0,
15161516
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1517+
{"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, "Obsolete option. Exists only for MySQL compatibility.",
1518+
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
15171519
{"vertical", 'E', "Print the output of a query (rows) vertically.",
15181520
&vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
15191521
0},
@@ -1812,6 +1814,14 @@ get_one_option(const struct my_option *opt, const char *argument, const char *)
18121814
printf("WARNING: --server-arg option not supported in this configuration.\n");
18131815
#endif
18141816
break;
1817+
case OPT_COMPATIBILTY_CLEARTEXT_PLUGIN:
1818+
/*
1819+
This option exists in MySQL client but not in MariaDB. Users switching from
1820+
MySQL might still have this option in their commands, and it will not work
1821+
in MariaDB unless it is handled. Therefore output a warning and continue.
1822+
*/
1823+
printf("WARNING: option '--enable-cleartext-plugin' is obsolete.\n");
1824+
break;
18151825
case 'A':
18161826
opt_rehash= 0;
18171827
break;

extra/mariabackup/ds_compress.cc

Lines changed: 33 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/******************************************************
22
Copyright (c) 2011-2013 Percona LLC and/or its affiliates.
3+
Copyright (c) 2022, MariaDB Corporation.
34
45
Compressing datasink implementation for XtraBackup.
56
@@ -32,11 +33,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
3233
typedef struct {
3334
pthread_t id;
3435
uint num;
35-
pthread_mutex_t ctrl_mutex;
36-
pthread_cond_t ctrl_cond;
3736
pthread_mutex_t data_mutex;
3837
pthread_cond_t data_cond;
39-
my_bool started;
4038
my_bool data_avail;
4139
my_bool cancelled;
4240
const char *from;
@@ -206,14 +204,13 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
206204

207205
thd = threads + i;
208206

209-
pthread_mutex_lock(&thd->ctrl_mutex);
207+
pthread_mutex_lock(&thd->data_mutex);
210208

211209
chunk_len = (len > COMPRESS_CHUNK_SIZE) ?
212210
COMPRESS_CHUNK_SIZE : len;
213211
thd->from = ptr;
214212
thd->from_len = chunk_len;
215213

216-
pthread_mutex_lock(&thd->data_mutex);
217214
thd->data_avail = TRUE;
218215
pthread_cond_signal(&thd->data_cond);
219216
pthread_mutex_unlock(&thd->data_mutex);
@@ -239,26 +236,24 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
239236

240237
xb_a(threads[i].to_len > 0);
241238

242-
if (ds_write(dest_file, "NEWBNEWB", 8) ||
243-
write_uint64_le(dest_file,
244-
comp_file->bytes_processed)) {
245-
msg("compress: write to the destination stream "
246-
"failed.");
247-
return 1;
239+
bool fail = ds_write(dest_file, "NEWBNEWB", 8) ||
240+
write_uint64_le(dest_file,
241+
comp_file->bytes_processed);
242+
comp_file->bytes_processed += threads[i].from_len;
243+
244+
if (!fail) {
245+
fail = write_uint32_le(dest_file, threads[i].adler) ||
246+
ds_write(dest_file, threads[i].to,
247+
threads[i].to_len);
248248
}
249249

250-
comp_file->bytes_processed += threads[i].from_len;
250+
pthread_mutex_unlock(&threads[i].data_mutex);
251251

252-
if (write_uint32_le(dest_file, threads[i].adler) ||
253-
ds_write(dest_file, threads[i].to,
254-
threads[i].to_len)) {
252+
if (fail) {
255253
msg("compress: write to the destination stream "
256254
"failed.");
257255
return 1;
258256
}
259-
260-
pthread_mutex_unlock(&threads[i].data_mutex);
261-
pthread_mutex_unlock(&threads[i].ctrl_mutex);
262257
}
263258
}
264259

@@ -328,6 +323,23 @@ write_uint64_le(ds_file_t *file, ulonglong n)
328323
return ds_write(file, tmp, sizeof(tmp));
329324
}
330325

326+
static
327+
void
328+
destroy_worker_thread(comp_thread_ctxt_t *thd)
329+
{
330+
pthread_mutex_lock(&thd->data_mutex);
331+
thd->cancelled = TRUE;
332+
pthread_cond_signal(&thd->data_cond);
333+
pthread_mutex_unlock(&thd->data_mutex);
334+
335+
pthread_join(thd->id, NULL);
336+
337+
pthread_cond_destroy(&thd->data_cond);
338+
pthread_mutex_destroy(&thd->data_mutex);
339+
340+
my_free(thd->to);
341+
}
342+
331343
static
332344
comp_thread_ctxt_t *
333345
create_worker_threads(uint n)
@@ -342,53 +354,31 @@ create_worker_threads(uint n)
342354
comp_thread_ctxt_t *thd = threads + i;
343355

344356
thd->num = i + 1;
345-
thd->started = FALSE;
346357
thd->cancelled = FALSE;
347358
thd->data_avail = FALSE;
348359

349360
thd->to = (char *) my_malloc(PSI_NOT_INSTRUMENTED,
350361
COMPRESS_CHUNK_SIZE + MY_QLZ_COMPRESS_OVERHEAD, MYF(MY_FAE));
351362

352-
/* Initialize the control mutex and condition var */
353-
if (pthread_mutex_init(&thd->ctrl_mutex, NULL) ||
354-
pthread_cond_init(&thd->ctrl_cond, NULL)) {
355-
goto err;
356-
}
357-
358363
/* Initialize and data mutex and condition var */
359364
if (pthread_mutex_init(&thd->data_mutex, NULL) ||
360365
pthread_cond_init(&thd->data_cond, NULL)) {
361366
goto err;
362367
}
363368

364-
pthread_mutex_lock(&thd->ctrl_mutex);
365-
366369
if (pthread_create(&thd->id, NULL, compress_worker_thread_func,
367370
thd)) {
368371
msg("compress: pthread_create() failed: "
369372
"errno = %d", errno);
370-
pthread_mutex_unlock(&thd->ctrl_mutex);
371373
goto err;
372374
}
373375
}
374376

375-
/* Wait for the threads to start */
376-
for (i = 0; i < n; i++) {
377-
comp_thread_ctxt_t *thd = threads + i;
378-
379-
while (thd->started == FALSE)
380-
pthread_cond_wait(&thd->ctrl_cond, &thd->ctrl_mutex);
381-
pthread_mutex_unlock(&thd->ctrl_mutex);
382-
}
383-
384377
return threads;
385378

386379
err:
387-
while (i > 0) {
388-
comp_thread_ctxt_t *thd;
389-
i--;
390-
thd = threads + i;
391-
pthread_mutex_unlock(&thd->ctrl_mutex);
380+
for (; i; i--) {
381+
destroy_worker_thread(threads + i);
392382
}
393383

394384
my_free(threads);
@@ -402,21 +392,7 @@ destroy_worker_threads(comp_thread_ctxt_t *threads, uint n)
402392
uint i;
403393

404394
for (i = 0; i < n; i++) {
405-
comp_thread_ctxt_t *thd = threads + i;
406-
407-
pthread_mutex_lock(&thd->data_mutex);
408-
threads[i].cancelled = TRUE;
409-
pthread_cond_signal(&thd->data_cond);
410-
pthread_mutex_unlock(&thd->data_mutex);
411-
412-
pthread_join(thd->id, NULL);
413-
414-
pthread_cond_destroy(&thd->data_cond);
415-
pthread_mutex_destroy(&thd->data_mutex);
416-
pthread_cond_destroy(&thd->ctrl_cond);
417-
pthread_mutex_destroy(&thd->ctrl_mutex);
418-
419-
my_free(thd->to);
395+
destroy_worker_thread(threads + i);
420396
}
421397

422398
my_free(threads);
@@ -428,19 +404,9 @@ compress_worker_thread_func(void *arg)
428404
{
429405
comp_thread_ctxt_t *thd = (comp_thread_ctxt_t *) arg;
430406

431-
pthread_mutex_lock(&thd->ctrl_mutex);
432-
433407
pthread_mutex_lock(&thd->data_mutex);
434408

435-
thd->started = TRUE;
436-
pthread_cond_signal(&thd->ctrl_cond);
437-
438-
pthread_mutex_unlock(&thd->ctrl_mutex);
439-
440409
while (1) {
441-
thd->data_avail = FALSE;
442-
pthread_cond_signal(&thd->data_cond);
443-
444410
while (!thd->data_avail && !thd->cancelled) {
445411
pthread_cond_wait(&thd->data_cond, &thd->data_mutex);
446412
}

man/mysql.1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,21 @@ the section called \(lqMYSQL COMMANDS\(rq\&.
507507
.sp -1
508508
.IP \(bu 2.3
509509
.\}
510+
.\" mysql: enable cleartext plugin option
511+
.\" enable cleartext plugin option: mysql
512+
\fB\-\-enable\-cleartext\-plugin\fR
513+
.sp
514+
Obsolete option\&. Exists only for MySQL compatibility\&.
515+
.RE
516+
.sp
517+
.RS 4
518+
.ie n \{\
519+
\h'-04'\(bu\h'+03'\c
520+
.\}
521+
.el \{\
522+
.sp -1
523+
.IP \(bu 2.3
524+
.\}
510525
.\" mysql: execute option
511526
.\" execute option: mysql
512527
\fB\-\-execute=\fR\fB\fIstatement\fR\fR,

mysql-test/main/mysql.result

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,4 +629,7 @@ drop table t1;
629629
#
630630
# MDEV-15538 '-N' Produce html output wrong
631631
#
632-
<TABLE BORDER=1><TR><TD>1</TD></TR></TABLE>
632+
<TABLE BORDER=1><TR><TD>1</TD></TR></TABLE>
633+
WARNING: option '--enable-cleartext-plugin' is obsolete.
634+
1
635+
1

mysql-test/main/mysql.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,3 +708,11 @@ drop table t1;
708708
--echo # MDEV-15538 '-N' Produce html output wrong
709709
--echo #
710710
--exec $MYSQL -NHe "select 1 as a"
711+
712+
713+
#
714+
# Test obsolete option --enable-cleartext-plugin
715+
# This should proceed with a warning
716+
#
717+
--echo
718+
--exec $MYSQL test --enable-cleartext-plugin -e "select 1"

mysql-test/main/partition_error.result

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@ drop table if exists t1, t2;
66
CREATE TABLE t1 (a int);
77
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
88
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
9-
ERROR 42000: Can't open table
9+
ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
10+
DROP VIEW v1;
11+
DROP TABLE t1;
12+
#
13+
# MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT
14+
#
15+
CREATE TABLE t1 (a int)
16+
PARTITION BY HASH (a)
17+
PARTITIONS 2;
18+
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
19+
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
20+
ERROR HY000: 'test.v1' is not of type 'BASE TABLE'
1021
DROP VIEW v1;
1122
DROP TABLE t1;
1223
#

mysql-test/main/partition_error.test

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,19 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`;
1616
--echo #
1717
CREATE TABLE t1 (a int);
1818
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
19-
--error ER_CHECK_NO_SUCH_TABLE
19+
--error ER_WRONG_OBJECT
20+
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
21+
DROP VIEW v1;
22+
DROP TABLE t1;
23+
24+
--echo #
25+
--echo # MDEV-28599 EXCHANGE PARTITION on view causes ER_CHECK_NO_SUCH_TABLE instead of ER_WRONG_OBJECT
26+
--echo #
27+
CREATE TABLE t1 (a int)
28+
PARTITION BY HASH (a)
29+
PARTITIONS 2;
30+
CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
31+
--error ER_WRONG_OBJECT
2032
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
2133
DROP VIEW v1;
2234
DROP TABLE t1;

mysql-test/suite/galera/r/MDEV-18832.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ INSERT INTO t1 VALUES (NEXT VALUE FOR Seq1_1);
1212
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
1313
DROP SEQUENCE Seq1_1;
1414
DROP TABLE t1;
15+
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
16+
connection node_2;
17+
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
connection node_2;
2+
connection node_1;
3+
CREATE SEQUENCE seq_nocache ENGINE=InnoDB;
4+
DROP SEQUENCE seq_nocache;
5+
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
6+
connection node_2;
7+
CALL mtr.add_suppression("SEQUENCES declared without `NOCACHE` will not behave correctly in galera cluster.");
8+
connection node_1;
9+
CREATE SEQUENCE seq NOCACHE ENGINE=InnoDB;
10+
SELECT NEXTVAL(seq) = 1;
11+
NEXTVAL(seq) = 1
12+
1
13+
connection node_2;
14+
SELECT NEXTVAL(seq) = 2;
15+
NEXTVAL(seq) = 2
16+
1
17+
connection node_1;
18+
SELECT NEXTVAL(seq) = 3;
19+
NEXTVAL(seq) = 3
20+
1
21+
SELECT SETVAL(seq, 100);
22+
SETVAL(seq, 100)
23+
100
24+
connection node_2;
25+
SELECT NEXTVAL(seq) = 101;
26+
NEXTVAL(seq) = 101
27+
1
28+
connection node_1;
29+
SELECT NEXTVAL(seq) = 102;
30+
NEXTVAL(seq) = 102
31+
1
32+
DROP SEQUENCE seq;
33+
CREATE TABLE t1(f1 INT);
34+
CREATE SEQUENCE seq_transaction NOCACHE ENGINE=InnoDB;
35+
START TRANSACTION;
36+
INSERT INTO t1 VALUES (0);
37+
SELECT NEXTVAL(seq_transaction);
38+
NEXTVAL(seq_transaction)
39+
1
40+
INSERT INTO t1 VALUES (NEXTVAL(seq_transaction));
41+
COMMIT;
42+
connection node_2;
43+
SELECT COUNT(*) = 2 FROM t1;
44+
COUNT(*) = 2
45+
1
46+
SELECT NEXTVAL(seq_transaction) = 3;
47+
NEXTVAL(seq_transaction) = 3
48+
1
49+
connection node_1;
50+
SELECT NEXTVAL(seq_transaction) = 4;
51+
NEXTVAL(seq_transaction) = 4
52+
1
53+
DROP SEQUENCE seq_transaction;
54+
DROP TABLE t1;

0 commit comments

Comments
 (0)