Skip to content

Commit d309998

Browse files
committed
Merge 10.8 into 10.9
2 parents 8cb75b9 + 2bddc5d commit d309998

Some content is hidden

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

46 files changed

+626
-194
lines changed

cmake/os/Darwin.cmake

Lines changed: 0 additions & 16 deletions
This file was deleted.

cmake/os/WindowsCache.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ IF(MSVC)
2323
SET(BFD_H_EXISTS 0 CACHE INTERNAL "")
2424
SET(HAVE_ACCESS 1 CACHE INTERNAL "")
2525
SET(HAVE_ALARM CACHE INTERNAL "")
26-
SET(HAVE_ALIGNED_ALLOC CACHE INTERNAL "")
2726
SET(HAVE_ALLOCA_H CACHE INTERNAL "")
2827
SET(HAVE_ARPA_INET_H CACHE INTERNAL "")
2928
SET(HAVE_BACKTRACE CACHE INTERNAL "")

config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
/* Headers we may want to use. */
2020
#cmakedefine STDC_HEADERS 1
2121
#cmakedefine _GNU_SOURCE 1
22-
#cmakedefine HAVE_ALIGNED_ALLOC 1
2322
#cmakedefine HAVE_ALLOCA_H 1
2423
#cmakedefine HAVE_ARPA_INET_H 1
2524
#cmakedefine HAVE_ASM_TERMBITS_H 1

configure.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,6 @@ ENDIF()
326326
CHECK_FUNCTION_EXISTS (accept4 HAVE_ACCEPT4)
327327
CHECK_FUNCTION_EXISTS (access HAVE_ACCESS)
328328
CHECK_FUNCTION_EXISTS (alarm HAVE_ALARM)
329-
IF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT WITH_ASAN)
330-
# When an old custom memory allocator library is used, aligned_alloc()
331-
# could invoke the built-in allocator in libc, not matching
332-
# the overriden free() in the custom memory allocator.
333-
SET(HAVE_ALIGNED_ALLOC 0)
334-
ELSE()
335-
CHECK_FUNCTION_EXISTS (aligned_alloc HAVE_ALIGNED_ALLOC)
336-
ENDIF()
337329
SET(HAVE_ALLOCA 1)
338330
CHECK_FUNCTION_EXISTS (backtrace HAVE_BACKTRACE)
339331
CHECK_FUNCTION_EXISTS (backtrace_symbols HAVE_BACKTRACE_SYMBOLS)

extra/mariabackup/ds_compress.cc

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ typedef struct {
3434
pthread_t id;
3535
uint num;
3636
pthread_mutex_t data_mutex;
37+
pthread_cond_t avail_cond;
3738
pthread_cond_t data_cond;
3839
pthread_cond_t done_cond;
39-
my_bool data_avail;
40+
pthread_t data_avail;
4041
my_bool cancelled;
4142
const char *from;
4243
size_t from_len;
@@ -195,9 +196,13 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
195196
threads = comp_ctxt->threads;
196197
nthreads = comp_ctxt->nthreads;
197198

199+
const pthread_t self = pthread_self();
200+
198201
ptr = (const char *) buf;
199202
while (len > 0) {
200-
uint max_thread;
203+
bool wait = nthreads == 1;
204+
retry:
205+
bool submitted = false;
201206

202207
/* Send data to worker threads for compression */
203208
for (i = 0; i < nthreads; i++) {
@@ -206,30 +211,54 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
206211
thd = threads + i;
207212

208213
pthread_mutex_lock(&thd->data_mutex);
214+
if (thd->data_avail == pthread_t(~0UL)) {
215+
} else if (!wait) {
216+
skip:
217+
pthread_mutex_unlock(&thd->data_mutex);
218+
continue;
219+
} else {
220+
for (;;) {
221+
pthread_cond_wait(&thd->avail_cond,
222+
&thd->data_mutex);
223+
if (thd->data_avail
224+
== pthread_t(~0UL)) {
225+
break;
226+
}
227+
goto skip;
228+
}
229+
}
209230

210231
chunk_len = (len > COMPRESS_CHUNK_SIZE) ?
211232
COMPRESS_CHUNK_SIZE : len;
212233
thd->from = ptr;
213234
thd->from_len = chunk_len;
214235

215-
thd->data_avail = TRUE;
236+
thd->data_avail = self;
216237
pthread_cond_signal(&thd->data_cond);
217238
pthread_mutex_unlock(&thd->data_mutex);
218239

240+
submitted = true;
219241
len -= chunk_len;
220242
if (len == 0) {
221243
break;
222244
}
223245
ptr += chunk_len;
224246
}
225247

226-
max_thread = (i < nthreads) ? i : nthreads - 1;
248+
if (!submitted) {
249+
wait = true;
250+
goto retry;
251+
}
227252

228-
/* Reap and stream the compressed data */
229-
for (i = 0; i <= max_thread; i++) {
253+
for (i = 0; i < nthreads; i++) {
230254
thd = threads + i;
231255

232256
pthread_mutex_lock(&thd->data_mutex);
257+
if (thd->data_avail != self) {
258+
pthread_mutex_unlock(&thd->data_mutex);
259+
continue;
260+
}
261+
233262
while (!thd->to_len) {
234263
pthread_cond_wait(&thd->done_cond,
235264
&thd->data_mutex);
@@ -247,6 +276,8 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
247276
}
248277

249278
thd->to_len = 0;
279+
thd->data_avail = pthread_t(~0UL);
280+
pthread_cond_signal(&thd->avail_cond);
250281
pthread_mutex_unlock(&thd->data_mutex);
251282

252283
if (fail) {
@@ -334,6 +365,7 @@ destroy_worker_thread(comp_thread_ctxt_t *thd)
334365

335366
pthread_join(thd->id, NULL);
336367

368+
pthread_cond_destroy(&thd->avail_cond);
337369
pthread_cond_destroy(&thd->data_cond);
338370
pthread_cond_destroy(&thd->done_cond);
339371
pthread_mutex_destroy(&thd->data_mutex);
@@ -364,11 +396,14 @@ create_worker_threads(uint n)
364396

365397
/* Initialize and data mutex and condition var */
366398
if (pthread_mutex_init(&thd->data_mutex, NULL) ||
399+
pthread_cond_init(&thd->avail_cond, NULL) ||
367400
pthread_cond_init(&thd->data_cond, NULL) ||
368401
pthread_cond_init(&thd->done_cond, NULL)) {
369402
goto err;
370403
}
371404

405+
thd->data_avail = pthread_t(~0UL);
406+
372407
if (pthread_create(&thd->id, NULL, compress_worker_thread_func,
373408
thd)) {
374409
msg("compress: pthread_create() failed: "
@@ -410,13 +445,13 @@ compress_worker_thread_func(void *arg)
410445
pthread_mutex_lock(&thd->data_mutex);
411446

412447
while (1) {
413-
while (!thd->data_avail && !thd->cancelled) {
448+
while (!thd->cancelled
449+
&& (thd->to_len || thd->data_avail == pthread_t(~0UL))) {
414450
pthread_cond_wait(&thd->data_cond, &thd->data_mutex);
415451
}
416452

417453
if (thd->cancelled)
418454
break;
419-
thd->data_avail = FALSE;
420455
thd->to_len = qlz_compress(thd->from, thd->to, thd->from_len,
421456
&thd->state);
422457

extra/mariabackup/xtrabackup.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,11 +2533,11 @@ xb_write_delta_metadata(const char *filename, const xb_delta_info_t *info)
25332533
/* ================= backup ================= */
25342534
void xtrabackup_io_throttling()
25352535
{
2536-
if (!xtrabackup_backup)
2536+
if (!xtrabackup_backup || !xtrabackup_throttle)
25372537
return;
25382538

25392539
mysql_mutex_lock(&recv_sys.mutex);
2540-
if (xtrabackup_throttle && (io_ticket--) < 0)
2540+
if (io_ticket-- < 0)
25412541
mysql_cond_wait(&wait_throttle, &recv_sys.mutex);
25422542
mysql_mutex_unlock(&recv_sys.mutex);
25432543
}

include/aligned.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,14 @@
1414
along with this program; if not, write to the Free Software
1515
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
1616

17-
#ifdef HAVE_ALIGNED_ALLOC
18-
#elif defined __linux__
17+
#if defined __linux__
1918
# include <malloc.h>
2019
#endif
2120

2221
inline void *aligned_malloc(size_t size, size_t alignment)
2322
{
2423
#ifdef _WIN32
2524
return _aligned_malloc(size, alignment);
26-
#elif defined HAVE_ALIGNED_ALLOC
27-
return aligned_alloc(alignment, size);
2825
#elif defined __linux__
2926
return memalign(alignment, size);
3027
#else

mysql-test/main/func_json.result

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1;
822822
SHOW CREATE TABLE t2;
823823
Table Create Table
824824
t2 CREATE TABLE `t2` (
825-
`JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(25) DEFAULT NULL
825+
`JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(21) DEFAULT NULL
826826
) ENGINE=MyISAM DEFAULT CHARSET=latin1
827827
DROP TABLE t1, t2;
828828
SET sql_mode=default;
@@ -1016,6 +1016,33 @@ j
10161016
{"ID": "4", "Name": "Betty", "Age": 19}
10171017
drop table t1;
10181018
#
1019+
# MDEV-27151: JSON_VALUE() does not parse NULL properties properly
1020+
#
1021+
#
1022+
# It is correct for JSON_EXTRACT() to give null instead of "NULL" because
1023+
# it returns the json literal that is put inside json.
1024+
# Hence it should return null as in 'null' string and not SQL NULL.
1025+
# JSON_VALUE() returns the "VALUE" so it is correct for it to return SQl NULL
1026+
#
1027+
SELECT NULL;
1028+
NULL
1029+
NULL
1030+
SELECT JSON_VALUE('{"nulltest": null}', '$.nulltest');
1031+
JSON_VALUE('{"nulltest": null}', '$.nulltest')
1032+
NULL
1033+
SELECT 1 + NULL;
1034+
1 + NULL
1035+
NULL
1036+
SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest');
1037+
1 + JSON_VALUE('{"nulltest": null}', '$.nulltest')
1038+
NULL
1039+
SELECT NULL;
1040+
NULL
1041+
NULL
1042+
SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a');
1043+
JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a')
1044+
null
1045+
#
10191046
# End of 10.3 tests
10201047
#
10211048
#
@@ -1437,6 +1464,21 @@ f
14371464
DROP VIEW v;
14381465
DROP TABLE t;
14391466
#
1467+
# MDEV-29264 JSON functions overflow error based ON LONGTEXT field
1468+
#
1469+
CREATE TABLE t(l1 LONGTEXT, l2 LONGTEXT, l3 LONGTEXT, l4 LONGTEXT);
1470+
INSERT INTO t VALUES('k1', 'v1', 'k2', 'v2');
1471+
SELECT JSON_ARRAY(l1, l2, l3, l4), JSON_OBJECT(l1, l2, l3, l4) from t;
1472+
JSON_ARRAY(l1, l2, l3, l4) JSON_OBJECT(l1, l2, l3, l4)
1473+
["k1", "v1", "k2", "v2"] {"k1": "v1", "k2": "v2"}
1474+
SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') from t;
1475+
JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3')
1476+
[["k1", "k3"], "v1", "k2", "v2"] ["k3", "k1", "v1", "k2", "v2"]
1477+
SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t;
1478+
JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3') JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2')
1479+
{"k1": "v1", "k2": "v2", "k3": "v3"} {"k1": "v1", "k2": "new v2"} {"k1": "v1", "k2": "new v2"}
1480+
DROP TABLE t;
1481+
#
14401482
# End of 10.5 tests
14411483
#
14421484
#

mysql-test/main/func_json.test

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,25 @@ SELECT * FROM t1 WHERE JSON_EXTRACT(j, '$.Age')=19;
627627

628628
drop table t1;
629629

630+
--echo #
631+
--echo # MDEV-27151: JSON_VALUE() does not parse NULL properties properly
632+
--echo #
633+
--echo #
634+
--echo # It is correct for JSON_EXTRACT() to give null instead of "NULL" because
635+
--echo # it returns the json literal that is put inside json.
636+
--echo # Hence it should return null as in 'null' string and not SQL NULL.
637+
--echo # JSON_VALUE() returns the "VALUE" so it is correct for it to return SQl NULL
638+
--echo #
639+
640+
SELECT NULL;
641+
SELECT JSON_VALUE('{"nulltest": null}', '$.nulltest');
642+
SELECT 1 + NULL;
643+
SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest');
644+
645+
646+
SELECT NULL;
647+
SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a');
648+
630649
--echo #
631650
--echo # End of 10.3 tests
632651
--echo #
@@ -927,6 +946,17 @@ SELECT JSON_ARRAYAGG(a) AS f FROM v;
927946
DROP VIEW v;
928947
DROP TABLE t;
929948

949+
950+
--echo #
951+
--echo # MDEV-29264 JSON functions overflow error based ON LONGTEXT field
952+
--echo #
953+
CREATE TABLE t(l1 LONGTEXT, l2 LONGTEXT, l3 LONGTEXT, l4 LONGTEXT);
954+
INSERT INTO t VALUES('k1', 'v1', 'k2', 'v2');
955+
SELECT JSON_ARRAY(l1, l2, l3, l4), JSON_OBJECT(l1, l2, l3, l4) from t;
956+
SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_INSERT(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3') from t;
957+
SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t;
958+
DROP TABLE t;
959+
930960
--echo #
931961
--echo # End of 10.5 tests
932962
--echo #

mysql-test/main/timezone2.result

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,3 +654,25 @@ SET time_zone=DEFAULT;
654654
#
655655
# End of 10.4 tests
656656
#
657+
#
658+
# MDEV-27101 Subquery using the ALL keyword on TIMESTAMP columns produces a wrong result
659+
#
660+
SET time_zone='Europe/Moscow';
661+
CREATE TABLE t1 (a TIMESTAMP NULL);
662+
SET timestamp=1288477526;
663+
/* this is summer time, earlier */
664+
INSERT INTO t1 VALUES (NOW());
665+
SET timestamp=1288477526+3599;
666+
/* this is winter time, later */
667+
INSERT INTO t1 VALUES (NOW());
668+
SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
669+
a UNIX_TIMESTAMP(a)
670+
2010-10-31 02:25:26 1288477526
671+
2010-10-31 02:25:25 1288481125
672+
SELECT a, UNIX_TIMESTAMP(a) FROM t1 WHERE a <= ALL (SELECT * FROM t1);
673+
a UNIX_TIMESTAMP(a)
674+
2010-10-31 02:25:26 1288477526
675+
SELECT a, UNIX_TIMESTAMP(a) FROM t1 WHERE a >= ALL (SELECT * FROM t1);
676+
a UNIX_TIMESTAMP(a)
677+
2010-10-31 02:25:25 1288481125
678+
DROP TABLE t1;

mysql-test/main/timezone2.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,3 +598,18 @@ SET time_zone=DEFAULT;
598598
--echo #
599599
--echo # End of 10.4 tests
600600
--echo #
601+
602+
--echo #
603+
--echo # MDEV-27101 Subquery using the ALL keyword on TIMESTAMP columns produces a wrong result
604+
--echo #
605+
606+
SET time_zone='Europe/Moscow';
607+
CREATE TABLE t1 (a TIMESTAMP NULL);
608+
SET timestamp=1288477526; /* this is summer time, earlier */
609+
INSERT INTO t1 VALUES (NOW());
610+
SET timestamp=1288477526+3599; /* this is winter time, later */
611+
INSERT INTO t1 VALUES (NOW());
612+
SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a;
613+
SELECT a, UNIX_TIMESTAMP(a) FROM t1 WHERE a <= ALL (SELECT * FROM t1);
614+
SELECT a, UNIX_TIMESTAMP(a) FROM t1 WHERE a >= ALL (SELECT * FROM t1);
615+
DROP TABLE t1;

mysql-test/suite/innodb/r/change_column_collation.result

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,17 @@ ALTER TABLE t1 MODIFY msg_2 VARCHAR(100) CHARACTER SET utf8
9595
COLLATE utf8_unicode_ci, ALGORITHM=inplace;
9696
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
9797
DROP TABLE t1;
98+
#
99+
# MDEV-29314 Assertion `n_fields > n_cols' failed
100+
# in dict_index_t::init_change_cols
101+
#
102+
CREATE TABLE t (a VARCHAR(16) COLLATE utf8_bin,
103+
FULLTEXT (a)) ENGINE=InnoDB COLLATE utf8_unicode_520_ci;
104+
ALTER TABLE t MODIFY COLUMN a VARCHAR(512);
105+
SHOW CREATE TABLE t;
106+
Table Create Table
107+
t CREATE TABLE `t` (
108+
`a` varchar(512) COLLATE utf8mb3_unicode_520_ci DEFAULT NULL,
109+
FULLTEXT KEY `a` (`a`)
110+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_520_ci
111+
DROP TABLE t;

0 commit comments

Comments
 (0)