Skip to content

Commit 4e805ae

Browse files
committed
Merge remote-tracking branch 'origin/11.4' into 11.5
2 parents 8f4ec79 + 5fb07d9 commit 4e805ae

File tree

645 files changed

+14637
-11299
lines changed

Some content is hidden

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

645 files changed

+14637
-11299
lines changed

.gitlab-ci.yml

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -447,41 +447,66 @@ fedora install:
447447
- installed-database.sql
448448
- upgraded-database.sql
449449

450-
cppcheck:
450+
cppcheck:
451+
allow_failure: true
451452
stage: sast
452453
needs: []
453454
variables:
454455
GIT_STRATEGY: fetch
455456
GIT_SUBMODULE_STRATEGY: normal
456457
script:
457458
- yum install -y cppcheck diffutils
458-
# --template: use a single-line template
459+
# --template: output format
459460
# --force: check large directories without warning
460461
# -i<directory>: ignore this directory when scanning
462+
# -I<directory>: include path, reduces false positives
463+
# related to inability to resolve symbols
461464
# -j: run multiple cppcheck threads
462465
# Use newline to escape colon in yaml
463466
- >
464-
cppcheck --template="{file}:{line}: {severity}: {message}" --force
467+
cppcheck --template="{file}:{line}\n{code}\n{severity}: {message}" --force --check-level=exhaustive
465468
client dbug extra include libmariadb libmysqld libservices mysql-test mysys mysys_ssl pcre plugin
466469
strings tests unittest vio wsrep-lib sql sql-common storage
467470
-istorage/mroonga -istorage/tokudb -istorage/spider -istorage/rocksdb -iextra/ -ilibmariadb/ -istorage/columnstore
468-
--output-file=cppcheck.txt -j $(nproc)
469-
# Parallel jobs may output findings in an nondeterministic order. Sort to match ignorelist.
470-
- cat cppcheck.txt | sort > cppcheck_sorted.txt
471-
# Remove line numbers for diff
472-
- sed 's/:[^:]*:/:/' cppcheck_sorted.txt > cppcheck_sorted_no_line_numbers.txt
471+
-Iinclude -Istorage/innobase/include
472+
--output-file=initial-cppcheck_output.txt -j $(nproc)
473+
# when including {code} in the cppcheck template, some more pre-processing needs to be done
474+
#
475+
# sample cppcheck finding: <file>:<line>
476+
# foo.bar()
477+
# ^
478+
# <severity>: <message>
479+
#
480+
# 1. remove all lines with "^"
481+
# 2. merge every 3 lines into 1 so it can be sorted (example: <file> foo.bar() <severity>: <message>)
482+
# 3. sort to match ignorelist since parallel jobs may output findings in an nondeterministic order
483+
# 4. remove findings likely to be false positives (i.e, "unknown macros")
484+
# 5. remove line numbers for diffing against ignorelist
485+
- |
486+
cat initial-cppcheck_output.txt | grep -v '\^$' > preprocessed-cppcheck_circumflex_removed.txt
487+
cat preprocessed-cppcheck_circumflex_removed.txt | awk 'NR%3==1 {printf "%s", (NR==1) ? "" : "\n"; printf "%s", $0} NR%3!=1 {printf " %s", $0}' > preprocessed-cppcheck_oneline.txt
488+
cat preprocessed-cppcheck_oneline.txt | sort > preprocessed-cppcheck_sorted.txt
489+
cat preprocessed-cppcheck_sorted.txt | grep -v "There is an unknown macro here somewhere" > results-cppcheck_all_findings.txt
490+
sed 's/:[0-9]\+//' results-cppcheck_all_findings.txt > preprocessed_final-cppcheck_no_line_nums.txt
473491
# Only print new issues not found in ignore list
474492
- echo "Problems found in ignore list that were not discovered by cppcheck (may have been fixed)."
475-
- diff --changed-group-format='%>' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt || true
493+
- diff --changed-group-format='%>' --unchanged-group-format='' preprocessed_final-cppcheck_no_line_nums.txt tests/code_quality/cppcheck_ignorelist.txt || true
476494
- echo "Problems found by cppcheck that were not in ignore list."
477-
- diff --changed-group-format='%<' --unchanged-group-format='' cppcheck_sorted_no_line_numbers.txt tests/code_quality/cppcheck_ignorelist.txt > lines_not_ignored.txt || true
478-
- cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt
495+
- diff --changed-group-format='%<' --unchanged-group-format='' preprocessed_final-cppcheck_no_line_nums.txt tests/code_quality/cppcheck_ignorelist.txt > results-cppcheck_new_findings.txt || true
496+
- cat results-cppcheck_new_findings.txt && test ! -s results-cppcheck_new_findings.txt
479497
artifacts:
480498
when: always
481499
paths:
482-
- cppcheck_sorted.txt
500+
# save all steps of pre-processing in-case it ever breaks
501+
- initial-cppcheck_output.txt
502+
- preprocessed-cppcheck_circumflex_removed.txt
503+
- preprocessed-cppcheck_sorted.txt
504+
- preprocessed_final-cppcheck_no_line_nums.txt
505+
- results-cppcheck_all_findings.txt
506+
- results-cppcheck_new_findings.txt
483507

484508
flawfinder:
509+
allow_failure: true
485510
stage: sast
486511
needs: []
487512
variables:
@@ -503,11 +528,12 @@ flawfinder:
503528
- echo "Problems found in ignore list that were not discovered by flawfinder (may have been fixed)."
504529
- diff --changed-group-format='%>' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json || true
505530
- echo "Problems found by flawfinder that were not in ignore list."
506-
- diff --changed-group-format='%<' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json > lines_not_ignored.txt || true
507-
- cat lines_not_ignored.txt && test ! -s lines_not_ignored.txt
531+
- diff --changed-group-format='%<' --unchanged-group-format='' flawfinder-min-level5.json tests/code_quality/flawfinder_ignorelist.json > flawfinder_new_findings.txt || true
532+
- cat flawfinder_new_findings.txt && test ! -s flawfinder_new_findings.txt
508533
artifacts:
509534
when: always
510535
paths:
536+
- flawfinder_new_findings.txt
511537
- flawfinder-all-vulnerabilities.html
512538
- flawfinder-min-level5.json
513539

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,20 @@ ELSE()
193193
SET (SKIP_COMPONENTS "N-O-N-E")
194194
ENDIF()
195195

196-
OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF)
196+
197+
IF("${MYSQL_NO_DASH_VERSION}" VERSION_LESS 11.2)
198+
SET(MEMPROTECT_DEFAULT ON)
199+
ELSE()
200+
SET(MEMPROTECT_DEFAULT OFF)
201+
ENDIF()
202+
203+
OPTION(WITH_PROTECT_STATEMENT_MEMROOT "Enable protection of statement's memory root after first SP/PS execution. Turned into account only for debug build"
204+
${MEMPROTECT_DEFAULT})
197205

198206
#
199207
# Enable protection of statement's memory root after first SP/PS execution.
200208
# Can be switched on only for debug build.
201209
#
202-
OPTION(WITH_PROTECT_STATEMENT_MEMROOT "Enable protection of statement's memory root after first SP/PS execution. Turned into account only for debug build" OFF)
203210
IF (WITH_PROTECT_STATEMENT_MEMROOT)
204211
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT")
205212
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT")

cmake/maintainer.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ SET(MY_WARNING_FLAGS
2727
-Wenum-conversion
2828
-Wextra
2929
-Wformat-security
30+
-Winconsistent-missing-override
3031
-Wmissing-braces
3132
-Wno-format-truncation
3233
-Wno-init-self
3334
-Wno-nonnull-compare
3435
-Wno-null-conversion
3536
-Wno-unused-parameter
3637
-Wno-unused-private-field
37-
-Woverloaded-virtual
3838
-Wnon-virtual-dtor
39+
-Woverloaded-virtual
3940
-Wvla
4041
-Wwrite-strings
4142
)
@@ -44,7 +45,7 @@ FOREACH(F ${MY_WARNING_FLAGS})
4445
MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO)
4546
ENDFOREACH()
4647

47-
SET(MY_ERROR_FLAGS -Werror -fno-operator-names)
48+
SET(MY_ERROR_FLAGS -Werror -fno-operator-names -Wsuggest-override)
4849

4950
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
5051
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized)

cmake/wsrep.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
#
1818
# Galera library does not compile with windows
1919
#
20-
IF (NOT WITHOUT_SERVER)
20+
IF(WITHOUT_SERVER)
21+
OPTION(WITH_WSREP "Galera server compatibility in build client utilities" ON)
22+
ELSE()
2123
IF(UNIX)
2224
SET(with_wsrep_default ON)
2325
ELSE()
@@ -67,4 +69,4 @@ ENDIF()
6769
IF (NOT WIN32)
6870
ADD_FEATURE_INFO(WSREP WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)")
6971
ENDIF()
70-
ENDIF(NOT WITHOUT_SERVER)
72+
ENDIF(WITHOUT_SERVER)

extra/mariabackup/xtrabackup.cc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ enum options_xtrabackup
13361336
OPT_INNODB_DATA_FILE_BUFFERING,
13371337
OPT_INNODB_DATA_FILE_WRITE_THROUGH,
13381338
OPT_INNODB_LOG_FILE_SIZE,
1339-
OPT_INNODB_LOG_FILES_IN_GROUP,
1339+
OPT_INNODB_LOG_WRITE_AHEAD_SIZE,
13401340
OPT_INNODB_OPEN_FILES,
13411341
OPT_XTRA_DEBUG_SYNC,
13421342
OPT_INNODB_CHECKSUM_ALGORITHM,
@@ -1918,6 +1918,10 @@ struct my_option xb_server_options[] =
19181918
{"innodb_log_group_home_dir", OPT_INNODB_LOG_GROUP_HOME_DIR,
19191919
"Path to InnoDB log files.", &srv_log_group_home_dir,
19201920
&srv_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1921+
{"innodb_log_write_ahead_size", OPT_INNODB_LOG_WRITE_AHEAD_SIZE,
1922+
"ib_logfile0 write size",
1923+
(G_PTR*) &log_sys.write_size, (G_PTR*) &srv_log_file_size, 0,
1924+
GET_UINT, REQUIRED_ARG, 512, 512, 4096, 0, 1, 0},
19211925
{"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
19221926
"Percentage of dirty pages allowed in bufferpool.",
19231927
(G_PTR*) &srv_max_buf_pool_modified_pct,
@@ -2366,6 +2370,11 @@ xb_get_one_option(const struct my_option *opt,
23662370

23672371
static bool innodb_init_param()
23682372
{
2373+
if (!ut_is_2pow(log_sys.write_size)) {
2374+
msg("InnoDB: innodb_log_write_ahead_size=%u"
2375+
" is not a power of two", log_sys.write_size);
2376+
return true;
2377+
}
23692378
srv_is_being_started = TRUE;
23702379
/* === some variables from mysqld === */
23712380
memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list));
@@ -3390,7 +3399,7 @@ static bool xtrabackup_copy_logfile()
33903399
ut_a(dst_log_file);
33913400
ut_ad(recv_sys.is_initialised());
33923401
const size_t sequence_offset{log_sys.is_encrypted() ? 8U + 5U : 5U};
3393-
const size_t block_size_1{log_sys.get_block_size() - 1};
3402+
const size_t block_size_1{log_sys.write_size - 1};
33943403

33953404
ut_ad(!log_sys.is_pmem());
33963405

@@ -3465,7 +3474,7 @@ static bool xtrabackup_copy_logfile()
34653474
if (r == recv_sys_t::GOT_EOF)
34663475
break;
34673476

3468-
if (recv_sys.offset < log_sys.get_block_size())
3477+
if (recv_sys.offset < log_sys.write_size)
34693478
break;
34703479

34713480
if (xtrabackup_throttle && io_ticket-- < 0)

extra/perror.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ int main(int argc,char *argv[])
352352
{
353353
found= 1;
354354
if (verbose)
355-
printf("MariaDB error code %3d (%s): %s\n", code, name, msg);
355+
printf("MariaDB error code %3d (%s): %s\n"
356+
"Learn more: https://mariadb.com/kb/en/e%3d/\n", code, name, msg, code);
356357
else
357358
puts(msg);
358359
}

mysql-test/include/ctype_myanmar.inc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,11 +1293,9 @@ INSERT INTO t1 (s1) VALUES
12931293
(_ucs2 0x101C1000103A10181000103A),
12941294
(_ucs2 0x101C103910181000103A /* tea */);
12951295

1296-
# enable view-protocol after fix MDEV-27871
1297-
--disable_view_protocol
1298-
1299-
SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) FROM t1 ORDER BY id;
1300-
--enable_view_protocol
1296+
--disable_service_connection
1297+
SELECT id, IF(LEFT(s1,1)='-',s1,CONCAT(HEX(WEIGHT_STRING(s1)),'\t', HEX(CONVERT(s1 USING ucs2)))) as exp FROM t1 ORDER BY id;
1298+
--enable_service_connection
13011299

13021300
DROP TABLE t1;
13031301

0 commit comments

Comments
 (0)