From f85005b6cde1b83ee14ef26424462d7e44b6a6c9 Mon Sep 17 00:00:00 2001 From: Dmitry Teselkin Date: Mon, 24 Jul 2017 11:47:05 +0300 Subject: [PATCH] mysql 5.6.37 * Apply diff 5.6.36 --> 5.6.37 from https://github.com/mysql/mysql-server * Refresh d/p/scripts__mysqld_safe.sh__signals.patch Related-Bug: #1705802 Related-Prod: OSCORE-345 Change-Id: I3abb2e2ee6cb8f1f10bb313b58ea333b0010cbf3 --- debian/changelog | 7 + .../scripts__mysqld_safe.sh__signals.patch | 6 +- mysql-wsrep-5.6/CMakeLists.txt | 30 +++ mysql-wsrep-5.6/VERSION | 2 +- mysql-wsrep-5.6/client/mysql.cc | 93 ++++++-- mysql-wsrep-5.6/client/mysqlbinlog.cc | 31 ++- .../include/byte_order_generic_x86.h | 10 +- .../include/byte_order_generic_x86_64.h | 10 +- mysql-wsrep-5.6/include/my_sys.h | 16 +- mysql-wsrep-5.6/libmysql/libmysql.c | 14 +- .../rpl_tests/rpl_mts_pending_events.inc | 123 +++++++++++ .../mysql-test/lib/My/ConfigFactory.pm | 3 +- mysql-wsrep-5.6/mysql-test/mysql-test-run.pl | 28 ++- .../mysql-test/r/binary_to_hex.result | 117 ++++++++++ .../mysql-test/r/query_cache.result | 57 +++++ .../r/show_processlist_state.result | 4 + .../binlog/r/binlog_mysqlbinlog_raw.result | 20 ++ .../binlog/r/binlog_use_gtid_skip.result | 16 ++ .../binlog/t/binlog_mysqlbinlog_raw.test | 77 +++++++ .../suite/binlog/t/binlog_use_gtid_skip.test | 35 +++ .../r/innodb_copy_col_in_partition.result | 26 +++ .../t/innodb_copy_col_in_partition.test | 21 ++ .../suite/rpl/r/rpl_mts_pending_max.result | 201 ++++++++++++++++++ .../suite/rpl/r/rpl_reset_slave_fail.result | 41 ++++ .../r/rpl_semi_sync_uninstall_plugin.result | 1 - .../suite/rpl/t/rpl_flush_logs.test | 7 + .../suite/rpl/t/rpl_mts_pending_max.test | 108 ++++++++++ .../suite/rpl/t/rpl_reset_slave_fail.test | 90 ++++++++ .../rpl/t/rpl_semi_sync_uninstall_plugin.test | 9 +- .../mysql-test/t/binary_to_hex.test | 76 +++++++ mysql-wsrep-5.6/mysql-test/t/disabled.def | 2 + mysql-wsrep-5.6/mysql-test/t/query_cache.test | 42 ++++ .../mysql-test/t/show_processlist_state.test | 11 + mysql-wsrep-5.6/mysys/my_symlink.c | 30 ++- mysql-wsrep-5.6/mysys/queues.c | 8 +- .../packaging/WiX/create_msi.cmake.in | 32 ++- .../packaging/WiX/mysql_server.wxs.in | 28 ++- .../packaging/deb-in/CMakeLists.txt | 2 + mysql-wsrep-5.6/packaging/deb-in/control.in | 20 +- .../mysql-packagesource-client.install.in | 6 +- .../mysql-packagesource-server.install.in | 7 +- mysql-wsrep-5.6/packaging/deb-in/rules.in | 17 +- .../packaging/rpm-docker/mysql.spec.in | 19 +- mysql-wsrep-5.6/scripts/CMakeLists.txt | 8 +- mysql-wsrep-5.6/scripts/dheadgen.pl | 8 +- .../scripts/invoke-with-relative-paths.pl | 95 +++++++++ mysql-wsrep-5.6/scripts/mysql_config.pl.in | 4 +- .../scripts/mysql_convert_table_format.sh | 5 +- mysql-wsrep-5.6/scripts/mysql_find_rows.sh | 5 +- .../scripts/mysql_fix_extensions.sh | 5 +- .../scripts/mysql_install_db.pl.in | 4 +- .../scripts/mysql_secure_installation.pl.in | 4 +- .../scripts/mysql_setpermission.sh | 5 +- mysql-wsrep-5.6/scripts/mysql_zap.sh | 5 +- mysql-wsrep-5.6/scripts/mysqlaccess.conf | 0 mysql-wsrep-5.6/scripts/mysqlaccess.sh | 19 +- mysql-wsrep-5.6/scripts/mysqld_multi.sh | 4 +- mysql-wsrep-5.6/scripts/mysqld_safe.sh | 10 +- mysql-wsrep-5.6/scripts/mysqldumpslow.sh | 4 +- mysql-wsrep-5.6/scripts/mysqlhotcopy.sh | 2 +- mysql-wsrep-5.6/sql/binlog.cc | 112 +++++++--- mysql-wsrep-5.6/sql/binlog.h | 5 +- mysql-wsrep-5.6/sql/filesort.cc | 7 +- mysql-wsrep-5.6/sql/ha_partition.cc | 7 +- mysql-wsrep-5.6/sql/handler.h | 16 +- mysql-wsrep-5.6/sql/item.cc | 3 + mysql-wsrep-5.6/sql/log.cc | 24 ++- mysql-wsrep-5.6/sql/log_event.cc | 8 +- mysql-wsrep-5.6/sql/mysqld.cc | 10 +- mysql-wsrep-5.6/sql/net_serv.cc | 19 +- mysql-wsrep-5.6/sql/records.cc | 5 +- mysql-wsrep-5.6/sql/rpl_gtid_execution.cc | 3 +- mysql-wsrep-5.6/sql/rpl_master.cc | 61 +++++- mysql-wsrep-5.6/sql/rpl_rli.cc | 54 ++++- mysql-wsrep-5.6/sql/rpl_rli_pdb.cc | 35 +-- mysql-wsrep-5.6/sql/sql_acl.cc | 4 +- mysql-wsrep-5.6/sql/sql_cache.cc | 11 +- mysql-wsrep-5.6/sql/sql_load.cc | 11 +- mysql-wsrep-5.6/sql/sql_optimizer.cc | 78 +++---- mysql-wsrep-5.6/sql/sql_parse.cc | 10 +- mysql-wsrep-5.6/sql/sql_union.cc | 15 +- .../storage/innobase/api/api0api.cc | 21 +- .../storage/innobase/handler/ha_innodb.cc | 21 ++ .../storage/innobase/handler/ha_innodb.h | 6 +- .../storage/innobase/include/row0mysql.h | 7 +- .../storage/innobase/include/row0sel.h | 14 +- .../storage/innobase/row/row0merge.cc | 6 +- .../storage/innobase/row/row0sel.cc | 153 +++++++++---- .../storage/myisam/mi_delete_table.c | 6 +- mysql-wsrep-5.6/storage/myisam/mi_open.c | 50 ++++- mysql-wsrep-5.6/unittest/gunit/fake_table.h | 4 +- mysql-wsrep-5.6/unittest/gunit/field-t.cc | 8 +- .../unittest/gunit/mock_field_timestamp.h | 6 +- .../unittest/gunit/mock_field_timestampf.h | 6 +- mysql-wsrep-5.6/unittest/gunit/segfault-t.cc | 8 +- 95 files changed, 2144 insertions(+), 360 deletions(-) create mode 100644 mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc create mode 100644 mysql-wsrep-5.6/mysql-test/r/binary_to_hex.result create mode 100644 mysql-wsrep-5.6/mysql-test/r/show_processlist_state.result create mode 100644 mysql-wsrep-5.6/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw.result create mode 100644 mysql-wsrep-5.6/mysql-test/suite/binlog/r/binlog_use_gtid_skip.result create mode 100644 mysql-wsrep-5.6/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw.test create mode 100644 mysql-wsrep-5.6/mysql-test/suite/binlog/t/binlog_use_gtid_skip.test create mode 100644 mysql-wsrep-5.6/mysql-test/suite/innodb/r/innodb_copy_col_in_partition.result create mode 100644 mysql-wsrep-5.6/mysql-test/suite/innodb/t/innodb_copy_col_in_partition.test create mode 100644 mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_mts_pending_max.result create mode 100644 mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result create mode 100644 mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_mts_pending_max.test create mode 100644 mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test create mode 100644 mysql-wsrep-5.6/mysql-test/t/binary_to_hex.test create mode 100644 mysql-wsrep-5.6/mysql-test/t/show_processlist_state.test mode change 100755 => 100644 mysql-wsrep-5.6/scripts/dheadgen.pl create mode 100644 mysql-wsrep-5.6/scripts/invoke-with-relative-paths.pl mode change 100755 => 100644 mysql-wsrep-5.6/scripts/mysql_secure_installation.pl.in mode change 100755 => 100644 mysql-wsrep-5.6/scripts/mysqlaccess.conf diff --git a/debian/changelog b/debian/changelog index cb6cbec9..c6a2cdaa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +mysql-wsrep-5.6 (5.6.37-0~u14.04+mos0) mos; urgency=medium + + * Update mysql to 5.6.37 + * d/p/* - quilt refresh to avoid fuzz + + -- Dmitry Teselkin Mon, 24 Jul 2017 11:53:55 +0300 + mysql-wsrep-5.6 (5.6.36-0~u14.04+mos0) mos; urgency=medium * Update mysql to 5.6.36 diff --git a/debian/patches/scripts__mysqld_safe.sh__signals.patch b/debian/patches/scripts__mysqld_safe.sh__signals.patch index 2bb2481b..e46e1eae 100644 --- a/debian/patches/scripts__mysqld_safe.sh__signals.patch +++ b/debian/patches/scripts__mysqld_safe.sh__signals.patch @@ -10,7 +10,7 @@ Reviewed-by: Nicholas Bamber --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh -@@ -29,9 +29,6 @@ +@@ -31,9 +31,6 @@ syslog_tag_mysqld=mysqld syslog_tag_mysqld_safe=mysqld_safe @@ -20,7 +20,7 @@ Reviewed-by: Nicholas Bamber # MySQL-specific environment variable. First off, it's not really a umask, # it's the desired mode. Second, it follows umask(2), not umask(3) in that # octal needs to be explicit. Our shell might be a proper sh without printf, -@@ -169,7 +166,7 @@ +@@ -171,7 +168,7 @@ # sed buffers output (only GNU sed supports a -u (unbuffered) option) # which means that messages may not get sent to syslog until the # mysqld process quits. @@ -29,7 +29,7 @@ Reviewed-by: Nicholas Bamber ;; *) echo "Internal program error (non-fatal):" \ -@@ -891,6 +888,13 @@ +@@ -897,6 +894,13 @@ fi # diff --git a/mysql-wsrep-5.6/CMakeLists.txt b/mysql-wsrep-5.6/CMakeLists.txt index fb2bd6c5..f14764dd 100644 --- a/mysql-wsrep-5.6/CMakeLists.txt +++ b/mysql-wsrep-5.6/CMakeLists.txt @@ -315,6 +315,36 @@ IF (ENABLE_GPROF AND NOT WIN32 AND NOT APPLE) "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -pg") ENDIF() +IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + OPTION(REPRODUCIBLE_BUILD "Take extra pains to make build result independent of build location and time" OFF) +ENDIF() +IF(REPRODUCIBLE_BUILD) + SET(DEBUG_PREFIX_FLAGS + "-fdebug-prefix-map=${CMAKE_SOURCE_DIR}/=./ -fdebug-prefix-map=${CMAKE_CURRENT_BINARY_DIR}=./obj") + + # See if -fdebug-prefix= commands are included in the debug output, + # making the build unreproducible with switches recorded. + # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69821. + EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -g3 -x c -S -fdebug-prefix-map=foo=bar -o - - + INPUT_FILE /dev/null OUTPUT_VARIABLE DEBUG_PREFIX_MAP_RESULT) + IF(DEBUG_PREFIX_MAP_RESULT MATCHES "foo=bar") + SET(DEBUG_PREFIX_FLAGS "${DEBUG_PREFIX_FLAGS} -gno-record-gcc-switches") + ENDIF() + + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_PREFIX_FLAGS}") + SET(CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${DEBUG_PREFIX_FLAGS}") + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_PREFIX_FLAGS}") + SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${DEBUG_PREFIX_FLAGS}") + + SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--build-id=none") + SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--build-id=none") + + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE + "${CMAKE_SOURCE_DIR}/scripts/invoke-with-relative-paths.pl") +ENDIF() + OPTION(ENABLED_LOCAL_INFILE "If we should should enable LOAD DATA LOCAL by default" ${IF_WIN}) MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE) diff --git a/mysql-wsrep-5.6/VERSION b/mysql-wsrep-5.6/VERSION index 8a458099..134a0125 100644 --- a/mysql-wsrep-5.6/VERSION +++ b/mysql-wsrep-5.6/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=6 -MYSQL_VERSION_PATCH=36 +MYSQL_VERSION_PATCH=37 MYSQL_VERSION_EXTRA= diff --git a/mysql-wsrep-5.6/client/mysql.cc b/mysql-wsrep-5.6/client/mysql.cc index 6f725df4..71fba6a9 100644 --- a/mysql-wsrep-5.6/client/mysql.cc +++ b/mysql-wsrep-5.6/client/mysql.cc @@ -151,7 +151,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0, default_pager_set= 0, opt_sigint_ignore= 0, auto_vertical_output= 0, show_warnings= 0, executing_query= 0, interrupted_query= 0, - ignore_spaces= 0; + ignore_spaces= 0, opt_binhex= 0; static my_bool debug_info_flag, debug_check_flag; static my_bool column_types_flag; static my_bool preserve_comments= 0; @@ -1567,6 +1567,8 @@ static struct my_option my_long_options[] = {"bind-address", 0, "IP address to bind to.", (uchar**) &opt_bind_addr, (uchar**) &opt_bind_addr, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex, + 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -3690,6 +3692,39 @@ print_field_types(MYSQL_RES *result) tee_puts("", PAGER); } +/* Used to determine if we should invoke print_as_hex for this field */ + +static bool +is_binary_field(MYSQL_FIELD *field) +{ + if ((field->charsetnr == 63) && + (field->type == MYSQL_TYPE_BIT || + field->type == MYSQL_TYPE_BLOB || + field->type == MYSQL_TYPE_LONG_BLOB || + field->type == MYSQL_TYPE_MEDIUM_BLOB || + field->type == MYSQL_TYPE_TINY_BLOB || + field->type == MYSQL_TYPE_VAR_STRING || + field->type == MYSQL_TYPE_STRING || + field->type == MYSQL_TYPE_VARCHAR || + field->type == MYSQL_TYPE_GEOMETRY)) + return 1; + return 0; +} + + +/* Print binary value as hex literal (0x ...) */ + +static void +print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send) +{ + const char *ptr= str, *end= ptr+len; + ulong i; + fprintf(output_file, "0x"); + for(; ptr < end; ptr++) + fprintf(output_file, "%02X", *((uchar*)ptr)); + for (i= 2*len+2; i < total_bytes_to_send; i++) + tee_putc((int)' ', output_file); +} static void print_table_data(MYSQL_RES *result) @@ -3719,7 +3754,9 @@ print_table_data(MYSQL_RES *result) length= max(length, field->max_length); if (length < 4 && !IS_NOT_NULL(field->flags)) length=4; // Room for "NULL" - field->max_length=length; + if (opt_binhex && is_binary_field(field)) + length= 2 + length * 2; + field->max_length=(ulong) length; separator.fill(separator.length()+length+2,'-'); separator.append('+'); } @@ -3786,9 +3823,11 @@ print_table_data(MYSQL_RES *result) many extra padding-characters we should send with the printing function. */ visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length); - extra_padding= data_length - visible_length; + extra_padding= (uint) (data_length - visible_length); - if (field_max_length > MAX_COLUMN_LENGTH) + if (opt_binhex && is_binary_field(field)) + print_as_hex(PAGER, cur[off], lengths[off], field_max_length); + else if (field_max_length > MAX_COLUMN_LENGTH) tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE); else { @@ -3914,11 +3953,15 @@ print_table_data_html(MYSQL_RES *result) if (interrupted_query) break; ulong *lengths=mysql_fetch_lengths(result); + field= mysql_fetch_fields(result); (void) tee_fputs("", PAGER); for (uint i=0; i < mysql_num_fields(result); i++) { (void) tee_fputs("", PAGER); - xmlencode_print(cur[i], lengths[i]); + if (opt_binhex && is_binary_field(&field[i])) + print_as_hex(PAGER, cur[i], lengths[i], lengths[i]); + else + xmlencode_print(cur[i], lengths[i]); (void) tee_fputs("", PAGER); } (void) tee_fputs("", PAGER); @@ -3926,7 +3969,6 @@ print_table_data_html(MYSQL_RES *result) (void) tee_fputs("", PAGER); } - static void print_table_data_xml(MYSQL_RES *result) { @@ -3954,7 +3996,10 @@ print_table_data_xml(MYSQL_RES *result) if (cur[i]) { tee_fprintf(PAGER, "\">"); - xmlencode_print(cur[i], lengths[i]); + if (opt_binhex && is_binary_field(&fields[i])) + print_as_hex(PAGER, cur[i], lengths[i], lengths[i]); + else + xmlencode_print(cur[i], lengths[i]); tee_fprintf(PAGER, "\n"); } else @@ -3999,7 +4044,10 @@ print_table_data_vertically(MYSQL_RES *result) tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name); if (cur[off]) { - tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB); + if (opt_binhex && is_binary_field(field)) + print_as_hex(PAGER, cur[off], lengths[off], lengths[off]); + else + tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB); tee_putc('\n', PAGER); } else @@ -4108,11 +4156,21 @@ print_tab_data(MYSQL_RES *result) while ((cur = mysql_fetch_row(result))) { lengths=mysql_fetch_lengths(result); - safe_put_field(cur[0],lengths[0]); + + field= mysql_fetch_fields(result); + if (opt_binhex && is_binary_field(&field[0])) + print_as_hex(PAGER, cur[0], lengths[0], lengths[0]); + else + safe_put_field(cur[0],lengths[0]); + for (uint off=1 ; off < mysql_num_fields(result); off++) { (void) tee_fputs("\t", PAGER); - safe_put_field(cur[off], lengths[off]); + + if (opt_binhex && field && is_binary_field(&field[off])) + print_as_hex(PAGER, cur[off], lengths[off], lengths[off]); + else + safe_put_field(cur[off], lengths[off]); } (void) tee_fputs("\n", PAGER); } @@ -4488,10 +4546,9 @@ com_use(String *buffer MY_ATTRIBUTE((unused)), char *line) memset(buff, 0, sizeof(buff)); /* - In case number of quotes exceed 2, we try to get - the normalized db name. + In case of quotes used, try to get the normalized db name. */ - if (get_quote_count(line) > 2) + if (get_quote_count(line) > 0) { if (normalize_dbname(line, buff, sizeof(buff))) return put_error(&mysql); @@ -4709,11 +4766,13 @@ char *get_arg(char *line, my_bool get_next_arg) static int get_quote_count(const char *line) { - int quote_count; - const char *ptr= line; + int quote_count= 0; + const char *quote= line; - for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`")) - quote_count ++; + while ((quote= strpbrk(quote, "'`\"")) != NULL) { + quote_count++; + quote++; + } return quote_count; } diff --git a/mysql-wsrep-5.6/client/mysqlbinlog.cc b/mysql-wsrep-5.6/client/mysqlbinlog.cc index 9cbd4cf5..6adb5872 100644 --- a/mysql-wsrep-5.6/client/mysqlbinlog.cc +++ b/mysql-wsrep-5.6/client/mysqlbinlog.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -68,6 +68,21 @@ using std::max; #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) +/** + The function represents Log_event delete wrapper + to reset possibly active temp_buf member. + It's to be invoked in context where the member is + not bound with dynamically allocated memory and therefore can + be reset as simple as with plain assignment to NULL. + + @param ev a pointer to Log_event instance +*/ +inline void reset_temp_buf_and_delete(Log_event *ev) +{ + ev->temp_buf= NULL; + delete ev; +} + char server_version[SERVER_VERSION_LENGTH]; ulong filter_server_id = 0; /* @@ -2408,6 +2423,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, if ((rev->ident_len != logname_len) || memcmp(rev->new_log_ident, logname, logname_len)) { + reset_temp_buf_and_delete(rev); DBUG_RETURN(OK_CONTINUE); } /* @@ -2416,6 +2432,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, log. If we are running with to_last_remote_log, we print it, because it serves as a useful marker between binlogs then. */ + reset_temp_buf_and_delete(rev); continue; } /* @@ -2446,6 +2463,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, MYF(MY_WME)))) { error("Could not create log file '%s'", log_file_name); + reset_temp_buf_and_delete(ev); DBUG_RETURN(ERROR_STOP); } DBUG_EXECUTE_IF("simulate_result_file_write_error_for_FD_event", @@ -2454,6 +2472,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, BIN_LOG_HEADER_SIZE, MYF(MY_NABP))) { error("Could not write into log file '%s'", log_file_name); + reset_temp_buf_and_delete(ev); DBUG_RETURN(ERROR_STOP); } /* @@ -2486,10 +2505,9 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, retval= ERROR_STOP; } if (ev) - { - ev->temp_buf=0; - delete ev; - } + reset_temp_buf_and_delete(ev); + /* Flush result_file after every event */ + fflush(result_file); } else { @@ -2507,7 +2525,10 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, File file; if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0) + { + reset_temp_buf_and_delete(ev); DBUG_RETURN(ERROR_STOP); + } retval= process_event(print_event_info, ev, old_off, logname); if (retval != OK_CONTINUE) diff --git a/mysql-wsrep-5.6/include/byte_order_generic_x86.h b/mysql-wsrep-5.6/include/byte_order_generic_x86.h index 95f9ecb9..d69541e4 100644 --- a/mysql-wsrep-5.6/include/byte_order_generic_x86.h +++ b/mysql-wsrep-5.6/include/byte_order_generic_x86.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,17 +27,9 @@ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (*((long *) (A))) #define uint2korr(A) (*((uint16 *) (A))) -/* - Attention: Please, note, uint3korr reads 4 bytes (not 3)! - It means, that you have to provide enough allocated space. -*/ -#if defined(HAVE_purify) && !defined(_WIN32) #define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16)) -#else -#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF) -#endif #define uint4korr(A) (*((uint32 *) (A))) #define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ diff --git a/mysql-wsrep-5.6/include/byte_order_generic_x86_64.h b/mysql-wsrep-5.6/include/byte_order_generic_x86_64.h index 72d9657a..c99c60c3 100644 --- a/mysql-wsrep-5.6/include/byte_order_generic_x86_64.h +++ b/mysql-wsrep-5.6/include/byte_order_generic_x86_64.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,17 +27,9 @@ ((uint32) (uchar) (A)[0]))) #define sint4korr(A) (int32) (*((int32 *) (A))) #define uint2korr(A) (uint16) (*((uint16 *) (A))) -/* - Attention: Please, note, uint3korr reads 4 bytes (not 3)! - It means, that you have to provide enough allocated space. -*/ -#if defined(HAVE_purify) && !defined(_WIN32) #define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ (((uint32) ((uchar) (A)[2])) << 16)) -#else -#define uint3korr(A) (uint32) (*((unsigned int *) (A)) & 0xFFFFFF) -#endif #define uint4korr(A) (uint32) (*((uint32 *) (A))) #define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\ (((uint32) ((uchar) (A)[1])) << 8) +\ diff --git a/mysql-wsrep-5.6/include/my_sys.h b/mysql-wsrep-5.6/include/my_sys.h index fa1203b4..b228d649 100644 --- a/mysql-wsrep-5.6/include/my_sys.h +++ b/mysql-wsrep-5.6/include/my_sys.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,6 +49,7 @@ typedef struct my_aio_result { #ifdef _WIN32 #include /*for alloca*/ #endif +#include #define MY_INIT(name) { my_progname= name; my_init(); } @@ -512,6 +513,16 @@ typedef struct st_io_cache /* Used when cacheing files */ typedef int (*qsort2_cmp)(const void *, const void *, const void *); +/* + Subset of struct stat fields filled by stat/lstat/fstat that uniquely + identify a file +*/ +typedef struct st_file_id +{ + dev_t st_dev; + ino_t st_ino; +} ST_FILE_ID; + typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...) ATTRIBUTE_FORMAT_FPTR(printf, 2, 3); @@ -591,8 +602,9 @@ extern File my_create(const char *FileName,int CreateFlags, extern int my_close(File Filedes,myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); extern int my_readlink(char *to, const char *filename, myf MyFlags); -extern int my_is_symlink(const char *filename); +extern int my_is_symlink(const char *filename, ST_FILE_ID *file_id); extern int my_realpath(char *to, const char *filename, myf MyFlags); +extern int my_is_same_file(File file, const ST_FILE_ID *file_id); extern File my_create_with_symlink(const char *linkname, const char *filename, int createflags, int access_flags, myf MyFlags); diff --git a/mysql-wsrep-5.6/libmysql/libmysql.c b/mysql-wsrep-5.6/libmysql/libmysql.c index e57d95a0..64ed5e86 100644 --- a/mysql-wsrep-5.6/libmysql/libmysql.c +++ b/mysql-wsrep-5.6/libmysql/libmysql.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -4726,10 +4726,14 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt) mysql->status= MYSQL_STATUS_READY; } int4store(buff, stmt->stmt_id); - if ((rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt))) - { - set_stmt_errmsg(stmt, &mysql->net); - } + /* + If stmt_command failed, it would have already raised + error using set_mysql_error. Caller should use + mysql_error() or mysql_errno() to find out details. + Memory allocated for stmt will be released regardless + of the error. + */ + rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt); } } diff --git a/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc new file mode 100644 index 00000000..787e82d2 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc @@ -0,0 +1,123 @@ +############################################################################### +# This .inc is used to check coordinator behaviour of scheduling an event +# when the new event cannot be placed into worker's queue due to size limit +# (SLAVE_PENDING_JOBS_SIZE_MAX) +# +# Usage: +# --let $table_to_lock=db1.t +# --let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES ('small event') +# --let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max)) +# --let $tables_involved_in_test=db1.t, db2.t +# --source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc +# +# Parameters: +# +# $table_to_lock: +# Provide full table name that needs to be locked using LOCK TABLE. +# Eg: --let $table_to_lock=db1.t +# +# $query_that_waits_on_table_lock: +# A query that cannot be executed due the lock acquired by LOCK TABLE. +# Eg: --let $table_to_lock=db1.t +# --let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES ('small event') +# +# $query_that_needs_to_be_processed_by_coordinator: +# A query that will be processed by coordinator only after +# $query_that_waits_on_table_lock is completely executed due to size limit +# (SLAVE_PENDING_JOBS_SIZE_MAX) +# --let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max)) +# +# $tables_involved_in_test: +# Tables that are involved in the test. This list will be used to do diff +# between master and slave's tables to test that replication worked fine. +# Eg: --let $tables_involved_in_test=db1.t, db2.t +# +############################################################################### + +if (!$table_to_lock) +{ + --die ERROR IN TEST: you must set $table_to_lock before sourcing rpl_mts_pending_events.inc. +} +if (!$query_that_waits_on_table_lock) +{ + --die ERROR IN TEST: you must set $query_that_waits_on_table_lock before sourcing rpl_mts_pending_events.inc. +} +if (!$query_that_needs_to_be_processed_by_coordinator) +{ + --die ERROR IN TEST: you must set $query_that_needs_to_be_processed_by_coordinator before sourcing rpl_mts_pending_events.inc. +} +if (!$tables_involved_in_test) +{ + --die ERROR IN TEST: you must set $tables_involved_in_test before sourcing rpl_mts_pending_events.inc. +} + +--echo # +--echo # 1) On Slave, lock one table so that any operation on that +--echo # will be waiting for the lock to be released. +--echo # +--source include/rpl_connection_slave1.inc +--eval LOCK TABLE $table_to_lock WRITE + +--echo # +--echo # 2) Execute query that is going to wait for the table lock. +--echo # +--source include/rpl_connection_master.inc +--eval $query_that_waits_on_table_lock + +--echo # +--echo # 3) Wait on Slave till a worker picks this event and wait for the +--echo # lock (which is acquired in step 1) +--echo # +--source include/rpl_connection_slave.inc +--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for table metadata lock" +--source include/wait_condition.inc + +--echo # +--echo # 4) Now on Master, insert another query that reaches slave. +--echo # +--source include/rpl_connection_master.inc +--eval $query_that_needs_to_be_processed_by_coordinator + +--echo # +--echo # 5) Check that Coordinator waits for the query (at step 2) to be +--echo # executed before dedicating this new query (at step 4) to +--echo # one of the workers because of the event size limits. +--echo # +--source include/rpl_connection_slave.inc +--let $assert_text= Check that one of the applier worker thread is waiting for the table metadata lock. +--let $assert_cond= [SELECT count(*) FROM information_schema.processlist WHERE state = "Waiting for table metadata lock"] = 1 +--source include/assert.inc + +--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for Slave Workers to free pending events" +--source include/wait_condition.inc + +--echo # +--echo # 6) Release the lock acquired in step 1, so that first query will +--echo # continue it's work and once it is done, second big event +--echo # will also continue it's work. +--echo # +--source include/rpl_connection_slave1.inc +UNLOCK TABLES; + +--echo # +--echo # 7) check that slave is able to catch up with master after releasing the +--echo # lock in step 6. +--echo # +--echo # 7.1) Sync SQL thread with Master. +--echo # +--source include/rpl_connection_master.inc +--source include/sync_slave_sql_with_master.inc + +--echo # +--echo # 7.2) Diff all the tables involved in the test to prove +--echo # that replication worked fine. +--echo # +--let $number_of_tables_involved_in_test=`SELECT LENGTH('$tables_involved_in_test') - LENGTH(REPLACE('$tables_involved_in_test',',','')) + 1` +--let $t=1 +while ($t <= $number_of_tables_involved_in_test) +{ + --let $table= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('$tables_involved_in_test', ',', $t), ',', -1 )` + --let $diff_tables= master:$table,slave:$table + --source include/diff_tables.inc + --inc $t +} diff --git a/mysql-wsrep-5.6/mysql-test/lib/My/ConfigFactory.pm b/mysql-wsrep-5.6/mysql-test/lib/My/ConfigFactory.pm index fca7f9d1..fbec1820 100644 --- a/mysql-wsrep-5.6/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-wsrep-5.6/mysql-test/lib/My/ConfigFactory.pm @@ -1,5 +1,5 @@ # -*- cperl -*- -# Copyright (c) 2007, 2011, Oracle and/or its affiliates +# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -363,6 +363,7 @@ my @mysqltest_rules= my @mysqlbinlog_rules= ( { 'character-sets-dir' => \&fix_charset_dir }, + { 'local-load' => sub { return shift->{ARGS}->{tmpdir}; } }, ); diff --git a/mysql-wsrep-5.6/mysql-test/mysql-test-run.pl b/mysql-wsrep-5.6/mysql-test/mysql-test-run.pl index 3be4e294..effc86fc 100755 --- a/mysql-wsrep-5.6/mysql-test/mysql-test-run.pl +++ b/mysql-wsrep-5.6/mysql-test/mysql-test-run.pl @@ -2550,6 +2550,17 @@ sub environment_setup { "$basedir/storage/myisam/myisampack", "$basedir/myisam/myisampack")); + # ---------------------------------------------------- + # mysqlaccess + # ---------------------------------------------------- + my $mysqlaccess= + mtr_pl_maybe_exists("$bindir/scripts/mysqlaccess") || + mtr_pl_maybe_exists("$path_client_bindir/mysqlaccess"); + if ($mysqlaccess) + { + $ENV{'MYSQLACCESS'}= $mysqlaccess; + } + # ---------------------------------------------------- # mysqlhotcopy # ---------------------------------------------------- @@ -5240,13 +5251,26 @@ sub mysqld_arguments ($$$) { my $found_skip_core= 0; my $found_no_console= 0; my $found_log_error= 0; + + # On windows, do not add console if log-error found in .cnf file + open (CONFIG_FILE, " < $path_config_file") or + die("Could not open output file $path_config_file"); + + while () + { + if (m/^log[-_]error/) + { + $found_log_error= 1; + } + } + close (CONFIG_FILE); + foreach my $arg ( @$extra_opts ) { # Skip --defaults-file option since it's handled above. next if $arg =~ /^--defaults-file/; - - if ($arg eq "--log-error") + if ($arg =~ /^--log[-_]error/) { $found_log_error= 1; } diff --git a/mysql-wsrep-5.6/mysql-test/r/binary_to_hex.result b/mysql-wsrep-5.6/mysql-test/r/binary_to_hex.result new file mode 100644 index 00000000..a6b68834 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/binary_to_hex.result @@ -0,0 +1,117 @@ +USE test; +DROP TABLE IF EXISTS t1, t2; +CREATE TABLE t1 (c1 TINYBLOB, +c2 BLOB, +c3 MEDIUMBLOB, +c4 LONGBLOB, +c5 TEXT, +c6 BIT(1), +c7 CHAR, +c8 VARCHAR(10), +c9 GEOMETRY) CHARACTER SET = binary; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` tinyblob, + `c2` blob, + `c3` mediumblob, + `c4` longblob, + `c5` blob, + `c6` bit(1) DEFAULT NULL, + `c7` binary(1) DEFAULT NULL, + `c8` varbinary(10) DEFAULT NULL, + `c9` geometry DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=binary +INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable', +'mediumblob-text readable', 'longblob-text readable', +'text readable', b'1', 'c', 'variable', +POINT(1, 1)); +CREATE TABLE t2(id int, `col1` binary(10),`col2` blob); +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) DEFAULT NULL, + `col1` binary(10) DEFAULT NULL, + `col2` blob +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF'); +#Print the table contents when binary-as-hex option is off. +SELECT * FROM t1; +c1 c2 c3 c4 c5 c6 c7 c8 c9 +tinyblob-text readable blob-text readable mediumblob-text readable longblob-text readable text readable # c variable # +SELECT * FROM t2; +id col1 col2 +1 # # +2 # # +#Print the table contents after turning on the binary-as-hex option + +#Print the table contents in tab format + +c1 c2 c3 c4 c5 c6 c7 c8 c9 +0x74696E79626C6F622D74657874207265616461626C65 0x626C6F622D74657874207265616461626C65 0x6D656469756D626C6F622D74657874207265616461626C65 0x6C6F6E67626C6F622D74657874207265616461626C65 0x74657874207265616461626C65 0x01 0x63 0x7661726961626C65 0x000000000101000000000000000000F03F000000000000F03F +id col1 col2 +1 0xAB123400000000000000 0x123ABC +2 0xDE123400000000000000 0x123DEF + +#Print the table contents in table format + ++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+ +| c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 | ++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+ +| 0x74696E79626C6F622D74657874207265616461626C65 | 0x626C6F622D74657874207265616461626C65 | 0x6D656469756D626C6F622D74657874207265616461626C65 | 0x6C6F6E67626C6F622D74657874207265616461626C65 | 0x74657874207265616461626C65 | 0x01 | 0x63 | 0x7661726961626C65 | 0x000000000101000000000000000000F03F000000000000F03F | ++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+ ++------+------------------------+------------+ +| id | col1 | col2 | ++------+------------------------+------------+ +| 1 | 0xAB123400000000000000 | 0x123ABC | ++------+------------------------+------------+ + +#Print the table contents vertically + +*************************** 1. row *************************** +c1: 0x74696E79626C6F622D74657874207265616461626C65 +c2: 0x626C6F622D74657874207265616461626C65 +c3: 0x6D656469756D626C6F622D74657874207265616461626C65 +c4: 0x6C6F6E67626C6F622D74657874207265616461626C65 +c5: 0x74657874207265616461626C65 +c6: 0x01 +c7: 0x63 +c8: 0x7661726961626C65 +c9: 0x000000000101000000000000000000F03F000000000000F03F + +#Print the table contents in xml format + + + + + + 0x74696E79626C6F622D74657874207265616461626C65 + 0x626C6F622D74657874207265616461626C65 + 0x6D656469756D626C6F622D74657874207265616461626C65 + 0x6C6F6E67626C6F622D74657874207265616461626C65 + 0x74657874207265616461626C65 + 0x01 + 0x63 + 0x7661726961626C65 + 0x000000000101000000000000000000F03F000000000000F03F + + + + + + + 1 + 0xAB123400000000000000 + 0x123ABC + + + + 2 + 0xDE123400000000000000 + 0x123DEF + + + +#Print the table contents in html format + +
c1c2c3c4c5c6c7c8c9
0x74696E79626C6F622D74657874207265616461626C650x626C6F622D74657874207265616461626C650x6D656469756D626C6F622D74657874207265616461626C650x6C6F6E67626C6F622D74657874207265616461626C650x74657874207265616461626C650x010x630x7661726961626C650x000000000101000000000000000000F03F000000000000F03F
idcol1col2
10xAB1234000000000000000x123ABC
20xDE1234000000000000000x123DEF
DROP TABLE t1, t2; diff --git a/mysql-wsrep-5.6/mysql-test/r/query_cache.result b/mysql-wsrep-5.6/mysql-test/r/query_cache.result index 495e87a2..8913514b 100644 --- a/mysql-wsrep-5.6/mysql-test/r/query_cache.result +++ b/mysql-wsrep-5.6/mysql-test/r/query_cache.result @@ -1864,5 +1864,62 @@ fld1 200 #cleanup DROP DATABASE `db-db`; +# +#Bug #25943038: QUERY WITH DERIVED TABLE IS CACHED IN MVCC SCENARIO +# +use test; +CREATE TABLE t1(i1 INT, i2 INT, v3 VARCHAR(20)) ENGINE=INNODB; +SET @qc= @@query_cache_size; +SET GLOBAL query_cache_size=16777216; +SELECT @@query_cache_size, @@query_cache_type; +@@query_cache_size @@query_cache_type +16777216 ON +connection con1; +START TRANSACTION; +INSERT INTO t1 VALUES(1,1,'a'),(2,1,'b'),(3,2,'c'),(4,2,'d'); +connection con2; +SHOW GLOBAL STATUS LIKE 'qcache%cache%'; +Variable_name Value +Qcache_not_cached 7 +Qcache_queries_in_cache 0 +SELECT * FROM t1; +i1 i2 v3 +SELECT * FROM (SELECT i2,SUM(i1) FROM t1 GROUP BY i2) b; +i2 SUM(i1) +SHOW GLOBAL STATUS LIKE 'qcache%cache%'; +Variable_name Value +Qcache_not_cached 9 +Qcache_queries_in_cache 0 +connection con1; +SHOW GLOBAL STATUS LIKE 'qcache%cache%'; +Variable_name Value +Qcache_not_cached 9 +Qcache_queries_in_cache 0 +commit; +connection con2; +SHOW GLOBAL STATUS LIKE 'qcache%cache%'; +Variable_name Value +Qcache_not_cached 9 +Qcache_queries_in_cache 0 +SELECT * FROM t1; +i1 i2 v3 +1 1 a +2 1 b +3 2 c +4 2 d +SELECT * FROM (SELECT * FROM t1) a; +i1 i2 v3 +1 1 a +2 1 b +3 2 c +4 2 d +SELECT * FROM (SELECT i2,SUM(i1) FROM t1 GROUP BY i2) b; +i2 SUM(i1) +1 3 +2 7 +disconnect con1; +disconnect con2; +connection default; +DROP TABLE t1; SET GLOBAL query_cache_size = @query_cache_size.saved; # diff --git a/mysql-wsrep-5.6/mysql-test/r/show_processlist_state.result b/mysql-wsrep-5.6/mysql-test/r/show_processlist_state.result new file mode 100644 index 00000000..d9aabc1f --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/r/show_processlist_state.result @@ -0,0 +1,4 @@ +"Test SHOW PROCESSLIST, column INFO" +show processlist; +Id User Host db Command Time State Info +ID root HOST test Query TIME init show processlist diff --git a/mysql-wsrep-5.6/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw.result b/mysql-wsrep-5.6/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw.result new file mode 100644 index 00000000..a7ecfaf7 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/binlog/r/binlog_mysqlbinlog_raw.result @@ -0,0 +1,20 @@ +RESET MASTER; +include/stop_dump_threads.inc +# Step-1: Execute some dummy statements. +CREATE TABLE t1(i int); +INSERT INTO t1 values (1); +# Step-2: Execute MYSQL_BINLOG with --stop-never and --raw option. +# Step-3: Wait till dump thread transfer is completed. +# Step-4: copy binary log file that is downloaded till now before +# stopping dump thread that is serving mysqlbinlog +# --stop-never process. +# Step-5: kill the dump thread serving the mysqlbinlog --stop-never process +include/stop_dump_threads.inc +# Step-6: Cleanup the data, so that it is ready for reapply. +DROP TABLE t1; +RESET MASTER; +# Step-7: Apply the data that we got from --stop-never process. +# Step-8: Check that the data is there. +include/assert.inc [Check the table t1 exists and contains one tuple with value 1.] +# Step-9: Cleanup +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/suite/binlog/r/binlog_use_gtid_skip.result b/mysql-wsrep-5.6/mysql-test/suite/binlog/r/binlog_use_gtid_skip.result new file mode 100644 index 00000000..889d84e8 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/binlog/r/binlog_use_gtid_skip.result @@ -0,0 +1,16 @@ +# +# 1. Apply some data on server. +# +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +# +# 2. Check that a SQL file with already logged transactions +# is correctly skipped when is replayed. +# +FLUSH LOGS; +# +# 3. Clean up. +# +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw.test b/mysql-wsrep-5.6/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw.test new file mode 100644 index 00000000..d91a2e55 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/binlog/t/binlog_mysqlbinlog_raw.test @@ -0,0 +1,77 @@ +############################################################################### +# Bug#24609402 MYSQLBINLOG --RAW DOES NOT GET ALL LATEST EVENTS +# +# Problem: When mysqlbinlog is used with --raw option, output file +# is not getting flushed till the process is completed. +# With --stop-never option (mysqlbinlog process never completes), +# output file will never contain any event. +# +# Steps to reproduce: +# 1) Execute some dummy statements(a create and an insert). +# 2) Execute MYSQL_BINLOG with --stop-never and --raw option +# and backup the binlog content. +# 3) Wait till server dump thread transfers all the data. +# 4) Copy binary log file that is downloaded till now before +# stopping dump thread that is serving mysqlbinlog +# --stop-never process. +# 5) kill the dump thread (serving the mysqlbinlog process). +# 6) Clean up the data on the server (a drop and a reset). +# 7) Apply binlog content (binlog from Step-2). +# 8) Check that table and the data in it exists (data from step-1). +# 9) Cleanup the server. +############################################################################### + +# Running MYSQL_BINLOG in a separate shell does not work properly in windows +# due to MTR limitation. +--source include/not_windows.inc + +# Test is not specific to any binlog format. Hence Running only for 'row'. +--source include/have_binlog_format_row.inc + +# binlog file name is needed in the test. To use master-bin.000001, +# RESET MASTER is needed. +RESET MASTER; +# kill the dump threads if there any dump threads (may be from previous test) +--source include/stop_dump_threads.inc + +--echo # Step-1: Execute some dummy statements. +CREATE TABLE t1(i int); +INSERT INTO t1 values (1); + +--echo # Step-2: Execute MYSQL_BINLOG with --stop-never and --raw option. +--write_file $MYSQL_TMP_DIR/mysqlbinlog_raw.sh +#!/bin/bash +(`$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQL_TMP_DIR/ master-bin.000001`) < /dev/null > /dev/null 2>&1 & +EOF +--chmod 0755 $MYSQL_TMP_DIR/mysqlbinlog_raw.sh +--exec $MYSQL_TMP_DIR/mysqlbinlog_raw.sh + +--echo # Step-3: Wait till dump thread transfer is completed. +let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%'; +--source include/wait_condition.inc + +--echo # Step-4: copy binary log file that is downloaded till now before +--echo # stopping dump thread that is serving mysqlbinlog +--echo # --stop-never process. +--copy_file $MYSQL_TMP_DIR/master-bin.000001 $MYSQL_TMP_DIR/master-bin-back_up_file.000001 + +--echo # Step-5: kill the dump thread serving the mysqlbinlog --stop-never process +--source include/stop_dump_threads.inc + +--echo # Step-6: Cleanup the data, so that it is ready for reapply. +DROP TABLE t1; +RESET MASTER; + +--echo # Step-7: Apply the data that we got from --stop-never process. +--exec $MYSQL_BINLOG $MYSQL_TMP_DIR/master-bin-back_up_file.000001 | $MYSQL --user=root --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT + +--echo # Step-8: Check that the data is there. +--let $assert_text= Check the table t1 exists and contains one tuple with value 1. +--let $assert_cond= [SELECT COUNT(*) AS Val FROM t1 WHERE i = 1, Val, 1] = 1 +--source include/assert.inc + +--echo # Step-9: Cleanup +DROP TABLE t1; +--remove_file $MYSQL_TMP_DIR/mysqlbinlog_raw.sh +--remove_file $MYSQL_TMP_DIR/master-bin.000001 +--remove_file $MYSQL_TMP_DIR/master-bin-back_up_file.000001 diff --git a/mysql-wsrep-5.6/mysql-test/suite/binlog/t/binlog_use_gtid_skip.test b/mysql-wsrep-5.6/mysql-test/suite/binlog/t/binlog_use_gtid_skip.test new file mode 100644 index 00000000..b6f52b06 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/binlog/t/binlog_use_gtid_skip.test @@ -0,0 +1,35 @@ +# ==== Purpose ==== +# +# This test will check that mysql client program is able to apply +# GTID skipped transactions without errors in the "use ``" +# statements. +# +# ==== Related Bugs and Worklogs ==== +# +# BUG#26128931 USE `DATABASE` STATEMENT FAILS INSIDE GTID SKIPPED TRANSACTION +# +--source include/have_gtid.inc + +--echo # +--echo # 1. Apply some data on server. +--echo # +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); + +--echo # +--echo # 2. Check that a SQL file with already logged transactions +--echo # is correctly skipped when is replayed. +--echo # +--let $MYSQLD_DATADIR= `SELECT @@DATADIR` +--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/binlog_gtid_set_gtid_next.sql +--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/binlog_gtid_set_gtid_next.sql +--remove_file $MYSQLTEST_VARDIR/tmp/binlog_gtid_set_gtid_next.sql + +--echo # +--echo # 3. Clean up. +--echo # +DROP TABLE t1; diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/r/innodb_copy_col_in_partition.result b/mysql-wsrep-5.6/mysql-test/suite/innodb/r/innodb_copy_col_in_partition.result new file mode 100644 index 00000000..c14b3397 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/innodb/r/innodb_copy_col_in_partition.result @@ -0,0 +1,26 @@ +CREATE TABLE t (id INT, a INT, b INT, KEY (a), KEY (b)) ENGINE=INNODB +PARTITION BY HASH (id) PARTITIONS 10; +insert into t values (0,4,1); +insert into t values (6,2,5); +insert into t values (6,7,5); +insert into t values (2,4,6); +insert into t values (3,5,6); +insert into t values (1,3,9); +insert into t values (1,3,9); +insert into t values (3,4,6); +insert into t values (4,4,6); +EXPLAIN SELECT SQL_NO_CACHE COUNT(*) FROM t WHERE a=4 AND b=6; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index_merge a,b a,b 5,5 NULL 7 Using intersect(a,b); Using where; Using index +EXPLAIN SELECT SQL_NO_CACHE a,b FROM t WHERE a=4 AND b=6; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t index_merge a,b a,b 5,5 NULL 7 Using intersect(a,b); Using where; Using index +SELECT SQL_NO_CACHE * FROM t WHERE a=4 AND b=6 ORDER BY id; +id a b +2 4 6 +3 4 6 +4 4 6 +SELECT SQL_NO_CACHE COUNT(*) FROM t WHERE a=4 AND b=6; +COUNT(*) +3 +DROP TABLE t; diff --git a/mysql-wsrep-5.6/mysql-test/suite/innodb/t/innodb_copy_col_in_partition.test b/mysql-wsrep-5.6/mysql-test/suite/innodb/t/innodb_copy_col_in_partition.test new file mode 100644 index 00000000..cc1c0395 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/innodb/t/innodb_copy_col_in_partition.test @@ -0,0 +1,21 @@ +--source include/have_innodb.inc + +CREATE TABLE t (id INT, a INT, b INT, KEY (a), KEY (b)) ENGINE=INNODB +PARTITION BY HASH (id) PARTITIONS 10; + +insert into t values (0,4,1); +insert into t values (6,2,5); +insert into t values (6,7,5); +insert into t values (2,4,6); +insert into t values (3,5,6); +insert into t values (1,3,9); +insert into t values (1,3,9); +insert into t values (3,4,6); +insert into t values (4,4,6); + +EXPLAIN SELECT SQL_NO_CACHE COUNT(*) FROM t WHERE a=4 AND b=6; +EXPLAIN SELECT SQL_NO_CACHE a,b FROM t WHERE a=4 AND b=6; +SELECT SQL_NO_CACHE * FROM t WHERE a=4 AND b=6 ORDER BY id; +SELECT SQL_NO_CACHE COUNT(*) FROM t WHERE a=4 AND b=6; + +DROP TABLE t; diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_mts_pending_max.result b/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_mts_pending_max.result new file mode 100644 index 00000000..fcc469ad --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_mts_pending_max.result @@ -0,0 +1,201 @@ +include/master-slave.inc +Warnings: +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. +Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +[connection master] +# +# 0) Set SLAVE_PENDING_JOBS_SIZE_MAX to a smaller number (1024) +# and slave_parallel_workers to 2 to make the test easy. +# +[connection slave] +SET @save.slave_pending_jobs_size_max= @@global.slave_pending_jobs_size_max; +SET @save.slave_parallel_workers= @@global.slave_parallel_workers; +SET @@GLOBAL.slave_pending_jobs_size_max= 1024; +SET @@GLOBAL.slave_parallel_workers= 2; +include/start_slave.inc +# +# +# 1) Create initial data required for the test +# (two databases (db1, db2) and two tables (db1.t and db2.t)). +# +[connection master] +CREATE DATABASE db1; +CREATE DATABASE db2; +CREATE TABLE db1.t (a TEXT) ENGINE=INNODB; +CREATE TABLE db2.t (a TEXT) ENGINE=INNODB; +include/sync_slave_sql_with_master.inc +# +# 2) Prove that Coordinator will make a big event (bigger in size than +# SLAVE_PENDING_JOBS_SIZE_MAX) wait for all workers to finish +# their work (empty their queue) before processing the big event. +# +# +# 1) On Slave, lock one table so that any operation on that +# will be waiting for the lock to be released. +# +[connection slave1] +LOCK TABLE db1.t WRITE; +# +# 2) Execute query that is going to wait for the table lock. +# +[connection master] +INSERT INTO db1.t VALUES ('small event'); +# +# 3) Wait on Slave till a worker picks this event and wait for the +# lock (which is acquired in step 1) +# +[connection slave] +# +# 4) Now on Master, insert another query that reaches slave. +# +[connection master] +INSERT INTO db2.t VALUES (REPEAT('big event', 1024)); +# +# 5) Check that Coordinator waits for the query (at step 2) to be +# executed before dedicating this new query (at step 4) to +# one of the workers because of the event size limits. +# +[connection slave] +include/assert.inc [Check that one of the applier worker thread is waiting for the table metadata lock.] +# +# 6) Release the lock acquired in step 1, so that first query will +# continue it's work and once it is done, second big event +# will also continue it's work. +# +[connection slave1] +UNLOCK TABLES; +# +# 7) check that slave is able to catch up with master after releasing the +# lock in step 6. +# +# 7.1) Sync SQL thread with Master. +# +[connection master] +include/sync_slave_sql_with_master.inc +# +# 7.2) Diff all the tables involved in the test to prove +# that replication worked fine. +# +include/diff_tables.inc [master:db1.t,slave:db1.t] +include/diff_tables.inc [master: db2.t,slave: db2.t] +# +# 3) When a big event is being processed by a worker, +# Coordinator will make smaller events to wait until the big event +# is executed completely. +# +# +# +# 1) On Slave, lock one table so that any operation on that +# will be waiting for the lock to be released. +# +[connection slave1] +LOCK TABLE db1.t WRITE; +# +# 2) Execute query that is going to wait for the table lock. +# +[connection master] +INSERT INTO db1.t VALUES (REPEAT('big event', 1024)); +# +# 3) Wait on Slave till a worker picks this event and wait for the +# lock (which is acquired in step 1) +# +[connection slave] +# +# 4) Now on Master, insert another query that reaches slave. +# +[connection master] +INSERT INTO db2.t VALUES ('small event'); +# +# 5) Check that Coordinator waits for the query (at step 2) to be +# executed before dedicating this new query (at step 4) to +# one of the workers because of the event size limits. +# +[connection slave] +include/assert.inc [Check that one of the applier worker thread is waiting for the table metadata lock.] +# +# 6) Release the lock acquired in step 1, so that first query will +# continue it's work and once it is done, second big event +# will also continue it's work. +# +[connection slave1] +UNLOCK TABLES; +# +# 7) check that slave is able to catch up with master after releasing the +# lock in step 6. +# +# 7.1) Sync SQL thread with Master. +# +[connection master] +include/sync_slave_sql_with_master.inc +# +# 7.2) Diff all the tables involved in the test to prove +# that replication worked fine. +# +include/diff_tables.inc [master:db1.t,slave:db1.t] +include/diff_tables.inc [master: db2.t,slave: db2.t] +# +# 4) When a big event is being processed by a worker, +# Coordinator will make another big event also to wait until the +# first big event is executed completely. +# +# +# 1) On Slave, lock one table so that any operation on that +# will be waiting for the lock to be released. +# +[connection slave1] +LOCK TABLE db1.t WRITE; +# +# 2) Execute query that is going to wait for the table lock. +# +[connection master] +INSERT INTO db1.t VALUES (REPEAT('big event', 1024)); +# +# 3) Wait on Slave till a worker picks this event and wait for the +# lock (which is acquired in step 1) +# +[connection slave] +# +# 4) Now on Master, insert another query that reaches slave. +# +[connection master] +INSERT INTO db2.t VALUES (REPEAT('big event', 1024)); +# +# 5) Check that Coordinator waits for the query (at step 2) to be +# executed before dedicating this new query (at step 4) to +# one of the workers because of the event size limits. +# +[connection slave] +include/assert.inc [Check that one of the applier worker thread is waiting for the table metadata lock.] +# +# 6) Release the lock acquired in step 1, so that first query will +# continue it's work and once it is done, second big event +# will also continue it's work. +# +[connection slave1] +UNLOCK TABLES; +# +# 7) check that slave is able to catch up with master after releasing the +# lock in step 6. +# +# 7.1) Sync SQL thread with Master. +# +[connection master] +include/sync_slave_sql_with_master.inc +# +# 7.2) Diff all the tables involved in the test to prove +# that replication worked fine. +# +include/diff_tables.inc [master:db1.t,slave:db1.t] +include/diff_tables.inc [master: db2.t,slave: db2.t] +# +# 5) Cleanup (drop tables/databases and reset the variables) +# +[connection master] +DROP DATABASE db1; +DROP DATABASE db2; +include/sync_slave_sql_with_master.inc +include/stop_slave_sql.inc +SET @@global.slave_pending_jobs_size_max= @save.slave_pending_jobs_size_max; +SET @@GLOBAL.slave_parallel_workers= @save.slave_parallel_workers; +include/start_slave_sql.inc +include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result b/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result new file mode 100644 index 00000000..881b86e3 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result @@ -0,0 +1,41 @@ +include/master-slave.inc +Warnings: +Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. +Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. +[connection master] +[connection master] +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1); +include/sync_slave_sql_with_master.inc +[connection slave] +include/stop_slave_sql.inc +[connection master] +FLUSH LOGS; +FLUSH LOGS; +INSERT INTO t1 (c1) VALUES (2); +include/sync_slave_io_with_master.inc +call mtr.add_suppression("File '.*slave-relay-bin."); +call mtr.add_suppression("Could not open log file"); +call mtr.add_suppression("Failed to open the relay log"); +call mtr.add_suppression("Slave failed to initialize relay log info structure"); +call mtr.add_suppression("Could not find target log file mentioned in relay log info in the index file"); +call mtr.add_suppression("Failed to initialize the relay-log-info structure"); +call mtr.add_suppression("Failed to initialize the master info structure"); +include/rpl_stop_server.inc [server_number=2] +# Removing file(s) +include/rpl_start_server.inc [server_number=2] +START SLAVE; +ERROR HY000: Slave failed to initialize relay log info structure from the repository +START SLAVE; +ERROR HY000: Slave failed to initialize relay log info structure from the repository +RESET SLAVE; +RESET MASTER; +DROP TABLE t1; +include/start_slave.inc +[connection master] +include/sync_slave_sql_with_master.inc +include/diff_tables.inc [master:t1, slave:t1] +[connection master] +DROP TABLE t1; +include/sync_slave_sql_with_master.inc +include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result b/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result index 6051a951..ac977201 100644 --- a/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result +++ b/mysql-wsrep-5.6/mysql-test/suite/rpl/r/rpl_semi_sync_uninstall_plugin.result @@ -31,7 +31,6 @@ include/stop_slave.inc SET GLOBAL rpl_semi_sync_slave_enabled = OFF; include/start_slave.inc UNINSTALL PLUGIN rpl_semi_sync_slave; -include/assert.inc [semi sync master clients should be 0.] UNINSTALL PLUGIN rpl_semi_sync_master; CREATE TABLE t1(i int); INSERT INTO t1 values (3); diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_flush_logs.test b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_flush_logs.test index a8d5dcd1..f98d0173 100644 --- a/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_flush_logs.test +++ b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_flush_logs.test @@ -4,6 +4,13 @@ # works fine. # +# "Flush" commands are logged as rotate events in the binary +# log without gtid events. So it is correct to check master +# and slave sync logic with positions instead gtids numbers. +# Hence for this test script, making use_gtids to false +# in all the cases (GTID_MODE ON or OFF). +--let $use_gtids=0 + --source include/master-slave.inc --source include/have_binlog_format_statement.inc connection master; diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_mts_pending_max.test b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_mts_pending_max.test new file mode 100644 index 00000000..938026be --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_mts_pending_max.test @@ -0,0 +1,108 @@ +############################################################################### +# Bug #21280753 MTS MUST BE ABLE HANDLE LARGE PACKETS WITH SMALL +# SLAVE_PENDING_JOBS_SIZE_MAX +# +# To prove the slave applier can apply events that are larger +# than SLAVE_PENDING_JOBS_SIZE_MAX but only one at a time. +# +# Steps to reproduce the issue: +# +# 0) Set SLAVE_PENDING_JOBS_SIZE_MAX to a smaller number (1024) +# and slave_parallel_workers to 2 to make the test easy. +# +# 1) Create initial data required for the test +# (two databases (db1, db2) and two tables (db1.t and db2.t)). +# +# 2) Prove that Coordinator will make a big event (bigger in size than +# SLAVE_PENDING_JOBS_SIZE_MAX) wait for all workers to finish +# their work (empty their queue) before processing the big event. +# +# 3) Prove that when a big event is being processed by a +# worker, Coordinator will make smaller events to wait. +# +# 4) Prove that when a big event is being processed by a +# worker, Coordinator will make another big event also to wait. +# +# 5) Cleanup (drop tables/databases and reset the variables) +# +############################################################################### + +# Row format is choosen so that event size can be changed easily. +--source include/have_binlog_format_row.inc +--let $rpl_skip_start_slave= 1 +--source include/master-slave.inc + +--echo # +--echo # 0) Set SLAVE_PENDING_JOBS_SIZE_MAX to a smaller number (1024) +--echo # and slave_parallel_workers to 2 to make the test easy. +--echo # +--source include/rpl_connection_slave.inc +SET @save.slave_pending_jobs_size_max= @@global.slave_pending_jobs_size_max; +SET @save.slave_parallel_workers= @@global.slave_parallel_workers; +--let $mts_pending_max=1024 +--eval SET @@GLOBAL.slave_pending_jobs_size_max= $mts_pending_max +--eval SET @@GLOBAL.slave_parallel_workers= 2 +--disable_warnings +--source include/start_slave.inc +--enable_warnings + +--echo # +--echo # +--echo # 1) Create initial data required for the test +--echo # (two databases (db1, db2) and two tables (db1.t and db2.t)). +--echo # +--source include/rpl_connection_master.inc +CREATE DATABASE db1; +CREATE DATABASE db2; +CREATE TABLE db1.t (a TEXT) ENGINE=INNODB; +CREATE TABLE db2.t (a TEXT) ENGINE=INNODB; +--source include/sync_slave_sql_with_master.inc + +--echo # +--echo # 2) Prove that Coordinator will make a big event (bigger in size than +--echo # SLAVE_PENDING_JOBS_SIZE_MAX) wait for all workers to finish +--echo # their work (empty their queue) before processing the big event. +--echo # +--let $table_to_lock=db1.t +--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES ('small event') +--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max)) +--let $tables_involved_in_test=db1.t, db2.t +--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc + +--echo # +--echo # 3) When a big event is being processed by a worker, +--echo # Coordinator will make smaller events to wait until the big event +--echo # is executed completely. +--echo # +--echo # +--let $table_to_lock=db1.t +--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES (REPEAT('big event', $mts_pending_max)) +--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES ('small event') +--let $tables_involved_in_test=db1.t, db2.t +--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc + +--echo # +--echo # 4) When a big event is being processed by a worker, +--echo # Coordinator will make another big event also to wait until the +--echo # first big event is executed completely. +--echo # +--let $table_to_lock=db1.t +--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES (REPEAT('big event', $mts_pending_max)) +--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max)) +--let $tables_involved_in_test=db1.t, db2.t +--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc + +--echo # +--echo # 5) Cleanup (drop tables/databases and reset the variables) +--echo # +--source include/rpl_connection_master.inc +DROP DATABASE db1; +DROP DATABASE db2; +--source include/sync_slave_sql_with_master.inc +--source include/stop_slave_sql.inc +SET @@global.slave_pending_jobs_size_max= @save.slave_pending_jobs_size_max; +SET @@GLOBAL.slave_parallel_workers= @save.slave_parallel_workers; +--disable_warnings +--source include/start_slave_sql.inc +--enable_warnings +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test new file mode 100644 index 00000000..325b42b4 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test @@ -0,0 +1,90 @@ +############################################################################### +# Bug#24901077: RESET SLAVE ALL DOES NOT ALWAYS RESET SLAVE +# +# Problem: +# ======= +# If you have a relay log index file that has ended up with +# some relay log files that do not exists, then RESET SLAVE +# ALL is not enough to get back to a clean state. +############################################################################### +# Remove all slave-relay-bin.0* files (do not remove slave-relay-bin.index) +# During server restart rli initialization will fail as there are no +# relay logs. In case of bug RESET SLAVE will not do the required clean up +# as rli is not inited and subsequent START SLAVE will fail. +# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found" +# because it is different on Unix and Windows systems. + +--source include/have_binlog_format_mixed.inc +--source include/master-slave.inc + +--source include/rpl_connection_master.inc +CREATE TABLE t1 (c1 INT); +INSERT INTO t1 (c1) VALUES (1); +--source include/sync_slave_sql_with_master.inc + +--source include/rpl_connection_slave.inc +--source include/stop_slave_sql.inc +--let $MYSQLD_SLAVE_DATADIR= `select @@datadir` + +--source include/rpl_connection_master.inc +# Generate more relay logs on slave. +FLUSH LOGS; +FLUSH LOGS; +INSERT INTO t1 (c1) VALUES (2); + +--source include/sync_slave_io_with_master.inc +call mtr.add_suppression("File '.*slave-relay-bin."); +call mtr.add_suppression("Could not open log file"); +call mtr.add_suppression("Failed to open the relay log"); +call mtr.add_suppression("Slave failed to initialize relay log info structure"); +call mtr.add_suppression("Could not find target log file mentioned in relay log info in the index file"); +call mtr.add_suppression("Failed to initialize the relay-log-info structure"); +call mtr.add_suppression("Failed to initialize the master info structure"); + +# Stop slave +--let $rpl_server_number= 2 +--source include/rpl_stop_server.inc + +# Delete file(s) +--echo # Removing $remove_pattern file(s) +--let $remove_pattern= slave-relay-bin.0* +--remove_files_wildcard $MYSQLD_SLAVE_DATADIR $remove_pattern + +# Start slave +--let $rpl_server_number= 2 +--source include/rpl_start_server.inc + +# Start slave must fail because of the removed file(s). +--error ER_SLAVE_RLI_INIT_REPOSITORY +START SLAVE; + +# Try a second time, it must fail again. +--error ER_SLAVE_RLI_INIT_REPOSITORY +START SLAVE; + +# Retrieve master executed position before reset slave. +--let $master_exec_file= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1) +--let $master_exec_pos= query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1) + +# Reset slave. +# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found" +# because it is different on Unix and Windows systems. +--disable_warnings +RESET SLAVE; +--enable_warnings +RESET MASTER; +DROP TABLE t1; +# Start slave. +--source include/start_slave.inc + +--source include/rpl_connection_master.inc +--source include/sync_slave_sql_with_master.inc +# Check consistency. +--let $diff_tables= master:t1, slave:t1 +--source include/diff_tables.inc + +# Cleanup +--source include/rpl_connection_master.inc +DROP TABLE t1; +--source include/sync_slave_sql_with_master.inc +--source include/rpl_end.inc diff --git a/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test index 8fff6747..1080eda3 100644 --- a/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test +++ b/mysql-wsrep-5.6/mysql-test/suite/rpl/t/rpl_semi_sync_uninstall_plugin.test @@ -125,12 +125,11 @@ SET GLOBAL rpl_semi_sync_slave_enabled = OFF; # Step 4.4: Uninstall semi sync plugin, it should be successful now. UNINSTALL PLUGIN rpl_semi_sync_slave; -# Step 4.5: On Master, check that semi sync slaves are now '0'. +# Step 4.5: On Master, wait until semi sync slaves is '0'. --connection master ---let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1] ---let assert_cond= $master_clients = 0 ---let assert_text= semi sync master clients should be 0. ---source include/assert.inc +--let $status_var= Rpl_semi_sync_master_clients +--let $status_var_value= 0 +--source include/wait_for_status_var.inc # Step 4.6: So uninstalling semi sync plugin should be allowed UNINSTALL PLUGIN rpl_semi_sync_master; diff --git a/mysql-wsrep-5.6/mysql-test/t/binary_to_hex.test b/mysql-wsrep-5.6/mysql-test/t/binary_to_hex.test new file mode 100644 index 00000000..8312a246 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/t/binary_to_hex.test @@ -0,0 +1,76 @@ +# === Purpose === +# The purpose of this test case is to make +# sure that the binary data in tables is printed +# as hex when the option binary-as-hex is enabled. +# +# === Related bugs and/or worklogs === +# Bug #25340722 - PRINT BINARY DATA AS HEX IN THE MYSQL +# CLIENT (CONTRIBUTION) +# + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc +--source include/not_embedded.inc + +USE test; +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (c1 TINYBLOB, + c2 BLOB, + c3 MEDIUMBLOB, + c4 LONGBLOB, + c5 TEXT, + c6 BIT(1), + c7 CHAR, + c8 VARCHAR(10), + c9 GEOMETRY) CHARACTER SET = binary; + +SHOW CREATE TABLE t1; + +INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable', + 'mediumblob-text readable', 'longblob-text readable', + 'text readable', b'1', 'c', 'variable', + POINT(1, 1)); + +CREATE TABLE t2(id int, `col1` binary(10),`col2` blob); + +SHOW CREATE TABLE t2; + +INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF'); + +--echo #Print the table contents when binary-as-hex option is off. +--replace_column 6 # 9 # +SELECT * FROM t1; + +--replace_column 2 # 3 # +SELECT * FROM t2; + +--echo #Print the table contents after turning on the binary-as-hex option +--echo +--echo #Print the table contents in tab format +--echo +--exec $MYSQL test --binary-as-hex -e "SELECT * FROM t1; SELECT * FROM t2;" +--echo +--echo #Print the table contents in table format +--echo +--exec $MYSQL test --binary-as-hex --table -e "SELECT * FROM t1; SELECT * FROM t2 WHERE col2=0x123ABC;" +--echo +--echo #Print the table contents vertically +--echo +--exec $MYSQL test --binary-as-hex --vertical -e "SELECT * FROM t1;" +--echo +--echo #Print the table contents in xml format +--echo +--exec $MYSQL test --binary-as-hex --xml -e "SELECT * FROM t1; SELECT * FROM t2;" +--echo +--echo #Print the table contents in html format +--echo +--exec $MYSQL test --binary-as-hex --html -e "SELECT * FROM t1; SELECT * FROM t2;" + +#Cleanup +DROP TABLE t1, t2; + +# Wait till all disconnects are completed + --source include/wait_until_count_sessions.inc diff --git a/mysql-wsrep-5.6/mysql-test/t/disabled.def b/mysql-wsrep-5.6/mysql-test/t/disabled.def index 88b65d1e..2b0bfcab 100644 --- a/mysql-wsrep-5.6/mysql-test/t/disabled.def +++ b/mysql-wsrep-5.6/mysql-test/t/disabled.def @@ -16,5 +16,7 @@ archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this le ds_mrr-big @solaris : Bug#14168107 2012-04-03 Hemant disabled new test added by Olav Sandstå,since this leads to timeout on Solaris on slow sparc servers mysql_embedded_client_test : Bug#13964673 2012-04-16 amitbha since most of the test cases are failing mysql_client_test_embedded : Bug#16084066 2013-01-08 Disabled since this test is failing +mysqlhotcopy_archive @solaris : DBD-mysql perl module not available on Solaris +mysqlhotcopy_myisam @solaris : DBD-mysql perl module not available on Solaris file_contents : Galera mysql-wsrep#4 2014-10-28 pstoev main.file_contents MTR test fails in mysql-wsrep bootstrap : Galera mysql-wsrep#19 2014-11-21 pstoev Crash in LOGGER::error_log_print when printing a WSREP message diff --git a/mysql-wsrep-5.6/mysql-test/t/query_cache.test b/mysql-wsrep-5.6/mysql-test/t/query_cache.test index a8a6df3c..050a4351 100644 --- a/mysql-wsrep-5.6/mysql-test/t/query_cache.test +++ b/mysql-wsrep-5.6/mysql-test/t/query_cache.test @@ -1453,6 +1453,48 @@ SELECT SQL_NO_CACHE * FROM `db-db`.`t$4`; --echo #cleanup DROP DATABASE `db-db`; + +--echo # +--echo #Bug #25943038: QUERY WITH DERIVED TABLE IS CACHED IN MVCC SCENARIO +--echo # + +use test; +CREATE TABLE t1(i1 INT, i2 INT, v3 VARCHAR(20)) ENGINE=INNODB; +SET @qc= @@query_cache_size; +SET GLOBAL query_cache_size=16777216; + +SELECT @@query_cache_size, @@query_cache_type; + +connect (con1, localhost, root); +connect (con2, localhost, root); + +--enable_connect_log +connection con1; +START TRANSACTION; +INSERT INTO t1 VALUES(1,1,'a'),(2,1,'b'),(3,2,'c'),(4,2,'d'); + +connection con2; +SHOW GLOBAL STATUS LIKE 'qcache%cache%'; +SELECT * FROM t1; +SELECT * FROM (SELECT i2,SUM(i1) FROM t1 GROUP BY i2) b; +SHOW GLOBAL STATUS LIKE 'qcache%cache%'; + +connection con1; +SHOW GLOBAL STATUS LIKE 'qcache%cache%'; +commit; + +connection con2; +SHOW GLOBAL STATUS LIKE 'qcache%cache%'; +SELECT * FROM t1; +SELECT * FROM (SELECT * FROM t1) a; +SELECT * FROM (SELECT i2,SUM(i1) FROM t1 GROUP BY i2) b; + +disconnect con1; +disconnect con2; +--source include/wait_until_disconnected.inc +connection default; +DROP TABLE t1; + SET GLOBAL query_cache_size = @query_cache_size.saved; --echo # diff --git a/mysql-wsrep-5.6/mysql-test/t/show_processlist_state.test b/mysql-wsrep-5.6/mysql-test/t/show_processlist_state.test new file mode 100644 index 00000000..76401f31 --- /dev/null +++ b/mysql-wsrep-5.6/mysql-test/t/show_processlist_state.test @@ -0,0 +1,11 @@ + +--source include/not_embedded.inc + +# +# Output should be the same with or without the performance schema. +# + +--echo "Test SHOW PROCESSLIST, column INFO" +--replace_column 1 ID 3 HOST 6 TIME +show processlist; + diff --git a/mysql-wsrep-5.6/mysys/my_symlink.c b/mysql-wsrep-5.6/mysys/my_symlink.c index 4b71df66..c27d2e00 100644 --- a/mysql-wsrep-5.6/mysys/my_symlink.c +++ b/mysql-wsrep-5.6/mysys/my_symlink.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -107,11 +107,18 @@ int my_symlink(const char *content, const char *linkname, myf MyFlags) #endif -int my_is_symlink(const char *filename MY_ATTRIBUTE((unused))) +int my_is_symlink(const char *filename MY_ATTRIBUTE((unused)), + ST_FILE_ID *file_id) { #if defined (HAVE_LSTAT) && defined (S_ISLNK) struct stat stat_buff; - return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode); + int result= !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode); + if (file_id && !result) + { + file_id->st_dev= stat_buff.st_dev; + file_id->st_ino= stat_buff.st_ino; + } + return result; #elif defined (_WIN32) DWORD dwAttr = GetFileAttributes(filename); return (dwAttr != INVALID_FILE_ATTRIBUTES) && @@ -180,3 +187,20 @@ int my_realpath(char *to, const char *filename, myf MyFlags) #endif return 0; } + + +/** + Return non-zero if the file descriptor and a previously lstat-ed file + identified by file_id point to the same file +*/ +int my_is_same_file(File file, const ST_FILE_ID *file_id) +{ + MY_STAT stat_buf; + if(my_fstat(file, &stat_buf, MYF(0)) == -1) + { + my_errno= errno; + return 0; + } + return (stat_buf.st_dev == file_id->st_dev) + && (stat_buf.st_ino == file_id->st_ino); +} diff --git a/mysql-wsrep-5.6/mysys/queues.c b/mysql-wsrep-5.6/mysys/queues.c index 7efcee95..bace6816 100644 --- a/mysql-wsrep-5.6/mysys/queues.c +++ b/mysql-wsrep-5.6/mysys/queues.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -582,13 +582,14 @@ my_bool do_test(uint no_parts, uint l_max_ind, my_bool l_fix_used) tot_no_parts= no_parts; tot_no_loops= 1024; perform_insert(&queue); - if ((result= perform_ins_del(&queue, max_ind))) - delete_queue(&queue); + result= perform_ins_del(&queue, max_ind); if (result) { printf("Error\n"); + delete_queue(&queue); return TRUE; } + delete_queue(&queue); return FALSE; } @@ -664,6 +665,7 @@ static void benchmark_test() queue_remove(queue, (uint) 0); queue_remove_all(queue); stop_measurement(); + delete_queue(queue); } int main() diff --git a/mysql-wsrep-5.6/packaging/WiX/create_msi.cmake.in b/mysql-wsrep-5.6/packaging/WiX/create_msi.cmake.in index 8de271fc..b306c0c7 100644 --- a/mysql-wsrep-5.6/packaging/WiX/create_msi.cmake.in +++ b/mysql-wsrep-5.6/packaging/WiX/create_msi.cmake.in @@ -1,4 +1,4 @@ -# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,6 +13,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +SET(LINK_STATIC_RUNTIME_LIBRARIES "@LINK_STATIC_RUNTIME_LIBRARIES@") SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@") SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@") @@ -217,22 +218,37 @@ MACRO(GENERATE_GUID VarName) OUTPUT_STRIP_TRAILING_WHITESPACE) ENDMACRO() -SET(INC_VAR 0) +# Make sure that WIX identifier created from a path matches all the rules: +# - it is shorter than 72 characters +# - doesn't contain reserver characters ('+', '-' and '/') +# ID_SET contains a global list of all identifiers which are too long. +# Every time we use an identifier which is too long we use its index in +# ID_SET to shorten the name. +SET_PROPERTY(GLOBAL PROPERTY ID_SET) MACRO(MAKE_WIX_IDENTIFIER str varname) STRING(REPLACE "/" "." ${varname} "${str}") + STRING(REPLACE "+" "p" ${varname} "${str}") + STRING(REPLACE "-" "m" ${varname} "${str}") STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}") STRING(LENGTH "${${varname}}" len) + # FIXME: the prefix length has to be controlled better # Identifier should be smaller than 72 character - # We have to cut down the length to 70 chars, since we add 2 char prefix + # We have to cut down the length to 40 chars, since we add prefixes # pretty often - IF(len GREATER 70) - STRING(SUBSTRING "${${varname}}" 0 67 shortstr) - MATH(EXPR INC_VAR ${INC_VAR}+1) - SET(${varname} "${shortstr}${INC_VAR}") + IF(len GREATER 40) + STRING(SUBSTRING "${${varname}}" 0 37 shortstr) + GET_PROPERTY(LOCAL_LIST GLOBAL PROPERTY ID_SET) + LIST(FIND LOCAL_LIST "${${varname}}" STRING_ID) + IF(${STRING_ID} EQUAL -1) + LIST(APPEND LOCAL_LIST "${${varname}}") + SET_PROPERTY(GLOBAL PROPERTY ID_SET "${LOCAL_LIST}") + LIST(LENGTH LOCAL_LIST STRING_ID) + MATH(EXPR STRING_ID "${STRING_ID}-1" ) + ENDIF() + SET(${varname} "${shortstr}${STRING_ID}") ENDIF() ENDMACRO() - FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root) FILE(RELATIVE_PATH dir_rel ${topdir} ${dir}) IF(dir_rel) diff --git a/mysql-wsrep-5.6/packaging/WiX/mysql_server.wxs.in b/mysql-wsrep-5.6/packaging/WiX/mysql_server.wxs.in index 132818e2..44849323 100644 --- a/mysql-wsrep-5.6/packaging/WiX/mysql_server.wxs.in +++ b/mysql-wsrep-5.6/packaging/WiX/mysql_server.wxs.in @@ -2,7 +2,7 @@ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"> diff --git a/mysql-wsrep-5.6/packaging/deb-in/CMakeLists.txt b/mysql-wsrep-5.6/packaging/deb-in/CMakeLists.txt index 6be1bbd2..d3348684 100644 --- a/mysql-wsrep-5.6/packaging/deb-in/CMakeLists.txt +++ b/mysql-wsrep-5.6/packaging/deb-in/CMakeLists.txt @@ -35,6 +35,7 @@ IF (DEB_PRODUCT STREQUAL "commercial") SET (DEB_INSTALL_LICENSEFILE "LICENSE.mysql") SET (DEB_SERVERVERSION "${VERSION}+commercial-1") SET (DEB_PLUGIN_SETPERMISSION "") + SET (DEB_MAN_SETPERMISSION "") # List of plugins that are only in commercial packages # Plugins that are in both community and commercial should NOT be added here @@ -71,6 +72,7 @@ ELSE() SET (DEB_SERVERVERSION "${VERSION}-1") SET (DEB_REMOVEPATTERN "com.in") SET (DEB_PLUGIN_SETPERMISSION "usr/bin/mysql_setpermission") + SET (DEB_MAN_SETPERMISSION "usr/share/man/man1/mysql_setpermission.1") ENDIF() # Platform specifics. The differences are generally only distro version diff --git a/mysql-wsrep-5.6/packaging/deb-in/control.in b/mysql-wsrep-5.6/packaging/deb-in/control.in index ab8cafb2..b32b6439 100644 --- a/mysql-wsrep-5.6/packaging/deb-in/control.in +++ b/mysql-wsrep-5.6/packaging/deb-in/control.in @@ -25,12 +25,21 @@ Depends: mysql-common (>= ${binary:Version}), mysql-client (= ${binary:Version}) ${shlibs:Depends}, ${misc:Depends} Breaks: mysql-common (<< 5.6.36) Conflicts: mysql, + mysql-client-5.0, mysql-client-core-5.0, + mysql-client-5.1, mysql-client-core-5.1, + mysql-client-5.5, mysql-client-core-5.5, + mysql-client-5.6, mysql-client-core-5.6, + mysql-client-5.7, mysql-client-core-5.7, mysql-server-5.0, mysql-server-core-5.0, mysql-server-5.1, mysql-server-core-5.1, mysql-server-5.5, mysql-server-core-5.5, mysql-server-5.6, mysql-server-core-5.6, mysql-server-5.7, mysql-server-core-5.7, mysql-@DEB_NOTPRODUCTNAME@-server, + mariadb-client-5.5, mariadb-client-core-5.5, + mariadb-client-10.0, mariadb-client-core-10.0, + mariadb-client-10.1, mariadb-client-core-10.1, + mariadb-client-10.2, mariadb-client-core-10.2, mariadb-server-5.5, mariadb-server-core-5.5, mariadb-server-10.0, mariadb-server-core-10.0, mariadb-server-10.1, mariadb-server-core-10.1, @@ -74,11 +83,20 @@ Conflicts: mysql, mysql-client-5.5, mysql-client-core-5.5, mysql-client-5.6, mysql-client-core-5.6, mysql-client-5.7, mysql-client-core-5.7, + mysql-server-5.0, mysql-server-core-5.0, + mysql-server-5.1, mysql-server-core-5.1, + mysql-server-5.5, mysql-server-core-5.5, + mysql-server-5.6, mysql-server-core-5.6, + mysql-server-5.7, mysql-server-core-5.7, mysql-@DEB_NOTPRODUCTNAME@-client, mariadb-client-5.5, mariadb-client-core-5.5, mariadb-client-10.0, mariadb-client-core-10.0, mariadb-client-10.1, mariadb-client-core-10.1, - mariadb-client-10.2, mariadb-client-core-10.2 + mariadb-client-10.2, mariadb-client-core-10.2, + mariadb-server-5.5, mariadb-server-core-5.5, + mariadb-server-10.0, mariadb-server-core-10.0, + mariadb-server-10.1, mariadb-server-core-10.1, + mariadb-server-10.2, mariadb-server-core-10.2 Replaces: mysql, mysql-client-5.0, mysql-client-core-5.0, mysql-client-5.1, mysql-client-core-5.1, diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.install.in index 5c42fd7d..6c9066c7 100644 --- a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.install.in +++ b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-client.install.in @@ -1,4 +1,4 @@ -# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -40,9 +40,13 @@ usr/share/man/man1/myisam_ftdump.1 usr/share/man/man1/mysql.1 usr/share/man/man1/mysql_config_editor.1 usr/share/man/man1/mysql_embedded.1 +usr/share/man/man1/mysql_find_rows.1 +usr/share/man/man1/mysql_fix_extensions.1 usr/share/man/man1/mysql_plugin.1 +usr/share/man/man1/mysql_waitpid.1 usr/share/man/man1/mysqlaccess.1 usr/share/man/man1/mysqladmin.1 +usr/share/man/man1/mysqlbug.1 usr/share/man/man1/mysqlcheck.1 usr/share/man/man1/mysqldump.1 usr/share/man/man1/mysqldumpslow.1 diff --git a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.install.in b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.install.in index a3ffa63d..951c80fc 100644 --- a/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.install.in +++ b/mysql-wsrep-5.6/packaging/deb-in/mysql-packagesource-server.install.in @@ -40,16 +40,21 @@ usr/sbin/mysqld usr/sbin/mysqld-debug # man pages usr/share/man/man1/innochecksum.1 +usr/share/man/man1/msql2mysql.1 +usr/share/man/man1/mysqlhotcopy.1 usr/share/man/man1/comp_err.1 usr/share/man/man1/myisamchk.1 usr/share/man/man1/myisamlog.1 usr/share/man/man1/myisampack.1 usr/share/man/man1/my_print_defaults.1 -usr/share/man/man1/mysql.server.1 usr/share/man/man1/mysql-stress-test.pl.1 +usr/share/man/man1/mysql_convert_table_format.1 +usr/share/man/man1/mysql_install_db.1 usr/share/man/man1/mysql_secure_installation.1 +@DEB_MAN_SETPERMISSION@ usr/share/man/man1/mysql_tzinfo_to_sql.1 usr/share/man/man1/mysql_upgrade.1 +usr/share/man/man1/mysql_zap.1 usr/share/man/man1/mysqlbinlog.1 usr/share/man/man1/mysqld_multi.1 usr/share/man/man1/mysqld_safe.1 diff --git a/mysql-wsrep-5.6/packaging/deb-in/rules.in b/mysql-wsrep-5.6/packaging/deb-in/rules.in index 227c28f4..e9f9e166 100644 --- a/mysql-wsrep-5.6/packaging/deb-in/rules.in +++ b/mysql-wsrep-5.6/packaging/deb-in/rules.in @@ -136,10 +136,13 @@ override_dh_installinit: touch $@ override_dh_install: - dh_install --list-missing - -Xusr/bin/i_mysql_client_test - -Xusr/share/mysql/mysql.server - -Xusr/share/mysql/COPYING - -Xusr/share/mysql/README - -Xusr/share/mysql/docs/mysql.info - -Xusr/share/man/man1/mysqlman.1 + dh_install --fail-missing \ + -Xusr/bin/i_mysql_client_test \ + -Xusr/share/mysql/mysql.server \ + -Xusr/share/man/man1/mysql.server.1 \ + -Xusr/share/mysql/binary-configure \ + -Xusr/share/mysql/@DEB_INSTALL_LICENSEFILE@ \ + -Xusr/share/mysql/README \ + -Xusr/share/mysql/docs/mysql.info \ + -Xusr/share/man/man1/mysqlman.1 \ + -X.h.pp diff --git a/mysql-wsrep-5.6/packaging/rpm-docker/mysql.spec.in b/mysql-wsrep-5.6/packaging/rpm-docker/mysql.spec.in index e51fdbcb..d02518d8 100644 --- a/mysql-wsrep-5.6/packaging/rpm-docker/mysql.spec.in +++ b/mysql-wsrep-5.6/packaging/rpm-docker/mysql.spec.in @@ -1,4 +1,4 @@ -# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -179,7 +179,7 @@ for f in msql2mysql mysqlaccess mysqlaccess.conf mysqlbug mysql_convert_table_fo rm -f %{buildroot}%{_bindir}/$f done -for f in innochecksum myisamchk myisam_ftdump myisamlog myisampack mysqladmin \ +for f in innochecksum myisamchk myisam_ftdump myisamlog myisampack \ mysqlbinlog mysqlcheck mysql_client_test mysql_config_editor \ mysqld_multi mysqld_safe mysqldumpslow mysql_embedded mysqlimport \ mysql_plugin mysql_secure_installation mysqlshow mysqlslap mysqltest \ @@ -197,6 +197,10 @@ done # No need for these scripts rm -f %{buildroot}%{_datadir}/mysql/{mysql.server,mysqld_multi.server,mysql-log-rotate,binary-configure} +# Remove files pages we explicitly do not want to package +rm -rf %{buildroot}%{_infodir}/mysql.info* +rm -f %{buildroot}%{_datadir}/mysql/win_install_firewall.sql + %check %if 0%{?runselftest} pushd release @@ -230,6 +234,7 @@ rm -r $(readlink var) var %dir %{_sysconfdir}/my.cnf.d %attr(755, root, root) %{_sbindir}/mysqld %attr(755, root, root) %{_bindir}/mysql +%attr(755, root, root) %{_bindir}/mysqladmin %attr(755, root, root) %{_bindir}/mysqldump %attr(755, root, root) %{_bindir}/mysql_config %attr(755, root, root) %{_bindir}/mysql_install_db @@ -283,6 +288,16 @@ rm -r $(readlink var) var %attr(644, root, root) %{_datadir}/mysql/dictionary.txt %attr(644, root, root) %{_datadir}/mysql/innodb_memcached_config.sql %attr(644, root, root) %{_datadir}/mysql/magic + +%if 0%{?commercial} +%attr(755, root, root) %{_libdir}/mysql/plugin/audit_log.so +%attr(755, root, root) %{_libdir}/mysql/plugin/authentication_pam.so +%attr(755, root, root) %{_libdir}/mysql/plugin/thread_pool.so +%attr(755, root, root) %{_libdir}/mysql/plugin/openssl_udf.so +%attr(755, root, root) %{_libdir}/mysql/plugin/firewall.so +%attr(644, root, root) %{_datadir}/mysql/linux_install_firewall.sql +%endif + %dir %attr(750, mysql, mysql) /var/lib/mysql %dir %attr(755, mysql, mysql) /var/run/mysqld %dir %attr(750, mysql, mysql) /var/lib/mysql-files diff --git a/mysql-wsrep-5.6/scripts/CMakeLists.txt b/mysql-wsrep-5.6/scripts/CMakeLists.txt index 37c34e60..b1e4d747 100644 --- a/mysql-wsrep-5.6/scripts/CMakeLists.txt +++ b/mysql-wsrep-5.6/scripts/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -124,6 +124,12 @@ STRING(REPLACE "-fstack-protector-strong" "" CXXFLAGS "${CXXFLAGS}") STRING(REPLACE "-grecord-gcc-switches" "" CXXFLAGS "${CXXFLAGS}") STRING(REPLACE "-pipe" "" CXXFLAGS "${CXXFLAGS}") +IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + SET (PERL_PATH "/usr/local/bin/perl") +ELSE() + SET (PERL_PATH "/usr/bin/perl") +ENDIF() + IF(UNIX) # SHELL_PATH, FIND_PROC, CHECK_PID are used by mysqld_safe IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") diff --git a/mysql-wsrep-5.6/scripts/dheadgen.pl b/mysql-wsrep-5.6/scripts/dheadgen.pl old mode 100755 new mode 100644 index c42bd49b..69ece2e7 --- a/mysql-wsrep-5.6/scripts/dheadgen.pl +++ b/mysql-wsrep-5.6/scripts/dheadgen.pl @@ -1,10 +1,4 @@ -#!/usr/bin/perl -w - -# -# Copyright (c) 2008, 2009 Sun Microsystems, Inc. -# Use is subject to license terms. -# - +# Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: diff --git a/mysql-wsrep-5.6/scripts/invoke-with-relative-paths.pl b/mysql-wsrep-5.6/scripts/invoke-with-relative-paths.pl new file mode 100644 index 00000000..97480330 --- /dev/null +++ b/mysql-wsrep-5.6/scripts/invoke-with-relative-paths.pl @@ -0,0 +1,95 @@ +#! /usr/bin/perl +# +# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA +# + +# +# Take the given GCC command line and run it with all absolute paths +# changed to relative paths. This makes sure that no part of the build +# path leaks into the .o files, which it normally would through the +# contents of __FILE__. (Debug information is also affected, but that +# is already fixed through -fdebug-prefix-map=.) +# +# A more elegant solution would be -ffile-prefix-map=, but this is +# not currently supported in GCC; see +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70268. +# + +use strict; +use warnings; +use Cwd; + +my $cwd = getcwd(); + +my @newarg = (); +for my $i (0..$#ARGV) { + my $arg = $ARGV[$i]; + if ($arg =~ /-I(.+)$/) { + $arg = '-I' . relativize($1, $cwd); + } elsif ($arg =~ /^\//) { + $arg = relativize($arg, $cwd); + } + push @newarg, $arg; +} + +exec(@newarg); + +# /a/b/c/foo from /a/b/d = ../c/foo +sub relativize { + my ($dir1, $dir2) = @_; + + if ($dir1 !~ /^\//) { + # Not an absolute path. + return $dir1; + } + + if (! -e $dir1) { +# print STDERR "Unknown file/directory $dir1.\n"; + return $dir1; + } + # Resolve symlinks and such, because getcwd() does. + $dir1 = Cwd::abs_path($dir1); + + if ($dir1 =~ /^\/(lib|tmp|usr)/) { + # Not related to our source code. + return $dir1; + } + + if ($dir1 eq $dir2) { + return "."; + } + + my (@dir1_components) = split /\//, $dir1; + my (@dir2_components) = split /\//, $dir2; + + # Remove common leading components. + while (scalar @dir1_components > 0 && scalar @dir2_components > 0 && + $dir1_components[0] eq $dir2_components[0]) { + shift @dir1_components; + shift @dir2_components; + } + + my $ret = ""; + for my $i (0..$#dir2_components) { + $ret .= '../'; + } + $ret .= join('/', @dir1_components); + + # print STDERR "[$dir1] from [$dir2] => [$ret]\n"; + + return $ret; +} + diff --git a/mysql-wsrep-5.6/scripts/mysql_config.pl.in b/mysql-wsrep-5.6/scripts/mysql_config.pl.in index fb3230dd..8ce67dcd 100644 --- a/mysql-wsrep-5.6/scripts/mysql_config.pl.in +++ b/mysql-wsrep-5.6/scripts/mysql_config.pl.in @@ -1,7 +1,7 @@ -#!/usr/bin/perl +#!@PERL_PATH@ # -*- cperl -*- # -# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-wsrep-5.6/scripts/mysql_convert_table_format.sh b/mysql-wsrep-5.6/scripts/mysql_convert_table_format.sh index 66fe055b..6927103b 100644 --- a/mysql-wsrep-5.6/scripts/mysql_convert_table_format.sh +++ b/mysql-wsrep-5.6/scripts/mysql_convert_table_format.sh @@ -1,6 +1,5 @@ -#!/usr/bin/perl -# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. -# Use is subject to license terms. +#!@PERL_PATH@ +# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-wsrep-5.6/scripts/mysql_find_rows.sh b/mysql-wsrep-5.6/scripts/mysql_find_rows.sh index 009085c0..d98e03b3 100644 --- a/mysql-wsrep-5.6/scripts/mysql_find_rows.sh +++ b/mysql-wsrep-5.6/scripts/mysql_find_rows.sh @@ -1,6 +1,5 @@ -#!/usr/bin/perl -# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. -# Use is subject to license terms. +#!@PERL_PATH@ +# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-wsrep-5.6/scripts/mysql_fix_extensions.sh b/mysql-wsrep-5.6/scripts/mysql_fix_extensions.sh index 3da49855..23d2629d 100644 --- a/mysql-wsrep-5.6/scripts/mysql_fix_extensions.sh +++ b/mysql-wsrep-5.6/scripts/mysql_fix_extensions.sh @@ -1,7 +1,6 @@ -#!/usr/bin/perl +#!@PERL_PATH@ -# Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public diff --git a/mysql-wsrep-5.6/scripts/mysql_install_db.pl.in b/mysql-wsrep-5.6/scripts/mysql_install_db.pl.in index c9af549d..0750ada9 100644 --- a/mysql-wsrep-5.6/scripts/mysql_install_db.pl.in +++ b/mysql-wsrep-5.6/scripts/mysql_install_db.pl.in @@ -1,7 +1,7 @@ -#!/usr/bin/perl +#!@PERL_PATH@ # -*- cperl -*- # -# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-wsrep-5.6/scripts/mysql_secure_installation.pl.in b/mysql-wsrep-5.6/scripts/mysql_secure_installation.pl.in old mode 100755 new mode 100644 index 9f4bf80a..f9edda00 --- a/mysql-wsrep-5.6/scripts/mysql_secure_installation.pl.in +++ b/mysql-wsrep-5.6/scripts/mysql_secure_installation.pl.in @@ -1,7 +1,7 @@ -#!/usr/bin/perl +#!@PERL_PATH@ # -*- cperl -*- # -# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-wsrep-5.6/scripts/mysql_setpermission.sh b/mysql-wsrep-5.6/scripts/mysql_setpermission.sh index 44cf5a37..08950006 100644 --- a/mysql-wsrep-5.6/scripts/mysql_setpermission.sh +++ b/mysql-wsrep-5.6/scripts/mysql_setpermission.sh @@ -1,8 +1,7 @@ -#!/usr/bin/perl +#!@PERL_PATH@ ## Emacs, this is -*- perl -*- mode? :-) -# Copyright (c) 2000, 2014 Oracle and/or its affiliates. All rights reserved. -# Use is subject to license terms. +# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public diff --git a/mysql-wsrep-5.6/scripts/mysql_zap.sh b/mysql-wsrep-5.6/scripts/mysql_zap.sh index cab209d2..f46dd92c 100644 --- a/mysql-wsrep-5.6/scripts/mysql_zap.sh +++ b/mysql-wsrep-5.6/scripts/mysql_zap.sh @@ -1,6 +1,5 @@ -#!/usr/bin/perl -# Copyright (c) 2000, 2014 Oracle and/or its affiliates. All rights reserved. -# Use is subject to license terms. +#!@PERL_PATH@ +# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/mysql-wsrep-5.6/scripts/mysqlaccess.conf b/mysql-wsrep-5.6/scripts/mysqlaccess.conf old mode 100755 new mode 100644 diff --git a/mysql-wsrep-5.6/scripts/mysqlaccess.sh b/mysql-wsrep-5.6/scripts/mysqlaccess.sh index 10c93746..0ef216cb 100644 --- a/mysql-wsrep-5.6/scripts/mysqlaccess.sh +++ b/mysql-wsrep-5.6/scripts/mysqlaccess.sh @@ -1,6 +1,6 @@ -#!/usr/bin/perl +#!@PERL_PATH@ -# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public @@ -477,15 +477,22 @@ MySQLaccess::Report::Print_Header(); # ***************************** # Read configuration-file MySQLaccess::Debug::Print(1, "Reading configuration file..."); - if (-f "./$script_conf") { - require "./$script_conf"; - } - elsif (-f "@sysconfdir@/$script_conf") { + if (-f "@sysconfdir@/$script_conf") { + print "Configuration file '$script_conf' is found in '@sysconfdir@/'\n"; require "@sysconfdir@/$script_conf"; } elsif (-f "/etc/$script_conf") { + print "Configuration file '$script_conf' is found in '/etc/'\n"; require "/etc/$script_conf"; } + elsif (-f "./$script_conf") { + print "\nERROR! Configuration file '$script_conf' is found in the current "; + print "directory.\nThe permissible locations for this file are either "; + print "@sysconfdir@/ or /etc/\n"; + print "Please move it to one of these locations and retry.\n\n"; + exit 0; + } + # **************************** # Read in all parameters diff --git a/mysql-wsrep-5.6/scripts/mysqld_multi.sh b/mysql-wsrep-5.6/scripts/mysqld_multi.sh index e6a6f022..fbedd484 100644 --- a/mysql-wsrep-5.6/scripts/mysqld_multi.sh +++ b/mysql-wsrep-5.6/scripts/mysqld_multi.sh @@ -1,6 +1,6 @@ -#!/usr/bin/perl +#!@PERL_PATH@ -# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public diff --git a/mysql-wsrep-5.6/scripts/mysqld_safe.sh b/mysql-wsrep-5.6/scripts/mysqld_safe.sh index c6b4f8d5..a2cbc1d2 100644 --- a/mysql-wsrep-5.6/scripts/mysqld_safe.sh +++ b/mysql-wsrep-5.6/scripts/mysqld_safe.sh @@ -24,7 +24,9 @@ want_syslog=0 syslog_tag= user='@MYSQLD_USER@' pid_file= +pid_file_append= err_log= +err_log_append= syslog_tag_mysqld=mysqld syslog_tag_mysqld_safe=mysqld_safe @@ -660,15 +662,17 @@ then err_log="$err_log".err fi + err_log_append="$err_log" case "$err_log" in /* ) ;; * ) err_log="$DATADIR/$err_log" ;; esac else err_log=$DATADIR/`@HOSTNAME@`.err + err_log_append=`@HOSTNAME@`.err fi - append_arg_to_args "--log-error=$err_log" + append_arg_to_args "--log-error=$err_log_append" if [ $want_syslog -eq 1 ] then @@ -778,13 +782,15 @@ fi if test -z "$pid_file" then pid_file="$DATADIR/`@HOSTNAME@`.pid" + pid_file_append="`@HOSTNAME@`.pid" else + pid_file_append="$pid_file" case "$pid_file" in /* ) ;; * ) pid_file="$DATADIR/$pid_file" ;; esac fi -append_arg_to_args "--pid-file=$pid_file" +append_arg_to_args "--pid-file=$pid_file_append" if test -n "$mysql_unix_port" then diff --git a/mysql-wsrep-5.6/scripts/mysqldumpslow.sh b/mysql-wsrep-5.6/scripts/mysqldumpslow.sh index 0c64297a..27044c10 100644 --- a/mysql-wsrep-5.6/scripts/mysqldumpslow.sh +++ b/mysql-wsrep-5.6/scripts/mysqldumpslow.sh @@ -1,6 +1,6 @@ -#!/usr/bin/perl +#!@PERL_PATH@ -# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public diff --git a/mysql-wsrep-5.6/scripts/mysqlhotcopy.sh b/mysql-wsrep-5.6/scripts/mysqlhotcopy.sh index 28a82c87..dc4a0493 100644 --- a/mysql-wsrep-5.6/scripts/mysqlhotcopy.sh +++ b/mysql-wsrep-5.6/scripts/mysqlhotcopy.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env perl +#!@PERL_PATH@ # Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. # diff --git a/mysql-wsrep-5.6/sql/binlog.cc b/mysql-wsrep-5.6/sql/binlog.cc index 9be49498..2b81800f 100644 --- a/mysql-wsrep-5.6/sql/binlog.cc +++ b/mysql-wsrep-5.6/sql/binlog.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2547,7 +2547,8 @@ void MYSQL_BIN_LOG::cleanup() if (inited) { inited= 0; - close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT); + close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT, true /*need_lock_log=true*/, + true /*need_lock_index=true*/); mysql_mutex_destroy(&LOCK_log); mysql_mutex_destroy(&LOCK_index); mysql_mutex_destroy(&LOCK_commit); @@ -2585,8 +2586,13 @@ void MYSQL_BIN_LOG::init_pthread_objects() bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg, const char *log_name, bool need_lock_index) { + bool error= false; File index_file_nr= -1; - DBUG_ASSERT(!my_b_inited(&index_file)); + + if (need_lock_index) + mysql_mutex_lock(&LOCK_index); + else + mysql_mutex_assert_owner(&LOCK_index); /* First open of this class instance @@ -2594,6 +2600,10 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg, Add new entries to the end of it. */ myf opt= MY_UNPACK_FILENAME; + + if (my_b_inited(&index_file)) + goto end; + if (!index_file_name_arg) { index_file_name_arg= log_name; // Use same basename for index file @@ -2605,7 +2615,8 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg, if (set_crash_safe_index_file_name(index_file_name_arg)) { sql_print_error("MYSQL_BIN_LOG::set_crash_safe_index_file_name failed."); - return TRUE; + error= true; + goto end; } /* @@ -2619,7 +2630,8 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg, { sql_print_error("MYSQL_BIN_LOG::open_index_file failed to " "move crash_safe_index_file to index file."); - return TRUE; + error= true; + goto end; } if ((index_file_nr= mysql_file_open(m_key_file_log_index, @@ -2641,7 +2653,8 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg, */ if (index_file_nr >= 0) mysql_file_close(index_file_nr, MYF(0)); - return TRUE; + error= true; + goto end; } #ifdef HAVE_REPLICATION @@ -2655,17 +2668,20 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg, if (set_purge_index_file_name(index_file_name_arg) || open_purge_index_file(FALSE) || - purge_index_entry(NULL, NULL, need_lock_index) || + purge_index_entry(NULL, NULL, false) || close_purge_index_file() || DBUG_EVALUATE_IF("fault_injection_recovering_index", 1, 0)) { sql_print_error("MYSQL_BIN_LOG::open_index_file failed to sync the index " "file."); - return TRUE; + error= TRUE; + goto end; } #endif - - return FALSE; +end: + if (need_lock_index) + mysql_mutex_unlock(&LOCK_index); + return error; } @@ -3227,11 +3243,11 @@ bool MYSQL_BIN_LOG::open_binlog(const char *log_name, enum cache_type io_cache_type_arg, ulong max_size_arg, bool null_created_arg, + bool need_lock_log, bool need_lock_index, bool need_sid_lock, Format_description_log_event *extra_description_event) { - File file= -1; // lock_index must be acquired *before* sid_lock. DBUG_ASSERT(need_sid_lock || !need_lock_index); @@ -3443,13 +3459,7 @@ err: purge_index_entry(NULL, NULL, need_lock_index); close_purge_index_file(); #endif - if (file >= 0) - mysql_file_close(file, MYF(0)); - end_io_cache(&log_file); - end_io_cache(&index_file); - my_free(name); - name= NULL; - log_state= LOG_CLOSED; + if (binlog_error_action == ABORT_SERVER) { exec_binlog_error_action_abort("Either disk is full or file system is read " @@ -3457,10 +3467,14 @@ err: " server."); } else + { sql_print_error("Could not use %s for logging (error %d). " "Turning logging off for the whole duration of the MySQL " "server process. To turn it on again: fix the cause, " - "shutdown the MySQL server and restart it.", name, errno); + "shutdown the MySQL server and restart it.", + (new_name) ? new_name : name, errno); + close(LOG_CLOSE_INDEX, need_lock_log, need_lock_index); + } DBUG_RETURN(1); } @@ -3744,6 +3758,12 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name, else mysql_mutex_assert_owner(&LOCK_index); + if (!my_b_inited(&index_file)) + { + error= LOG_INFO_IO; + goto end; + } + // extend relative paths for log_name to be searched if (log_name) { @@ -3836,6 +3856,11 @@ int MYSQL_BIN_LOG::find_next_log(LOG_INFO* linfo, bool need_lock_index) else mysql_mutex_assert_owner(&LOCK_index); + if (!my_b_inited(&index_file)) + { + error= LOG_INFO_IO; + goto err; + } /* As the file is flushed, we can't get an error here */ my_b_seek(&index_file, linfo->index_file_offset); @@ -3920,7 +3945,8 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) /* Save variables so that we can reopen the log */ save_name=name; name=0; // Protect against free - close(LOG_CLOSE_TO_BE_OPENED); + close(LOG_CLOSE_TO_BE_OPENED, false/*need_lock_log=false*/, + false/*need_lock_index=false*/); /* First delete all old log files and then update the index file. @@ -3973,7 +3999,9 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) } /* Start logging with a new file */ - close(LOG_CLOSE_INDEX | LOG_CLOSE_TO_BE_OPENED); + close(LOG_CLOSE_INDEX | LOG_CLOSE_TO_BE_OPENED, + false/*need_lock_log=false*/, + false/*need_lock_index=false*/); if ((error= my_delete_allow_opened(index_file_name, MYF(0)))) // Reset (open will update) { if (my_errno == ENOENT) @@ -4019,6 +4047,7 @@ bool MYSQL_BIN_LOG::reset_logs(THD* thd) if (!open_index_file(index_file_name, 0, false/*need_lock_index=false*/)) if ((error= open_binlog(save_name, 0, io_cache_type, max_size, false, + false/*need_lock_log=false*/, false/*need_lock_index=false*/, false/*need_sid_lock=false*/, NULL))) @@ -5076,7 +5105,9 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock_log, Format_description_log_even old_name=name; name=0; // Don't free name - close(LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX); + close(LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX, + false/*need_lock_log=false*/, + false/*need_lock_index=false*/); if (checksum_alg_reset != BINLOG_CHECKSUM_ALG_UNDEF) { @@ -5107,6 +5138,7 @@ int MYSQL_BIN_LOG::new_file_impl(bool need_lock_log, Format_description_log_even file_to_open= new_name_ptr; error= open_binlog(old_name, new_name_ptr, io_cache_type, max_size, true/*null_created_arg=true*/, + false/*need_lock_log=false*/, false/*need_lock_index=false*/, true/*need_sid_lock=true*/, extra_description_event); @@ -5139,7 +5171,6 @@ end: - switch server to protected/readonly mode - ... */ - close(LOG_CLOSE_INDEX); if (binlog_error_action == ABORT_SERVER) { exec_binlog_error_action_abort("Either disk is full or file system is" @@ -5153,12 +5184,15 @@ end: "again: fix the cause, shutdown the MySQL " "server and restart it.", new_name_ptr, errno); + close(LOG_CLOSE_INDEX, false /*need_lock_log=false*/, + false/*need_lock_index=false*/); } mysql_mutex_unlock(&LOCK_index); if (need_lock_log) mysql_mutex_unlock(&LOCK_log); + DEBUG_SYNC(current_thd, "after_disable_binlog"); DBUG_RETURN(error); } @@ -6196,15 +6230,28 @@ int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd, at once after close. - LOG_CLOSE_STOP_EVENT : write a 'stop' event to the log + @param need_lock_log If true, this function acquires LOCK_log; + otherwise the caller should already have acquired it. + + @param need_lock_index If true, this function acquires LOCK_index; + otherwise the caller should already have acquired it. + @note One can do an open on the object at once after doing a close. The internal structures are not freed until cleanup() is called */ -void MYSQL_BIN_LOG::close(uint exiting) +void MYSQL_BIN_LOG::close(uint exiting, bool need_lock_log, + bool need_lock_index) { // One can't set log_type here! DBUG_ENTER("MYSQL_BIN_LOG::close"); DBUG_PRINT("enter",("exiting: %d", (int) exiting)); + + if (need_lock_log) + mysql_mutex_lock(&LOCK_log); + else + mysql_mutex_assert_owner(&LOCK_log); + if (log_state == LOG_OPENED) { #ifdef HAVE_REPLICATION @@ -6247,6 +6294,11 @@ void MYSQL_BIN_LOG::close(uint exiting) called a not complete close earlier and the index file is still open. */ + if (need_lock_index) + mysql_mutex_lock(&LOCK_index); + else + mysql_mutex_assert_owner(&LOCK_index); + if ((exiting & LOG_CLOSE_INDEX) && my_b_inited(&index_file)) { end_io_cache(&index_file); @@ -6258,9 +6310,17 @@ void MYSQL_BIN_LOG::close(uint exiting) errno, my_strerror(errbuf, sizeof(errbuf), errno)); } } + + if (need_lock_index) + mysql_mutex_unlock(&LOCK_index); + log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED; my_free(name); name= NULL; + + if (need_lock_log) + mysql_mutex_unlock(&LOCK_log); + DBUG_VOID_RETURN; } @@ -6325,6 +6385,7 @@ int MYSQL_BIN_LOG::open_binlog(const char *opt_name) { /* generate a new binlog to mask a corrupted one */ open_binlog(opt_name, 0, WRITE_CACHE, max_binlog_size, false, + true/*need_lock_log=true*/, true/*need_lock_index=true*/, true/*need_sid_lock=true*/, NULL); @@ -7138,7 +7199,8 @@ void MYSQL_BIN_LOG::handle_binlog_flush_or_sync_error(THD *thd, "the cause, shutdown the MySQL server and restart it.", errmsg); } - close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT); + close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT, false/*need_lock_log=false*/, + true/*need_lock_index=true*/); if (need_lock_log) mysql_mutex_unlock(&LOCK_log); DEBUG_SYNC(thd, "after_binlog_closed_due_to_error"); diff --git a/mysql-wsrep-5.6/sql/binlog.h b/mysql-wsrep-5.6/sql/binlog.h index 3251a4a3..8fd10369 100644 --- a/mysql-wsrep-5.6/sql/binlog.h +++ b/mysql-wsrep-5.6/sql/binlog.h @@ -1,5 +1,5 @@ #ifndef BINLOG_H_INCLUDED -/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -585,6 +585,7 @@ public: enum cache_type io_cache_type_arg, ulong max_size, bool null_created, + bool need_lock_log, bool need_lock_index, bool need_sid_lock, Format_description_log_event *extra_description_event); bool open_index_file(const char *index_file_name_arg, @@ -658,7 +659,7 @@ public: int purge_index_entry(THD *thd, ulonglong *decrease_log_space, bool need_lock_index); bool reset_logs(THD* thd); - void close(uint exiting); + void close(uint exiting, bool need_lock_log, bool need_lock_index); // iterating through the log index file int find_log_pos(LOG_INFO* linfo, const char* log_name, diff --git a/mysql-wsrep-5.6/sql/filesort.cc b/mysql-wsrep-5.6/sql/filesort.cc index eeed08b0..4b40c0f6 100644 --- a/mysql-wsrep-5.6/sql/filesort.cc +++ b/mysql-wsrep-5.6/sql/filesort.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -66,6 +66,7 @@ static bool save_index(Sort_param *param, uint count, Filesort_info *table_sort); static uint suffix_length(ulong string_length); static SORT_ADDON_FIELD *get_addon_fields(ulong max_length_for_sort_data, + TABLE *const table, Field **ptabfield, uint sortlength, uint *plength); static void unpack_addon_fields(struct st_sort_addon_field *addon_field, @@ -90,6 +91,7 @@ void Sort_param::init_for_filesort(uint sortlen, TABLE *table, to sorted fields and get its total length in addon_length. */ addon_field= get_addon_fields(max_length_for_sort_data, + table, table->field, sort_length, &addon_length); } if (addon_field) @@ -1948,6 +1950,7 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length, static SORT_ADDON_FIELD * get_addon_fields(ulong max_length_for_sort_data, + TABLE *const table, Field **ptabfield, uint sortlength, uint *plength) { Field **pfield; @@ -1956,7 +1959,7 @@ get_addon_fields(ulong max_length_for_sort_data, uint length= 0; uint fields= 0; uint null_fields= 0; - MY_BITMAP *read_set= (*ptabfield)->table->read_set; + MY_BITMAP *read_set= table->read_set; /* If there is a reference to a field in the query add it diff --git a/mysql-wsrep-5.6/sql/ha_partition.cc b/mysql-wsrep-5.6/sql/ha_partition.cc index a3e43718..60070198 100644 --- a/mysql-wsrep-5.6/sql/ha_partition.cc +++ b/mysql-wsrep-5.6/sql/ha_partition.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -6092,7 +6092,10 @@ void ha_partition::return_top_record(uchar *buf) uchar *rec_buffer= key_buffer + m_rec_offset; part_id= uint2korr(key_buffer); - memcpy(buf, rec_buffer, m_rec_length); + /* Do column copy to avoid overwriting of non read columns + specific to table with innodb engine */ + handler *file= m_file[part_id]; + file->copy_cached_row(buf, rec_buffer, m_rec_length); m_last_part= part_id; m_top_entry= part_id; } diff --git a/mysql-wsrep-5.6/sql/handler.h b/mysql-wsrep-5.6/sql/handler.h index d000ab2f..144208e5 100644 --- a/mysql-wsrep-5.6/sql/handler.h +++ b/mysql-wsrep-5.6/sql/handler.h @@ -2,7 +2,7 @@ #define HANDLER_INCLUDED /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -2315,6 +2315,20 @@ public: by another transaction, the engine may try an optimistic read of the last committed row value under the cursor. */ + /** + Copy a cached row. + This is currently implemented only in innodb for supporting + HA_EXTRA_KEYREAD_PRESERVE_FIELDS. + Used when copying a row from the record priority queue to + the return buffer. For some engines, like InnoDB, only + marked columns must be copied,to preserve non-read columns. + + @param[out] to_rec Buffer to copy to. + @param[in] from_rec Buffer to copy from. + @param[in] rec_length Record length + */ + virtual void copy_cached_row(uchar *to_rec, const uchar *from_rec, uint rec_length) + { memcpy(to_rec, from_rec, rec_length); } virtual void try_semi_consistent_read(bool) {} virtual void unlock_row() {} virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;} diff --git a/mysql-wsrep-5.6/sql/item.cc b/mysql-wsrep-5.6/sql/item.cc index a75097e3..767c6b07 100644 --- a/mysql-wsrep-5.6/sql/item.cc +++ b/mysql-wsrep-5.6/sql/item.cc @@ -2444,6 +2444,9 @@ Item_field::Item_field(Field *f) item_equal(0), no_const_subst(0), have_privileges(0), any_privileges(0) { + if (f->table->pos_in_table_list != NULL) + context= &(f->table->pos_in_table_list->select_lex->context); + set_field(f); /* field_name and table_name should not point to garbage diff --git a/mysql-wsrep-5.6/sql/log.cc b/mysql-wsrep-5.6/sql/log.cc index 86436092..13629730 100644 --- a/mysql-wsrep-5.6/sql/log.cc +++ b/mysql-wsrep-5.6/sql/log.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3074,14 +3074,20 @@ void exec_binlog_error_action_abort(const char* err_string) Hence we clear the previous errors and push one critical error message to clients. */ - thd->clear_error(); - /* - Adding ME_NOREFRESH flag will ensure that the error is sent to both - client and to the server error log as well. - */ - my_error(ER_BINLOG_LOGGING_IMPOSSIBLE, MYF(ME_NOREFRESH + ME_FATALERROR), - err_string); - thd->protocol->end_statement(); + if (thd) + { + if (thd->is_error()) + thd->clear_error(); + /* + Adding ME_NOREFRESH flag will ensure that the error is sent to both + client and to the server error log as well. + */ + my_error(ER_BINLOG_LOGGING_IMPOSSIBLE, MYF(ME_NOREFRESH + ME_FATALERROR), + err_string); + thd->protocol->end_statement(); + } + else + sql_print_error("%s",err_string); abort(); } diff --git a/mysql-wsrep-5.6/sql/log_event.cc b/mysql-wsrep-5.6/sql/log_event.cc index 7b6f7b50..c336729e 100644 --- a/mysql-wsrep-5.6/sql/log_event.cc +++ b/mysql-wsrep-5.6/sql/log_event.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -9585,8 +9585,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, DBUG_PRINT("info",("m_table_id: %llu m_flags: %d m_width: %lu data_size: %lu", m_table_id.id(), m_flags, m_width, (ulong) data_size)); - // Allocate one extra byte, in case we have to do uint3korr! - m_rows_buf= (uchar*) my_malloc(data_size + 1, MYF(MY_WME)); // didrik + m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME)); if (likely((bool)m_rows_buf)) { #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -9713,9 +9712,8 @@ int Rows_log_event::do_add_row_data(uchar *row_data, size_t length) ulong const new_alloc= block_size * ((cur_size + length + block_size - 1) / block_size); - // Allocate one extra byte, in case we have to do uint3korr! uchar* const new_buf= - (uchar*)my_realloc((uchar*)m_rows_buf, (uint) new_alloc + 1, + (uchar*)my_realloc((uchar*)m_rows_buf, (uint) new_alloc, MYF(MY_ALLOW_ZERO_PTR|MY_WME)); if (unlikely(!new_buf)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); diff --git a/mysql-wsrep-5.6/sql/mysqld.cc b/mysql-wsrep-5.6/sql/mysqld.cc index 4824933f..4ce88f9f 100644 --- a/mysql-wsrep-5.6/sql/mysqld.cc +++ b/mysql-wsrep-5.6/sql/mysqld.cc @@ -992,6 +992,10 @@ void net_after_header_psi(struct st_net *net, void *user_data, size_t /* unused: thd->db, thd->db_length, thd->charset()); + /* + Starts a new stage in performance schema, if compiled in and enabled. + Also sets THD::proc_info (used by SHOW PROCESSLIST, column STATE) + */ THD_STAGE_INFO(thd, stage_init); } @@ -1006,20 +1010,17 @@ void net_after_header_psi(struct st_net *net, void *user_data, size_t /* unused: void init_net_server_extension(THD *thd) { -#ifdef HAVE_PSI_INTERFACE /* Start with a clean state for connection events. */ thd->m_idle_psi= NULL; thd->m_statement_psi= NULL; thd->m_server_idle= false; + /* Hook up the NET_SERVER callback in the net layer. */ thd->m_net_server_extension.m_user_data= thd; thd->m_net_server_extension.m_before_header= net_before_header_psi; thd->m_net_server_extension.m_after_header= net_after_header_psi; /* Activate this private extension for the mysqld server. */ thd->net.extension= & thd->m_net_server_extension; -#else - thd->net.extension= NULL; -#endif } #endif /* EMBEDDED_LIBRARY */ @@ -5291,6 +5292,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); const_cast(gtid_state->get_logged_gtids())); if (mysql_bin_log.open_binlog(opt_bin_logname, 0, WRITE_CACHE, max_binlog_size, false, + true/*need_lock_log=true*/, true/*need_lock_index=true*/, true/*need_sid_lock=true*/, NULL)) diff --git a/mysql-wsrep-5.6/sql/net_serv.cc b/mysql-wsrep-5.6/sql/net_serv.cc index 53c3034c..87507f94 100644 --- a/mysql-wsrep-5.6/sql/net_serv.cc +++ b/mysql-wsrep-5.6/sql/net_serv.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -157,15 +157,13 @@ my_bool net_realloc(NET *net, size_t length) #endif DBUG_RETURN(1); } - pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1); + pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1); /* - We must allocate some extra bytes for the end 0 and to be able to - read big compressed blocks + 1 safety byte since uint3korr() in - net_read_packet() may actually read 4 bytes depending on build flags and - platform. + We must allocate some extra bytes for the end 0 and to be able to + read big compressed blocks in net_read_packet(). */ if (!(buff= (uchar*) my_realloc((char*) net->buff, pkt_length + - NET_HEADER_SIZE + COMP_HEADER_SIZE + 1, + NET_HEADER_SIZE + COMP_HEADER_SIZE, MYF(MY_WME)))) { /* @todo: 1 and 2 codes are identical. */ @@ -820,12 +818,11 @@ static ulong net_read_packet(NET *net, size_t *complen) if (net->compress) { /* - The following uint3korr() may read 4 bytes, so make sure we don't - read unallocated or uninitialized memory. The right-hand expression - must match the size of the buffer allocated in net_realloc(). + The right-hand expression must match the size of the buffer + allocated in net_realloc(). */ DBUG_ASSERT(net->where_b + NET_HEADER_SIZE + sizeof(uint32) <= - net->max_packet + NET_HEADER_SIZE + COMP_HEADER_SIZE + 1); + net->max_packet + NET_HEADER_SIZE + COMP_HEADER_SIZE); /* If the packet is compressed then complen > 0 and contains the diff --git a/mysql-wsrep-5.6/sql/records.cc b/mysql-wsrep-5.6/sql/records.cc index 78b83783..0fb923b2 100644 --- a/mysql-wsrep-5.6/sql/records.cc +++ b/mysql-wsrep-5.6/sql/records.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -617,10 +617,9 @@ static int init_rr_cache(THD *thd, READ_RECORD *info) rec_cache_size= info->cache_records*info->reclength; info->rec_cache_size= info->cache_records*info->ref_length; - // We have to allocate one more byte to use uint3korr (see comments for it) if (info->cache_records <= 2 || !(info->cache=(uchar*) my_malloc_lock(rec_cache_size+info->cache_records* - info->struct_length+1, + info->struct_length, MYF(0)))) { *info= info_copy; diff --git a/mysql-wsrep-5.6/sql/rpl_gtid_execution.cc b/mysql-wsrep-5.6/sql/rpl_gtid_execution.cc index eb259674..030a2f6a 100644 --- a/mysql-wsrep-5.6/sql/rpl_gtid_execution.cc +++ b/mysql-wsrep-5.6/sql/rpl_gtid_execution.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -325,6 +325,7 @@ enum_gtid_statement_status gtid_pre_statement_checks(const THD *thd) enum_sql_command sql_command= thd->lex->sql_command; if (sql_command == SQLCOM_COMMIT || sql_command == SQLCOM_BEGIN || sql_command == SQLCOM_ROLLBACK || + sql_command == SQLCOM_CHANGE_DB || ((sql_command == SQLCOM_SELECT || (sql_command == SQLCOM_SET_OPTION && !thd->lex->is_set_password_sql)) && !thd->lex->uses_stored_routines())) diff --git a/mysql-wsrep-5.6/sql/rpl_master.cc b/mysql-wsrep-5.6/sql/rpl_master.cc index 503ad426..03367025 100644 --- a/mysql-wsrep-5.6/sql/rpl_master.cc +++ b/mysql-wsrep-5.6/sql/rpl_master.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -845,6 +845,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, char *log_file_name = linfo.log_file_name; char search_file_name[FN_REFLEN], *name; + bool is_index_file_reopened_on_binlog_disable= false; ulong ev_offset; bool using_gtid_protocol= slave_gtid_executed != NULL; bool searching_first_gtid= using_gtid_protocol; @@ -1900,18 +1901,65 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, if (goto_next_binlog) { + DBUG_EXECUTE_IF("waiting_for_disable_binlog", + { + const char act[]= "now " + "signal dump_thread_reached_wait_point " + "wait_for continue_dump_thread no_clear_event"; + DBUG_ASSERT(!debug_sync_set_action(current_thd, + STRING_WITH_LEN(act))); + };); + // clear flag because we open a new binlog binlog_has_previous_gtids_log_event= false; THD_STAGE_INFO(thd, stage_finished_reading_one_binlog_switching_to_next_binlog); - switch (mysql_bin_log.find_next_log(&linfo, 1)) { - case 0: - break; - default: + /* + When moving to next binlog, always check if binlog is enabled or not. + There can be critical errors like for example out of memory scenarios + which prevent mysqld server from writing to binlog. In those cases + server refers to binlog_error_action variable and takes the appropriate + action. If users choose to ignore the error then binary log will be + disabled and server will continue to do its work. In such cases dump + thread which is trying to move to the next log will fail as binlog index + file and binlog file are already closed and their corresponding caches + are also cleared. + + Hence first check if binary log is enabled or not. If enabled look for + the next binary log in the index file. If it is disabled open the index + file once again and check if there any more binary logs that needs to be + sent. Keep reading binary log files until find_next_log returns empty. + If there is an error during open index file or we sent all binary logs + then ER_MASTER_FATAL_ERROR_READING_BINLOG is raised. + */ + mysql_bin_log.lock_index(); + if (!mysql_bin_log.is_open()) + { + if (mysql_bin_log.open_index_file(mysql_bin_log.get_index_fname(), + linfo.log_file_name,FALSE)) + { + errmsg = "Binary log is not open and failed to open index file to " + "retrieve next file."; + my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; + mysql_bin_log.unlock_index(); + GOTO_ERR; + } + is_index_file_reopened_on_binlog_disable= true; + } + if (mysql_bin_log.find_next_log(&linfo, 0)) + { + DBUG_EXECUTE_IF("waiting_for_disable_binlog", + { + const char act[]= "now signal consumed_binlog"; + DBUG_ASSERT(!debug_sync_set_action(current_thd, + STRING_WITH_LEN(act))); + };); errmsg = "could not find next log"; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; + mysql_bin_log.unlock_index(); GOTO_ERR; } + mysql_bin_log.unlock_index(); end_io_cache(&log); mysql_file_close(file, MYF(MY_WME)); @@ -2002,6 +2050,9 @@ err: error_text[sizeof(error_text) - 1]= '\0'; } end_io_cache(&log); + if (is_index_file_reopened_on_binlog_disable) + mysql_bin_log.close(LOG_CLOSE_INDEX, true/*need_lock_log=true*/, + true/*need_lock_index=true*/); if (has_transmit_started) (void) RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags)); /* diff --git a/mysql-wsrep-5.6/sql/rpl_rli.cc b/mysql-wsrep-5.6/sql/rpl_rli.cc index ca394645..f2e4dc24 100644 --- a/mysql-wsrep-5.6/sql/rpl_rli.cc +++ b/mysql-wsrep-5.6/sql/rpl_rli.cc @@ -1085,6 +1085,8 @@ int Relay_log_info::purge_relay_logs(THD *thd, bool just_reset, const char** errmsg) { int error=0; + const char *ln; + char name_buf[FN_REFLEN]; DBUG_ENTER("Relay_log_info::purge_relay_logs"); /* @@ -1109,11 +1111,41 @@ int Relay_log_info::purge_relay_logs(THD *thd, bool just_reset, if (!inited) { DBUG_PRINT("info", ("inited == 0")); - DBUG_RETURN(0); - } + if (error_on_rli_init_info) + { + ln= relay_log.generate_name(opt_relay_logname, "-relay-bin", + 1, name_buf); + if (relay_log.open_index_file(opt_relaylog_index_name, ln, TRUE)) + { + sql_print_error("Unable to purge relay log files. Failed to open relay " + "log index file:%s.", relay_log.get_index_fname()); - DBUG_ASSERT(slave_running == 0); - DBUG_ASSERT(mi->slave_running == 0); + DBUG_RETURN(1); + } + mysql_mutex_lock(&mi->data_lock); + if (relay_log.open_binlog(ln, 0, SEQ_READ_APPEND, + (max_relay_log_size ? max_relay_log_size : + max_binlog_size), true, + true/*need_lock_log=true*/, + true/*need_lock_index=true*/, + true/*need_sid_lock=true*/, + mi->get_mi_description_event())) + { + sql_print_error("Unable to purge relay log files. Failed to open relay " + "log file:%s.", relay_log.get_log_fname()); + mysql_mutex_unlock(&mi->data_lock); + DBUG_RETURN(1); + } + mysql_mutex_unlock(&mi->data_lock); + } + else + DBUG_RETURN(0); + } + else + { + DBUG_ASSERT(slave_running == 0); + DBUG_ASSERT(mi->slave_running == 0); + } slave_skip_counter= 0; mysql_mutex_lock(&data_lock); @@ -1154,6 +1186,11 @@ int Relay_log_info::purge_relay_logs(THD *thd, bool just_reset, group_relay_log_pos, false/*need_data_lock=false*/, errmsg, 0); + if (!inited && error_on_rli_init_info) + relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT, + true/*need_lock_log=true*/, + true/*need_lock_index=true*/); + err: #ifndef DBUG_OFF char buf[22]; @@ -1819,6 +1856,7 @@ a file name for --relay-log-index option.", opt_relaylog_index_name); if (relay_log.open_binlog(ln, 0, SEQ_READ_APPEND, (max_relay_log_size ? max_relay_log_size : max_binlog_size), true, + true/*need_lock_log=true*/, true/*need_lock_index=true*/, true/*need_sid_lock=true*/, mi->get_mi_description_event())) @@ -1931,7 +1969,9 @@ err: error_on_rli_init_info= true; if (msg) sql_print_error("%s.", msg); - relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT); + relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT, + true/*need_lock_log=true*/, + true/*need_lock_index=true*/); DBUG_RETURN(error); } @@ -1952,7 +1992,9 @@ void Relay_log_info::end_info() cur_log_fd= -1; } inited = 0; - relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT); + relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT, + true/*need_lock_log=true*/, + true/*need_lock_index=true*/); relay_log.harvest_bytes_written(&log_space_total); /* Delete the slave's temporary tables from memory. diff --git a/mysql-wsrep-5.6/sql/rpl_rli_pdb.cc b/mysql-wsrep-5.6/sql/rpl_rli_pdb.cc index 2c2e1346..1f918682 100644 --- a/mysql-wsrep-5.6/sql/rpl_rli_pdb.cc +++ b/mysql-wsrep-5.6/sql/rpl_rli_pdb.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1833,26 +1833,27 @@ bool append_item_to_jobs(slave_job_item *job_item, ulonglong new_pend_size; PSI_stage_info old_stage; - DBUG_ASSERT(thd == current_thd); - if (ev_size > rli->mts_pending_jobs_size_max) - { - char llbuff[22]; - llstr(rli->get_event_relay_log_pos(), llbuff); - my_error(ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX, MYF(0), - ((Log_event*) (job_item->data))->get_type_str(), - rli->get_event_relay_log_name(), llbuff, ev_size, - rli->mts_pending_jobs_size_max); - /* Waiting in slave_stop_workers() avoidance */ - rli->mts_group_status= Relay_log_info::MTS_KILLED_GROUP; - return ret; - } - mysql_mutex_lock(&rli->pending_jobs_lock); new_pend_size= rli->mts_pending_jobs_size + ev_size; - // C waits basing on *data* sizes in the queues - while (new_pend_size > rli->mts_pending_jobs_size_max) + bool big_event= (ev_size > rli->mts_pending_jobs_size_max); + /* + C waits basing on *data* sizes in the queues. + If it is a big event (event size is greater than + slave_pending_jobs_size_max but less than slave_max_allowed_packet), + it will wait for all the jobs in the workers's queue to be + completed. If it is normal event (event size is less than + slave_pending_jobs_size_max), then it will wait for + enough empty memory to keep the event in one of the workers's + queue. + NOTE: Receiver thread (I/O thread) is taking care of restricting + the event size to slave_max_allowed_packet. If an event from + the master is bigger than this value, IO thread will be stopped + with error ER_NET_PACKET_TOO_LARGE. + */ + while ( (!big_event && new_pend_size > rli->mts_pending_jobs_size_max) + || (big_event && rli->mts_pending_jobs_size != 0 )) { rli->mts_wq_oversize= TRUE; rli->wq_size_waits_cnt++; // waiting due to the total size diff --git a/mysql-wsrep-5.6/sql/sql_acl.cc b/mysql-wsrep-5.6/sql/sql_acl.cc index 77da10ed..c32a4d55 100644 --- a/mysql-wsrep-5.6/sql/sql_acl.cc +++ b/mysql-wsrep-5.6/sql/sql_acl.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. -sql_authenticate + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. @@ -3566,7 +3566,7 @@ static int replace_user_table(THD *thd, TABLE *table, LEX_USER *combo, * An empty password is considered to be of mysql_native type. */ - if (combo->plugin.str == NULL || combo->plugin.str == '\0') + if (combo->plugin.str == NULL || combo->plugin.str[0] == '\0') { if (combo->uses_identified_by_password_clause) { diff --git a/mysql-wsrep-5.6/sql/sql_cache.cc b/mysql-wsrep-5.6/sql/sql_cache.cc index 17b46a65..2ef55e11 100644 --- a/mysql-wsrep-5.6/sql/sql_cache.cc +++ b/mysql-wsrep-5.6/sql/sql_cache.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify @@ -3800,13 +3800,10 @@ my_bool Query_cache::ask_handler_allowance(THD *thd, if (tables_used->uses_materialization()) { /* - Currently all result tables are MyISAM or HEAP. MyISAM allows caching - unless table is under in a concurrent insert (which never could - happen to a derived table). HEAP always allows caching. + Skip the derived table itself, but process its underlying tables and + other tables that follow. */ - DBUG_ASSERT(table->s->db_type() == heap_hton || - table->s->db_type() == myisam_hton); - DBUG_RETURN(0); + continue; } /* diff --git a/mysql-wsrep-5.6/sql/sql_load.cc b/mysql-wsrep-5.6/sql/sql_load.cc index 57497ad7..38dd4ed3 100644 --- a/mysql-wsrep-5.6/sql/sql_load.cc +++ b/mysql-wsrep-5.6/sql/sql_load.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2045,6 +2045,15 @@ int READ_INFO::read_xml() case '>': /* end tag - read tag value */ in_tag= false; + /* Skip all whitespaces */ + while (' ' == (chr= my_tospace(GET))) + { + } + /* + Push the first non-whitespace char back to Stack. This char would be + read in the upcoming call to read_value() + */ + PUSH(chr); chr= read_value('<', &value); if(chr == my_b_EOF) goto found_eof; diff --git a/mysql-wsrep-5.6/sql/sql_optimizer.cc b/mysql-wsrep-5.6/sql/sql_optimizer.cc index 5e75a099..cf241ad3 100644 --- a/mysql-wsrep-5.6/sql/sql_optimizer.cc +++ b/mysql-wsrep-5.6/sql/sql_optimizer.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -4197,40 +4197,39 @@ static void add_not_null_conds(JOIN *join) } -/* - Check if given expression uses only table fields covered by the given index - - SYNOPSIS - uses_index_fields_only() - item Expression to check - tbl The table having the index - keyno The index number - other_tbls_ok TRUE <=> Fields of other non-const tables are allowed - - DESCRIPTION - Check if given expression only uses fields covered by index #keyno in the - table tbl. The expression can use any fields in any other tables. - - The expression is guaranteed not to be AND or OR - those constructs are - handled outside of this function. - - RETURN - TRUE Yes - FALSE No +/** + Check if given expression only uses fields covered by index #keyno in the + table tbl. The expression can use any fields in any other tables. + + The expression is guaranteed not to be AND or OR - those constructs are + handled outside of this function. + + Restrict some function types from being pushed down to storage engine: + a) Don't push down the triggered conditions. Nested outer joins execution + code may need to evaluate a condition several times (both triggered and + untriggered). + b) Stored functions contain a statement that might start new operations (like + DML statements) from within the storage engine. This does not work against + all SEs. + c) Subqueries might contain nested subqueries and involve more tables. + + @param item Expression to check + @param tbl The table having the index + @param keyno The index number + @param other_tbls_ok TRUE <=> Fields of other non-const tables are allowed + + @return false if No, true if Yes */ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno, bool other_tbls_ok) { + // Restrictions b and c. + if (item->has_stored_program() || item->has_subquery()) + return false; + if (item->const_item()) - { - /* - const_item() might not return correct value if the item tree - contains a subquery. If this is the case we do not include this - part of the condition. - */ - return !item->has_subquery(); - } + return true; const Item::Type item_type= item->type(); @@ -4241,21 +4240,14 @@ bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno, const Item_func::Functype func_type= item_func->functype(); /* - Avoid some function types from being pushed down to storage engine: - - Don't push down the triggered conditions. Nested outer joins - execution code may need to evaluate a condition several times - (both triggered and untriggered). - TODO: Consider cloning the triggered condition and using the - copies for: - 1. push the first copy down, to have most restrictive - index condition possible. - 2. Put the second copy into tab->m_condition. - - Stored functions contain a statement that might start new operations - against the storage engine. This does not work against all storage - engines. + Restriction a. + TODO: Consider cloning the triggered condition and using the copies + for: + 1. push the first copy down, to have most restrictive index condition + possible. + 2. Put the second copy into tab->m_condition. */ - if (func_type == Item_func::TRIG_COND_FUNC || - func_type == Item_func::FUNC_SP) + if (func_type == Item_func::TRIG_COND_FUNC) return false; /* This is a function, apply condition recursively to arguments */ diff --git a/mysql-wsrep-5.6/sql/sql_parse.cc b/mysql-wsrep-5.6/sql/sql_parse.cc index 69f9f1be..f3216952 100644 --- a/mysql-wsrep-5.6/sql/sql_parse.cc +++ b/mysql-wsrep-5.6/sql/sql_parse.cc @@ -1228,14 +1228,18 @@ static my_bool deny_updates_if_read_only_option(THD *thd, (lex->sql_command == SQLCOM_CREATE_TABLE) && (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE); + const my_bool create_real_tables= + (lex->sql_command == SQLCOM_CREATE_TABLE) && + !(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE); + const my_bool drop_temp_tables= (lex->sql_command == SQLCOM_DROP_TABLE) && lex->drop_temporary; const my_bool update_real_tables= - some_non_temp_table_to_be_updated(thd, all_tables) && - !(create_temp_tables || drop_temp_tables); - + ((create_real_tables || + some_non_temp_table_to_be_updated(thd, all_tables)) && + !(create_temp_tables || drop_temp_tables)); const my_bool create_or_drop_databases= (lex->sql_command == SQLCOM_CREATE_DB) || diff --git a/mysql-wsrep-5.6/sql/sql_union.cc b/mysql-wsrep-5.6/sql/sql_union.cc index 1141313b..092c580c 100644 --- a/mysql-wsrep-5.6/sql/sql_union.cc +++ b/mysql-wsrep-5.6/sql/sql_union.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -372,6 +372,19 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, Item *item_tmp; while ((item_tmp= it++)) { + /* + If the outer query has a GROUP BY clause, an outer reference to this + query block may have been wrapped in a Item_outer_ref, which has not + been fixed yet. An Item_type_holder must be created based on a fixed + Item, so use the inner Item instead. + */ + DBUG_ASSERT(item_tmp->fixed || + (item_tmp->type() == Item::REF_ITEM && + ((Item_ref *)(item_tmp))->ref_type() == + Item_ref::OUTER_REF)); + if (!item_tmp->fixed) + item_tmp= item_tmp->real_item(); + /* Error's in 'new' will be detected after loop */ types.push_back(new Item_type_holder(thd_arg, item_tmp)); } diff --git a/mysql-wsrep-5.6/storage/innobase/api/api0api.cc b/mysql-wsrep-5.6/storage/innobase/api/api0api.cc index 07eecdc4..d01b221d 100644 --- a/mysql-wsrep-5.6/storage/innobase/api/api0api.cc +++ b/mysql-wsrep-5.6/storage/innobase/api/api0api.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2008, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2008, 2017, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1976,11 +1976,14 @@ ib_cursor_read_row( page_format = static_cast( dict_table_is_comp(tuple->index->table)); + rec = btr_pcur_get_rec(pcur); - if (prebuilt->innodb_api_rec && - prebuilt->innodb_api_rec != rec) { - rec = prebuilt->innodb_api_rec; + if (!rec_get_deleted_flag(rec, page_format)) { + if (prebuilt->innodb_api && + prebuilt->innodb_api_rec != NULL) { + rec =prebuilt->innodb_api_rec; + } } if (!rec_get_deleted_flag(rec, page_format)) { @@ -2017,6 +2020,10 @@ ib_cursor_position( buf = static_cast(mem_alloc(UNIV_PAGE_SIZE)); + if (prebuilt->innodb_api) { + prebuilt->cursor_heap = cursor->heap; + } + /* We want to position at one of the ends, row_search_for_mysql() uses the search_tuple fields to work out what to do. */ dtuple_set_n_fields(prebuilt->search_tuple, 0); @@ -2071,6 +2078,9 @@ ib_cursor_next( row_prebuilt_t* prebuilt = cursor->prebuilt; byte buf[UNIV_PAGE_SIZE_MAX]; + if (prebuilt->innodb_api) { + prebuilt->cursor_heap = cursor->heap; + } /* We want to move to the next record */ dtuple_set_n_fields(prebuilt->search_tuple, 0); @@ -2123,6 +2133,9 @@ ib_cursor_moveto( buf = static_cast(mem_alloc(UNIV_PAGE_SIZE)); + if (prebuilt->innodb_api) { + prebuilt->cursor_heap = cursor->heap; + } err = static_cast(row_search_for_mysql( buf, ib_srch_mode, prebuilt, cursor->match_mode, 0)); diff --git a/mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.cc b/mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.cc index 9fe3ab29..4bd54894 100644 --- a/mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.cc +++ b/mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.cc @@ -9031,6 +9031,27 @@ ha_innobase::ft_init_ext( return((FT_INFO*) fts_hdl); } +/*****************************************************************//** +Copy a cached MySQL row. +If requested, also avoids overwriting non-read columns. +@param[out] buf Row in MySQL format. +@param[in] cached_row Which row to copy. +@param[in] rec_len Record length. */ +void +ha_innobase::copy_cached_row( + uchar* buf, + const uchar* cached_row, + uint rec_len) +{ + if (prebuilt->keep_other_fields_on_keyread) { + row_sel_copy_cached_fields_for_mysql(buf, cached_row, + prebuilt); + } else { + memcpy(buf, cached_row, rec_len); + } +} + + /*****************************************************************//** Set up search tuple for a query through FTS_DOC_ID_INDEX on supplied Doc ID. This is used by MySQL to retrieve the documents diff --git a/mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.h b/mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.h index 898d47a5..0073bd94 100644 --- a/mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.h +++ b/mysql-wsrep-5.6/storage/innobase/handler/ha_innodb.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -146,6 +146,10 @@ class ha_innobase: public handler int index_first(uchar * buf); int index_last(uchar * buf); + /* Copy a cached MySQL row. If requested, also avoids + overwriting non-read columns. */ + void copy_cached_row(uchar *to_rec, const uchar *from_rec, + uint rec_length); int rnd_init(bool scan); int rnd_end(); int rnd_next(uchar *buf); diff --git a/mysql-wsrep-5.6/storage/innobase/include/row0mysql.h b/mysql-wsrep-5.6/storage/innobase/include/row0mysql.h index d0c1bdaa..c648332c 100644 --- a/mysql-wsrep-5.6/storage/innobase/include/row0mysql.h +++ b/mysql-wsrep-5.6/storage/innobase/include/row0mysql.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -723,6 +723,8 @@ struct row_prebuilt_t { mem_heap_t* heap; /*!< memory heap from which these auxiliary structures are allocated when needed */ + mem_heap_t* cursor_heap; /*!< memory heap from which + innodb_api_buf is allocated per session*/ ins_node_t* ins_node; /*!< Innobase SQL insert node used to perform inserts to the table */ @@ -873,6 +875,9 @@ struct row_prebuilt_t { unsigned innodb_api:1; /*!< whether this is a InnoDB API query */ const rec_t* innodb_api_rec; /*!< InnoDB API search result */ + void* innodb_api_buf; /*!< Buffer holding copy of the physical + Innodb API search record */ + ulint innodb_api_rec_size; /*!< Size of the Innodb API record */ byte* srch_key_val1; /*!< buffer used in converting search key values from MySQL format to InnoDB format.*/ diff --git a/mysql-wsrep-5.6/storage/innobase/include/row0sel.h b/mysql-wsrep-5.6/storage/innobase/include/row0sel.h index fd5bc755..afeb216c 100644 --- a/mysql-wsrep-5.6/storage/innobase/include/row0sel.h +++ b/mysql-wsrep-5.6/storage/innobase/include/row0sel.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -205,6 +205,18 @@ struct sel_buf_t{ when data != NULL */ }; +/** Copy used fields from cached row. +Copy cache record field by field, don't touch fields that +are not covered by current key. +@param[out] buf Where to copy the MySQL row. +@param[in] cached_rec What to copy (in MySQL row format). +@param[in] prebuilt prebuilt struct. */ +void +row_sel_copy_cached_fields_for_mysql( + byte* buf, + const byte* cached_rec, + row_prebuilt_t* prebuilt); + /** Query plan */ struct plan_t{ dict_table_t* table; /*!< table struct in the dictionary diff --git a/mysql-wsrep-5.6/storage/innobase/row/row0merge.cc b/mysql-wsrep-5.6/storage/innobase/row/row0merge.cc index 2d63352f..4a6fb763 100644 --- a/mysql-wsrep-5.6/storage/innobase/row/row0merge.cc +++ b/mysql-wsrep-5.6/storage/innobase/row/row0merge.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1462,6 +1462,8 @@ row_merge_read_clustered_index( row_ext_t* ext; page_cur_t* cur = btr_pcur_get_page_cur(&pcur); + mem_heap_empty(row_heap); + page_cur_move_to_next(cur); if (page_cur_is_after_last(cur)) { @@ -1885,8 +1887,6 @@ write_buffers: if (err != DB_SUCCESS) { goto func_exit; } - - mem_heap_empty(row_heap); } func_exit: diff --git a/mysql-wsrep-5.6/storage/innobase/row/row0sel.cc b/mysql-wsrep-5.6/storage/innobase/row/row0sel.cc index c53c1154..f321e0ba 100644 --- a/mysql-wsrep-5.6/storage/innobase/row/row0sel.cc +++ b/mysql-wsrep-5.6/storage/innobase/row/row0sel.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -2555,47 +2555,51 @@ row_sel_store_row_id_to_prebuilt( #ifdef UNIV_DEBUG /** Convert a non-SQL-NULL field from Innobase format to MySQL format. */ -# define row_sel_field_store_in_mysql_format(dest,templ,idx,field,src,len) \ - row_sel_field_store_in_mysql_format_func(dest,templ,idx,field,src,len) +# define row_sel_field_store_in_mysql_format(dest,templ,idx,field,src,len,sec) \ + row_sel_field_store_in_mysql_format_func(dest,templ,idx,field,src,len,sec) #else /* UNIV_DEBUG */ /** Convert a non-SQL-NULL field from Innobase format to MySQL format. */ -# define row_sel_field_store_in_mysql_format(dest,templ,idx,field,src,len) \ - row_sel_field_store_in_mysql_format_func(dest,templ,src,len) +# define row_sel_field_store_in_mysql_format(dest,templ,idx,field,src,len,sec) \ + row_sel_field_store_in_mysql_format_func(dest,templ,src,len,sec) #endif /* UNIV_DEBUG */ -/**************************************************************//** -Stores a non-SQL-NULL field in the MySQL format. The counterpart of this -function is row_mysql_store_col_in_innobase_format() in row0mysql.cc. */ +/** Stores a non-SQL-NULL field in the MySQL format. The counterpart of this +function is row_mysql_store_col_in_innobase_format() in row0mysql.cc. +@param[in,out] dest buffer where to store; NOTE + that BLOBs are not in themselves stored + here: the caller must allocate and copy + the BLOB into buffer before, and pass + the pointer to the BLOB in 'data' +@param[in] templ MySQL column template. Its following fields + are referenced: type, is_unsigned, mysql_col_len, + mbminlen, mbmaxlen +@param[in] index InnoDB index +@param[in] field_no templ->rec_field_no or templ->clust_rec_field_no + or templ->icp_rec_field_no +@param[in] data data to store +@param[in] len length of the data +@param[in] sec_field secondary index field no if the secondary index + record but the prebuilt template is in + clustered index format and used only for end + range comparison. */ static MY_ATTRIBUTE((nonnull)) void row_sel_field_store_in_mysql_format_func( -/*=====================================*/ - byte* dest, /*!< in/out: buffer where to store; NOTE - that BLOBs are not in themselves - stored here: the caller must allocate - and copy the BLOB into buffer before, - and pass the pointer to the BLOB in - 'data' */ + byte* dest, const mysql_row_templ_t* templ, - /*!< in: MySQL column template. - Its following fields are referenced: - type, is_unsigned, mysql_col_len, - mbminlen, mbmaxlen */ #ifdef UNIV_DEBUG const dict_index_t* index, - /*!< in: InnoDB index */ ulint field_no, - /*!< in: templ->rec_field_no or - templ->clust_rec_field_no or - templ->icp_rec_field_no */ #endif /* UNIV_DEBUG */ - const byte* data, /*!< in: data to store */ - ulint len) /*!< in: length of the data */ + const byte* data, + ulint len, + ulint sec_field) { byte* ptr; #ifdef UNIV_DEBUG const dict_field_t* field = dict_index_get_nth_field(index, field_no); + bool clust_templ_for_sec = (sec_field != ULINT_UNDEFINED); #endif /* UNIV_DEBUG */ ut_ad(len != UNIV_SQL_NULL); @@ -2709,7 +2713,8 @@ row_sel_field_store_in_mysql_format_func( containing UTF-8 ENUM columns due to Bug #9526. */ ut_ad(!templ->mbmaxlen || !(templ->mysql_col_len % templ->mbmaxlen)); - ut_ad(len * templ->mbmaxlen >= templ->mysql_col_len + ut_ad(clust_templ_for_sec + || len * templ->mbmaxlen >= templ->mysql_col_len || (field_no == templ->icp_rec_field_no && field->prefix_len > 0)); ut_ad(!(field->prefix_len % templ->mbmaxlen)); @@ -2737,21 +2742,26 @@ row_sel_field_store_in_mysql_format_func( case DATA_DECIMAL: /* Above are the valid column types for MySQL data. */ #endif /* UNIV_DEBUG */ + /* If sec_field value is present then mapping of + secondary index records to clustered index template + happens for end range comparison. So length can + vary according to secondary index record length. */ ut_ad(field->prefix_len ? field->prefix_len == len - : templ->mysql_col_len == len); + : (clust_templ_for_sec ? + 1 : (templ->mysql_col_len == len))); memcpy(dest, data, len); } } #ifdef UNIV_DEBUG /** Convert a field from Innobase format to MySQL format. */ -# define row_sel_store_mysql_field(m,p,r,i,o,f,t,c) \ - row_sel_store_mysql_field_func(m,p,r,i,o,f,t,c) +# define row_sel_store_mysql_field(m,p,r,i,o,f,t,s) \ + row_sel_store_mysql_field_func(m,p,r,i,o,f,t,s) #else /* UNIV_DEBUG */ /** Convert a field from Innobase format to MySQL format. */ -# define row_sel_store_mysql_field(m,p,r,i,o,f,t,c) \ - row_sel_store_mysql_field_func(m,p,r,o,f,t,c) +# define row_sel_store_mysql_field(m,p,r,i,o,f,t,s) \ + row_sel_store_mysql_field_func(m,p,r,o,f,t,s) #endif /* UNIV_DEBUG */ /** Convert a field in the Innobase format to a field in the MySQL format. @param[out] mysql_rec record in the MySQL format @@ -2766,7 +2776,7 @@ row_sel_field_store_in_mysql_format_func( or sec field no if clust_templ_for_sec is TRUE @param[in] templ row template -@param[in] clust_templ_for_sec TRUE if rec belongs to secondary index +@param[in] sec_field_no field_no if rec belongs to secondary index but prebuilt template is in clustered index format and used only for end range comparison. */ @@ -2782,10 +2792,12 @@ row_sel_store_mysql_field_func( const ulint* offsets, ulint field_no, const mysql_row_templ_t*templ, - bool clust_templ_for_sec) + ulint sec_field_no) { const byte* data; ulint len; + ulint clust_field_no; + bool clust_templ_for_sec = (sec_field_no != ULINT_UNDEFINED); ut_ad(prebuilt->default_rec); ut_ad(templ); @@ -2796,7 +2808,14 @@ row_sel_store_mysql_field_func( || field_no == templ->rec_field_no || field_no == templ->icp_rec_field_no); ut_ad(rec_offs_validate(rec, - clust_templ_for_sec == true ? prebuilt->index : index, offsets)); + clust_templ_for_sec ? prebuilt->index : index, offsets)); + + /* If sec_field_no is present then extract the data from record + using secondary field no. */ + if (clust_templ_for_sec) { + clust_field_no = field_no; + field_no = sec_field_no; + } if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, field_no))) { @@ -2845,7 +2864,8 @@ row_sel_store_mysql_field_func( row_sel_field_store_in_mysql_format( mysql_rec + templ->mysql_col_offset, - templ, index, field_no, data, len); + templ, index, field_no, data, len, + ULINT_UNDEFINED); if (heap != prebuilt->blob_heap) { mem_heap_free(heap); @@ -2893,9 +2913,14 @@ row_sel_store_mysql_field_func( mem_heap_dup(prebuilt->blob_heap, data, len)); } + /* Reassign the clustered index field no. */ + if (clust_templ_for_sec) { + field_no = clust_field_no; + } + row_sel_field_store_in_mysql_format( mysql_rec + templ->mysql_col_offset, - templ, index, field_no, data, len); + templ, index, field_no, data, len, sec_field_no); } ut_ad(len != UNIV_SQL_NULL); @@ -2967,6 +2992,8 @@ row_sel_store_mysql_rec( = rec_clust ? templ->clust_rec_field_no : templ->rec_field_no; + ulint sec_field_no = ULINT_UNDEFINED; + /* We should never deliver column prefixes to MySQL, except for evaluating innobase_index_cond(). */ ut_ad(dict_index_get_nth_field(index, field_no)->prefix_len @@ -2983,13 +3010,13 @@ row_sel_store_mysql_rec( ut_ad(templ->rec_field_no == templ->clust_rec_field_no); - field_no = it - template_col.begin(); + sec_field_no = it - template_col.begin(); } if (!row_sel_store_mysql_field(mysql_rec, prebuilt, rec, index, offsets, field_no, templ, - clust_templ_for_sec)) { + sec_field_no)) { return(FALSE); } } @@ -2999,7 +3026,8 @@ row_sel_store_mysql_rec( NOTE, the record must be cluster index record. Secondary index might not have the Doc ID */ if (dict_table_has_fts_index(prebuilt->table) - && dict_index_is_clust(index)) { + && dict_index_is_clust(index) + && !clust_templ_for_sec) { prebuilt->fts_doc_id = fts_get_doc_id_from_rec( prebuilt->table, rec, NULL); @@ -3370,6 +3398,36 @@ row_sel_copy_cached_field_for_mysql( ut_memcpy(buf, cache, len); } +/** Copy used fields from cached row. +Copy cache record field by field, don't touch fields that +are not covered by current key. +@param[out] buf Where to copy the MySQL row. +@param[in] cached_rec What to copy (in MySQL row format). +@param[in] prebuilt prebuilt struct. */ +void +row_sel_copy_cached_fields_for_mysql( + byte* buf, + const byte* cached_rec, + row_prebuilt_t* prebuilt) +{ + const mysql_row_templ_t*templ; + ulint i; + for (i = 0; i < prebuilt->n_template; i++) { + templ = prebuilt->mysql_template + i; + + row_sel_copy_cached_field_for_mysql( + buf, cached_rec, templ); + /* Copy NULL bit of the current field from cached_rec + to buf */ + if (templ->mysql_null_bit_mask) { + buf[templ->mysql_null_byte_offset] + ^= (buf[templ->mysql_null_byte_offset] + ^ cached_rec[templ->mysql_null_byte_offset]) + & (byte) templ->mysql_null_bit_mask; + } + } +} + /********************************************************************//** Pops a cached row for MySQL from the fetch cache. */ UNIV_INLINE @@ -3629,7 +3687,7 @@ row_search_idx_cond_check( if (!row_sel_store_mysql_field(mysql_rec, prebuilt, rec, prebuilt->index, offsets, templ->icp_rec_field_no, - templ, false)) { + templ, ULINT_UNDEFINED)) { return(ICP_NO_MATCH); } } @@ -5086,8 +5144,19 @@ idx_cond_failed: btr_pcur_store_position(pcur, &mtr); - if (prebuilt->innodb_api) { - prebuilt->innodb_api_rec = result_rec; + if (prebuilt->innodb_api + && (btr_pcur_get_rec(pcur) != result_rec)) { + ulint rec_size = rec_offs_size(offsets); + if (!prebuilt->innodb_api_rec_size || + (prebuilt->innodb_api_rec_size < rec_size)) { + prebuilt->innodb_api_buf = + static_cast + (mem_heap_alloc(prebuilt->cursor_heap,rec_size)); + prebuilt->innodb_api_rec_size = rec_size; + } + prebuilt->innodb_api_rec = + rec_copy( + prebuilt->innodb_api_buf, result_rec, offsets); } } diff --git a/mysql-wsrep-5.6/storage/myisam/mi_delete_table.c b/mysql-wsrep-5.6/storage/myisam/mi_delete_table.c index b6530334..768b4618 100644 --- a/mysql-wsrep-5.6/storage/myisam/mi_delete_table.c +++ b/mysql-wsrep-5.6/storage/myisam/mi_delete_table.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ int mi_delete_table(const char *name) #endif fn_format(from,name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); - if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from)) + if (my_is_symlink(from, NULL) && (*myisam_test_invalid_symlink)(from)) { /* Symlink is pointing to file in data directory. @@ -44,7 +44,7 @@ int mi_delete_table(const char *name) DBUG_RETURN(my_errno); } fn_format(from,name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); - if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from)) + if (my_is_symlink(from, NULL) && (*myisam_test_invalid_symlink)(from)) { /* Symlink is pointing to file in data directory. diff --git a/mysql-wsrep-5.6/storage/myisam/mi_open.c b/mysql-wsrep-5.6/storage/myisam/mi_open.c index ac25be90..ea284f1b 100644 --- a/mysql-wsrep-5.6/storage/myisam/mi_open.c +++ b/mysql-wsrep-5.6/storage/myisam/mi_open.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -90,6 +90,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) ulong rec_per_key_part[HA_MAX_POSSIBLE_KEY*MI_MAX_KEY_SEG]; my_off_t key_root[HA_MAX_POSSIBLE_KEY],key_del[MI_MAX_KEY_BLOCK_SIZE]; ulonglong max_key_file_length, max_data_file_length; + ST_FILE_ID file_id= {0, 0}; DBUG_ENTER("mi_open"); LINT_INIT(m_info); @@ -101,11 +102,15 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) realpath_err= my_realpath(name_buff, fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0)); - if (my_is_symlink(org_name) && - (realpath_err || (*myisam_test_invalid_symlink)(name_buff))) + if (my_is_symlink(name_buff, &file_id)) { - my_errno= HA_WRONG_CREATE_OPTION; - DBUG_RETURN (NULL); + if (realpath_err || + (*myisam_test_invalid_symlink)(name_buff) || + my_is_symlink(name_buff, &file_id)) + { + my_errno= HA_WRONG_CREATE_OPTION; + DBUG_RETURN (NULL); + } } if (!internal_table) @@ -130,17 +135,28 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) my_errno= HA_ERR_CRASHED; goto err; }); + DEBUG_SYNC_C("before_opening_indexfile"); if ((kfile= mysql_file_open(mi_key_file_kfile, name_buff, - (open_mode= O_RDWR) | O_SHARE, MYF(0))) < 0) + (open_mode= O_RDWR) | O_SHARE | O_NOFOLLOW, + MYF(0))) < 0) { if ((errno != EROFS && errno != EACCES) || mode != O_RDONLY || (kfile= mysql_file_open(mi_key_file_kfile, name_buff, - (open_mode= O_RDONLY) | O_SHARE, MYF(0))) < 0) + (open_mode= O_RDONLY) | O_SHARE | O_NOFOLLOW, + MYF(0))) < 0) goto err; } + + if (!my_is_same_file(kfile, &file_id)) + { + mysql_file_close(kfile, MYF(0)); + my_errno= HA_WRONG_CREATE_OPTION; + goto err; + } + share->mode=open_mode; errpos=1; if (mysql_file_read(kfile, share->state.header.file_version, head_length, @@ -1233,14 +1249,16 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *org_name, { char *data_name= share->data_file_name; char real_data_name[FN_REFLEN]; + ST_FILE_ID file_id= {0, 0}; if (org_name) { fn_format(real_data_name,org_name,"",MI_NAME_DEXT,4); - if (my_is_symlink(real_data_name)) + if (my_is_symlink(real_data_name, &file_id)) { if (my_realpath(real_data_name, real_data_name, MYF(0)) || - (*myisam_test_invalid_symlink)(real_data_name)) + (*myisam_test_invalid_symlink)(real_data_name) || + my_is_symlink(real_data_name, &file_id)) { my_errno= HA_WRONG_CREATE_OPTION; return 1; @@ -1248,9 +1266,19 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *org_name, data_name= real_data_name; } } + DEBUG_SYNC_C("before_opening_datafile"); info->dfile= mysql_file_open(mi_key_file_dfile, - data_name, share->mode | O_SHARE, MYF(MY_WME)); - return info->dfile >= 0 ? 0 : 1; + data_name, share->mode | O_SHARE | O_NOFOLLOW, + MYF(MY_WME)); + if (info->dfile < 0) + return 1; + if (org_name && !my_is_same_file(info->dfile, &file_id)) + { + mysql_file_close(info->dfile, MYF(0)); + my_errno= HA_WRONG_CREATE_OPTION; + return 1; + } + return 0; } diff --git a/mysql-wsrep-5.6/unittest/gunit/fake_table.h b/mysql-wsrep-5.6/unittest/gunit/fake_table.h index 2b823233..7e0f9391 100644 --- a/mysql-wsrep-5.6/unittest/gunit/fake_table.h +++ b/mysql-wsrep-5.6/unittest/gunit/fake_table.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -58,7 +58,7 @@ class Fake_TABLE: public TABLE write_set= &write_set_struct; read_set= NULL; next_number_field= NULL; // No autoinc column - + pos_in_table_list= NULL; EXPECT_EQ(0, bitmap_init(write_set, &write_set_buf, s->fields, false)); static const char *table_name= "Fake"; diff --git a/mysql-wsrep-5.6/unittest/gunit/field-t.cc b/mysql-wsrep-5.6/unittest/gunit/field-t.cc index 004f1c81..82fc61a8 100644 --- a/mysql-wsrep-5.6/unittest/gunit/field-t.cc +++ b/mysql-wsrep-5.6/unittest/gunit/field-t.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -369,7 +369,7 @@ Field_set *FieldTest::create_field_set(TYPELIB *tl) 1, // packlength_arg tl, // typelib_arg &my_charset_latin1); // charset_arg - f->table= new Fake_TABLE(f); + f->table= ::new Fake_TABLE(f); return f; } @@ -400,8 +400,8 @@ TEST_F(FieldTest, CopyFieldSet) // Copy_field DTOR is not invoked in all contexts, so we may leak memory. EXPECT_FALSE(cf->tmp.is_alloced()); - delete f_to->table; - delete f_from->table; + ::delete static_cast(f_to->table); + ::delete static_cast(f_from->table); } diff --git a/mysql-wsrep-5.6/unittest/gunit/mock_field_timestamp.h b/mysql-wsrep-5.6/unittest/gunit/mock_field_timestamp.h index 433215cc..591c8aca 100644 --- a/mysql-wsrep-5.6/unittest/gunit/mock_field_timestamp.h +++ b/mysql-wsrep-5.6/unittest/gunit/mock_field_timestamp.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ class Mock_field_timestamp : public Field_timestamp uchar null_byte; void initialize() { - table = new Fake_TABLE(this); + table = ::new Fake_TABLE(this); EXPECT_FALSE(table == NULL) << "Out of memory"; ptr= buffer; memset(buffer, 0, PACK_LENGTH); @@ -81,7 +81,7 @@ public: store_timestamp_called= true; } - ~Mock_field_timestamp() { delete table; } + ~Mock_field_timestamp() { ::delete static_cast(table); } }; #endif // MOCK_FIELD_TIMESTAMP_H diff --git a/mysql-wsrep-5.6/unittest/gunit/mock_field_timestampf.h b/mysql-wsrep-5.6/unittest/gunit/mock_field_timestampf.h index 327a1dfd..9803d091 100644 --- a/mysql-wsrep-5.6/unittest/gunit/mock_field_timestampf.h +++ b/mysql-wsrep-5.6/unittest/gunit/mock_field_timestampf.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ class Mock_field_timestampf : public Field_timestampf uchar null_byte; void initialize() { - table = new Fake_TABLE(this); + table = ::new Fake_TABLE(this); EXPECT_FALSE(table == NULL) << "Out of memory"; ptr= buffer; memset(buffer, 0, PACK_LENGTH); @@ -65,7 +65,7 @@ public: return Field_timestampf::store_timestamp_internal(tm); } - ~Mock_field_timestampf() { delete table; } + ~Mock_field_timestampf() { ::delete static_cast(table); } }; #endif // MOCK_FIELD_TIMESTAMPF_H diff --git a/mysql-wsrep-5.6/unittest/gunit/segfault-t.cc b/mysql-wsrep-5.6/unittest/gunit/segfault-t.cc index 056a7a63..1b3239fd 100644 --- a/mysql-wsrep-5.6/unittest/gunit/segfault-t.cc +++ b/mysql-wsrep-5.6/unittest/gunit/segfault-t.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,8 +53,8 @@ TEST_F(FatalSignalDeathTest, Abort) TEST_F(FatalSignalDeathTest, Segfault) { - int *pint= NULL; #if defined(__WIN__) + int *pint= NULL; /* After upgrading from gtest 1.5 to 1.6 this segfault is no longer caught by handle_fatal_signal(). We get an empty error message from the @@ -63,8 +63,10 @@ TEST_F(FatalSignalDeathTest, Segfault) EXPECT_DEATH_IF_SUPPORTED(*pint= 42, ""); #elif defined(__SANITIZE_ADDRESS__) /* gcc 4.8.1 with '-fsanitize=address -O1' */ - EXPECT_DEATH_IF_SUPPORTED(*pint= 42, ".*ASAN:SIGSEGV.*"); + /* Newer versions of ASAN give other error message, disable it */ + // EXPECT_DEATH_IF_SUPPORTED(*pint= 42, ".*ASAN:SIGSEGV.*"); #else + int *pint= NULL; /* On most platforms we get SIGSEGV == 11, but SIGBUS == 10 is also possible. And on Mac OsX we can get SIGILL == 4 (but only in optmized mode). -- 2.45.2