Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS-5859: Merge MySQL 5.7.28 (part 1) #3476

Merged
merged 116 commits into from
Nov 1, 2019
Merged

PS-5859: Merge MySQL 5.7.28 (part 1) #3476

merged 116 commits into from
Nov 1, 2019

Conversation

inikep
Copy link
Collaborator

@inikep inikep commented Oct 22, 2019

https://jira.percona.com/browse/PS-5859


Updated man pages from MySQL Server 5.7.28 source tarball.


Updated 'scripts/fill_help_tables.sql' from MySQL Server 5.7.28 source tarball.


VERSION raised to "5.7.28-31".
univ.i version raised to "31".


Removed remaining code related to HAVE_YASSL


Reverted PS-5828 in favor of upstream solution.
PS-5828: incorrect length in read_ok_ex() in sql-common/client.c:805
https://jira.percona.com/browse/PS-5828 (commit e788bc5)
https://bugs.mysql.com/bug.php?id=96433 (commit mysql/mysql-server@c44b18041f)


Kept our solution for PS-5836 and reverted upstream.
PS-5836: clang-8 reports broken source encoding in scripts/sql_commands_help_data.h
https://jira.percona.com/browse/PS-5836 (commit e788bc5)
https://bugs.mysql.com/bug.php?id=96449 (commit mysql/mysql-server@19a667b6ac)


Reverted PS-3410 in favor of upstream solution with added our innodb.percona_bulk_load_insert.
PS-3410: LP #1570114: Long running ALTER TABLE ADD INDEX causes semaphore wait > 600 assertion
https://jira.percona.com/browse/PS-3410 (commit 7ebaef8)
https://bugs.mysql.com/bug.php?id=82940 (commit mysql/mysql-server@f9fb96c20f)


Fixed gcc 9.2.1 warnings in storage/innobase/log/log0online.cc and storage/innobase/os/os0file.cc

bjornmu and others added 30 commits May 27, 2019 12:08
Approved-by: Erlend Dahl <erlend.dahl@oracle.com>
Approved-by: Erlend Dahl <erlend.dahl@oracle.com>
Approved-by: Erlend Dahl <erlend.dahl@oracle.com>
PROBLEM
-------
Usage of a freed object while printing error.

FIX
---

Print the error and then free the associated object

Reviewed by : Debarun Banerjee <debarun.banerjee@oracle.com>
PLUGIN CLIENTS

Problem:
In read uncommitted isolation level, If a tuple has a externally
stored blob is updated (or a new tuple is inserted). and if updated
operation is not yet completed. Cluster index record has been
updated and stored zeros in blob reference field in cluster index
record, but externally stored blob data has not been stored yet.
At this point of time, another transaction read the same record and
finds that the blob column is null because blob reference contains
all zeros.
In innodb memcache plugin, ib_read_tuple() read blob column data as
null and data length 20. which causes the segmentation fault while
copying 20 bytes data.

Fix:
Added a check. If ib_read_tuple() read the blob data as null then
set data length to zero.

RB: 22128
Reviewed by: Annamalai Gurusami <annamalai.gurusami@oracle.com>
              SERVER TO EXIT ON STARTUP

Post push patch to fix valgrind test failure in PB2 5.6

RB#22243
…E FOR EVENTS

Unit test mem0mem-t was missing to call os_event_global_init.

RB: 22281
…HOUT PROPER LOCK

PROBLEM
=======
When mysqld_main thread is run in parallel with Ndb_binlog thread, mysqld
crashes during startup. This is because initialize_storage_engine() tries
to de-allocate and allocate memory for global pointer global_variables.table_plugin.
During De-allocation the function holds mutex on LOCK_plugin but unlocks
the mutex immidietly after releasing the memory. So, when allocating, the
function modifies the global pointer(global_variables.table_plugin) with
out holding any mutex. This makes the pointer accessible to other threads.
So, if there is a context switch before allocation, the value of global_variables.
table_plugin will be invalid and any thread accessing it will lead to the crash.

FIX
===
Fix by saving the plugin reference pointed by global_variables.table_plugin
to a temp pointer, assign new plugin to global_variables.table_plugin and
release the temp pointer at last. This way the global_variables.table_plugin
will be always valid. So, if the context switch happens before assignment
old value will be read and if the context switch happens after assignment
new value will be read. Hence, the pointer can never be invalid and thus
avoiding the issue. The code is only used during mysqld startup, so this
fix is of low risk.

Change-Id: Icbbe9c1b1407478cb738706c5c6bdb76c1517163
…ASK PASSWORD FROM QUERY

If a rewritten version of a given query exists
(to hide passwords etc.), use that instead of
the original query in

a) SHOW PROCESSLIST
b) information_schema.processlist
c) performance_schema.threads

in addition to the support for
d) performance_schema.events_statements_current
e) performance_schema.events_statements_history
f) performance_schema.events_statements_history_long

v5.6

Approved by: Karthik Kamath <karthik.kamath@oracle.com>
…ASK PASSWORD FROM QUERY

If a rewritten version of a given query exists
(to hide passwords etc.), use that instead of
the original query in

a) SHOW PROCESSLIST
b) information_schema.processlist
c) performance_schema.threads

in addition to the support for
d) performance_schema.events_statements_current
e) performance_schema.events_statements_history
f) performance_schema.events_statements_history_long

v5.7

Approved by: Karthik Kamath <karthik.kamath@oracle.com>
Approved by: Karthik Kamath <karthik.kamath@oracle.com>
Approved by: Karthik Kamath <karthik.kamath@oracle.com>
This patch is for 5.6

Cmake changes to support:

WL#12903 BACKPORT OF WL#12361 - SUPPORT TLS 1.3 TO MYSQL 5.6 & 5.7
WL#13289 Remove yaSSL support from 5.6/5.7 codebase

In several CMakeLitst.txt files: remove obsolete cmake code for copying
OpenSSL .dll files on Windows.

In cmake/ssl.cmake:
- Add code to do version check for minor and fix version of ssl.
- SSL libraries version 1.1 on windows have changed names,
  so extend the list of names to search for in FIND_LIBRARY(...)
- Remove obsolete cmake code which tried to use openssl .dlls on windows.
- Translate WITH_SSL=system on Mac and Windows to known paths (same as 8.0)
  This is to simplify the work for developers: no need to download tarballs
    from pushbuild.
  Note that pushbuild will continue to use WITH_SSL=<path/to/custom/openssl>

In libmysql/CMakeLists.txt separate the LIBS macro into LIBS_TO_MERGE
and LIBS_TO_LINK, otherwise the code in MERGE_CONVENIENCE_LIBRARIES
may fail in mysterious ways. This is a backport from 8.0

Same patch as for 5.7 plus:
- disable -Wclass-memaccess warnings for modern C++ compilers.
- explicitly set -std=gnu++03 in order to be able to build with modern
  C++ compilers

Changes from the 5.7 patch *not* included
- 5.6 has no protobuf code
- ndbcluster does not build in 5.6 so cmake changes not backported

The current patch keeps "bundled" i.e. YaSSL as default.
This will be removed by WL#13289.

Change-Id: Id546350978fe579b77b144dfda2f4635c0600852
Change-Id: I559fc98300044e5367ce9080538af65edd1dbab2
This patch is for 5.7

Cmake changes to support:

WL#12903 BACKPORT OF WL#12361 - SUPPORT TLS 1.3 TO MYSQL 5.6 & 5.7
WL#13289 Remove yaSSL support from 5.6/5.7 codebase

In several CMakeLitst.txt files: remove obsolete cmake code for copying
OpenSSL .dll files on Windows.

In cmake/ssl.cmake:
- Add code to do version check for minor and fix version of ssl.
- SSL libraries version 1.1 on windows have changed names,
  so extend the list of names to search for in FIND_LIBRARY(...)
- Remove obsolete cmake code which tried to use openssl .dlls on windows.
- Translate WITH_SSL=system on Mac and Windows to known paths (same as 8.0)
  This is to simplify the work for developers: no need to download tarballs
    from pushbuild.
  Note that pushbuild will continue to use WITH_SSL=<path/to/custom/openssl>

In libmysql/CMakeLists.txt separate the LIBS macro into LIBS_TO_MERGE
and LIBS_TO_LINK, otherwise the code in MERGE_CONVENIENCE_LIBRARIES
may fail in mysterious ways. This is a backport from 8.0

Same change for two CMakeLists.txt in storage/ndb, separate LIBS macro
into LIBS_TO_MERGE and LIBS_TO_LINK.

Also silence cmake warning CMP0075
Also silence some compiler warnings when building protobuf and ndb.

The current patch keeps "bundled" i.e. YaSSL as default.
This will be removed by WL#13289.

Change-Id: I10198277448745346889b0209e320aa45878a1de
fixes rpl_mts_slave_preserve_commit_order_deadlock_error (log_event.cc)
fixes processlist_priv_no_prot (rpl_rli.cc)
fixes rpl_row_ignorable_event (rpl_rli.cc)

Clean-up for Bug#20712046 which was
Approved by: Karthik Kamath <karthik.kamath@oracle.com>
Problem: When mysqlpump is run against server with version less than
5.7.8 pump reports an error.
Fix: Fix is to allow pump to run against any server version.

RB: 22323
Description:
============
MySQL server ends abruptly when a SELECT query with WHERE clause
having a predicate with a numeric value in the format of
(scientific) E-notation is executed.

ANALYSIS:
=========
my_strntoull10_8bit is invoked to convert user provided string to
unsigned longlong integer value. The 'exponent' variable is used to
store the value of exponent part of the user provided literal.
But the data type of 'exponent' variable is of int, whereas the
exponent part of the user provided literal is greater than INT_MAX.
Hence it results into garbage value into 'exponent' variable and then
it results the segmentation fault, when we access array d10 using
this garbage value.

SOLUTION:
=========
Change the data type variables used for storing the value of exponent
to longlong. Also check the value of exponent so that value greater
than LLONG_MAX is not processed further.

This is a partial backport of the patch for
  Bug#22824408 FIX MORE ERRORS REPORTED BY UBSAN - FOUR
and
  Bug#28505423 UBSAN: SIGNED INTEGER OVERFLOW IN
  MY_STRNTOULL10RND_8BIT

Change-Id: I773d048496b37d921b3504b1ec61b0a31f24ca77
inikep added 11 commits October 9, 2019 15:34
PS-5761: gcc-9 compilation warnings (5.6)
https://jira.percona.com/browse/PS-5988

***
Updated man pages from MySQL Server 5.6.46 source tarball.

***
Updated 'scripts/fill_help_tables.sql' from MySQL Server 5.6.46 source
tarball.
PS-5997: Add LLVM/clang-9 to Travis CI (5.6)
…olved)

https://jira.percona.com/browse/PS-NNNN
***
VERSION raised to "5.6.46-87.1".
univ.i version raised to "87.1".
***
Removed remaining code related to HAVE_YASSL
***
Fix `storage/tokudb/CMakeLists.txt` after `compiler_options.cmake` sets `-std=gnu++03` for clang-6 or newer
***
Fix `main.plugin-load-add-with-path` after `ha_example.so` is being built by default.
https://jira.percona.com/browse/PS-5989

***
Updated man pages from MySQL Server 5.7.28 source tarball.

***
Updated 'scripts/fill_help_tables.sql' from MySQL Server 5.7.28 source
tarball.
…olved)

https://jira.percona.com/browse/PS-5859
***
VERSION raised to "5.7.28-31".
univ.i version raised to "31".
***
Removed remaining code related to HAVE_YASSL
@inikep
Copy link
Collaborator Author

inikep commented Oct 23, 2019

@percona-ysorokin
Copy link
Collaborator

@inikep
Copy link
Collaborator Author

inikep commented Oct 23, 2019

@percona-ysorokin I followed our guide "Upstream merges" on Confluence to use --big-test --sanitize (on 8.0).

@inikep
Copy link
Collaborator Author

inikep commented Oct 24, 2019

-DWITH_ASAN=ON --big-test --sanitize at https://ps57.cd.percona.com/job/percona-server-5.7-asan-param/6
-DWITH_VALGRIND=ON --big-test at https://ps57.cd.percona.com/job/percona-server-5.7-valgrind-param/5

@percona-ysorokin
Copy link
Collaborator

Upstream merges

Confluence document updated

@percona-ysorokin
Copy link
Collaborator

https://ps57.cd.percona.com/job/percona-server-5.7-pipeline/7525/consoleText

==26003==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 536 byte(s) in 1 object(s) allocated from:
    #0 0x7efffb305b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x5588b6614d8a in my_raw_malloc /tmp/ps/mysys/my_malloc.c:203
    #2 0x5588b6614d8a in my_malloc /tmp/ps/mysys/my_malloc.c:66
    #3 0x5588b73a3b44 in mysql_socket_vio_new /tmp/ps/vio/vio.c:299
    #4 0x5588b5ef6023 in Channel_info_local_socket::create_and_init_vio() const /tmp/ps/sql/conn_handler/socket_connection.cc:161
    #5 0x5588b6376ead in Channel_info::create_thd() /tmp/ps/sql/conn_handler/channel_info.cc:35
    #6 0x5588b5efb652 in Channel_info_local_socket::create_thd() /tmp/ps/sql/conn_handler/socket_connection.cc:176
    #7 0x5588b5ed411d in Thread_pool_connection_handler::add_connection(Channel_info*) /tmp/ps/sql/threadpool_unix.cc:1335
    #8 0x5588b609eefa in Connection_handler_manager::process_new_connection(Channel_info*) /tmp/ps/sql/conn_handler/connection_handler_manager.cc:322
    #9 0x5588b5f30dd9 in Connection_acceptor<Mysqld_socket_listener>::connection_event_loop() /tmp/ps/sql/conn_handler/connection_acceptor.h:75
    #10 0x5588b5f30dd9 in mysqld_main(int, char**) /tmp/ps/sql/mysqld.cc:5513
    #11 0x5588b4883772 in main /tmp/ps/sql/main.cc:32
    #12 0x7efff8b70b96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Also check if this is upstream

@percona-ysorokin
Copy link
Collaborator

percona-ysorokin commented Oct 29, 2019

https://ps57.cd.percona.com/job/percona-server-5.7-pipeline/7525/consoleText

==18788==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 2208 byte(s) in 1 object(s) allocated from:
    #0 0x7f42a4034b50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x55a945fb4054 in ut_allocator<unsigned char>::allocate(unsigned long, unsigned char const*, char const*, bool, bool) /tmp/ps/storage/innobase/include/ut0new.h:367
    #2 0x55a945fb4054 in mem_heap_create_block_func(mem_block_info_t*, unsigned long, char const*, unsigned long, unsigned long) /tmp/ps/storage/innobase/mem/mem0mem.cc:310
    #3 0x55a945fb53e2 in mem_heap_add_block(mem_block_info_t*, unsigned long) /tmp/ps/storage/innobase/mem/mem0mem.cc:415
    #4 0x55a945fb58e5 in mem_heap_alloc /tmp/ps/storage/innobase/include/mem0mem.ic:212
    #5 0x55a945fb58e5 in mem_heap_dup(mem_block_info_t*, void const*, unsigned long) /tmp/ps/storage/innobase/mem/mem0mem.cc:67
    #6 0x55a945fb5a7f in mem_heap_strdup(mem_block_info_t*, char const*) /tmp/ps/storage/innobase/mem/mem0mem.cc:54
    #7 0x55a9465d7b82 in dict_mem_fill_index_struct /tmp/ps/storage/innobase/include/dict0mem.ic:59
    #8 0x55a9465d7b82 in dict_mem_index_create(char const*, char const*, unsigned long, unsigned long, unsigned long) /tmp/ps/storage/innobase/dict/dict0mem.cc:700
    #9 0x55a9461110b6 in row_merge_create_index(trx_t*, dict_table_t*, index_def_t const*, dict_add_v_col_t const*) /tmp/ps/storage/innobase/row/row0merge.cc:4290
    #10 0x55a945e8b6fb in prepare_inplace_alter_table_dict /tmp/ps/storage/innobase/handler/handler0alter.cc:4971
    #11 0x55a945e978da in ha_innobase::prepare_inplace_alter_table(TABLE*, Alter_inplace_info*) /tmp/ps/storage/innobase/handler/handler0alter.cc:6390
    #12 0x55a943e8c431 in handler::ha_prepare_inplace_alter_table(TABLE*, Alter_inplace_info*) /tmp/ps/sql/handler.cc:5147
    #13 0x55a94531e970 in mysql_inplace_alter_table /tmp/ps/sql/sql_table.cc:7845
    #14 0x55a945330f32 in mysql_alter_table(THD*, char const*, char const*, st_ha_create_information*, TABLE_LIST*, Alter_info*) /tmp/ps/sql/sql_table.cc:10324
    #15 0x55a94586a549 in Sql_cmd_alter_table::execute(THD*) /tmp/ps/sql/sql_alter.cc:355
    #16 0x55a945190a41 in mysql_execute_command(THD*, bool) /tmp/ps/sql/sql_parse.cc:5154
    #17 0x55a9451997f7 in mysql_parse(THD*, Parser_state*, bool) /tmp/ps/sql/sql_parse.cc:5927
    #18 0x55a94519d04a in dispatch_command(THD*, COM_DATA const*, enum_server_command) /tmp/ps/sql/sql_parse.cc:1539
    #19 0x55a9451a2d59 in do_command(THD*) /tmp/ps/sql/sql_parse.cc:1060
    #20 0x55a945494ea2 in handle_connection /tmp/ps/sql/conn_handler/connection_handler_per_thread.cc:325
    #21 0x55a945c1544b in pfs_spawn_thread /tmp/ps/storage/perfschema/pfs.cc:2198
    #22 0x7f42a39056da in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76da)

Also check if this is upstream
Could be related to https://jira.percona.com/browse/PS-5992

@percona-ysorokin
Copy link
Collaborator

https://ps57.cd.percona.com/job/percona-server-5.7-pipeline/7525/consoleText

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x7fe1a32c5d38 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded38)
    #1 0x7fe18a10a641  (<unknown module>)
    #2 0x7fe18a10fbff  (<unknown module>)
    #3 0x7fe18a118630  (<unknown module>)
    #4 0x7fe18a0eee45  (<unknown module>)
    #5 0x7fe18a0f1c1e  (<unknown module>)
    #6 0x7fe18a0f9793  (<unknown module>)
    #7 0x7fe18a0ff19e  (<unknown module>)
    #8 0x7fe18a10b378  (<unknown module>)
    #9 0x7fe18a128ae0  (<unknown module>)
    #10 0x7fe18a0ee985  (<unknown module>)
    #11 0x7fe18a1c71c4  (<unknown module>)
    #12 0x7fe18a15d0fa  (<unknown module>)
    #13 0x7fe1a2b966da in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76da)

At lease identify which MTR test case generates this.
Also check if this is upstream.

@percona-ysorokin
Copy link
Collaborator

https://ps57.cd.percona.com/job/percona-server-5.7-pipeline/7524/consoleText

SUMMARY: AddressSanitizer: stack-overflow (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x5ecd8) 
Thread T25 created by T0 here:
    #0 0x7f47e6398d2f in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.4+0x37d2f)
    #1 0x5647fe19e425 in pfs_spawn_thread_v1 /tmp/ps/storage/perfschema/pfs.cc:2249
    #2 0x5647fdafa39a in inline_mysql_thread_create /tmp/ps/include/mysql/psi/mysql_thread.h:1304
    #3 0x5647fdafa39a in Per_thread_connection_handler::add_connection(Channel_info*) /tmp/ps/sql/conn_handler/connection_handler_per_thread.cc:429
    #4 0x5647fdc90b09 in Connection_handler_manager::process_new_connection(Channel_info*) /tmp/ps/sql/conn_handler/connection_handler_manager.cc:322
    #5 0x5647fdb36839 in Connection_acceptor<Mysqld_socket_listener>::connection_event_loop() /tmp/ps/sql/conn_handler/connection_acceptor.h:75
    #6 0x5647fdb36839 in mysqld_main(int, char**) /tmp/ps/sql/mysqld.cc:5513
    #7 0x7f47e3caab96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

@percona-ysorokin
Copy link
Collaborator

Updated Valgrind run (--big-test)
https://ps57.cd.percona.com/job/percona-server-5.7-valgrind-param/6/

@inikep
Copy link
Collaborator Author

inikep commented Oct 30, 2019

Memory leaks are detected on main.threadpool_debug, group_replication.gr_majority_loss_restart, innodb.alter_crash.
Upstream bugs are group_replication.gr_majority_loss_restart, innodb.alter_crash.
The stack overflow is detected only for gcc-7.

@inikep
Copy link
Collaborator Author

inikep commented Nov 1, 2019

Copy link
Collaborator

@percona-ysorokin percona-ysorokin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@inikep inikep changed the title PS-5859: Merge MySQL 5.7.28 PS-5859: Merge MySQL 5.7.28 (part 1) Nov 1, 2019
@inikep inikep merged commit b90d9b1 into percona:5.7 Nov 1, 2019
@inikep inikep deleted the ps-merge-5.7.28-part1 branch November 1, 2019 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.