Skip to content

Commit e7a7489

Browse files
committed
Bug#24399819 SQL/RPL_WRITE_SET_HANDLER.CC INCLUDES PRIVATE LZ4 HEADER
FILE Problem: The fix for bug #23607230 used xxhash symbols from liblz4, but even though the xxhash symbols are exported by liblz4, the header file is not part of the API, so compilation fails when building with WITH_LZ4=system. Fix: Build xxhash separately from liblz4 so that it's available both when using system and bundled lz4 libraries.
1 parent 357b5bf commit e7a7489

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

extra/lz4/my_xxhash.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef MY_XXHASH_H_INCLUDED
2+
#define MY_XXHASH_H_INCLUDED
3+
4+
/*
5+
Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; version 2 of the License.
10+
11+
This program is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, write to the Free Software Foundation,
18+
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
19+
*/
20+
21+
// Define a namespace prefix to all xxhash functions. This is done to
22+
// avoid conflict with xxhash symbols in liblz4.
23+
#define XXH_NAMESPACE MY_
24+
25+
#include "xxhash.h"
26+
27+
#endif // MY_XXHASH_H_INCLUDED

libmysqld/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ SET(SQL_EMBEDDED_SOURCES
6262
libmysqld.c
6363
${GEN_SOURCES}
6464
${GEN_YACC_SOURCES}
65+
../extra/lz4/xxhash.c
6566
../client/get_password.c
6667
../libmysql/errmsg.c
6768
../libmysql/libmysql.c
@@ -118,6 +119,11 @@ ADD_COMPILE_FLAGS(
118119
COMPILE_FLAGS -I${BOOST_PATCHES_DIR} -I${BOOST_INCLUDE_DIR}
119120
)
120121

122+
ADD_COMPILE_FLAGS(
123+
../extra/lz4/xxhash.c
124+
COMPILE_FLAGS -DXXH_NAMESPACE=MY_
125+
)
126+
121127
# Fixes "C1128: number of sections exceeded object file format limit" in MSVC /MD
122128
# The flag /bigobj is not added if the build is not /MD
123129
IF(WIN32 AND CMAKE_SIZEOF_VOID_P MATCHES 8)

sql/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ SET(SQL_SOURCE
254254
${GEN_DIGEST_SOURCES}
255255
${CONF_SOURCES}
256256
${SQL_SHARED_SOURCES}
257+
../extra/lz4/xxhash.c
257258
../libmysql/errmsg.c
258259
../sql-common/client.c
259260
../sql-common/client_plugin.c
@@ -314,6 +315,11 @@ ADD_COMPILE_FLAGS(
314315
COMPILE_FLAGS -I${BOOST_PATCHES_DIR} -I${BOOST_INCLUDE_DIR}
315316
)
316317

318+
ADD_COMPILE_FLAGS(
319+
../extra/lz4/xxhash.c
320+
COMPILE_FLAGS -DXXH_NAMESPACE=MY_
321+
)
322+
317323
# Fixes "C1128: number of sections exceeded object file format limit" in MSVC /MD
318324
# The flag /bigobj is not added if the build is not WINDOWS_RUNTIME_MD (/MD)
319325
IF(WINDOWS_RUNTIME_MD AND CMAKE_SIZEOF_VOID_P MATCHES 8)

sql/rpl_write_set_handler.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "table.h" // TABLE
2424

2525
#include "my_murmur3.h" // murmur3_32
26-
#include "xxhash.h" // xxHash
26+
#include "../extra/lz4/my_xxhash.h" // xxHash
2727

2828
#include <map>
2929
#include <string>
@@ -61,7 +61,7 @@ template <class type> uint64 calc_hash(ulong algorithm, type T)
6161
if(algorithm == HASH_ALGORITHM_MURMUR32)
6262
return (murmur3_32((const uchar*)T, strlen(T), 0));
6363
else
64-
return (XXH64((const uchar*)T, strlen(T), 0));
64+
return (MY_XXH64((const uchar*)T, strlen(T), 0));
6565
}
6666

6767
/**

0 commit comments

Comments
 (0)