Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Feb 2023 08:58:34 GMT
From:      Eugene Grosbein <eugen@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: d06e12de9aec - main - databases/xtrabackup8: update to version 8.0.31-24
Message-ID:  <202302260858.31Q8wYV7050534@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by eugen:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d06e12de9aeccfddb388561466ef833a2906d39e

commit d06e12de9aeccfddb388561466ef833a2906d39e
Author:     Eugene Grosbein <eugen@FreeBSD.org>
AuthorDate: 2023-02-26 08:50:17 +0000
Commit:     Eugene Grosbein <eugen@FreeBSD.org>
CommitDate: 2023-02-26 08:58:22 +0000

    databases/xtrabackup8: update to version 8.0.31-24
    
    This change includes files/patch-llvm-15, a copy of the patch
    fixing UB in MySQL Server 8.0.31 code included in xtrabackup8
    and discovered with Clang 15:
    
    https://cgit.freebsd.org/ports/tree/databases/mysql80-server/files/patch-llvm15-fix?id=9f33a321916b
    
    The version 8.0.31-24 includes auto-tuning of its "use-memory" option
    that needs implementation of host_free_memory() but lacks one
    suitable for FreeBSD. This change adds simple implementation by me
    in files/patch-storage_innobase_xtrabackup_src_utils.cc
    that sums sysctls vm.stats.vm.v_free_count and vm.stats.vm.v_inactive_count
    assuming that FreeBSD VM subsystem frees Inactive pages as needed.
    
    This feature was tested by port maintainer Eugene Zheganin
    successfully performing backup of 730GB MySQL InnoDB
    that failed with previous xtrabackup8 version if used with defaults.
    
    Drop unused dependency on vim and explicitly disable
    online version update check. Force NDEBUG build as it fails otherwise.
    Pet portlint.
    
    Work-around a problem with ncurses-6.3 dependency that installs
    wrong libncurses.so file (ASCII text), so use libncurses.so.6
    in LIB_DEPENDS instead.
    
    Tested by:      Eugene Zheganin
    Approved by:    Eugene Zheganin (maintainer)
---
 databases/xtrabackup8/Makefile                     | 54 ++++++++++++--------
 databases/xtrabackup8/distinfo                     | 10 ++--
 databases/xtrabackup8/files/patch-CMakeLists.txt   | 22 +++++---
 databases/xtrabackup8/files/patch-llvm-15          | 41 +++++++++++++++
 databases/xtrabackup8/files/patch-procps           | 15 ++++++
 databases/xtrabackup8/files/patch-sql_binlog.cc    | 24 ---------
 .../patch-storage_innobase_xtrabackup_src_utils.cc | 59 ++++++++++++++++++++++
 7 files changed, 168 insertions(+), 57 deletions(-)

diff --git a/databases/xtrabackup8/Makefile b/databases/xtrabackup8/Makefile
index a44d56c4e1b2..c38b83ce5ee1 100644
--- a/databases/xtrabackup8/Makefile
+++ b/databases/xtrabackup8/Makefile
@@ -1,13 +1,11 @@
 PORTNAME=	xtrabackup
-PORTVERSION=	8.0.14
-PORTREVISION=	6
+PORTVERSION=	8.0.31
+DISTVERSIONSUFFIX=	-24
 CATEGORIES=	databases
-MASTER_SITES=	https://www.percona.com/downloads/Percona-XtraBackup-${PORTVERSION:R}/Percona-XtraBackup-${PORTVERSION}/source/tarball/:precona \
-		https://github.com/percona/percona-xtrabackup/archive/:percona \
+MASTER_SITES=	https://github.com/percona/percona-xtrabackup/archive/:percona \
 		SF/boost/boost/${BOOST_VERSION}:boost
 PKGNAMESUFFIX=	8
-DISTNAME=	percona-${PORTNAME}-${PORTVERSION}
-DISTFILES=	percona-${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}:percona \
+DISTFILES=	${PPORTNAME}-${DVERSION}${EXTRACT_SUFX}:percona \
 		boost_${BOOST_VERSION_UNDER}${EXTRACT_SUFX}:boost
 
 MAINTAINER=	eugene@zhegan.in
@@ -17,34 +15,47 @@ WWW=		https://www.percona.com/doc/percona-xtrabackup/
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BUILD_DEPENDS=	xxd:editors/vim \
-		protobuf>=3.0:devel/protobuf \
+BUILD_DEPENDS=	protobuf>=3.0:devel/protobuf \
 		rapidjson>=1.1.0:devel/rapidjson \
-		libevent>=2.1:devel/libevent
+		libevent>=2.1:devel/libevent \
+		ncurses>=6.3:devel/ncurses
 LIB_DEPENDS=	libcurl.so:ftp/curl \
 		libev.so:devel/libev \
 		libgcrypt.so:security/libgcrypt \
 		libgpg-error.so:security/libgpg-error \
 		libicudata.so:devel/icu \
+		libncurses.so.6:devel/ncurses \
+		libprotobuf-lite.so:devel/protobuf \
 		libunwind.so:devel/libunwind \
 		libzstd.so:archivers/zstd
 RUN_DEPENDS=	qpress:archivers/qpress
 
-CONFLICTS_INSTALL=	${PORTNAME}
-
 USES=		bison cmake compiler:c++14-lang cpe pkgconfig ssl
 CPE_VENDOR=	percona
-CMAKE_ARGS=	-DBUILD_CONFIG:STRING=xtrabackup_release
+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}
+
 # Bundle last supported Boost release
-BOOST_VERSION=	1.72.0
+BOOST_VERSION=	1.77.0
 BOOST_VERSION_UNDER=	${BOOST_VERSION:C/\./_/g}
 
 CMAKE_ARGS+=	-DWITH_BOOST=${WRKDIR}/boost_${BOOST_VERSION_UNDER}
 
+# Build fails without NDEBUG, so force it
+CFLAGS+=	-DNDEBUG
+CXXFLAGS+=	-DNDEBUG
+
+DVERSION=	${PORTVERSION}${DISTVERSIONSUFFIX}
+PPORTNAME=	percona-${PORTNAME}
+WRKSRC=		${WRKDIR}/${PPORTNAME}-${PPORTNAME}-${DVERSION}
+
 .include <bsd.port.pre.mk>
 
 # Since MySQL 8.0.20 InnoDB engine uses new memory alligned allocator
@@ -54,15 +65,16 @@ CMAKE_ARGS+=	-DWITH_BOOST=${WRKDIR}/boost_${BOOST_VERSION_UNDER}
 CMAKE_ARGS+=	-DDISABLE_PSI_MEMORY=1
 .endif
 
-post-extract:
-# Delete bundled components so we won't accidentally use them, except LZ4
-# which cannot be removed just yet
-	@${MV} ${WRKSRC}/extra/lz4 ${WRKSRC}
-	@${RM} -r ${WRKSRC}/extra/*
-	@${MV} ${WRKSRC}/lz4 ${WRKSRC}/extra
+KEEP_EXTRA=	lz4 robin-hood-hashing zlib
 
-post-patch:
-	@${REINPLACE_CMD} -e 's,TRUE,true,' ${WRKSRC}/sql/mysqld.cc
+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
diff --git a/databases/xtrabackup8/distinfo b/databases/xtrabackup8/distinfo
index 6675fcff0dc8..d0cdcc263929 100644
--- a/databases/xtrabackup8/distinfo
+++ b/databases/xtrabackup8/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1650736843
-SHA256 (percona-xtrabackup-8.0.14.tar.gz) = db8d6d2c6a6b016bf24b4942582ebdbd55c09253ccc78daa6911217bd5a73d5d
-SIZE (percona-xtrabackup-8.0.14.tar.gz) = 285621091
-SHA256 (boost_1_72_0.tar.gz) = c66e88d5786f2ca4dbebb14e06b566fb642a1a6947ad8cc9091f9f445134143f
-SIZE (boost_1_72_0.tar.gz) = 126580835
+TIMESTAMP = 1677255149
+SHA256 (percona-xtrabackup-8.0.31-24.tar.gz) = 0031a91501a98e09b8d3955d580552ae05ac28696143369ba461aa1fa04c5140
+SIZE (percona-xtrabackup-8.0.31-24.tar.gz) = 336261760
+SHA256 (boost_1_77_0.tar.gz) = 5347464af5b14ac54bb945dc68f1dd7c56f0dad7262816b956138fc53bcc0131
+SIZE (boost_1_77_0.tar.gz) = 130620992
diff --git a/databases/xtrabackup8/files/patch-CMakeLists.txt b/databases/xtrabackup8/files/patch-CMakeLists.txt
index 15735641fee2..59e23aedca07 100644
--- a/databases/xtrabackup8/files/patch-CMakeLists.txt
+++ b/databases/xtrabackup8/files/patch-CMakeLists.txt
@@ -1,13 +1,21 @@
---- CMakeLists.txt.orig	2020-08-28 21:02:32 UTC
+--- CMakeLists.txt.orig	2023-01-30 13:34:34 UTC
 +++ CMakeLists.txt
-@@ -1575,10 +1575,6 @@ IF(ENABLE_GCOV)
-   INCLUDE(fastcov)
+@@ -2081,7 +2081,6 @@ ENDIF()
+   ENDIF()
  ENDIF()
  
--IF(UNIX)
--  ADD_SUBDIRECTORY(man)
+-ADD_SUBDIRECTORY(extra/libkmip)
+ 
+ #
+ # Setup maintainer mode options by the end. Platform checks are
+@@ -2292,10 +2291,6 @@ IF(ENABLE_GCOV)
+ 
+ IF(ENABLE_GCOV)
+   INCLUDE(fastcov)
 -ENDIF()
 -
+-IF(UNIX)
+-  ADD_SUBDIRECTORY(man)
+ ENDIF()
+ 
  IF(NOT WITHOUT_SERVER)
-   ADD_SUBDIRECTORY(packaging/rpm-common)
-   ADD_SUBDIRECTORY(packaging/rpm-oel)
diff --git a/databases/xtrabackup8/files/patch-llvm-15 b/databases/xtrabackup8/files/patch-llvm-15
new file mode 100644
index 000000000000..95eba05846e8
--- /dev/null
+++ b/databases/xtrabackup8/files/patch-llvm-15
@@ -0,0 +1,41 @@
+--- include/varlen_sort.h.orig	2023-01-30 20:34:34.000000000 +0700
++++ include/varlen_sort.h	2023-02-25 15:15:11.238374000 +0700
+@@ -184,7 +184,9 @@ template <>
+ 
+ // Required for Iterator.
+ template <>
+-struct iterator_traits<varlen_iterator> : iterator_traits<varlen_element *> {};
++struct iterator_traits<varlen_iterator> : iterator_traits<varlen_element *> {
++  using reference = varlen_element;
++};
+ 
+ }  // namespace std
+ 
+--- storage/innobase/include/ddl0impl.h.orig	2023-01-30 20:34:34.000000000 +0700
++++ storage/innobase/include/ddl0impl.h	2023-02-25 15:17:06.382636000 +0700
+@@ -118,14 +118,6 @@ struct Row {
+ 
+ /** Physical row context. */
+ struct Row {
+-  /** Constructor. */
+-  Row() = default;
+-
+-  Row(const Row &) = default;
+-
+-  /** Destructor. */
+-  ~Row() = default;
+-
+   /** Build a row from a raw record.
+   @param[in,out] ctx            DDL context.
+   @param[in,out] index          Index the record belongs to.
+--- unittest/gunit/mysys_my_rdtsc-t.cc.orig	2023-01-30 20:34:34.000000000 +0700
++++ unittest/gunit/mysys_my_rdtsc-t.cc	2023-02-25 15:23:43.264080000 +0700
+@@ -113,7 +113,7 @@ TEST_F(RDTimeStampCounter, TestCycle) {
+   ulonglong t1 = my_timer_cycles();
+   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/xtrabackup8/files/patch-procps b/databases/xtrabackup8/files/patch-procps
new file mode 100644
index 000000000000..3331e9140f8a
--- /dev/null
+++ b/databases/xtrabackup8/files/patch-procps
@@ -0,0 +1,15 @@
+--- storage/innobase/xtrabackup/src/CMakeLists.txt.orig	2023-01-30 20:34:34.000000000 +0700
++++ storage/innobase/xtrabackup/src/CMakeLists.txt	2023-02-25 17:34:58.412247000 +0700
+@@ -132,12 +132,6 @@ TARGET_LINK_LIBRARIES(xtrabackup
+   crc
+   )
+ 
+-IF(NOT APPLE)
+-  TARGET_LINK_LIBRARIES(xtrabackup
+-    procps
+-    )
+-ENDIF()
+-
+  # We depend on protobuf because of the mysqlx plugin and replication.
+  IF(UNIX_INSTALL_RPATH_ORIGIN_PRIV_LIBDIR)
+    ADD_INSTALL_RPATH_FOR_PROTOBUF(xtrabackup)
diff --git a/databases/xtrabackup8/files/patch-sql_binlog.cc b/databases/xtrabackup8/files/patch-sql_binlog.cc
deleted file mode 100644
index 2bae3d050d5a..000000000000
--- a/databases/xtrabackup8/files/patch-sql_binlog.cc
+++ /dev/null
@@ -1,24 +0,0 @@
---- sql/binlog.cc.orig	2020-08-28 21:02:32 UTC
-+++ sql/binlog.cc
-@@ -9163,8 +9163,8 @@ void MYSQL_BIN_LOG::report_missing_purged_gtids(
- 
-   char *missing_gtids = NULL;
-   char *slave_executed_gtids = NULL;
--  gtid_missing.to_string(&missing_gtids, NULL);
--  slave_executed_gtid_set->to_string(&slave_executed_gtids, NULL);
-+  gtid_missing.to_string(&missing_gtids, false);
-+  slave_executed_gtid_set->to_string(&slave_executed_gtids, false);
- 
-   /*
-      Log the information about the missing purged GTIDs to the error log.
-@@ -9217,8 +9217,8 @@ void MYSQL_BIN_LOG::report_missing_gtids(
-   Gtid_set gtid_missing(slave_executed_gtid_set->get_sid_map());
-   gtid_missing.add_gtid_set(slave_executed_gtid_set);
-   gtid_missing.remove_gtid_set(previous_gtid_set);
--  gtid_missing.to_string(&missing_gtids, NULL);
--  slave_executed_gtid_set->to_string(&slave_executed_gtids, NULL);
-+  gtid_missing.to_string(&missing_gtids, false);
-+  slave_executed_gtid_set->to_string(&slave_executed_gtids, false);
- 
-   String tmp_uuid;
- 
diff --git a/databases/xtrabackup8/files/patch-storage_innobase_xtrabackup_src_utils.cc b/databases/xtrabackup8/files/patch-storage_innobase_xtrabackup_src_utils.cc
new file mode 100644
index 000000000000..34feee9867f6
--- /dev/null
+++ b/databases/xtrabackup8/files/patch-storage_innobase_xtrabackup_src_utils.cc
@@ -0,0 +1,59 @@
+--- storage/innobase/xtrabackup/src/utils.cc.orig	2023-01-30 20:34:34.000000000 +0700
++++ storage/innobase/xtrabackup/src/utils.cc	2023-02-25 02:50:31.899561000 +0700
+@@ -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
+ #include <proc/sysinfo.h>
+@@ -112,12 +114,14 @@ unsigned long get_version_number(std::string version_s
+   return major * 10000 + minor * 100 + version;
+ }
+ 
+-#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;
+@@ -138,6 +142,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() {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302260858.31Q8wYV7050534>