Skip to content

Commit 1d90d68

Browse files
committed
Merge 10.4 into 10.5
2 parents 5fc172f + 36d173e commit 1d90d68

18 files changed

+255
-96
lines changed

cmake/os/Darwin.cmake

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

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

mysql-test/main/func_json.result

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
#

mysql-test/main/func_json.test

Lines changed: 19 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 #

mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
--- check_ibd_filesize.result
2-
+++ check_ibd_filesize.result,32k
1+
--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530
2+
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:29:25.129637040 +0530
33
@@ -3,18 +3,12 @@
44
# SPACE IN 5.7 THAN IN 5.6
55
#
66
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
7-
-# bytes: 98304
8-
+# bytes: 196608
7+
-# bytes: 65536
8+
+# bytes: 131072
99
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
1010
-# bytes: 9437184
1111
+# bytes: 786432
1212
DROP TABLE t1;
1313
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
14-
-# bytes: 98304
15-
+# bytes: 196608
14+
-# bytes: 65536
15+
+# bytes: 131072
1616
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
1717
-# bytes: 4194304
1818
-DROP TABLE t1;

mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
--- check_ibd_filesize.result
2-
+++ check_ibd_filesize.result,4k
1+
--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530
2+
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:39.288769153 +0530
33
@@ -3,18 +3,18 @@
44
# SPACE IN 5.7 THAN IN 5.6
55
#
66
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
7-
-# bytes: 98304
8-
+# bytes: 24576
7+
-# bytes: 65536
8+
+# bytes: 16384
99
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
1010
# bytes: 9437184
1111
DROP TABLE t1;
1212
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
13-
-# bytes: 98304
14-
+# bytes: 24576
13+
-# bytes: 65536
14+
+# bytes: 16384
1515
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
1616
# bytes: 4194304
1717
DROP TABLE t1;

mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
--- check_ibd_filesize.result
2-
+++ check_ibd_filesize.result,64k
1+
--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530
2+
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:30:28.957174270 +0530
33
@@ -3,18 +3,12 @@
44
# SPACE IN 5.7 THAN IN 5.6
55
#
66
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
7-
-# bytes: 98304
8-
+# bytes: 393216
7+
-# bytes: 65536
8+
+# bytes: 262144
99
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
1010
-# bytes: 9437184
1111
+# bytes: 983040
1212
DROP TABLE t1;
1313
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
14-
-# bytes: 98304
15-
+# bytes: 393216
14+
-# bytes: 65536
15+
+# bytes: 262144
1616
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
1717
-# bytes: 4194304
1818
-DROP TABLE t1;

mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
--- check_ibd_filesize.result
2-
+++ check_ibd_filesize.result,8k
1+
--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530
2+
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:03.516962339 +0530
33
@@ -3,18 +3,18 @@
44
# SPACE IN 5.7 THAN IN 5.6
55
#
66
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
7-
-# bytes: 98304
8-
+# bytes: 49152
7+
-# bytes: 65536
8+
+# bytes: 32768
99
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
1010
# bytes: 9437184
1111
DROP TABLE t1;
1212
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
13-
-# bytes: 98304
14-
+# bytes: 49152
13+
-# bytes: 65536
14+
+# bytes: 32768
1515
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
1616
# bytes: 4194304
1717
DROP TABLE t1;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
# SPACE IN 5.7 THAN IN 5.6
44
#
55
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
6-
# bytes: 98304
6+
# bytes: 65536
77
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
88
# bytes: 9437184
99
DROP TABLE t1;
1010
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
11-
# bytes: 98304
11+
# bytes: 65536
1212
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
1313
# bytes: 4194304
1414
DROP TABLE t1;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#
66

77
--source include/have_innodb.inc
8+
--source include/innodb_page_size.inc
89
# Embedded server does not restart of server
910
--source include/not_embedded.inc
1011
--source include/no_valgrind_without_big.inc

0 commit comments

Comments
 (0)