databases/xtrabackup80: fix build with llvm-19
PORTREVISION not bumped as this fixes build. PR: 287958 Reported by: Eugene M. Zheganin (maintainer) Tested by: Eugene M. Zheganin (maintainer)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
PORTNAME= xtrabackup80
|
||||
PORTVERSION= 8.0.35
|
||||
DISTVERSIONSUFFIX= -30
|
||||
PORTREVISION= 8
|
||||
PORTREVISION= 9
|
||||
CATEGORIES= databases
|
||||
MASTER_SITES= https://downloads.percona.com/downloads/Percona-XtraBackup-8.0/Percona-XtraBackup-8.0.35-30/source/tarball/:percona \
|
||||
SF/boost/boost/${BOOST_VERSION}:boost
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- sql/binlog_ostream.cc.orig 2023-11-24 10:33:10 UTC
|
||||
+++ sql/binlog_ostream.cc
|
||||
@@ -239,7 +239,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();
|
||||
@@ -0,0 +1,36 @@
|
||||
--- sql/mdl_context_backup.cc.orig 2023-11-24 10:33:10 UTC
|
||||
+++ sql/mdl_context_backup.cc
|
||||
@@ -159,7 +159,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
|
||||
@@ -192,7 +192,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
|
||||
@@ -238,7 +238,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);
|
||||
@@ -251,5 +251,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));
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
--- sql/mdl_context_backup.h.orig 2023-11-24 10:33:10 UTC
|
||||
+++ sql/mdl_context_backup.h
|
||||
@@ -46,7 +46,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;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
--- sql/range_optimizer/index_range_scan_plan.cc.orig 2023-11-24 10:33:10 UTC
|
||||
+++ sql/range_optimizer/index_range_scan_plan.cc
|
||||
@@ -1015,11 +1015,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;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1082,8 +1082,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,
|
||||
@@ -1159,8 +1158,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
|
||||
@@ -0,0 +1,143 @@
|
||||
--- sql/rpl_log_encryption.cc.orig 2023-11-24 10:33:10 UTC
|
||||
+++ sql/rpl_log_encryption.cc
|
||||
@@ -212,7 +212,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;
|
||||
}
|
||||
@@ -289,7 +289,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) {
|
||||
@@ -379,8 +379,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));
|
||||
}
|
||||
|
||||
@@ -395,7 +395,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;
|
||||
@@ -449,7 +449,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;
|
||||
}
|
||||
@@ -770,7 +770,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);
|
||||
}
|
||||
@@ -975,7 +975,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;
|
||||
}
|
||||
@@ -1078,12 +1078,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));
|
||||
@@ -1138,13 +1138,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:
|
||||
@@ -1204,11 +1204,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
|
||||
@@ -1239,16 +1239,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;
|
||||
@@ -1264,7 +1264,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) ||
|
||||
@@ -0,0 +1,11 @@
|
||||
--- sql/stream_cipher.cc.orig 2023-11-24 10:33:10 UTC
|
||||
+++ sql/stream_cipher.cc
|
||||
@@ -45,7 +45,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
|
||||
@@ -0,0 +1,20 @@
|
||||
--- sql/stream_cipher.h.orig 2023-11-24 10:33:10 UTC
|
||||
+++ sql/stream_cipher.h
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <openssl/evp.h>
|
||||
#include <memory>
|
||||
-#include <string>
|
||||
+#include <vector>
|
||||
|
||||
/**
|
||||
@file stream_cipher.h
|
||||
@@ -34,7 +34,7 @@
|
||||
binary log files.
|
||||
*/
|
||||
|
||||
-typedef std::basic_string<unsigned char> Key_string;
|
||||
+typedef std::vector<unsigned char> Key_string;
|
||||
|
||||
/**
|
||||
@class Stream_cipher
|
||||
@@ -1,29 +0,0 @@
|
||||
--- storage/innobase/log/log0recv.cc.orig 2023-11-24 13:33:10.000000000 +0300
|
||||
+++ storage/innobase/log/log0recv.cc 2024-02-16 15:16:49.528584000 +0300
|
||||
@@ -3702,7 +3702,7 @@
|
||||
#else /* !UNIV_HOTBACKUP */
|
||||
bool meb_scan_log_recs(
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
- size_t *max_memory, const byte *buf, size_t len,
|
||||
+ size_t max_memory, const byte *buf, size_t len,
|
||||
lsn_t start_lsn, lsn_t *read_upto_lsn,
|
||||
lsn_t to_lsn) {
|
||||
const byte *log_block = buf;
|
||||
@@ -3975,7 +3975,7 @@
|
||||
recv_parse_log_recs();
|
||||
|
||||
#ifndef UNIV_HOTBACKUP
|
||||
- if (recv_heap_used() > *max_memory) {
|
||||
+ if (recv_heap_used() > max_memory) {
|
||||
recv_apply_hashed_log_recs(log, false);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
@@ -4161,7 +4161,7 @@
|
||||
break;
|
||||
}
|
||||
|
||||
- finished = recv_scan_log_recs(log, &max_mem, log.buf, end_lsn - start_lsn,
|
||||
+ finished = recv_scan_log_recs(log, max_mem, log.buf, end_lsn - start_lsn,
|
||||
start_lsn, &log.m_scanned_lsn, to_lsn);
|
||||
|
||||
start_lsn = end_lsn;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
--- storage/innobase/xtrabackup/src/keyring_plugins.cc.orig 2023-11-24 10:33:10 UTC
|
||||
+++ storage/innobase/xtrabackup/src/keyring_plugins.cc
|
||||
@@ -890,7 +890,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;
|
||||
@@ -1,59 +0,0 @@
|
||||
--- 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() {
|
||||
@@ -1,15 +0,0 @@
|
||||
--- 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}
|
||||
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
--- storage/temptable/include/temptable/lock_free_type.h.orig 2020-06-16 16:31:03 UTC
|
||||
+++ storage/temptable/include/temptable/lock_free_type.h
|
||||
@@ -31,6 +31,14 @@ Lock-free type (selection) implementation. */
|
||||
|
||||
#include "storage/temptable/include/temptable/constants.h"
|
||||
|
||||
+#if defined(__i386__) //&& defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8)
|
||||
+/* Fix for clang setting __GCC_ATOMIC_LLONG_LOCK_FREE incorrectly for x86
|
||||
+ * https://llvm.org/bugs/show_bug.cgi?id=19355
|
||||
+ */
|
||||
+#undef ATOMIC_LLONG_LOCK_FREE
|
||||
+#define ATOMIC_LLONG_LOCK_FREE 2
|
||||
+#endif
|
||||
+
|
||||
namespace temptable {
|
||||
|
||||
/** Enum class describing alignment-requirements. */
|
||||
@@ -0,0 +1,83 @@
|
||||
--- storage/innobase/xtrabackup/src/utils.cc.orig 2025-06-26 11:44:12.347914000 +0300
|
||||
+++ storage/innobase/xtrabackup/src/utils.cc 2025-06-26 11:47:31.087768000 +0300
|
||||
@@ -19,16 +19,6 @@
|
||||
#include <my_default.h>
|
||||
#include <mysqld.h>
|
||||
|
||||
-#ifdef __APPLE__
|
||||
-#include <mach/mach_host.h>
|
||||
-#include <sys/sysctl.h>
|
||||
-#else
|
||||
-#ifdef HAVE_PROCPS_V3
|
||||
-#include <proc/sysinfo.h>
|
||||
-#else
|
||||
-#include <libproc2/meminfo.h>
|
||||
-#endif // HAVE_PROCPS_V3
|
||||
-#endif // __APPLE__
|
||||
#include <boost/uuid/uuid.hpp> // uuid class
|
||||
#include <boost/uuid/uuid_generators.hpp> // generators
|
||||
#include <boost/uuid/uuid_io.hpp> // streaming operators etc.
|
||||
@@ -116,62 +106,13 @@
|
||||
return major * 10000 + minor * 100 + version;
|
||||
}
|
||||
|
||||
-#ifdef __APPLE__
|
||||
unsigned long host_total_memory() {
|
||||
- unsigned long total_mem = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE);
|
||||
- return total_mem;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
unsigned long host_free_memory() {
|
||||
- unsigned long total_mem = host_total_memory();
|
||||
- int64_t used_mem;
|
||||
- vm_size_t page_size;
|
||||
- mach_msg_type_number_t count;
|
||||
- vm_statistics_data_t vm_stats;
|
||||
-
|
||||
- // Get used memory
|
||||
- mach_port_t host = mach_host_self();
|
||||
- count = sizeof(vm_stats) / sizeof(natural_t);
|
||||
- if (KERN_SUCCESS == host_page_size(host, &page_size) &&
|
||||
- KERN_SUCCESS ==
|
||||
- host_statistics(host, HOST_VM_INFO, (host_info_t)&vm_stats, &count)) {
|
||||
- used_mem = ((int64_t)vm_stats.active_count + (int64_t)vm_stats.wire_count) *
|
||||
- (int64_t)page_size;
|
||||
-
|
||||
- ut_a(total_mem >= (unsigned long)used_mem);
|
||||
- return total_mem - (unsigned long)used_mem;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
-#else
|
||||
-unsigned long host_total_memory() {
|
||||
-#ifdef HAVE_PROCPS_V3
|
||||
- meminfo();
|
||||
- return kb_main_total * 1024;
|
||||
-#else
|
||||
- struct meminfo_info *mem_info;
|
||||
- if (procps_meminfo_new(&mem_info) < 0) {
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- return MEMINFO_GET(mem_info, MEMINFO_MEM_TOTAL, ul_int) * 1024;
|
||||
-#endif // HAVE_PROCPS_V3
|
||||
-}
|
||||
-
|
||||
-unsigned long host_free_memory() {
|
||||
-#ifdef HAVE_PROCPS_V3
|
||||
- meminfo();
|
||||
- return kb_main_available * 1024;
|
||||
-#else
|
||||
- struct meminfo_info *mem_info;
|
||||
- if (procps_meminfo_new(&mem_info) < 0) {
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- return MEMINFO_GET(mem_info, MEMINFO_MEM_AVAILABLE, ul_int) * 1024;
|
||||
-#endif // HAVE_PROCPS_V3
|
||||
-}
|
||||
-#endif
|
||||
|
||||
std::string generate_uuid() {
|
||||
boost::uuids::uuid uuid = gen();
|
||||
Reference in New Issue
Block a user