diff options
Diffstat (limited to 'databases/xtrabackup84')
30 files changed, 830 insertions, 0 deletions
diff --git a/databases/xtrabackup84/Makefile b/databases/xtrabackup84/Makefile new file mode 100644 index 000000000000..1a6221595c3c --- /dev/null +++ b/databases/xtrabackup84/Makefile @@ -0,0 +1,72 @@ +PORTNAME= xtrabackup84 +DISTVERSION= 8.4.0-2 +CATEGORIES= databases +MASTER_SITES= https://downloads.percona.com/downloads/Percona-XtraBackup-8.4/Percona-XtraBackup-${DISTVERSION}/source/tarball/:percona +DISTFILES= ${PPORTNAME}-${DISTVERSION}${EXTRACT_SUFX}:percona + +MAINTAINER= samm@FreeBSD.org +COMMENT= Open-source backup tool for InnoDB and XtraDB +WWW= https://docs.percona.com/percona-xtrabackup/8.4/ + +LICENSE= GPLv2 +LICENSE_FILE= ${WRKSRC}/LICENSE + +# MySQL8.2+ supports only 64-bit platforms +NOT_FOR_ARCHS= armv6 armv7 i386 powerpc + +BUILD_DEPENDS= protobuf>=3.0:devel/protobuf \ + rapidjson>=1.1.0:devel/rapidjson \ + libevent>=2.1:devel/libevent +LIB_DEPENDS= libcurl.so:ftp/curl \ + libev.so:devel/libev \ + libgcrypt.so:security/libgcrypt \ + libgpg-error.so:security/libgpg-error \ + libicudata.so:devel/icu \ + libprotobuf-lite.so:devel/protobuf \ + libunwind.so:devel/libunwind \ + libzstd.so:archivers/zstd +RUN_DEPENDS= qpress:archivers/qpress + +USES= bison cmake compiler:c++14-lang cpe pkgconfig ssl +CPE_VENDOR= percona +CMAKE_ARGS= -DBUILD_CONFIG:STRING=xtrabackup_release \ + -DWITHOUT_COMPONENT_KEYRING_KMIP:STRING=yes \ + -DWITH_VERSION_CHECK=false + +.for component in EDITLINE ICU LIBEVENT PROTOBUF RAPIDJSON ZSTD +CMAKE_ARGS+= -DWITH_${component}:STRING=system +.endfor + +CONFLICTS_INSTALL= ${PORTNAME:C/.$//}* + +# Build fails without NDEBUG, so force it +CFLAGS+= -DNDEBUG -fPIC +CXXFLAGS+= -DNDEBUG -fPIC +CFLAGS_aarch64?= -march=armv8-a+crc+crypto + +PPORTNAME= percona-xtrabackup +WRKSRC= ${WRKDIR}/${PPORTNAME}-${DISTVERSION} + +.include <bsd.port.pre.mk> + +KEEP_EXTRA= lz4 zlib libbacktrace libcno boost unordered_dense + +post-patch: +.for d in storage/innobase/xtrabackup/src sql/protobuf + ${REINPLACE_CMD} 's,%%PREFIX%%,${PREFIX},' ${WRKSRC}/${d}/CMakeLists.txt +.endfor + +pre-configure: +.for dir in ${KEEP_EXTRA} + @${MV} ${WRKSRC}/extra/${dir} ${WRKDIR} +.endfor + @${RM} -r ${WRKSRC}/extra/* +.for dir in ${KEEP_EXTRA} + @${MV} ${WRKDIR}/${dir} ${WRKSRC}/extra +.endfor + +post-stage: + @${RM} -r ${STAGEDIR}${PREFIX}/docs ${STAGEDIR}${PREFIX}/man + @${RMDIR} ${STAGEDIR}${PREFIX}/lib/plugin/debug + +.include <bsd.port.post.mk> diff --git a/databases/xtrabackup84/distinfo b/databases/xtrabackup84/distinfo new file mode 100644 index 000000000000..4d592fe2d125 --- /dev/null +++ b/databases/xtrabackup84/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1745706170 +SHA256 (percona-xtrabackup-8.4.0-2.tar.gz) = 0777e3d3c3b4d4649ed23ed7197ec0aa71379b4a4a41b969b7286f6cf8888b4a +SIZE (percona-xtrabackup-8.4.0-2.tar.gz) = 432635356 diff --git a/databases/xtrabackup84/files/patch-CMakeLists.txt b/databases/xtrabackup84/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..f8dc92ee52fe --- /dev/null +++ b/databases/xtrabackup84/files/patch-CMakeLists.txt @@ -0,0 +1,22 @@ +--- CMakeLists.txt.orig 2024-08-08 10:30:27 UTC ++++ CMakeLists.txt +@@ -2097,8 +2097,6 @@ ENDIF() + ENDIF() + ENDIF() + +-ADD_SUBDIRECTORY(extra/libkmip) +- + # + # Setup maintainer mode options by the end. Platform checks are + # not run with the warning options as to not perturb fragile checks +@@ -2364,10 +2362,6 @@ IF(ENABLE_GCOV) + + IF(ENABLE_GCOV) + INCLUDE(fastcov) +-ENDIF() +- +-IF(UNIX) +- ADD_SUBDIRECTORY(man) + ENDIF() + + IF(LINUX AND NOT WITHOUT_SERVER) diff --git a/databases/xtrabackup84/files/patch-cmake-install_layout.cmake b/databases/xtrabackup84/files/patch-cmake-install_layout.cmake new file mode 100644 index 000000000000..ccfe4ddb0dfb --- /dev/null +++ b/databases/xtrabackup84/files/patch-cmake-install_layout.cmake @@ -0,0 +1,11 @@ +--- cmake/install_layout.cmake.orig 2024-08-08 10:30:27 UTC ++++ cmake/install_layout.cmake +@@ -160,7 +160,7 @@ SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share") + # + SET(INSTALL_SHAREDIR_STANDALONE "share") + SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share") +-SET(INSTALL_MYSQLTESTDIR_STANDALONE "xtrabackup-test") ++# SET(INSTALL_MYSQLTESTDIR_STANDALONE "xtrabackup-test") + SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") + # + SET(INSTALL_MYSQLDATADIR_STANDALONE "data") diff --git a/databases/xtrabackup84/files/patch-file_utils b/databases/xtrabackup84/files/patch-file_utils new file mode 100644 index 000000000000..a23aa72136d4 --- /dev/null +++ b/databases/xtrabackup84/files/patch-file_utils @@ -0,0 +1,20 @@ +--- storage/innobase/xtrabackup/src/file_utils.cc.orig 2023-11-24 17:33:10.000000000 +0700 ++++ storage/innobase/xtrabackup/src/file_utils.cc 2024-02-17 00:40:45.193255000 +0700 +@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Bos + + #include "file_utils.h" + #include <mysql/service_mysql_alloc.h> +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined (__FreeBSD__) + #include <sys/event.h> + #else + #include <sys/epoll.h> +@@ -391,7 +391,7 @@ File open_fifo_for_read_with_timeout(const char *path, + } + + /* File was open, lets check its open on the other side */ +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__FreeBSD__) + struct timespec tm = {timeout, 0}; + int kqueue_fd = kqueue(); + if (kqueue_fd < 0) { diff --git a/databases/xtrabackup84/files/patch-include_my__stacktrace.h b/databases/xtrabackup84/files/patch-include_my__stacktrace.h new file mode 100644 index 000000000000..c9435e093fd5 --- /dev/null +++ b/databases/xtrabackup84/files/patch-include_my__stacktrace.h @@ -0,0 +1,11 @@ +--- include/my_stacktrace.h.orig 2024-04-10 06:26:28 UTC ++++ include/my_stacktrace.h +@@ -45,7 +45,7 @@ + _WIN32 - Windows + HAVE_EXT_BACKTRACE - Unixes without backtrace(3) + */ +-#if defined(HAVE_BACKTRACE) || defined(_WIN32) || defined(HAVE_EXT_BACKTRACE) ++#if (defined(HAVE_BACKTRACE) && (defined(__aarch64__) || defined(__amd64__))) || defined(_WIN32) || defined(HAVE_EXT_BACKTRACE) + #define HAVE_STACKTRACE 1 + void my_init_stacktrace(); + void my_print_stacktrace(const uchar *stack_bottom, ulong thread_stack); diff --git a/databases/xtrabackup84/files/patch-libs_mysql_serialization_archive.h b/databases/xtrabackup84/files/patch-libs_mysql_serialization_archive.h new file mode 100644 index 000000000000..9c5c096c2b6b --- /dev/null +++ b/databases/xtrabackup84/files/patch-libs_mysql_serialization_archive.h @@ -0,0 +1,19 @@ +--- libs/mysql/serialization/archive.h.orig 2024-07-12 19:20:22 UTC ++++ libs/mysql/serialization/archive.h +@@ -81,14 +81,14 @@ class Archive { + /// @note To be implemented in Archive_derived_type + template <typename Type> + static std::size_t get_size(Type &&arg) { +- return Archive_derived_type::template get_size(std::forward<Type>(arg)); ++ return Archive_derived_type::template get_size<>(std::forward<Type>(arg)); + } + + /// @brief Returns archive size - size of data written to the archive + /// @return archive size - size of data written to the archive + /// @note To be implemented in Archive_derived_type + inline std::size_t get_size_written() const { +- return Archive_derived_type::template get_size_written(); ++ return Archive_derived_type::template get_size_written<>(); + } + + /// @brief Function returns maximum size of the Type diff --git a/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__default__impl.hpp b/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__default__impl.hpp new file mode 100644 index 000000000000..43dd9792cd34 --- /dev/null +++ b/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__default__impl.hpp @@ -0,0 +1,42 @@ +--- libs/mysql/serialization/serializer_default_impl.hpp.orig 2024-07-12 19:20:22 UTC ++++ libs/mysql/serialization/serializer_default_impl.hpp +@@ -233,7 +233,7 @@ std::size_t Serializer_default<Archive_concrete_type>: + template <class Field_type, Field_size field_size_defined, typename Enabler> + std::size_t Serializer_default<Archive_concrete_type>::get_field_size( + const Field_type &field) { +- return Archive_concrete_type::template get_size( ++ return Archive_concrete_type::template get_size<>( + Field_wrapper<const Field_type, field_size_defined>(field)); + } + +@@ -473,7 +473,7 @@ std::size_t Serializer_default<Archive_concrete_type>: + std::size_t calculated_size = 0; + bool is_provided = field_definition.run_encode_predicate(); + if (is_provided) { +- auto size_id_type = Archive_concrete_type::template get_size( ++ auto size_id_type = Archive_concrete_type::template get_size<>( + create_varlen_field_wrapper(field_id)); + calculated_size = get_field_size<Field_type, field_size_defined>( + field_definition.get_ref()) + +@@ -489,18 +489,18 @@ std::size_t Serializer_default<Archive_concrete_type>: + bool skip_id) { + std::size_t serializable_overhead_type = 0; + if (skip_id == false) { +- serializable_overhead_type = Archive_concrete_type::template get_size( ++ serializable_overhead_type = Archive_concrete_type::template get_size<>( + create_varlen_field_wrapper(field_id)); + } + auto serializable_size = serializable.template get_size_internal<Base_type>(); +- auto serializable_overhead_size = Archive_concrete_type::template get_size( ++ auto serializable_overhead_size = Archive_concrete_type::template get_size<>( + create_varlen_field_wrapper(serializable_size)); + + Field_id_type last_non_ignorable_field_id = + find_last_non_ignorable_field_id(serializable); + + auto serializable_overhead_last_non_ignorable_field_id = +- Archive_concrete_type::template get_size( ++ Archive_concrete_type::template get_size<>( + create_varlen_field_wrapper(last_non_ignorable_field_id)); + return serializable_overhead_type + serializable_overhead_size + + serializable_overhead_last_non_ignorable_field_id + serializable_size; diff --git a/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__impl.hpp b/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__impl.hpp new file mode 100644 index 000000000000..da31e03eb489 --- /dev/null +++ b/databases/xtrabackup84/files/patch-libs_mysql_serialization_serializer__impl.hpp @@ -0,0 +1,22 @@ +--- libs/mysql/serialization/serializer_impl.hpp.orig 2024-07-12 19:20:22 UTC ++++ libs/mysql/serialization/serializer_impl.hpp +@@ -51,8 +51,8 @@ Serializer<Serializer_derived_type, Archive_type>::get + Serializer<Serializer_derived_type, Archive_type>::get_size_field_def( + Field_id_type field_id, + const Field_definition<Field_type, field_size_defined> &field_definition) { +- return Serializer_derived_type::template get_size_field_def(field_id, +- field_definition); ++ return Serializer_derived_type::template get_size_field_def<>( ++ field_id, field_definition); + } + + template <class Serializer_derived_type, class Archive_type> +@@ -61,7 +61,7 @@ Serializer<Serializer_derived_type, Archive_type>::get + Serializer<Serializer_derived_type, Archive_type>::get_size_serializable( + Field_id_type field_id, const Serializable_concrete_type &serializable, + bool skip_id) { +- return Serializer_derived_type::template get_size_serializable( ++ return Serializer_derived_type::template get_size_serializable<>( + field_id, serializable, skip_id); + } + diff --git a/databases/xtrabackup84/files/patch-llvm-15 b/databases/xtrabackup84/files/patch-llvm-15 new file mode 100644 index 000000000000..68b5a7cee871 --- /dev/null +++ b/databases/xtrabackup84/files/patch-llvm-15 @@ -0,0 +1,28 @@ +--- storage/innobase/include/ddl0impl.h.orig 2024-08-08 10:30:27 UTC ++++ storage/innobase/include/ddl0impl.h +@@ -119,14 +119,6 @@ struct Row { + + /** Physical row context. */ + struct Row { +- /** Constructor. */ +- Row() = default; +- +- Row(const Row &) = default; +- +- /** Destructor. */ +- ~Row() = default; +- + Row &operator=(const Row &) = default; + + /** Build a row from a raw record. +--- unittest/gunit/mysys_my_rdtsc-t.cc.orig 2024-08-08 10:30:27 UTC ++++ unittest/gunit/mysys_my_rdtsc-t.cc +@@ -146,7 +146,7 @@ TEST_F(RDTimeStampCounter, TestNanosecond) { + ulonglong t1 = my_timer_nanoseconds(); + ulonglong t2; + int i; +- int backward = 0; ++ int backward [[maybe_unused]] = 0; + int nonzero = 0; + + for (i = 0; i < LOOP_COUNT; i++) { diff --git a/databases/xtrabackup84/files/patch-procps b/databases/xtrabackup84/files/patch-procps new file mode 100644 index 000000000000..2604380ecf1e --- /dev/null +++ b/databases/xtrabackup84/files/patch-procps @@ -0,0 +1,34 @@ +--- storage/innobase/xtrabackup/src/CMakeLists.txt.orig 2024-08-08 12:30:27.000000000 +0200 ++++ storage/innobase/xtrabackup/src/CMakeLists.txt 2024-09-03 10:39:46.078261000 +0200 +@@ -19,12 +19,13 @@ + OPTION(WITH_VERSION_CHECK "Build with version check" ON) + + INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake) ++INCLUDE_DIRECTORIES(%%PREFIX%%/include) + + FIND_GCRYPT() + +-IF(NOT APPLE) +- FIND_PROCPS() +-ENDIF() ++#IF(NOT APPLE) ++# FIND_PROCPS() ++#ENDIF() + + CHECK_TYPE_SIZE("unsigned long" SIZEOF_UNSIGNED_LONG) + +@@ -134,14 +135,6 @@ + ext::icu + crc + ) +- +-IF(NOT APPLE) +- IF(PROCPS_VERSION EQUAL 4) +- TARGET_LINK_LIBRARIES(xtrabackup proc2) +- ELSE() +- TARGET_LINK_LIBRARIES(xtrabackup procps) +- ENDIF() +-ENDIF() + + # We depend on protobuf because of the mysqlx plugin and replication. + IF(UNIX_INSTALL_RPATH_ORIGIN_PRIV_LIBDIR) diff --git a/databases/xtrabackup84/files/patch-protobuf b/databases/xtrabackup84/files/patch-protobuf new file mode 100644 index 000000000000..f1bd482d944a --- /dev/null +++ b/databases/xtrabackup84/files/patch-protobuf @@ -0,0 +1,10 @@ +--- sql/protobuf/CMakeLists.txt.orig 2023-11-24 17:33:10.000000000 +0700 ++++ sql/protobuf/CMakeLists.txt 2024-02-17 02:13:42.264307000 +0700 +@@ -21,6 +21,7 @@ + # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + INCLUDE(${CMAKE_SOURCE_DIR}/cmake/protobuf.cmake) ++INCLUDE_DIRECTORIES(%%PREFIX%%/include) + + SET(PROTOBUF_LITE_LIB_NAME rpl_protobuf_lite) + diff --git a/databases/xtrabackup84/files/patch-sql_auth_sql__authorization.cc b/databases/xtrabackup84/files/patch-sql_auth_sql__authorization.cc new file mode 100644 index 000000000000..7356f3ca739c --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_auth_sql__authorization.cc @@ -0,0 +1,13 @@ +--- sql/auth/sql_authorization.cc.orig 2024-08-08 10:30:27 UTC ++++ sql/auth/sql_authorization.cc +@@ -237,6 +237,10 @@ bool operator==(const Role_id &a, const std::string &b + return tmp == b; + } + ++bool operator==(const Role_id &a, const LEX_CSTRING &b) { ++ return a == to_string(b); ++} ++ + bool operator==(const std::pair<Role_id, bool> &a, const std::string &b) { + return a.first == b; + } diff --git a/databases/xtrabackup84/files/patch-sql_binlog__ostream.cc b/databases/xtrabackup84/files/patch-sql_binlog__ostream.cc new file mode 100644 index 000000000000..09a825eb9d7e --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_binlog__ostream.cc @@ -0,0 +1,11 @@ +--- sql/binlog_ostream.cc.orig 2024-08-08 10:30:27 UTC ++++ sql/binlog_ostream.cc +@@ -240,7 +240,7 @@ bool IO_CACHE_binlog_cache_storage::setup_ciphers_pass + + /* Generate password, it is a random string. */ + if (my_rand_buffer(password, sizeof(password))) return true; +- password_str.append(password, sizeof(password)); ++ password_str.insert(password_str.end(), password, password + sizeof(password)); + + m_io_cache.m_encryptor->close(); + m_io_cache.m_decryptor->close(); diff --git a/databases/xtrabackup84/files/patch-sql_mdl__context__backup.cc b/databases/xtrabackup84/files/patch-sql_mdl__context__backup.cc new file mode 100644 index 000000000000..f1a421d1f3ef --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_mdl__context__backup.cc @@ -0,0 +1,36 @@ +--- sql/mdl_context_backup.cc.orig 2024-08-08 10:30:27 UTC ++++ sql/mdl_context_backup.cc +@@ -160,7 +160,7 @@ bool MDL_context_backup_manager::create_backup(const M + DBUG_TRACE; + + try { +- MDL_context_backup_key key_obj(key, keylen); ++ MDL_context_backup_key key_obj(key, key + keylen); + + /* + Since this method is called as part of THD cleaning up, every XA +@@ -193,7 +193,7 @@ bool MDL_context_backup_manager::create_backup(MDL_req + + bool result = false; + try { +- MDL_context_backup_key key_obj(key, keylen); ++ MDL_context_backup_key key_obj(key, key + keylen); + /* + Check for presence a record with specified key in the collection of + MDL_context_backup elements. It is ok to already have a record with +@@ -239,7 +239,7 @@ bool MDL_context_backup_manager::restore_backup(MDL_co + + MUTEX_LOCK(guard, &m_LOCK_mdl_context_backup); + +- auto result = m_backup_map.find(MDL_context_backup_key(key, keylen)); ++ auto result = m_backup_map.find(MDL_context_backup_key(key, key + keylen)); + if (result != m_backup_map.end()) { + element = result->second.get(); + res = mdl_context->clone_tickets(element->get_context(), MDL_TRANSACTION); +@@ -252,5 +252,5 @@ void MDL_context_backup_manager::delete_backup(const u + const size_t keylen) { + DBUG_TRACE; + MUTEX_LOCK(guard, &m_LOCK_mdl_context_backup); +- m_backup_map.erase(MDL_context_backup_key(key, keylen)); ++ m_backup_map.erase(MDL_context_backup_key(key, key + keylen)); + } diff --git a/databases/xtrabackup84/files/patch-sql_mdl__context__backup.h b/databases/xtrabackup84/files/patch-sql_mdl__context__backup.h new file mode 100644 index 000000000000..76ef3239e8c2 --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_mdl__context__backup.h @@ -0,0 +1,11 @@ +--- sql/mdl_context_backup.h.orig 2024-08-08 10:30:27 UTC ++++ sql/mdl_context_backup.h +@@ -47,7 +47,7 @@ class MDL_context_backup_manager { + /** + Key for uniquely identifying MDL_context in the MDL_context_backup map. + */ +- typedef std::basic_string<uchar> MDL_context_backup_key; ++ typedef std::vector<uchar> MDL_context_backup_key; + + class MDL_context_backup; + diff --git a/databases/xtrabackup84/files/patch-sql_range__optimizer_index__range__scan__plan.cc b/databases/xtrabackup84/files/patch-sql_range__optimizer_index__range__scan__plan.cc new file mode 100644 index 000000000000..443abfba0906 --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_range__optimizer_index__range__scan__plan.cc @@ -0,0 +1,39 @@ +--- sql/range_optimizer/index_range_scan_plan.cc.orig 2024-08-08 10:30:27 UTC ++++ sql/range_optimizer/index_range_scan_plan.cc +@@ -1016,11 +1016,11 @@ static bool null_part_in_key(KEY_PART *key_part, const + return false; + } + +-// TODO(sgunders): This becomes a bit simpler with C++20's string_view +-// constructors. +-static inline std::basic_string_view<uchar> make_string_view(const uchar *start, +- const uchar *end) { +- return {start, static_cast<size_t>(end - start)}; ++static inline bool equal(const uchar *start1, const uchar *end1, ++ const uchar *start2, const uchar *end2) { ++ auto diff1 = end1 - start1; ++ auto diff2 = end2 - start2; ++ return diff1 == diff2 && memcmp(start1, start2, diff1) == 0; + } + + /** +@@ -1083,8 +1083,7 @@ static bool get_ranges_from_tree_given_base( + node->next_key_part->type == SEL_ROOT::Type::KEY_RANGE && + node->next_key_part->root->part == part + 1) { + if (node->min_flag == 0 && node->max_flag == 0 && +- make_string_view(min_key, tmp_min_key) == +- make_string_view(max_key, tmp_max_key)) { ++ equal(min_key, tmp_min_key, max_key, tmp_max_key)) { + // This range was an equality predicate, and we have more + // keyparts to scan, so use its range as a base for ranges on + // the next keypart(s). E.g. if we have (a = 3) on this keypart, +@@ -1160,8 +1159,7 @@ static bool get_ranges_from_tree_given_base( + else + flag |= NO_MAX_RANGE; + } +- if (flag == 0 && make_string_view(base_min_key, tmp_min_key) == +- make_string_view(base_max_key, tmp_max_key)) { ++ if (flag == 0 && equal(base_min_key, tmp_min_key, base_max_key, tmp_max_key)) { + flag |= EQ_RANGE; + /* + Note that keys which are extended with PK parts have no diff --git a/databases/xtrabackup84/files/patch-sql_rpl__log__encryption.cc b/databases/xtrabackup84/files/patch-sql_rpl__log__encryption.cc new file mode 100644 index 000000000000..d7a9ad58cf93 --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_rpl__log__encryption.cc @@ -0,0 +1,143 @@ +--- sql/rpl_log_encryption.cc.orig 2024-08-08 10:30:27 UTC ++++ sql/rpl_log_encryption.cc +@@ -213,7 +213,7 @@ bool Rpl_encryption::recover_master_key() { + Rpl_encryption_header::seqno_to_key_id(m_master_key_seqno); + auto master_key = + get_key(m_master_key.m_id, Rpl_encryption_header::get_key_type()); +- m_master_key.m_value.assign(master_key.second); ++ m_master_key.m_value = master_key.second; + /* No keyring error */ + if (master_key.first == Keyring_status::KEYRING_ERROR_FETCHING) goto err1; + } +@@ -290,7 +290,7 @@ bool Rpl_encryption::recover_master_key() { + + if (new_master_key.first == Keyring_status::SUCCESS) { + m_master_key.m_id = new_master_key_id; +- m_master_key.m_value.assign(new_master_key.second); ++ m_master_key.m_value = new_master_key.second; + if (new_master_key_seqno.second > m_master_key_seqno && + new_master_key_seqno.second > old_master_key_seqno.second) { + if (m_master_key_seqno > 0) { +@@ -380,8 +380,8 @@ std::pair<Rpl_encryption::Keyring_status, Key_string> + reinterpret_cast<unsigned char *>(std::get<1>(tuple)); + first[0] = ~(first[0]); + }); +- key_str.append(reinterpret_cast<unsigned char *>(std::get<1>(tuple)), +- std::get<2>(tuple)); ++ auto *first = reinterpret_cast<unsigned char *>(std::get<1>(tuple)); ++ key_str.insert(key_str.end(), first, first + std::get<2>(tuple)); + my_free(std::get<1>(tuple)); + } + +@@ -396,7 +396,7 @@ std::pair<Rpl_encryption::Keyring_status, Key_string> + if (pair.first == Keyring_status::SUCCESS) { + DBUG_EXECUTE_IF("corrupt_replication_encryption_key_size", + { pair.second.resize(key_size / 2); }); +- if (pair.second.length() != key_size) ++ if (pair.second.size() != key_size) + pair.first = Keyring_status::UNEXPECTED_KEY_SIZE; + } + return pair; +@@ -450,7 +450,7 @@ bool Rpl_encryption::enable_for_xtrabackup() { + Rpl_encryption_header::seqno_to_key_id(m_master_key_seqno); + auto master_key = + get_key(m_master_key.m_id, Rpl_encryption_header::get_key_type()); +- m_master_key.m_value.assign(master_key.second); ++ m_master_key.m_value = master_key.second; + /* No keyring error */ + if (master_key.first == Keyring_status::KEYRING_ERROR_FETCHING) res = true; + } +@@ -771,7 +771,7 @@ Rpl_encryption::get_seqno_from_keyring(std::string key + auto fetched_key = get_key(key_id, SEQNO_KEY_TYPE, SEQNO_KEY_LENGTH); + uint32_t seqno = 0; + if (fetched_key.first == Keyring_status::SUCCESS) { +- const void *key = fetched_key.second.c_str(); ++ const void *key = fetched_key.second.data(); + memcpy(&seqno, key, sizeof(seqno)); + seqno = le32toh(seqno); + } +@@ -976,7 +976,7 @@ bool Rpl_encryption::generate_master_key_on_keyring(ui + + /* Store the generated key as the new master key */ + m_master_key.m_id = key_id; +- m_master_key.m_value.assign(pair.second); ++ m_master_key.m_value = pair.second; + + return false; + } +@@ -1079,12 +1079,12 @@ bool Rpl_encryption_header_v1::serialize(Basic_ostream + + assert(m_encrypted_password.length() == PASSWORD_FIELD_SIZE); + *ptr++ = ENCRYPTED_FILE_PASSWORD; +- memcpy(ptr, m_encrypted_password.data(), m_encrypted_password.length()); ++ memcpy(ptr, m_encrypted_password.data(), m_encrypted_password.size()); + ptr += PASSWORD_FIELD_SIZE; + + assert(m_iv.length() == IV_FIELD_SIZE); + *ptr++ = IV_FOR_FILE_PASSWORD; +- memcpy(ptr, m_iv.data(), m_iv.length()); ++ memcpy(ptr, m_iv.data(), m_iv.size()); + + bool res = DBUG_EVALUATE_IF("fail_to_serialize_encryption_header", true, + ostream->write(header, HEADER_SIZE)); +@@ -1139,13 +1139,13 @@ bool Rpl_encryption_header_v1::deserialize(Basic_istre + reinterpret_cast<const unsigned char *>( + reader.ptr(PASSWORD_FIELD_SIZE)); + if (!reader.has_error()) +- m_encrypted_password.assign(password_ptr, PASSWORD_FIELD_SIZE); ++ m_encrypted_password.assign(password_ptr, password_ptr + PASSWORD_FIELD_SIZE); + break; + } + case IV_FOR_FILE_PASSWORD: { + const unsigned char *iv_ptr = + reinterpret_cast<const unsigned char *>(reader.ptr(IV_FIELD_SIZE)); +- if (!reader.has_error()) m_iv.assign(iv_ptr, IV_FIELD_SIZE); ++ if (!reader.has_error()) m_iv.assign(iv_ptr, iv_ptr + IV_FIELD_SIZE); + break; + } + default: +@@ -1205,11 +1205,11 @@ Key_string Rpl_encryption_header_v1::decrypt_file_pass + unsigned char buffer[Aes_ctr::PASSWORD_LENGTH]; + + if (my_aes_decrypt(m_encrypted_password.data(), +- m_encrypted_password.length(), buffer, ++ m_encrypted_password.size(), buffer, + error_and_key.second.data(), +- error_and_key.second.length(), my_aes_256_cbc, ++ error_and_key.second.size(), my_aes_256_cbc, + m_iv.data(), false) != MY_AES_BAD_DATA) +- file_password.append(buffer, Aes_ctr::PASSWORD_LENGTH); ++ file_password.insert(file_password.end(), buffer, buffer + Aes_ctr::PASSWORD_LENGTH); + } + } + #endif +@@ -1240,16 +1240,16 @@ bool Rpl_encryption_header_v1::encrypt_file_password(K + + /* Generate iv, it is a random string. */ + error = my_rand_buffer(iv, Aes_ctr::AES_BLOCK_SIZE); +- m_iv = Key_string(iv, sizeof(iv)); ++ m_iv = Key_string(iv, iv + sizeof(iv)); + + /* Encrypt password */ + if (!error) { +- error = (my_aes_encrypt(password_str.data(), password_str.length(), ++ error = (my_aes_encrypt(password_str.data(), password_str.size(), + encrypted_password, master_key.m_value.data(), +- master_key.m_value.length(), my_aes_256_cbc, iv, ++ master_key.m_value.size(), my_aes_256_cbc, iv, + false) == MY_AES_BAD_DATA); + m_encrypted_password = +- Key_string(encrypted_password, sizeof(encrypted_password)); ++ Key_string(encrypted_password, encrypted_password + sizeof(encrypted_password)); + } + + return error; +@@ -1265,7 +1265,7 @@ Key_string Rpl_encryption_header_v1::generate_new_file + /* Generate password, it is a random string. */ + error = my_rand_buffer(password, sizeof(password)); + if (!error) { +- password_str.append(password, sizeof(password)); ++ password_str.insert(password_str.end(), password, password + sizeof(password)); + } + + if (error || encrypt_file_password(password_str) || diff --git a/databases/xtrabackup84/files/patch-sql_stream__cipher.cc b/databases/xtrabackup84/files/patch-sql_stream__cipher.cc new file mode 100644 index 000000000000..a1de0e8f6df7 --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_stream__cipher.cc @@ -0,0 +1,11 @@ +--- sql/stream_cipher.cc.orig 2024-07-12 19:15:25 UTC ++++ sql/stream_cipher.cc +@@ -46,7 +46,7 @@ bool Aes_ctr_cipher<TYPE>::open(const Key_string &pass + m_header_size = header_size; + #ifdef HAVE_BYTESTOKEY_SHA512_HANDLING + if (EVP_BytesToKey(Aes_ctr::get_evp_cipher(), Aes_ctr::get_evp_md(), nullptr, +- password.data(), password.length(), 1, m_file_key, ++ password.data(), password.size(), 1, m_file_key, + m_iv) == 0) + return true; + #else diff --git a/databases/xtrabackup84/files/patch-sql_stream__cipher.h b/databases/xtrabackup84/files/patch-sql_stream__cipher.h new file mode 100644 index 000000000000..02b6baa6a178 --- /dev/null +++ b/databases/xtrabackup84/files/patch-sql_stream__cipher.h @@ -0,0 +1,19 @@ +--- sql/stream_cipher.h.orig 2024-08-08 10:30:27 UTC ++++ sql/stream_cipher.h +@@ -27,6 +27,7 @@ + #include <openssl/evp.h> + #include <memory> + #include <string> ++#include <vector> + + /** + @file stream_cipher.h +@@ -35,7 +36,7 @@ + binary log files. + */ + +-typedef std::basic_string<unsigned char> Key_string; ++typedef std::vector<unsigned char> Key_string; + + /** + @class Stream_cipher diff --git a/databases/xtrabackup84/files/patch-storage_innobase_include_srv0mon.h b/databases/xtrabackup84/files/patch-storage_innobase_include_srv0mon.h new file mode 100644 index 000000000000..a0279de2a126 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_include_srv0mon.h @@ -0,0 +1,13 @@ +--- storage/innobase/include/srv0mon.h.orig 2024-04-10 06:26:28 UTC ++++ storage/innobase/include/srv0mon.h +@@ -41,6 +41,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + /* Required for FreeBSD so that INT64_MAX is defined. */ + #define __STDC_LIMIT_MACROS + #endif /* __STDC_LIMIT_MACROS */ ++#ifdef __DragonFly__ ++/* The hack above doen't work for dragonfly, stdint.h already imported */ ++#include <machine/int_limits.h> ++#endif + + #include <stdint.h> + diff --git a/databases/xtrabackup84/files/patch-storage_innobase_include_ut0crc32.h b/databases/xtrabackup84/files/patch-storage_innobase_include_ut0crc32.h new file mode 100644 index 000000000000..b1b372a2d8c7 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_include_ut0crc32.h @@ -0,0 +1,12 @@ +--- storage/innobase/include/ut0crc32.h.orig 2024-04-10 06:26:28 UTC ++++ storage/innobase/include/ut0crc32.h +@@ -133,7 +133,9 @@ CRC32_DEFAULT + #endif /* CRC32_ARM64 */ + + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __FreeBSD__ + #include <asm/hwcap.h> ++#endif /* __FreeBSD__ */ + #include <sys/auxv.h> + #endif /* CRC32_ARM64_DEFAULT */ + diff --git a/databases/xtrabackup84/files/patch-storage_innobase_ut_crc32.cc b/databases/xtrabackup84/files/patch-storage_innobase_ut_crc32.cc new file mode 100644 index 000000000000..4a2609cc1491 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_ut_crc32.cc @@ -0,0 +1,104 @@ +--- storage/innobase/ut/crc32.cc.orig 2024-04-10 06:26:28 UTC ++++ storage/innobase/ut/crc32.cc +@@ -333,8 +333,25 @@ bool can_use_poly_mul() { return true; } + #endif /* CRC32_ARM64_APPLE */ + + #ifdef CRC32_ARM64_DEFAULT ++#ifdef __FreeBSD__ ++bool can_use_crc32() { ++ unsigned long capabilities; ++ ++ if (elf_aux_info(AT_HWCAP, &capabilities, sizeof(unsigned long))) ++ return false; ++ return capabilities & HWCAP_CRC32; ++} ++bool can_use_poly_mul() { ++ unsigned long capabilities; ++ ++ if (elf_aux_info(AT_HWCAP, &capabilities, sizeof(unsigned long))) ++ return false; ++ return capabilities & HWCAP_PMULL; ++} ++#else + bool can_use_crc32() { return getauxval(AT_HWCAP) & HWCAP_CRC32; } + bool can_use_poly_mul() { return getauxval(AT_HWCAP) & HWCAP_PMULL; } ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + + /** A helper template to statically unroll a loop with a fixed number of +@@ -443,25 +460,39 @@ uint64_t crc32_impl::update(uint64_t crc, uint64_t dat + + #ifdef CRC32_ARM64 + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"))) ++#else ++MY_ATTRIBUTE((target("crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_impl::update(uint32_t crc, unsigned char data) { + return __crc32cb(crc, data); + } + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_impl::update(uint32_t crc, uint16_t data) { + return __crc32ch(crc, data); + } + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"))) ++#else ++MY_ATTRIBUTE((target("crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_impl::update(uint32_t crc, uint32_t data) { + return __crc32cw(crc, data); + } + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"))) ++#else ++MY_ATTRIBUTE((target("crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint64_t crc32_impl::update(uint64_t crc, uint64_t data) { + return (uint64_t)__crc32cd((uint32_t)crc, data); +@@ -508,7 +539,11 @@ template <uint32_t w> + } + template <uint32_t w> + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crypto"))) ++#else ++MY_ATTRIBUTE((target("crypto"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint64_t use_pclmul::polynomial_mul_rev(uint32_t rev_u) { + constexpr uint64_t flipped_w = flip_at_32(w); +@@ -751,7 +786,11 @@ MY_ATTRIBUTE((flatten)) + MY_ATTRIBUTE((flatten)) + #endif /* CRC32_ARM64_APPLE */ + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc+crypto"), flatten)) ++#else ++MY_ATTRIBUTE((target("crc,crypto"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_using_pclmul(const byte *data, size_t len) { + return crc32<use_pclmul>(0, data, len); +@@ -771,7 +810,11 @@ MY_ATTRIBUTE((flatten)) + MY_ATTRIBUTE((flatten)) + #endif /* CRC32_ARM64_APPLE */ + #ifdef CRC32_ARM64_DEFAULT ++#ifndef __clang__ + MY_ATTRIBUTE((target("+crc"), flatten)) ++#else ++MY_ATTRIBUTE((target("crc"))) ++#endif + #endif /* CRC32_ARM64_DEFAULT */ + uint32_t crc32_using_unrolled_loop_poly_mul(const byte *data, size_t len) { + return crc32<use_unrolled_loop_poly_mul>(0, data, len); diff --git a/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_keyring__plugins.cc b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_keyring__plugins.cc new file mode 100644 index 000000000000..53acbc1a18d1 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_keyring__plugins.cc @@ -0,0 +1,11 @@ +--- storage/innobase/xtrabackup/src/keyring_plugins.cc.orig 2024-11-11 11:46:47 UTC ++++ storage/innobase/xtrabackup/src/keyring_plugins.cc +@@ -863,7 +863,7 @@ bool xb_binlog_password_reencrypt(const char *binlog_f + return (false); + } + +- Key_string file_password(key, Encryption::KEY_LEN); ++ Key_string file_password(key, key + Encryption::KEY_LEN); + header->encrypt_file_password(file_password); + + IO_CACHE_ostream ostream; diff --git a/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_utils.cc b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_utils.cc new file mode 100644 index 000000000000..4203a118de83 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_src_utils.cc @@ -0,0 +1,59 @@ +--- storage/innobase/xtrabackup/src/utils.cc.orig 2024-08-08 10:30:27 UTC ++++ storage/innobase/xtrabackup/src/utils.cc +@@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Bos + + #ifdef __APPLE__ + #include <mach/mach_host.h> ++#endif ++#if defined(__APPLE__) || defined(__FreeBSD__) + #include <sys/sysctl.h> + #else + #ifdef HAVE_PROCPS_V3 +@@ -131,12 +133,14 @@ bool get_major_minor_version(const std::string &versio + return true; + } + +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__FreeBSD__) + unsigned long host_total_memory() { + unsigned long total_mem = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE); + return total_mem; + } ++#endif + ++#ifdef __APPLE__ + unsigned long host_free_memory() { + unsigned long total_mem = host_total_memory(); + int64_t used_mem; +@@ -157,6 +161,31 @@ unsigned long host_free_memory() { + return total_mem - (unsigned long)used_mem; + } + return 0; ++} ++#elif defined(__FreeBSD__) ++unsigned long host_free_memory() { ++ static int mib_free[2] = { -1, 0 }; ++ static int mib_inactive[2] = { -1, 0 }; ++ size_t miblen = sizeof(mib_free) / sizeof(mib_free[0]); ++ uint32_t free_pages, inactive_pages; ++ size_t sz = sizeof(free_pages); ++ ++ free_pages = inactive_pages = 0; ++ ++ if (mib_free[0] < 0 && ++ sysctlnametomib("vm.stats.vm.v_free_count", mib_free, &miblen) < 0) ++ mib_free[0] = 0; ++ if (mib_inactive[0] < 0 && ++ sysctlnametomib("vm.stats.vm.v_inactive_count", mib_inactive, &miblen) < 0) ++ mib_inactive[0] = 0; ++ ++ if (mib_free[0] && ++ sysctl(mib_free, 2, &free_pages, &sz, NULL, 0) < 0) ++ free_pages = 0; /* should not happen */ ++ if (mib_inactive[0] && sysctl(mib_inactive, 2, &inactive_pages, &sz, NULL, 0) < 0) ++ inactive_pages = 0; /* should not happen, too */ ++ ++ return (free_pages + inactive_pages) * sysconf(_SC_PAGESIZE); + } + #else + unsigned long host_total_memory() { diff --git a/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_xbcloud__osenv.sh b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_xbcloud__osenv.sh new file mode 100644 index 000000000000..37b1e45afc66 --- /dev/null +++ b/databases/xtrabackup84/files/patch-storage_innobase_xtrabackup_xbcloud__osenv.sh @@ -0,0 +1,15 @@ +--- storage/innobase/xtrabackup/xbcloud_osenv.sh.orig 2020-08-28 21:02:32 UTC ++++ storage/innobase/xtrabackup/xbcloud_osenv.sh +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + + # Copyright (C) 2015 Percona LLC and/or its affiliates. + # This software comes with ABSOLUTELY NO WARRANTY. This is free software, +@@ -105,5 +105,5 @@ fi + + # do it + # shellcheck disable=SC2086,SC2048 +-${XBCLOUD_BIN} $* ${XBCLOUD_OS_ENV} ++${XBCLOUD_BIN} "$@" ${XBCLOUD_OS_ENV} + diff --git a/databases/xtrabackup84/files/patch-unittest_gunit_binlogevents_transaction__compression-t.cc b/databases/xtrabackup84/files/patch-unittest_gunit_binlogevents_transaction__compression-t.cc new file mode 100644 index 000000000000..d77f946e2276 --- /dev/null +++ b/databases/xtrabackup84/files/patch-unittest_gunit_binlogevents_transaction__compression-t.cc @@ -0,0 +1,11 @@ +--- unittest/gunit/binlogevents/transaction_compression-t.cc.orig 2024-07-12 19:20:22 UTC ++++ unittest/gunit/binlogevents/transaction_compression-t.cc +@@ -49,7 +49,7 @@ class TransactionPayloadCompressionTest : public ::tes + using Managed_buffer_t = Decompressor_t::Managed_buffer_t; + using Size_t = Decompressor_t::Size_t; + using Char_t = Decompressor_t::Char_t; +- using String_t = std::basic_string<Char_t>; ++ using String_t = std::vector<Char_t>; + using Decompress_status_t = + mysql::binlog::event::compression::Decompress_status; + using Compress_status_t = mysql::binlog::event::compression::Compress_status; diff --git a/databases/xtrabackup84/files/patch-unittest_gunit_stream__cipher-t.cc b/databases/xtrabackup84/files/patch-unittest_gunit_stream__cipher-t.cc new file mode 100644 index 000000000000..cf39ae68faf3 --- /dev/null +++ b/databases/xtrabackup84/files/patch-unittest_gunit_stream__cipher-t.cc @@ -0,0 +1,15 @@ +--- unittest/gunit/stream_cipher-t.cc.orig 2024-08-08 10:30:27 UTC ++++ unittest/gunit/stream_cipher-t.cc +@@ -251,10 +251,10 @@ void SetKeyStr(Key_string &key_str, const unsigned cha + template <typename T> + void SetKeyStr(Key_string &key_str, const unsigned char *key) { + if (key) { +- key_str.assign(key, T::PASSWORD_LENGTH); ++ key_str.assign(key, key + T::PASSWORD_LENGTH); + } else { + const unsigned char new_key[T::PASSWORD_LENGTH]{0}; +- key_str.assign(new_key, T::PASSWORD_LENGTH); ++ key_str.assign(new_key, new_key + T::PASSWORD_LENGTH); + } + } + diff --git a/databases/xtrabackup84/pkg-descr b/databases/xtrabackup84/pkg-descr new file mode 100644 index 000000000000..da1655f57769 --- /dev/null +++ b/databases/xtrabackup84/pkg-descr @@ -0,0 +1,4 @@ +Percona XtraBackup is an open-source hot backup utility for MySQL that +doesn't lock your database during the backup. It can back up data from +InnoDB, XtraDB and MyISAM tables on MySQL/Percona Server/MariaDB +servers, and has many advanced features. diff --git a/databases/xtrabackup84/pkg-plist b/databases/xtrabackup84/pkg-plist new file mode 100644 index 000000000000..8128dd3b9dac --- /dev/null +++ b/databases/xtrabackup84/pkg-plist @@ -0,0 +1,9 @@ +bin/xbcloud +bin/xbcloud_osenv +bin/xbcrypt +bin/xbstream +bin/xtrabackup +lib/libmysqlservices.a +lib/plugin/component_keyring_file.so +lib/plugin/component_keyring_kms.so +lib/plugin/component_keyring_vault.so |