]> TLD Linux GIT Repositories - packages/mysql.git/blob - mysql-system-xxhash.patch
- fix bcond comment (breaks build)
[packages/mysql.git] / mysql-system-xxhash.patch
1 diff -urNpa mysql-8.4.0.orig/plugin/group_replication/libmysqlgcs/CMakeLists.txt mysql-8.4.0/plugin/group_replication/libmysqlgcs/CMakeLists.txt
2 --- mysql-8.4.0.orig/plugin/group_replication/libmysqlgcs/CMakeLists.txt        2024-05-09 18:15:12.545961950 +0200
3 +++ mysql-8.4.0/plugin/group_replication/libmysqlgcs/CMakeLists.txt     2024-05-09 18:15:56.994571858 +0200
4 @@ -138,7 +138,6 @@ SET(GCS_SOURCES
5    src/bindings/xcom/gcs_xcom_statistics_interface.cc
6    src/bindings/xcom/gcs_xcom_proxy.cc
7    src/bindings/xcom/gcs_xcom_communication_protocol_changer.cc
8 -  ${BUNDLED_LZ4_PATH}/xxhash.c # required by gcs_message_stage_split
9    src/bindings/xcom/gcs_message_stage_split.cc
10    src/bindings/xcom/gcs_xcom_synode.cc
11    src/bindings/xcom/gcs_xcom_expels_in_progress.cc
12 @@ -236,6 +235,7 @@ ADD_LIBRARY(mysqlgcs STATIC ${XCOM_SOURC
13  # Dependency on mysys from gcs_logging_system.cc
14  # but pick up symbols from the server:
15  # TARGET_LINK_LIBRARIES(mysqlgcs mysys)
16 +TARGET_LINK_LIBRARIES(mysqlgcs xxhash)
17  
18  IF(LINUX AND WITH_TIRPC STREQUAL "bundled")
19    ADD_DEPENDENCIES(mysqlgcs tirpc_ext)
20 diff -urNpa mysql-8.4.0.orig/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_message_stage_split.cc mysql-8.4.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_message_stage_split.cc
21 --- mysql-8.4.0.orig/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_message_stage_split.cc  2024-05-09 18:15:12.549962005 +0200
22 +++ mysql-8.4.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_message_stage_split.cc       2024-05-09 18:15:57.910584352 +0200
23 @@ -127,7 +127,7 @@ Gcs_sender_id calculate_sender_id(const
24    std::string info(node.get_member_id().get_member_id());
25    info.append(node.get_member_uuid().actual_value);
26  
27 -  return GCS_XXH64(info.c_str(), info.size(), 0);
28 +  return XXH64(info.c_str(), info.size(), 0);
29  }
30  
31  bool Gcs_message_stage_split_v2::update_members_information(
32 diff -urNpa mysql-8.4.0.orig/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xxhash.h mysql-8.4.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xxhash.h
33 --- mysql-8.4.0.orig/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xxhash.h        2024-05-09 18:15:12.549962005 +0200
34 +++ mysql-8.4.0/plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xxhash.h     2024-05-09 18:15:57.910584352 +0200
35 @@ -26,10 +26,6 @@
36    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
37  */
38  
39 -// Define a namespace prefix to all xxhash functions. This is done to
40 -// avoid conflict with xxhash symbols in liblz4.
41 -#define XXH_NAMESPACE GCS_
42 -
43 -#include "xxhash.h"
44 +#include <xxhash.h>
45  
46  #endif  // GCS_XXHASH_H_INCLUDED
47 diff -urNpa mysql-8.4.0.orig/sql/CMakeLists.txt mysql-8.4.0/sql/CMakeLists.txt
48 --- mysql-8.4.0.orig/sql/CMakeLists.txt 2024-05-09 18:15:03.917843242 +0200
49 +++ mysql-8.4.0/sql/CMakeLists.txt      2024-05-09 18:16:12.978789893 +0200
50 @@ -762,7 +762,6 @@ SET(SQL_SOURCE
51    ${CONF_SOURCES}
52    ${SQL_SHARED_SOURCES}
53    ${SQL_HEADERS}
54 -  ${BUNDLED_LZ4_PATH}/xxhash.c
55    ../libmysql/errmsg.cc
56    ../sql-common/client.cc
57    ../sql-common/client_plugin.cc
58 @@ -828,11 +827,6 @@ IF(WIN32)
59        )
60  ENDIF()
61  
62 -MY_ADD_COMPILE_DEFINITIONS(
63 -  ${BUNDLED_LZ4_PATH}/xxhash.c
64 -  COMPILE_DEFINITIONS XXH_NAMESPACE=MY_
65 -  )
66 -
67  # Workaround for Apple Clang bug on ARM.
68  # When linking mysqld (and executables using server_unittest_library)
69  # we get linker warnings about
70 @@ -858,14 +852,6 @@ IF(APPLE_ARM)
71  ENDIF()
72  
73  ADD_COMPILE_FLAGS(
74 -  ${BUNDLED_LZ4_PATH}/xxhash.c
75 -  iterators/hash_join_iterator.cc
76 -  iterators/composite_iterators.cc
77 -  rpl_write_set_handler.cc
78 -  COMPILE_FLAGS -I${CMAKE_SOURCE_DIR}/extra/lz4 -I${BUNDLED_LZ4_PATH}
79 -  )
80 -
81 -ADD_COMPILE_FLAGS(
82    iterators/composite_iterators.cc
83    iterators/hash_join_buffer.cc
84    COMPILE_FLAGS
85 @@ -966,7 +952,7 @@ MYSQL_ADD_PLUGIN(mysql_native_password
86  
87  TARGET_LINK_LIBRARIES(sql_main ${MYSQLD_STATIC_PLUGIN_LIBS}
88    mysql_server_component_services mysys strings vio
89 -  mysql_binlog_event ${LIBWRAP} ${LIBDL} OpenSSL::SSL OpenSSL::Crypto
90 +  mysql_binlog_event xxhash ${LIBWRAP} ${LIBDL} OpenSSL::SSL OpenSSL::Crypto
91    extra::rapidjson extra::boost)
92  
93  # sql/immutable_string.h uses
94 diff -urNpa mysql-8.4.0.orig/sql/iterators/composite_iterators.cc mysql-8.4.0/sql/iterators/composite_iterators.cc
95 --- mysql-8.4.0.orig/sql/iterators/composite_iterators.cc       2024-05-09 18:15:03.989844233 +0200
96 +++ mysql-8.4.0/sql/iterators/composite_iterators.cc    2024-05-09 18:15:57.910584352 +0200
97 @@ -44,7 +44,7 @@
98  #include "my_dbug.h"
99  #include "my_inttypes.h"
100  #include "my_sys.h"
101 -#include "my_xxhash.h"
102 +#include <xxhash.h>
103  #include "mysql_com.h"
104  #include "mysqld_error.h"
105  #include "prealloced_array.h"
106 @@ -2928,7 +2928,7 @@ bool SpillState::compute_chunk_file_sets
107    const ulonglong primary_hash =
108        static_cast<ulonglong>(m_materialized_table->hash_field->val_int());
109    const uint64_t chunk_hash =
110 -      MY_XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
111 +      XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
112  
113    const size_t chunk_index = hash_to_chunk_index(chunk_hash);
114    m_offending_row.m_chunk_offset = chunk_offset(chunk_index);
115 @@ -3005,7 +3005,7 @@ bool SpillState::spread_hash_map_to_HF_c
116          const ulonglong primary_hash =
117              static_cast<ulonglong>(m_materialized_table->hash_field->val_int());
118          const uint64_t chunk_hash =
119 -            MY_XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
120 +            XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
121          const size_t chunk_index = hash_to_chunk_index(chunk_hash);
122          const size_t set_index = chunk_index_to_set(chunk_index);
123          const size_t offset = chunk_offset(chunk_index);
124 @@ -3070,7 +3070,7 @@ bool SpillState::append_hash_map_to_HF()
125        const ulonglong primary_hash =
126            static_cast<ulonglong>(m_materialized_table->hash_field->val_int());
127        const uint64_t chunk_hash =
128 -          MY_XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
129 +          XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
130        const size_t chunk_index = hash_to_chunk_index(chunk_hash);
131        const size_t set_index = chunk_index_to_set(chunk_index);
132        const size_t offset = chunk_offset(chunk_index);
133 @@ -3164,7 +3164,7 @@ bool SpillState::save_operand_to_IF_chun
134        m_materialized_table->hash_field->store(
135            static_cast<longlong>(primary_hash), true);
136        const uint64_t chunk_hash =
137 -          MY_XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
138 +          XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
139        const size_t chunk_index = hash_to_chunk_index(chunk_hash);
140        const size_t set_index = chunk_index_to_set(chunk_index);
141        const size_t offset = chunk_offset(chunk_index);
142 @@ -3219,7 +3219,7 @@ bool SpillState::write_HF(THD *thd, size
143      const ulonglong primary_hash =
144          static_cast<ulonglong>(m_materialized_table->hash_field->val_int());
145      const uint64_t chunk_hash =
146 -        MY_XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
147 +        XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
148      const size_t chunk_index = hash_to_chunk_index(chunk_hash);
149      const size_t set_index = chunk_index_to_set(chunk_index);
150      assert(chunk_offset(chunk_index) == chunk_idx);
151 @@ -3452,7 +3452,7 @@ int SpillState::read_next_row(const Oper
152              const ulonglong primary_hash = static_cast<ulonglong>(
153                  m_materialized_table->hash_field->val_int());
154              const uint64_t chunk_hash =
155 -                MY_XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
156 +                XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
157              const size_t chunk_index = hash_to_chunk_index(chunk_hash);
158              const size_t set_index = chunk_index_to_set(chunk_index);
159              assert(chunk_offset(chunk_index) == m_current_chunk_idx);
160 @@ -3485,7 +3485,7 @@ int SpillState::read_next_row(const Oper
161              const ulonglong primary_hash = static_cast<ulonglong>(
162                  m_materialized_table->hash_field->val_int());
163              const uint64_t chunk_hash =
164 -                MY_XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
165 +                XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
166              const size_t chunk_index = hash_to_chunk_index(chunk_hash);
167              assert(chunk_index_to_set(chunk_index) == set_idx);
168              assert(chunk_offset(chunk_index) == m_current_chunk_idx);
169 @@ -3574,7 +3574,7 @@ int SpillState::read_next_row_secondary_
170            const ulonglong primary_hash = static_cast<ulonglong>(
171                m_materialized_table->hash_field->val_int());
172            const uint64_t chunk_hash =
173 -              MY_XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
174 +              XXH64(&primary_hash, sizeof(primary_hash), m_hash_seed);
175            const size_t chunk_index = hash_to_chunk_index(chunk_hash);
176            assert(chunk_index_to_set(chunk_index) == set_idx);
177            assert(chunk_offset(chunk_index) == m_current_chunk_idx);
178 diff -urNpa mysql-8.4.0.orig/sql/iterators/hash_join_iterator.cc mysql-8.4.0/sql/iterators/hash_join_iterator.cc
179 --- mysql-8.4.0.orig/sql/iterators/hash_join_iterator.cc        2024-05-09 18:15:03.989844233 +0200
180 +++ mysql-8.4.0/sql/iterators/hash_join_iterator.cc     2024-05-09 18:15:57.910584352 +0200
181 @@ -38,7 +38,7 @@
182  #include "my_dbug.h"
183  #include "my_inttypes.h"
184  #include "my_sys.h"
185 -#include "my_xxhash.h"
186 +#include <xxhash.h>
187  #include "mysql/components/services/bits/psi_bits.h"
188  #include "mysqld_error.h"
189  #include "sql/item.h"
190 @@ -378,7 +378,7 @@ static bool WriteRowToChunk(
191    const uint64_t join_key_hash =
192        join_key_and_row_buffer->length() == 0
193            ? kZeroKeyLengthHash
194 -          : MY_XXH64(join_key_and_row_buffer->ptr(),
195 +          : XXH64(join_key_and_row_buffer->ptr(),
196                       join_key_and_row_buffer->length(), xxhash_seed);
197  
198    assert((chunks->size() & (chunks->size() - 1)) == 0);
199 diff -urNpa mysql-8.4.0.orig/sql/rpl_write_set_handler.cc mysql-8.4.0/sql/rpl_write_set_handler.cc
200 --- mysql-8.4.0.orig/sql/rpl_write_set_handler.cc       2024-05-09 18:15:03.945843627 +0200
201 +++ mysql-8.4.0/sql/rpl_write_set_handler.cc    2024-05-09 18:15:57.910584352 +0200
202 @@ -37,7 +37,7 @@
203  #include "my_dbug.h"
204  #include "my_inttypes.h"
205  #include "my_murmur3.h"  // murmur3_32
206 -#include "my_xxhash.h"   // IWYU pragma: keep
207 +#include <xxhash.h>
208  #include "mysql/strings/m_ctype.h"
209  #include "mysql_com.h"
210  #include "sql-common/json_binary.h"
211 @@ -682,7 +682,7 @@ static bool generate_hash_pke(const std:
212  ) {
213    DBUG_TRACE;
214  
215 -  uint64 hash = MY_XXH64(pke.c_str(), pke.size(), 0);
216 +  uint64 hash = XXH64(pke.c_str(), pke.size(), 0);
217    if (thd->get_transaction()->get_transaction_write_set_ctx()->add_write_set(
218            hash))
219      return true;
220 diff -urNpa mysql-8.4.0.orig/unittest/gunit/hash_join-t.cc mysql-8.4.0/unittest/gunit/hash_join-t.cc
221 --- mysql-8.4.0.orig/unittest/gunit/hash_join-t.cc      2024-05-09 18:15:15.950008783 +0200
222 +++ mysql-8.4.0/unittest/gunit/hash_join-t.cc   2024-05-09 18:15:57.910584352 +0200
223 @@ -38,7 +38,7 @@
224  #include "my_config.h"
225  #include "my_inttypes.h"
226  #include "my_murmur3.h"
227 -#include "my_xxhash.h"
228 +#include <xxhash.h>
229  #include "mysql/components/services/bits/psi_bits.h"
230  #include "prealloced_array.h"
231  #include "sql/field.h"
232 @@ -227,7 +227,7 @@ static void BM_XXHash64ShortData(size_t
233  
234    size_t sum = 0;
235    for (size_t i = 0; i < num_iterations; ++i) {
236 -    sum += MY_XXH64(&data[0], data.size(), 0);
237 +    sum += XXH64(&data[0], data.size(), 0);
238    }
239    StopBenchmarkTiming();
240  
241 @@ -246,7 +246,7 @@ static void BM_XXHash64LongData(size_t n
242  
243    size_t sum = 0;
244    for (size_t i = 0; i < num_iterations; ++i) {
245 -    sum += MY_XXH64(&data[0], data.size(), 0);
246 +    sum += XXH64(&data[0], data.size(), 0);
247    }
248    StopBenchmarkTiming();
249  
250 diff -urNpa mysql-8.4.0.orig/unittest/gunit/innodb/ut0rnd-t.cc mysql-8.4.0/unittest/gunit/innodb/ut0rnd-t.cc
251 --- mysql-8.4.0.orig/unittest/gunit/innodb/ut0rnd-t.cc  2024-05-09 18:15:15.998009443 +0200
252 +++ mysql-8.4.0/unittest/gunit/innodb/ut0rnd-t.cc       2024-05-09 18:15:57.910584352 +0200
253 @@ -34,7 +34,7 @@
254  #include "storage/innobase/include/ut0crc32.h"
255  #include "storage/innobase/include/ut0rnd.h"
256  
257 -#include "my_xxhash.h"
258 +#include <xxhash.h>
259  
260  namespace innodb_ut0rnd_unittest {
261