Skip to content

Commit cb257cb

Browse files
author
Arpit Goswami
committed
BUG#37008442 Change data structure from Tree map to unordered_map in
binlog_transaction_dependency [1/2] Changed the data structure from Tree map to ankerl::unordered_dense::map of variable m_writeset_history in sql/rpl_trx_tracking.h file which enhances performance. Changed CMakeFiles to support #include <ankerl/unordered_dense.h> Change-Id: I59835525559a41d47305463d07e903b88d6a8696
1 parent 91b5134 commit cb257cb

File tree

7 files changed

+22
-12
lines changed

7 files changed

+22
-12
lines changed

cmake/plugin.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ MACRO(MYSQL_ADD_PLUGIN plugin_arg)
305305
ENDIF()
306306

307307
# Add SYSTEM INCLUDE_DIRECTORIES
308-
IF(ARG_SYSTEM_INCLUDE_DIRECTORIES)
308+
IF(BUILD_PLUGIN AND ARG_SYSTEM_INCLUDE_DIRECTORIES)
309309
TARGET_INCLUDE_DIRECTORIES(${target} SYSTEM PRIVATE
310310
${ARG_SYSTEM_INCLUDE_DIRECTORIES})
311311
ENDIF()

sql/CMakeLists.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2024, Oracle and/or its affiliates.
1+
# Copyright (c) 2006, 2024, Oracle and/or its affiliates.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License, version 2.0,
@@ -865,13 +865,6 @@ ADD_COMPILE_FLAGS(
865865
COMPILE_FLAGS -I${CMAKE_SOURCE_DIR}/extra/lz4 -I${BUNDLED_LZ4_PATH}
866866
)
867867

868-
ADD_COMPILE_FLAGS(
869-
iterators/composite_iterators.cc
870-
iterators/hash_join_buffer.cc
871-
COMPILE_FLAGS
872-
-I${CMAKE_SOURCE_DIR}/extra/unordered_dense/unordered_dense-4.4.0/include
873-
)
874-
875868
# Fixes "C1128: number of sections exceeded object file format limit" in MSVC
876869
IF(WIN32)
877870
ADD_COMPILE_FLAGS(
@@ -964,6 +957,9 @@ MYSQL_ADD_PLUGIN(mysql_native_password
964957
SYSTEM_INCLUDE_DIRECTORIES "${RAPIDJSON_INCLUDE_DIR}"
965958
STATIC_ONLY DEFAULT)
966959

960+
TARGET_INCLUDE_DIRECTORIES(sql_main SYSTEM PUBLIC
961+
${CMAKE_SOURCE_DIR}/extra/unordered_dense/unordered_dense-4.4.0/include)
962+
967963
TARGET_LINK_LIBRARIES(sql_main ${MYSQLD_STATIC_PLUGIN_LIBS}
968964
mysql_server_component_services mysys strings vio
969965
mysql_binlog_event ${LIBWRAP} ${LIBDL} OpenSSL::SSL OpenSSL::Crypto

sql/rpl_trx_tracking.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
#include "mysql/binlog/event/binlog_event.h"
3333

34+
#include <ankerl/unordered_dense.h>
3435
#include "my_inttypes.h"
3536

3637
class THD;
@@ -173,7 +174,7 @@ class Writeset_trx_dependency_tracker {
173174
Track the last transaction sequence number that changed each row
174175
in the database, using row hashes from the writeset as the index.
175176
*/
176-
typedef std::map<uint64, int64> Writeset_history;
177+
using Writeset_history = ankerl::unordered_dense::map<uint64, int64>;
177178
Writeset_history m_writeset_history;
178179
};
179180

sql/server_component/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,6 @@ TARGET_COMPILE_DEFINITIONS(mysql_server_component_services
9292
TARGET_LINK_LIBRARIES(mysql_server_component_services PRIVATE extra::rapidjson)
9393
TARGET_LINK_LIBRARIES(mysql_server_component_services PRIVATE ext::zlib)
9494
ADD_DEPENDENCIES(mysql_server_component_services GenError)
95+
96+
TARGET_INCLUDE_DIRECTORIES(mysql_server_component_services SYSTEM PRIVATE
97+
${CMAKE_SOURCE_DIR}/extra/unordered_dense/unordered_dense-4.4.0/include)

storage/ndb/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ IF(NOT WITHOUT_SERVER)
127127
# unless it is explicitly disabled on the command line.
128128
MYSQL_ADD_PLUGIN(ndbcluster ${NDBCLUSTER_SOURCES} STORAGE_ENGINE
129129
DEFAULT STATIC_ONLY
130-
LINK_LIBRARIES ndbclient_static extra::rapidjson)
130+
LINK_LIBRARIES ndbclient_static extra::rapidjson
131+
SYSTEM_INCLUDE_DIRECTORIES
132+
${CMAKE_SOURCE_DIR}/extra/unordered_dense/unordered_dense-4.4.0/include)
131133

132134
SET_PROPERTY(SOURCE plugin/ha_ndbcluster.cc
133135
PROPERTY COMPILE_DEFINITIONS

storage/perfschema/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ telemetry_pfs_metrics.cc
378378
)
379379
MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES}
380380
STORAGE_ENGINE MANDATORY STATIC_ONLY
381-
LINK_LIBRARIES extra::rapidjson ext::zlib mysql_gtid)
381+
LINK_LIBRARIES extra::rapidjson ext::zlib mysql_gtid
382+
SYSTEM_INCLUDE_DIRECTORIES
383+
${CMAKE_SOURCE_DIR}/extra/unordered_dense/unordered_dense-4.4.0/include)
382384

383385
IF(WITH_UNIT_TESTS)
384386
ADD_SUBDIRECTORY(unittest)

unittest/gunit/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ ADD_STATIC_LIBRARY(gunit_large
8484
thread_utils.cc
8585
LINK_LIBRARIES ext::icu ext::zlib
8686
)
87+
TARGET_INCLUDE_DIRECTORIES(gunit_large SYSTEM PRIVATE
88+
${CMAKE_SOURCE_DIR}/extra/unordered_dense/unordered_dense-4.4.0/include)
8789

8890
# Add a library for enable_win_jemalloc.cc
8991
# and link it with both gunit_small and gunit_large below.
@@ -368,6 +370,10 @@ IF(MY_COMPILER_IS_GNU)
368370
MY_TARGET_LINK_OPTIONS(merge_large_tests-t "-Wno-alloc-size-larger-than")
369371
ENDIF()
370372

373+
TARGET_INCLUDE_DIRECTORIES(merge_large_tests-t SYSTEM PRIVATE
374+
${CMAKE_SOURCE_DIR}/extra/unordered_dense/unordered_dense-4.4.0/include)
375+
376+
371377
FOREACH(test ${TESTS})
372378
MYSQL_ADD_EXECUTABLE(${test}-t ${test}-t.cc
373379
COMPILE_DEFINITIONS ${DISABLE_PSI_DEFINITIONS}

0 commit comments

Comments
 (0)