Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37490382
en ru br
Репозитории ALT
S:8.0.30-alt2
5.1: 5.0.89-alt1
4.1: 5.0.51-alt2.a
4.0: 5.0.51-alt2.a.M40.2
+updates:5.0.51-alt2.a.M40.1
3.0: 4.0.24-alt1
www.altlinux.org/Changes

Группа :: Базы Данных
Пакет: MySQL

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: mysql-8.0.30-alt-e2k.patch
Скачать


From c335ffa055646319af9a9c0e92be02d215143e9d Mon Sep 17 00:00:00 2001
From: Ilya Kurdyukov <jpegqs@gmail.com>
Date: Sat, 3 Sep 2022 21:09:44 +0700
Subject: [PATCH] mysql-8.0.30 e2k support
These sed patches are also needed to workaround bugs in the EDG frontend: 
sed -i "/using __base/{N;N;s/^.*using __base.*EncodeBase.*friend __base.*$/EncodeBase_EDG/}" router/src/mysql_protocol/include/mysqlrouter/classic_protocol_codec_*.h
sed -i "/#include <filesystem>/c #define preferred_separator preferred_separator_1\n#include <experimental/filesystem>\nnamespace std { namespace filesystem = experimental::filesystem; }" mysql-shell/{configure.cmake,mysqlshdk/libs/storage/backend/directory.cc}
sed -i "s/-Werror/-Wno-error/" mysql-shell/cmake/compiler.cmake
---
 CMakeLists.txt                                  |  1 +
 cmake/abi_check.cmake                           |  2 +-
 extra/robin-hood-hashing/robin_hood.h           |  2 +-
 extra/zstd/zstd-1.5.0/lib/common/compiler.h     |  2 +-
 .../devapi/mod_mysqlx_collection_find.cc        |  6 ++++++
 .../devapi/mod_mysqlx_collection_modify.cc      |  4 ++++
 .../modules/devapi/mod_mysqlx_table_insert.cc   |  6 ++++++
 .../mysqlshdk/include/scripting/types_cpp.h     |  4 ++--
 .../mysqlshdk/libs/storage/backend/directory.cc |  4 ++--
 .../mysqlrouter/classic_protocol_codec_base.h   | 17 +++++++++++++++++
 sql/containers/atomics_array.h                  |  2 +-
 sql/containers/integrals_lockfree_queue.h       |  2 +-
 sql/mem_root_array.h                            |  2 +-
 sql/mysqld.cc                                   |  2 +-
 sql/mysqld.h                                    |  2 +-
 sql/thr_malloc.h                                |  2 +-
 storage/innobase/buf/checksum.cc                |  2 ++
 storage/innobase/include/os0thread.h            |  7 +++++++
 storage/innobase/include/ut0rnd.h               |  2 +-
 storage/innobase/ut/ut0rnd.cc                   |  2 +-
 unittest/gunit/fake_table.cc                    |  7 +++++++
 unittest/gunit/gunit_test_main.cc               |  2 +-
 unittest/gunit/gunit_test_main.h                |  2 +-
 23 files changed, 67 insertions(+), 17 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22fa2127..9cca8fef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -665,6 +665,7 @@ SET(MYSQL_MACHINE_TYPE ${CMAKE_SYSTEM_PROCESSOR})
 SET(KNOWN_64BIT_ARCHITECTURES
   arm64
   aarch64
+  e2k
   ppc64
   ppc64le
   s390x
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index 864fcbe6..4248be2a 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -32,7 +32,7 @@
 # On Windows we use the Windows subsystem for Linux and gcc and sed
 # installed in it, if available.
 SET(RUN_ABI_CHECK 0)
-IF(LINUX AND MY_COMPILER_IS_GNU)
+IF(LINUX AND MY_COMPILER_IS_GNU AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "e2k")
   SET(RUN_ABI_CHECK 1)
 ELSEIF(WIN32)
   FIND_PROGRAM(WSL_EXECUTABLE wsl HINTS C:/Windows/Sysnative)
diff --git a/extra/robin-hood-hashing/robin_hood.h b/extra/robin-hood-hashing/robin_hood.h
index c92b96ad..67f25aeb 100644
--- a/extra/robin-hood-hashing/robin_hood.h
+++ b/extra/robin-hood-hashing/robin_hood.h
@@ -175,7 +175,7 @@ static Counts& counts() {
 #ifndef __has_cpp_attribute // For backwards compatibility
 #    define __has_cpp_attribute(x) 0
 #endif
-#if __has_cpp_attribute(clang::fallthrough)
+#if __has_cpp_attribute(clang::fallthrough) && !defined(__e2k__)
 #    define ROBIN_HOOD_PRIVATE_DEFINITION_FALLTHROUGH() [[clang::fallthrough]]
 #elif __has_cpp_attribute(gnu::fallthrough)
 #    define ROBIN_HOOD_PRIVATE_DEFINITION_FALLTHROUGH() [[gnu::fallthrough]]
diff --git a/extra/zstd/zstd-1.5.0/lib/common/compiler.h b/extra/zstd/zstd-1.5.0/lib/common/compiler.h
index a951d0ad..bc67d06a 100644
--- a/extra/zstd/zstd-1.5.0/lib/common/compiler.h
+++ b/extra/zstd/zstd-1.5.0/lib/common/compiler.h
@@ -151,7 +151,7 @@
 
 /* vectorization
  * older GCC (pre gcc-4.3 picked as the cutoff) uses a different syntax */
-#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__)
+#if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && !defined(__e2k__)
 #  if (__GNUC__ == 4 && __GNUC_MINOR__ > 3) || (__GNUC__ >= 5)
 #    define DONT_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
 #  else
diff --git a/mysql-shell/modules/devapi/mod_mysqlx_collection_find.cc b/mysql-shell/modules/devapi/mod_mysqlx_collection_find.cc
index d0347020..53466482 100644
--- a/mysql-shell/modules/devapi/mod_mysqlx_collection_find.cc
+++ b/mysql-shell/modules/devapi/mod_mysqlx_collection_find.cc
@@ -36,9 +36,15 @@ namespace mysqlsh {
 namespace mysqlx {
 
 using shcore::Value;
+#ifdef __EDG__
+constexpr shcore::Value_type Array = shcore::Value_type::Array;
+constexpr shcore::Value_type Object = shcore::Value_type::Object;
+constexpr shcore::Value_type String = shcore::Value_type::String;
+#else
 using shcore::Value_type::Array;
 using shcore::Value_type::Object;
 using shcore::Value_type::String;
+#endif
 using std::placeholders::_1;
 
 REGISTER_HELP_CLASS(CollectionFind, mysqlx);
diff --git a/mysql-shell/modules/devapi/mod_mysqlx_collection_modify.cc b/mysql-shell/modules/devapi/mod_mysqlx_collection_modify.cc
index 9fb9875a..144a09d4 100644
--- a/mysql-shell/modules/devapi/mod_mysqlx_collection_modify.cc
+++ b/mysql-shell/modules/devapi/mod_mysqlx_collection_modify.cc
@@ -42,7 +42,11 @@ namespace mysqlsh {
 namespace mysqlx {
 
 using shcore::Value;
+#ifdef __EDG__
+constexpr shcore::Value_type Array = shcore::Value_type::Array;
+#else
 using shcore::Value_type::Array;
+#endif
 using std::placeholders::_1;
 
 // Documentation of CollectionModify class
diff --git a/mysql-shell/modules/devapi/mod_mysqlx_table_insert.cc b/mysql-shell/modules/devapi/mod_mysqlx_table_insert.cc
index 01f621c4..9a39f97e 100644
--- a/mysql-shell/modules/devapi/mod_mysqlx_table_insert.cc
+++ b/mysql-shell/modules/devapi/mod_mysqlx_table_insert.cc
@@ -33,9 +33,15 @@ namespace mysqlsh {
 namespace mysqlx {
 
 using shcore::Value;
+#ifdef __EDG__
+constexpr shcore::Value_type Array = shcore::Value_type::Array;
+constexpr shcore::Value_type Map = shcore::Value_type::Map;
+constexpr shcore::Value_type String = shcore::Value_type::String;
+#else
 using shcore::Value_type::Array;
 using shcore::Value_type::Map;
 using shcore::Value_type::String;
+#endif
 using std::placeholders::_1;
 
 REGISTER_HELP_CLASS(TableInsert, mysqlx);
diff --git a/mysql-shell/mysqlshdk/include/scripting/types_cpp.h b/mysql-shell/mysqlshdk/include/scripting/types_cpp.h
index 0da02a85..a5cd5bc3 100644
--- a/mysql-shell/mysqlshdk/include/scripting/types_cpp.h
+++ b/mysql-shell/mysqlshdk/include/scripting/types_cpp.h
@@ -1634,7 +1634,7 @@ class SHCORE_PUBLIC Cpp_object_bridge : public Object_bridge {
     _funcs.emplace(
         registered_name,
         std::shared_ptr<Cpp_function>(
-            new Cpp_function(&md, [&md, func = std::forward<F>(func),
+            new Cpp_function(&md, [this, &md, func = std::forward<F>(func),
                                    defs = std::make_tuple(std::move(defs)...)](
                                       const shcore::Argument_list &args) {
               // Executes parameter validators
@@ -1645,7 +1645,7 @@ class SHCORE_PUBLIC Cpp_object_bridge : public Object_bridge {
                 md.signature[index]->validate(args[index], &context);
               }
 
-              return detail::Result_wrapper<R>::call([&func, &args, &defs]() {
+              return detail::Result_wrapper<R>::call([this, &func, &args, &defs]() {
                 return call<R, F, A...>(func, args, defs,
                                         std::index_sequence_for<A...>{});
               });
diff --git a/mysql-shell/mysqlshdk/libs/storage/backend/directory.cc b/mysql-shell/mysqlshdk/libs/storage/backend/directory.cc
index ac06d7f1..ab4e4cd0 100644
--- a/mysql-shell/mysqlshdk/libs/storage/backend/directory.cc
+++ b/mysql-shell/mysqlshdk/libs/storage/backend/directory.cc
@@ -66,7 +66,7 @@ std::unordered_set<IDirectory::File_info> Directory::filter_files(
   std::error_code ec;
 
   for (auto &entry : std::filesystem::directory_iterator(path, ec)) {
-    if (entry.is_regular_file()
+    if (std::filesystem::is_regular_file(entry.symlink_status())) {
 #if (__GNUC__ < 8 || (__GNUC__ == 8 && __GNUC_MINOR__ < 4)) && \
     !defined(__clang__)
         // older versions of GCC do not handle filesystems which do not support
@@ -84,7 +84,7 @@ std::unordered_set<IDirectory::File_info> Directory::filter_files(
 
       if (pattern.empty() || shcore::match_glob(pattern, name)) {
         files.emplace(std::move(name), [entry = std::move(entry)]() {
-          return entry.file_size();
+          return std::filesystem::file_size(entry.path());
         });
       }
     }
diff --git a/router/src/mysql_protocol/include/mysqlrouter/classic_protocol_codec_base.h b/router/src/mysql_protocol/include/mysqlrouter/classic_protocol_codec_base.h
index b376d921..a4c7ca93 100644
--- a/router/src/mysql_protocol/include/mysqlrouter/classic_protocol_codec_base.h
+++ b/router/src/mysql_protocol/include/mysqlrouter/classic_protocol_codec_base.h
@@ -347,6 +347,22 @@ class EncodeSizeAccumulator {
  * used by .size() and .encode() as both have to process the same
  * fields in the same order, just with different mappers
  */
+#ifdef __EDG__
+#define EncodeBase_EDG \
+ private: \
+  const capabilities::value_type __base; \
+ public: \
+  constexpr size_t size() const noexcept { \
+    return accumulate_fields(impl::EncodeSizeAccumulator(__base)); \
+  } \
+  stdx::expected<size_t, std::error_code> encode( \
+      const net::mutable_buffer &buffer) const { \
+    return accumulate_fields(impl::EncodeBufferAccumulator(buffer, __base)); \
+  } \
+  constexpr capabilities::value_type caps() const noexcept { return __base; }
+
+template <class T> class EncodeBase {};
+#else
 template <class T>
 class EncodeBase {
  public:
@@ -368,6 +384,7 @@ class EncodeBase {
  private:
   const capabilities::value_type caps_;
 };
+#endif
 
 }  // namespace impl
 }  // namespace classic_protocol
diff --git a/sql/containers/atomics_array.h b/sql/containers/atomics_array.h
index 588fe986..1dd16139 100644
--- a/sql/containers/atomics_array.h
+++ b/sql/containers/atomics_array.h
@@ -256,7 +256,7 @@ class Atomics_array {
 
   friend std::ostream &operator<<(std::ostream &out,
                                   Atomics_array<T, I, A> &in) {
-    out << in.to_string(true) << std::flush;
+    out << in.to_string() << std::flush;
     return out;
   }
 
diff --git a/sql/containers/integrals_lockfree_queue.h b/sql/containers/integrals_lockfree_queue.h
index 923d4362..663057d3 100644
--- a/sql/containers/integrals_lockfree_queue.h
+++ b/sql/containers/integrals_lockfree_queue.h
@@ -542,7 +542,7 @@ class Integrals_lockfree_queue {
   friend std::ostream &operator<<(
       std::ostream &out,
       Integrals_lockfree_queue<T, Null, Erased, I, A> const &in) {
-    out << in.to_string(true) << std::flush;
+    out << in.to_string() << std::flush;
     return out;
   }
 
diff --git a/sql/mem_root_array.h b/sql/mem_root_array.h
index bceaff70..59d9fccf 100644
--- a/sql/mem_root_array.h
+++ b/sql/mem_root_array.h
@@ -480,7 +480,7 @@ class Mem_root_array : public Mem_root_array_YY<Element_type> {
       : Mem_root_array(root, x.cbegin(), x.cend()) {}
 
   Mem_root_array(std::initializer_list<Element_type> elements)
-      : Mem_root_array(*THR_MALLOC, begin(elements), end(elements)) {}
+      : Mem_root_array(*THR_MALLOC, elements.begin(), elements.end()) {}
 
   ~Mem_root_array() { super::clear(); }
 
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 32c0328a..81ed19ca 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1537,7 +1537,7 @@ SHOW_COMP_OPTION have_statement_timeout = SHOW_OPTION_DISABLED;
 
 /* Thread specific variables */
 
-thread_local MEM_ROOT **THR_MALLOC = nullptr;
+__thread MEM_ROOT **THR_MALLOC = nullptr;
 
 mysql_mutex_t LOCK_status, LOCK_uuid_generator, LOCK_crypt,
     LOCK_global_system_variables, LOCK_user_conn, LOCK_error_messages;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index c6f9fcc5..7def3bac 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -416,7 +416,7 @@ extern bool migrate_connect_options;
 
 extern LEX_CSTRING sql_statement_names[(uint)SQLCOM_END + 1];
 
-extern thread_local MEM_ROOT **THR_MALLOC;
+extern __thread MEM_ROOT **THR_MALLOC;
 
 extern PSI_file_key key_file_binlog_cache;
 extern PSI_file_key key_file_binlog_index_cache;
diff --git a/sql/thr_malloc.h b/sql/thr_malloc.h
index c3a3ed75..a4f49323 100644
--- a/sql/thr_malloc.h
+++ b/sql/thr_malloc.h
@@ -28,7 +28,7 @@
 struct CHARSET_INFO;
 struct MEM_ROOT;
 typedef unsigned int PSI_memory_key;
-extern thread_local MEM_ROOT **THR_MALLOC;
+extern __thread MEM_ROOT **THR_MALLOC;
 
 void init_sql_alloc(PSI_memory_key key, MEM_ROOT *root, size_t block_size);
 
diff --git a/storage/innobase/buf/checksum.cc b/storage/innobase/buf/checksum.cc
index 8f8a7631..ef28838c 100644
--- a/storage/innobase/buf/checksum.cc
+++ b/storage/innobase/buf/checksum.cc
@@ -30,6 +30,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
  Created Aug 11, 2011 Vasil Dimov
  *******************************************************/
 
+#define EDG_THREAD_FIX
+
 #include <sys/types.h>
 #include <zlib.h>
 
diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h
index f2371478..cc6e8ddc 100644
--- a/storage/innobase/include/os0thread.h
+++ b/storage/innobase/include/os0thread.h
@@ -69,8 +69,15 @@ using os_thread_id_t = std::thread::native_handle_type;
 
 namespace ut {
 /** The hash value of the current thread's id */
+#ifdef __EDG__
+extern const thread_local size_t this_thread_hash;
+#ifdef EDG_THREAD_FIX
+const thread_local size_t this_thread_hash = std::hash<std::thread::id>{}(std::this_thread::get_id());
+#endif
+#else
 const inline thread_local size_t this_thread_hash =
     std::hash<std::thread::id>{}(std::this_thread::get_id());
+#endif
 }  // namespace ut
 
 /** Returns the string representation of the thread ID supplied. It uses the
diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h
index 5a8dd225..5f7fa7b6 100644
--- a/storage/innobase/include/ut0rnd.h
+++ b/storage/innobase/include/ut0rnd.h
@@ -107,7 +107,7 @@ on data written to disk.
 
 namespace detail {
 /** Seed value of ut::random_64() */
-extern thread_local uint64_t random_seed;
+extern __thread uint64_t random_seed;
 
 /** A helper method, it is used by hash_binary_ib for backward compatibility.
 NOTE: Do not use this method, it produces results that are not hashed well.
diff --git a/storage/innobase/ut/ut0rnd.cc b/storage/innobase/ut/ut0rnd.cc
index 7f8ff347..1f003a66 100644
--- a/storage/innobase/ut/ut0rnd.cc
+++ b/storage/innobase/ut/ut0rnd.cc
@@ -35,7 +35,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
 
 namespace ut::detail {
 
-thread_local uint64_t random_seed = 0;
+__thread uint64_t random_seed = 0;
 
 /* This is a "precomputed" table of random hash values. */
 alignas(ut::INNODB_CACHE_LINE_SIZE)
diff --git a/unittest/gunit/fake_table.cc b/unittest/gunit/fake_table.cc
index a7480360..26850d35 100644
--- a/unittest/gunit/fake_table.cc
+++ b/unittest/gunit/fake_table.cc
@@ -19,7 +19,14 @@
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
+#ifdef __EDG__
+#include "sql/table.h"
+class Fake_TABLE : public TABLE {
+  static int highest_table_id;
+};
+#else
 #include "unittest/gunit/fake_table.h"
+#endif
 
 // We choose non-zero to avoid it working by coincidence.
 int Fake_TABLE::highest_table_id = 5;
diff --git a/unittest/gunit/gunit_test_main.cc b/unittest/gunit/gunit_test_main.cc
index 7bcc21ce..7ce83fc7 100644
--- a/unittest/gunit/gunit_test_main.cc
+++ b/unittest/gunit/gunit_test_main.cc
@@ -121,7 +121,7 @@ static void init_signal_handling() {
 // Some globals needed for "small" tests.
 mysql_mutex_t LOCK_open;
 uint opt_debug_sync_timeout = 0;
-thread_local MEM_ROOT **THR_MALLOC = nullptr;
+__thread MEM_ROOT **THR_MALLOC = nullptr;
 thread_local THD *current_thd = nullptr;
 size_t malloc_chunk_size = 1024;
 
diff --git a/unittest/gunit/gunit_test_main.h b/unittest/gunit/gunit_test_main.h
index 2fe17ac4..2f0db81e 100644
--- a/unittest/gunit/gunit_test_main.h
+++ b/unittest/gunit/gunit_test_main.h
@@ -30,7 +30,7 @@ struct MEM_ROOT;
 
 extern mysql_mutex_t LOCK_open;
 extern uint opt_debug_sync_timeout;
-extern thread_local MEM_ROOT **THR_MALLOC;
+extern __thread MEM_ROOT **THR_MALLOC;
 extern thread_local THD *current_thd;
 extern size_t malloc_chunk_size;
 
-- 
2.34.1
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin