From e6c1e588f05bd022262e68eb10f3634558e3f42c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 23 Jul 2019 14:51:48 +0300 Subject: [PATCH 1/4] gen_lex_hash: Omit deprecated register keywords This is follow-up to d36c107a6b7f9e9bc9425072f2ac13afd2334069 --- sql/gen_lex_hash.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index d488900fb85..76c747cebb8 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -403,8 +403,8 @@ int main(int argc,char **argv) static SYMBOL *get_hash_symbol(const char *s,\n\ unsigned int len,bool function)\n\ {\n\ - register uchar *hash_map;\n\ - register const char *cur_str= s;\n\ + uchar *hash_map;\n\ + const char *cur_str= s;\n\ \n\ if (len == 0) {\n\ DBUG_PRINT(\"warning\", (\"get_hash_symbol() received a request for a zero-length symbol, which is probably a mistake.\"));\ @@ -416,25 +416,25 @@ static SYMBOL *get_hash_symbol(const char *s,\n\ if (function){\n\ if (len>sql_functions_max_len) return 0;\n\ hash_map= sql_functions_map;\n\ - register uint32 cur_struct= uint4korr(hash_map+((len-1)*4));\n\ + uint32 cur_struct= uint4korr(hash_map+((len-1)*4));\n\ \n\ for (;;){\n\ - register uchar first_char= (uchar)cur_struct;\n\ + uchar first_char= (uchar)cur_struct;\n\ \n\ if (first_char == 0)\n\ {\n\ - register int16 ires= (int16)(cur_struct>>16);\n\ + int16 ires= (int16)(cur_struct>>16);\n\ if (ires==array_elements(symbols)) return 0;\n\ - register SYMBOL *res;\n\ + SYMBOL *res;\n\ if (ires>=0) \n\ res= symbols+ires;\n\ else\n\ res= sql_functions-ires-1;\n\ - register uint count= (uint) (cur_str - s);\n\ + uint count= (uint) (cur_str - s);\n\ return lex_casecmp(cur_str,res->name+count,len-count) ? 0 : res;\n\ }\n\ \n\ - register uchar cur_char= (uchar)to_upper_lex[(uchar)*cur_str];\n\ + uchar cur_char= (uchar)to_upper_lex[(uchar)*cur_str];\n\ if (cur_char>=8;\n\ if (cur_char>(uchar)cur_struct) return 0;\n\ @@ -450,20 +450,20 @@ static SYMBOL *get_hash_symbol(const char *s,\n\ }else{\n\ if (len>symbols_max_len) return 0;\n\ hash_map= symbols_map;\n\ - register uint32 cur_struct= uint4korr(hash_map+((len-1)*4));\n\ + uint32 cur_struct= uint4korr(hash_map+((len-1)*4));\n\ \n\ for (;;){\n\ - register uchar first_char= (uchar)cur_struct;\n\ + uchar first_char= (uchar)cur_struct;\n\ \n\ if (first_char==0){\n\ - register int16 ires= (int16)(cur_struct>>16);\n\ + int16 ires= (int16)(cur_struct>>16);\n\ if (ires==array_elements(symbols)) return 0;\n\ - register SYMBOL *res= symbols+ires;\n\ - register uint count= (uint) (cur_str - s);\n\ + SYMBOL *res= symbols+ires;\n\ + uint count= (uint) (cur_str - s);\n\ return lex_casecmp(cur_str,res->name+count,len-count)!=0 ? 0 : res;\n\ }\n\ \n\ - register uchar cur_char= (uchar)to_upper_lex[(uchar)*cur_str];\n\ + uchar cur_char= (uchar)to_upper_lex[(uchar)*cur_str];\n\ if (cur_char>=8;\n\ if (cur_char>(uchar)cur_struct) return 0;\n\ From 61b5e244d6a2079a35d76092be132dd625aafc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 23 Jul 2019 15:15:00 +0300 Subject: [PATCH 2/4] MDEV-20127 Merge new release of InnoDB 5.6.45 to 10.1 There is one directly applicable change to InnoDB: commit 739f5239f12904247d2a61f9880ea1fafbedc332 in the 5.5 branch will be merged before the next MariaDB releases. Another potentially applicable change will be tracked separately as MDEV-20126. Thus, here we only update the InnoDB version number and do not change anything else. --- mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff | 2 +- mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff | 2 +- mysql-test/suite/sys_vars/r/sysvars_innodb.result | 2 +- storage/innobase/include/univ.i | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff index 794e93a108b..9ff01028e25 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff @@ -1214,7 +1214,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.44 +-GLOBAL_VALUE 5.6.45 +GLOBAL_VALUE 5.6.43-84.3 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff index 195eda13c52..99293d1e11b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff @@ -684,7 +684,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.44 +-GLOBAL_VALUE 5.6.45 +GLOBAL_VALUE 5.6.43-84.3 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 7d18ab15085..7c8ce321cb2 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -2401,7 +2401,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.6.44 +GLOBAL_VALUE 5.6.45 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index dba52d3f647..02ab9e8b94f 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -45,7 +45,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 6 -#define INNODB_VERSION_BUGFIX 44 +#define INNODB_VERSION_BUGFIX 45 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; From c385d80abd8fd0f1aa1d514e046da96dc2011175 Mon Sep 17 00:00:00 2001 From: Laurynas Biveinis Date: Wed, 30 Jan 2019 10:16:55 +0200 Subject: [PATCH 3/4] Fix PS-5388 (Enable hardware CRC32 under Valgrind) Valgrind started supporting CRC32 instruction starting with version 3.6.1, released in 2011. Thus remove the fallback to software implementation in case running under Valgrind. --- storage/innobase/ut/ut0crc32.cc | 19 ------------------- storage/xtradb/ut/ut0crc32.cc | 19 ------------------- 2 files changed, 38 deletions(-) diff --git a/storage/innobase/ut/ut0crc32.cc b/storage/innobase/ut/ut0crc32.cc index cdf036e9d50..4d2d311ff48 100644 --- a/storage/innobase/ut/ut0crc32.cc +++ b/storage/innobase/ut/ut0crc32.cc @@ -316,26 +316,7 @@ ut_crc32_init() ut_cpuid(vend, &model, &family, &stepping, &features_ecx, &features_edx); - /* Valgrind does not understand the CRC32 instructions: - - vex amd64->IR: unhandled instruction bytes: 0xF2 0x48 0xF 0x38 0xF0 0xA - valgrind: Unrecognised instruction at address 0xad3db5. - Your program just tried to execute an instruction that Valgrind - did not recognise. There are two possible reasons for this. - 1. Your program has a bug and erroneously jumped to a non-code - location. If you are running Memcheck and you just saw a - warning about a bad jump, it's probably your program's fault. - 2. The instruction is legitimate but Valgrind doesn't handle it, - i.e. it's Valgrind's fault. If you think this is the case or - you are not sure, please let us know and we'll try to fix it. - Either way, Valgrind will now raise a SIGILL signal which will - probably kill your program. - - */ -#ifndef UNIV_DEBUG_VALGRIND ut_crc32_sse2_enabled = (features_ecx >> 20) & 1; -#endif /* UNIV_DEBUG_VALGRIND */ - #endif /* defined(__GNUC__) && defined(__x86_64__) */ #if defined(__linux__) && defined(__powerpc__) && defined(AT_HWCAP2) \ diff --git a/storage/xtradb/ut/ut0crc32.cc b/storage/xtradb/ut/ut0crc32.cc index f8e93ee7581..4ace913726d 100644 --- a/storage/xtradb/ut/ut0crc32.cc +++ b/storage/xtradb/ut/ut0crc32.cc @@ -316,26 +316,7 @@ ut_crc32_init() ut_cpuid(vend, &model, &family, &stepping, &features_ecx, &features_edx); - /* Valgrind does not understand the CRC32 instructions: - - vex amd64->IR: unhandled instruction bytes: 0xF2 0x48 0xF 0x38 0xF0 0xA - valgrind: Unrecognised instruction at address 0xad3db5. - Your program just tried to execute an instruction that Valgrind - did not recognise. There are two possible reasons for this. - 1. Your program has a bug and erroneously jumped to a non-code - location. If you are running Memcheck and you just saw a - warning about a bad jump, it's probably your program's fault. - 2. The instruction is legitimate but Valgrind doesn't handle it, - i.e. it's Valgrind's fault. If you think this is the case or - you are not sure, please let us know and we'll try to fix it. - Either way, Valgrind will now raise a SIGILL signal which will - probably kill your program. - - */ -#ifndef UNIV_DEBUG_VALGRIND ut_crc32_sse2_enabled = (features_ecx >> 20) & 1; -#endif /* UNIV_DEBUG_VALGRIND */ - #endif /* defined(__GNUC__) && defined(__x86_64__) */ #if defined(__linux__) && defined(__powerpc__) && defined(AT_HWCAP2) \ From d653db32f295e4a9d5fd53961f384ea427989dd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 23 Jul 2019 14:40:22 +0300 Subject: [PATCH 4/4] MDEV-14154: Make ut_time_ms(), ut_time_us() monotonic This is motivated by PS-5221 in percona/percona-server@2817c561fce9e20a83b13272ac45fd333467715d The coarser-precision ut_time() will still refer to the system clock, meaning that bad things can happen if the real time clock is adjusted backwards. --- storage/innobase/ut/ut0ut.cc | 14 +++----------- storage/xtradb/ut/ut0ut.cc | 14 +++----------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index b108fd7002e..92250bf0ebf 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2017, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. 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 @@ -165,12 +166,7 @@ ut_time_us( /*=======*/ ullint* tloc) /*!< out: us since epoch, if non-NULL */ { - struct timeval tv; - ullint us; - - ut_gettimeofday(&tv, NULL); - - us = (ullint) tv.tv_sec * 1000000 + tv.tv_usec; + ullint us = my_interval_timer() / 1000; if (tloc != NULL) { *tloc = us; @@ -189,11 +185,7 @@ ulint ut_time_ms(void) /*============*/ { - struct timeval tv; - - ut_gettimeofday(&tv, NULL); - - return((ulint) tv.tv_sec * 1000 + tv.tv_usec / 1000); + return static_cast(my_interval_timer() / 1000000); } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/xtradb/ut/ut0ut.cc b/storage/xtradb/ut/ut0ut.cc index 7b76d968e28..eda3921c5de 100644 --- a/storage/xtradb/ut/ut0ut.cc +++ b/storage/xtradb/ut/ut0ut.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2017, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. 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 @@ -189,12 +190,7 @@ ut_time_us( /*=======*/ ullint* tloc) /*!< out: us since epoch, if non-NULL */ { - struct timeval tv; - ullint us; - - ut_gettimeofday(&tv, NULL); - - us = (ullint) tv.tv_sec * 1000000 + tv.tv_usec; + ullint us = my_interval_timer() / 1000; if (tloc != NULL) { *tloc = us; @@ -213,11 +209,7 @@ ulint ut_time_ms(void) /*============*/ { - struct timeval tv; - - ut_gettimeofday(&tv, NULL); - - return((ulint) tv.tv_sec * 1000 + tv.tv_usec / 1000); + return static_cast(my_interval_timer() / 1000000); } #endif /* !UNIV_HOTBACKUP */