From bc76ad8f6be7e75c7f1dccc322638566ee0fc0e7 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 9 Nov 2009 12:32:48 +0100 Subject: WL#5161 : Cross-platform build with CMake BUILD-CMAKE: WL#5161 : Documentation on how to build with CMake on Unix/Windows BUILD/Makefile.am: Add new file BUILD/autorun.sh: WL#5161 : use choose_configure instead of autotools configure script (choose configure will call cmake if cmake is available) BUILD/choose_configure.sh: WL#5161 : use choose_configure instead of autotools configure script (choose configure will call cmake if cmake is available) CMakeLists.txt: WL#5161 : Rewrite top-level CMakeLists.txt. Remove Windows specifics - compiler flags handling moved to configure.cmake - storage engine/plugin stuff moved into cmake/plugin.cmake - copy docs Makefile.am: Added new files client/CMakeLists.txt: WL#5161 : Rewrite CMakeLists.txt to be platform-independent Handle packagng (add INSTALL commands) cmake/Makefile.am: WL#5161 : use choose_configure instead of autotools configure script (choose configure will call cmake if cmake is available) cmake/abi_check.cmake: Custom targets for abi_check (for cmake) cmake/bison.cmake: - Check bison availability - Add RUN_BISON macro (used to create sql_yacc.cc and sql_yacc.h) cmake/cat.cmake: Add helper script to concatenate files. cmake/character_sets.cmake: Handle configuration parameters WITH_EXTRA_CHARSETS cmake/check_minimal_version.cmake: Helper script to check the minimum required version of cmake cmake/configure.pl: Add perl script to convert ./configure parameters for cmake cmake/create_initial_db.cmake.in: Add script helper to create initial database. (on Windows, we pack initial db with the redistribution package) cmake/do_abi_check.cmake: Perform abi check cmake/dtrace.cmake: Handle dtrace in CMake Build. Check for dtrace availablility, run dtrace -G on solaris in prelink step cmake/dtrace_prelink.cmake: Run dtrace -G on Solaris in pre-link step, link the object it creates together with library or executable cmake/install_macros.cmake: Helper macros for packaging (install pdb on Windows, install symlinks on Unix) cmake/make_dist.cmake.in: "make dist" - - pack autotools ./configure script with the source (renamed to configure.am) - pack bison output cmake/merge_archives_unix.cmake.in: script to merge static libraries on Unix cmake/misc.cmake: Build helper macros - MERGE_STATIC_LIBS We use it when building client library and embedded (avoid recompilation) - Convert source file paths to absolute names. We use it in to locate files of a different project, when the files need to be recompiled (e.g in embedded several storage engines are recompiled with -DEMBEDDED_LIBRARY) cmake/mysql_version.cmake: Extract version info from configure.in Handle package names. cmake/plugin.cmake: Rewrote storage/mysql_storage_engine.cmake to handle other types of plugins and do it in OS-independent manner. cmake/readline.cmake: Macros to handle WITH_READLINE/WITH_LIBEDIT parameters cmake/ssl.cmake: Add macros to handle WITH_SSL parameter. cmake/stack_direction.c: Helper to check stack direction. cmake/zlib.cmake: Add macros to handle WITH_ZLIB parameter cmd-line-utils/libedit/CMakeLists.txt: Build libedit with cmake. cmd-line-utils/libedit/Makefile.am: Add new file cmd-line-utils/readline/CMakeLists.txt: Build readline with CMake. cmd-line-utils/readline/Makefile.am: Add new file config.h.cmake: WL#5161 : Add config.h template for cmake configure.cmake: WL#5161 : Add platform tests ( for cmake) configure.in: Added new subdirectories dbug/CMakeLists.txt: WL#5161 extra/CMakeLists.txt: WL#5161 extra/yassl/CMakeLists.txt: WL#5161 extra/yassl/taocrypt/CMakeLists.txt: WL#5161 include/Makefile.am: Add new file include/keycache.h: remove configure-win.h and remove HUGE_PTR defined there. include/my_global.h: use my_config.h for Windows, not config-win.h anymore include/my_pthread.h: - Move thread_safe_increment from config-win.h to other headers (config-win.h is not used anymore) - Declare pthread_cancel on Windows (it is used in daemon_example) include/my_sys.h: Add malloc.h on Windows (we use -D_WIN32_LEAN_AND_MEAN now, and with this define malloc.h is not included automatically via windows.h) include/mysql/plugin.h: Handle pure-C plugins with Microsoft compiler. include/thr_alarm.h: remove rf_SetTimer that used to be defined in config-win.h Replace with UINT_PTR (we do not use config-win.h anymore and typedef was needed in this single place only) libmysql/CMakeLists.txt: Avoid pointless recompilation of source files in client library if possible. Merge static libs (dbug, mysys) to create static client library. libmysqld/CMakeLists.txt: Avoid pointless recompilation of source files when building embedded. Instead, merge dbug and mysys (and some other static libs) into embedded. libmysqld/examples/CMakeLists.txt: Embedded compilation on Unix libmysqld/lib_sql.cc: Do not define THD::clear_error() in lib_sql.cc for embedded. Instead, use the same inline definition from sql_class.h as in none-embedded case (fixes duplicate symbol errors on Windows and removes pointless #ifdef EMBEDDED) man/CMakeLists.txt: Install man files. man/Makefile.am: Add new file. mysql-test/CMakeLists.txt: Install mysql-test files mysql-test/Makefile.am: Add new files mysql-test/lib/My/ConfigFactory.pm: Allow testing with mtr in out-of-source builds. mysql-test/lib/My/Find.pm: the build configurations are now also available on Unix Xcode on Mac uses the Release, RelwithDebinfo and Debug subdirectories for executables. Earlier, build configurations were available only on Windows. mysql-test/lib/My/SafeProcess.pm: Allow testing with mtr in out-of-source builds. mysql-test/lib/My/SafeProcess/CMakeLists.txt: Port CMakeLists.txt to Unix mysql-test/lib/My/SafeProcess/safe_kill_win.cc: add stdlib.h (to be able to compile with -DWIN32_LEAN_AND_MEAN) mysql-test/lib/My/SafeProcess/safe_process_win.cc: Add stdlib.h (to be able to compile with -DWIN32_LEAN_AND_MEAN) define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE if not defined (can happen using MinGW compiler that comes with old SDK) mysql-test/mtr.out-of-source: Allow testing with mtr in out-of-source builds. mysql-test/mysql-test-run.pl: Allow testing with mtr in out-of-source builds. Use common find_plugin macro for Windows and unix. mysql-test/t/fulltext_plugin.test: This test can now run on Windows as well. mysys/CMakeLists.txt: Port CMakeLists.txt to Unix mysys/my_create.c: config-win.h is dead => NO_OPEN_3 is never defined. mysys/my_getsystime.c: config-win.h is dead => define OFFSET_TO_EPOCH where it is used. mysys/my_winthread.c: Add win32 pthread_cancel - used by daemon_example mysys/mysys_priv.h: config-win.h is dead => include where it is used fix prototype of my_win_(f)stat plugin/daemon_example/CMakeLists.txt: Compile daemon_example with CMake plugin/daemon_example/Makefile.am: Add new file plugin/fulltext/CMakeLists.txt: Compile full-text example with CMake plugin/fulltext/Makefile.am: Add new file. plugin/semisync/CMakeLists.txt: Fix semisync to use common macro for plugins. regex/CMakeLists.txt: Use absolute filenames, when adding regex library (we recompile files in embedded, and want to locate sources via GET_TARGET_PROPERTY( ... SOURCES ..)) regex/regex2.h: Remove pointless typedef (produces error with MinGW compiler) scripts/CMakeLists.txt: Add configure/install for scripts sql-bench/CMakeLists.txt: install sql-bench files sql-bench/Makefile.am: Add new file sql/CMakeLists.txt: Port CmakeLists.txt to Unix sql/nt_servc.cc: compile server with -DWIN32_LEAN_AND_MEAN sql/share/CMakeLists.txt: Install charsets sql/share/Makefile.am: Add new file sql/sql_builtin.cc.in: Handle pure-C plugins on Windows. sql/sql_class.h: Use the same clear_error macro in embedded and not embedded. Fixes pointless #ifdef and avoids duplicate symbols when linking on Windows. storage/Makefile.am: storage/mysql_storage_engine.cmake => cmake/plugin.cmake storage/archive/CMakeLists.txt: Add names for static and dynamic plugin libraries. Link archive with zlib storage/blackhole/CMakeLists.txt: Add names for static and dynamic storage engine libraries storage/csv/CMakeLists.txt: Add names for static and dynamic storage engine libraries storage/example/CMakeLists.txt: Add names for static and dynamic storage engine libraries storage/federated/CMakeLists.txt: Add names for static and dynamic storage engine libraries storage/heap/CMakeLists.txt: Add names for static and dynamic storage engine libraries storage/ibmdb2i/CMakeLists.txt: Better port for ibmdb2i plugin storage/innobase/CMakeLists.txt: Run system checks. Add names for static and dynamic storage engine libraries. storage/innobase/include/page0page.ic: Fix compile error on OpenSolaris. storage/myisam/CMakeLists.txt: Port CmakeLists.txt to Unix storage/myisammrg/CMakeLists.txt: Add names for static and dynamic storage engine libraries storage/mysql_storage_engine.cmake: storage/mysql_storage_engine.cmake => cmake/plugin.cmake support-files/CMakeLists.txt: Configure and install some files from support-files. support-files/Makefile.am: Add new file tests/CMakeLists.txt: In general case, mysqlclient library can be dependent on C++ runtime(if it includes yassl and is not compiled with gcc or MSVC) unittest/mysys/CMakeLists.txt: Add unit tests unittest/mysys/Makefile.am: Add new file unittest/mytap/CMakeLists.txt: Add library for unit tests unittest/mytap/Makefile.am: Add new file unittest/mytap/tap.c: fix function definitions to match declarations win/create_def_file.js: Fix link error with intel compiler (icl defines of special label for exception handler) --- sql/CMakeLists.txt | 280 +++++++++++++++++++++++++++++++---------------- sql/nt_servc.cc | 1 + sql/share/CMakeLists.txt | 52 +++++++++ sql/share/Makefile.am | 5 +- sql/sql_builtin.cc.in | 7 +- sql/sql_class.h | 4 +- 6 files changed, 251 insertions(+), 98 deletions(-) create mode 100644 sql/share/CMakeLists.txt (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 15c2d950ff9..881772bfc5a 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -12,32 +12,36 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -INCLUDE("${PROJECT_SOURCE_DIR}/win/mysql_manifest.cmake") - -SET(CMAKE_CXX_FLAGS_DEBUG - "${CMAKE_CXX_FLAGS_DEBUG} -DUSE_SYMDIR /Zi") -SET(CMAKE_C_FLAGS_DEBUG - "${CMAKE_C_FLAGS_DEBUG} -DUSE_SYMDIR /Zi") -SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /MAP /MAPINFO:EXPORTS") - -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include - ${CMAKE_SOURCE_DIR}/extra/yassl/include - ${CMAKE_SOURCE_DIR}/sql - ${CMAKE_SOURCE_DIR}/regex - ${CMAKE_SOURCE_DIR}/zlib + +IF(MSVC) + #Innodb plugin needs linker-generated map file to locate server exports + #see bug#42001 + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS") +ENDIF(MSVC) + +INCLUDE_DIRECTORIES( +${CMAKE_SOURCE_DIR}/include +${CMAKE_SOURCE_DIR}/sql +${CMAKE_SOURCE_DIR}/regex +${ZLIB_INCLUDE_DIR} +${SSL_INCLUDE_DIRS} +${CMAKE_BINARY_DIR}/sql +) + +SET(GEN_SOURCES +${CMAKE_BINARY_DIR}/sql/sql_yacc.h +${CMAKE_BINARY_DIR}/sql/sql_yacc.cc +${CMAKE_BINARY_DIR}/sql/sql_builtin.cc +${CMAKE_BINARY_DIR}/sql/lex_hash.h ) -SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/sql_yacc.h - ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc - ${CMAKE_SOURCE_DIR}/include/mysql_version.h - ${CMAKE_SOURCE_DIR}/sql/sql_builtin.cc - ${CMAKE_SOURCE_DIR}/sql/lex_hash.h - ${PROJECT_SOURCE_DIR}/include/mysqld_error.h - ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h - ${PROJECT_SOURCE_DIR}/include/sql_state.h - PROPERTIES GENERATED 1) +SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED 1) + +ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER) +IF(SSL_DEFINES) + ADD_DEFINITIONS(${SSL_DEFINES}) +ENDIF() -ADD_DEFINITIONS(-DMYSQL_SERVER -D_CONSOLE -DHAVE_DLOPEN -DHAVE_EVENT_SCHEDULER) SET (SQL_SOURCE @@ -54,7 +58,7 @@ SET (SQL_SOURCE log_event_old.cc rpl_record_old.cc message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c mysqld.cc net_serv.cc - nt_servc.cc nt_servc.h opt_range.cc opt_range.h opt_sum.cc + opt_range.cc opt_range.h opt_sum.cc ../sql-common/pack.c parse_file.cc password.c procedure.cc protocol.cc records.cc repl_failsafe.cc rpl_filter.cc set_var.cc slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc @@ -77,79 +81,169 @@ SET (SQL_SOURCE sql_connect.cc scheduler.cc sql_profile.cc event_parse_data.cc sql_signal.cc rpl_handler.cc - ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc - ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h - ${PROJECT_SOURCE_DIR}/include/mysqld_error.h - ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h - ${PROJECT_SOURCE_DIR}/include/sql_state.h - ${PROJECT_SOURCE_DIR}/include/mysql_version.h - ${PROJECT_SOURCE_DIR}/sql/sql_builtin.cc - ${PROJECT_SOURCE_DIR}/sql/lex_hash.h) -ADD_LIBRARY(sql ${SQL_SOURCE}) - -IF (NOT EXISTS cmake_dummy.cc) - FILE (WRITE cmake_dummy.cc "") -ENDIF (NOT EXISTS cmake_dummy.cc) -ADD_EXECUTABLE(mysqld cmake_dummy.cc) - -SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX}) -SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) - -SET (MYSQLD_CORE_LIBS mysys zlib dbug strings yassl taocrypt vio regex sql) -TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_CORE_LIBS} ${MYSQLD_STATIC_ENGINE_LIBS}) - - -IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) - # Set module definition file. Also use non-incremental linker, - # incremental appears to crash from time to time,if used with /DEF option - SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "/DEF:mysqld.def /INCREMENTAL:NO") - - FOREACH (CORELIB ${MYSQLD_CORE_LIBS}) - GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION) - FILE(TO_NATIVE_PATH ${LOC} LOC) - SET (LIB_LOCATIONS ${LIB_LOCATIONS} ${LOC}) - ENDFOREACH (CORELIB ${MYSQLD_CORE_LIBS}) + ${GEN_SOURCES} + ${MYSYS_LIBWRAP_SOURCE}) + + +SET (MYSQLD_CORE_LIBS mysys ${ZLIB_LIBRARY} ${SSL_LIBRARIES} vio regex ) +IF(WIN32) + SET(SQL_SOURCE ${SQL_SOURCE} nt_servc.cc nt_servc.h) +ENDIF() +IF(MSVC) + ADD_LIBRARY(sql ${SQL_SOURCE}) + ADD_EXECUTABLE(mysqld mysqld_dummy.cc) + ADD_CUSTOM_COMMAND( + OUTPUT mysqld_dummy.cc + COMMAND cmake ARGS -E touch mysqld_dummy.cc + VERBATIM) + SET(MYSQLD_CORE_LIBS ${MYSQLD_CORE_LIBS} sql) + +ELSE() + ADD_EXECUTABLE(mysqld ${SQL_SOURCE}) + DTRACE_INSTRUMENT(mysqld) +ENDIF() + +IF(NOT WITHOUT_DYNAMIC_PLUGINS) + SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) + IF (MINGW OR CYGWIN) + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") + ENDIF() + IF(MSVC) + # Set module definition file. Also use non-incremental linker, + # incremental appears to crash from time to time,if used with /DEF option + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "/DEF:mysqld.def /INCREMENTAL:NO") + + FOREACH (CORELIB ${MYSQLD_CORE_LIBS} dbug strings) + GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION) + FILE(TO_NATIVE_PATH ${LOC} LOC) + SET (LIB_LOCATIONS ${LIB_LOCATIONS} ${LOC}) + ENDFOREACH (CORELIB ${MYSQLD_CORE_LIBS}) - ADD_CUSTOM_COMMAND(TARGET mysqld PRE_LINK - COMMAND cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js + ADD_CUSTOM_COMMAND(TARGET mysqld PRE_LINK + COMMAND echo ${PLATFORM} && cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js ${PLATFORM} ${LIB_LOCATIONS} > mysqld.def - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/sql) -ENDIF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + ADD_DEPENDENCIES(sql GenError) + ENDIF() +ENDIF() + +SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) +SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX}) +TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_STATIC_PLUGIN_LIBS} ${MYSQLD_CORE_LIBS} ${LIBWRAP_LIBRARY}) +INSTALL(TARGETS mysqld DESTINATION bin) +INSTALL_DEBUG_SYMBOLS(mysqld) + + +FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable") +MARK_AS_ADVANCED(BISON_EXECUTABLE "") + + +# Handle out-of-source build from source package with possibly broken +# bison. Copy bison output to from source to build directory, if not already +# there +IF (NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR}) + IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.cc) + IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.cc + ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc COPYONLY) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.h + ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h COPYONLY) + ENDIF() + ENDIF() +ENDIF() + + +INCLUDE(${CMAKE_SOURCE_DIR}/cmake/bison.cmake) +RUN_BISON( + ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy + ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc + ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h +) -ADD_DEPENDENCIES(sql GenError) +# Gen_lex_hash +ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc) +TARGET_LINK_LIBRARIES(gen_lex_hash mysys) -# Sql Parser custom command ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h - ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc - COMMAND bison ARGS -y -p MYSQL --defines=sql_yacc.h - --output=sql_yacc.cc sql_yacc.yy - DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy) + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h + COMMAND gen_lex_hash ARGS > lex_hash.h + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_lex_hash.cc) + +ADD_CUSTOM_TARGET( + GenServerSource + DEPENDS ${GEN_SOURCES} +) +#Need this only for embedded +SET_TARGET_PROPERTIES(GenServerSource PROPERTIES EXCLUDE_FROM_ALL TRUE) + +IF(WIN32 OR HAVE_DLOPEN) + ADD_LIBRARY(udf_example MODULE udf_example.c) + SET_TARGET_PROPERTIES(udf_example PROPERTIES PREFIX "") + # udf_example depends on strings + IF(WIN32) + IF(MSVC) + SET_TARGET_PROPERTIES(udf_example PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/udf_example.def") + ENDIF() + TARGET_LINK_LIBRARIES(udf_example strings) + ENDIF() +ENDIF() + +FOREACH(tool glibtoolize libtoolize aclocal autoconf autoheader automake gtar + tar bzr) + STRING(TOUPPER ${tool} TOOL) + FIND_PROGRAM(${TOOL}_EXECUTABLE ${tool} DOC "path to the executable") + MARK_AS_ADVANCED(${TOOL}_EXECUTABLE) +ENDFOREACH() + +CONFIGURE_FILE( + ${CMAKE_SOURCE_DIR}/cmake/make_dist.cmake.in ${CMAKE_BINARY_DIR}/make_dist.cmake @ONLY) + +ADD_CUSTOM_TARGET(dist + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/make_dist.cmake + DEPENDS ${CMAKE_BINARY_DIR}/sql/sql_yacc.cc ${CMAKE_BINARY_DIR}/sql/sql_yacc.h + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} +) -# Gen_lex_hash -ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc) -TARGET_LINK_LIBRARIES(gen_lex_hash dbug mysqlclient) -GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION) -ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_SOURCE_DIR}/sql/lex_hash.h - COMMAND ${GEN_LEX_HASH_EXE} ARGS > lex_hash.h - DEPENDS ${GEN_LEX_HASH_EXE}) - -ADD_CUSTOM_TARGET( - GenServerSource ALL - DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h - ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc - ${PROJECT_SOURCE_DIR}/sql/message.h - ${PROJECT_SOURCE_DIR}/sql/message.rc - ${PROJECT_SOURCE_DIR}/sql/lex_hash.h) - -ADD_DEPENDENCIES(mysqld GenServerSource) - -# Remove the auto-generated files as part of 'Clean Solution' -SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES - "lex_hash.h;sql_yacc.h;sql_yacc.cc;mysqld.def") - -ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def) -ADD_DEPENDENCIES(udf_example strings GenError) -TARGET_LINK_LIBRARIES(udf_example strings) + + + + +# We need to create empty directories (data/test) the installation. +# This does not work with current CPack due to http://www.cmake.org/Bug/view.php?id=8767 +# Avoid completely empty directories and install dummy file instead. + +SET(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.empty ) +FILE(WRITE ${DUMMY_FILE} "") +INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test) + +# Install initial database on windows +IF(NOT CMAKE_CROSSCOMPILING) + GET_TARGET_PROPERTY(MYSQLD_EXECUTABLE mysqld LOCATION) +ENDIF() +IF(WIN32 AND MYSQLD_EXECUTABLE) + CONFIGURE_FILE( + ${CMAKE_SOURCE_DIR}/cmake/create_initial_db.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake + @ONLY + ) + + MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data) + ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm + COMMAND ${CMAKE_COMMAND} + -DCONFIG=${CMAKE_CFG_INTDIR} + -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data + DEPENDS mysqld + ) + ADD_CUSTOM_TARGET(initial_database + ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm + ) + INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data/mysql DESTINATION data) +ELSE() + # Not windows or cross compiling, just install an empty directory + INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql) +ENDIF() \ No newline at end of file diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc index f41fa08f828..76dc2846ed0 100644 --- a/sql/nt_servc.cc +++ b/sql/nt_servc.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include "nt_servc.h" diff --git a/sql/share/CMakeLists.txt b/sql/share/CMakeLists.txt new file mode 100644 index 00000000000..7a67833f9e3 --- /dev/null +++ b/sql/share/CMakeLists.txt @@ -0,0 +1,52 @@ +# Copyright (C) 2009 Sun Microsystems, Inc +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +SET (dirs +danish +german +slovak +dutch +greek +norwegian +spanish +english +hungarian +norwegian-ny +swedish +italian +polish +ukrainian +japanese +portuguese +romanian +estonian +korean +russian +czech +french +serbian +) + +SET(files + errmsg-utf8.txt +) + +FOREACH (dir ${dirs}) + INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dir} + DESTINATION share) +ENDFOREACH() +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION share) + +INSTALL(FILES ${files} DESTINATION share) diff --git a/sql/share/Makefile.am b/sql/share/Makefile.am index 06b349d5de2..c4078440abf 100644 --- a/sql/share/Makefile.am +++ b/sql/share/Makefile.am @@ -15,8 +15,9 @@ ## Process this file with automake to create Makefile.in -EXTRA_DIST= errmsg-utf8.txt - +EXTRA_DIST= errmsg-utf8.txt \ + CMakeLists.txt + dist-hook: for dir in charsets @AVAILABLE_LANGUAGES@; do \ test -d $(distdir)/$$dir || mkdir $(distdir)/$$dir; \ diff --git a/sql/sql_builtin.cc.in b/sql/sql_builtin.cc.in index 3becdbaccfe..1b9b152247f 100644 --- a/sql/sql_builtin.cc.in +++ b/sql/sql_builtin.cc.in @@ -17,7 +17,12 @@ typedef struct st_mysql_plugin builtin_plugin[]; -extern builtin_plugin +#if defined(_MSC_VER) +extern "C" +#else +extern +#endif +builtin_plugin builtin_binlog_plugin@mysql_plugin_defs@; struct st_mysql_plugin *mysqld_builtins[]= diff --git a/sql/sql_class.h b/sql/sql_class.h index 1a5cceaca90..e876b2a6787 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1960,7 +1960,7 @@ public: void add_changed_table(const char *key, long key_length); CHANGED_TABLE_LIST * changed_table_dup(const char *key, long key_length); int send_explain_fields(select_result *result); -#ifndef EMBEDDED_LIBRARY + /** Clear the current error, if any. We do not clear is_fatal_error or is_fatal_sub_stmt_error since we @@ -1976,9 +1976,9 @@ public: is_slave_error= 0; DBUG_VOID_RETURN; } +#ifndef EMBEDDED_LIBRARY inline bool vio_ok() const { return net.vio != 0; } #else - void clear_error(); inline bool vio_ok() const { return true; } #endif /** -- cgit v1.2.1 From cd2fa695de80667bbb8cbfb7d1c99762e5cba380 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 9 Nov 2009 19:14:33 +0100 Subject: Fix problems found by Joro (Xcode generator specific) --- sql/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 881772bfc5a..336f94c0718 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -187,6 +187,9 @@ IF(WIN32 OR HAVE_DLOPEN) SET_TARGET_PROPERTIES(udf_example PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/udf_example.def") ENDIF() TARGET_LINK_LIBRARIES(udf_example strings) + ELSE() + # udf_example is using safemutex exported by mysqld + TARGET_LINK_LIBRARIES(udf_example mysqld) ENDIF() ENDIF() @@ -246,4 +249,4 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) ELSE() # Not windows or cross compiling, just install an empty directory INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql) -ENDIF() \ No newline at end of file +ENDIF() -- cgit v1.2.1 From a15d4127fd115069f4322a9ebd4db67af39c977f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 16 Nov 2009 14:45:06 +0100 Subject: Fixes for cmake2.8 --- sql/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 336f94c0718..c3aadc8def5 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -232,11 +232,14 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) @ONLY ) + IF(MSVC_IDE OR CMAKE_GENERATOR MATCHES "Xcode") + SET (CONFIG_PARAM -DCONFIG=${CMAKE_CFG_INTDIR}) + ENDIF() MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm - COMMAND ${CMAKE_COMMAND} - -DCONFIG=${CMAKE_CFG_INTDIR} + COMMAND ${CMAKE_COMMAND} + ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DEPENDS mysqld -- cgit v1.2.1 From 39a158221ddac1c83766fe0b4635d854a664f262 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 25 Nov 2009 05:13:51 +0100 Subject: add --disable-shared equivalent fix mtr (empty argument passed to mysqld) --- sql/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index c3aadc8def5..82ad781c73b 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -178,7 +178,7 @@ ADD_CUSTOM_TARGET( #Need this only for embedded SET_TARGET_PROPERTIES(GenServerSource PROPERTIES EXCLUDE_FROM_ALL TRUE) -IF(WIN32 OR HAVE_DLOPEN) +IF(WIN32 OR HAVE_DLOPEN AND NOT DISABLE_SHARED) ADD_LIBRARY(udf_example MODULE udf_example.c) SET_TARGET_PROPERTIES(udf_example PROPERTIES PREFIX "") # udf_example depends on strings -- cgit v1.2.1 From d2139f313583aa7f6e09a505ea44aff0073d0d0d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 1 Dec 2009 12:00:50 +0100 Subject: - Introduce MYSQL_ADD_PLUGIN that replaces MYSQL_STORAGE_ENGINE - Fix semisync library prefix (remove lib on Unixes) - restrict exported symbols from zlib and yassl (fvisibility=hidden) --- sql/CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 82ad781c73b..158f0cbc884 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -48,7 +48,6 @@ SET (SQL_SOURCE ../sql-common/client.c derror.cc des_key_file.cc discover.cc ../libmysql/errmsg.c field.cc field_conv.cc filesort.cc gstream.cc - ha_partition.cc handler.cc hash_filo.cc hash_filo.h sql_plugin_services.h hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc item_create.cc item_func.cc item_geofunc.cc item_row.cc @@ -81,11 +80,12 @@ SET (SQL_SOURCE sql_connect.cc scheduler.cc sql_profile.cc event_parse_data.cc sql_signal.cc rpl_handler.cc - ${GEN_SOURCES} + ${GEN_SOURCES} ${MYSYS_LIBWRAP_SOURCE}) +MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY) + -SET (MYSQLD_CORE_LIBS mysys ${ZLIB_LIBRARY} ${SSL_LIBRARIES} vio regex ) IF(WIN32) SET(SQL_SOURCE ${SQL_SOURCE} nt_servc.cc nt_servc.h) ENDIF() @@ -113,7 +113,7 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS) # incremental appears to crash from time to time,if used with /DEF option SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "/DEF:mysqld.def /INCREMENTAL:NO") - FOREACH (CORELIB ${MYSQLD_CORE_LIBS} dbug strings) + FOREACH (CORELIB sql mysys dbug strings) GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION) FILE(TO_NATIVE_PATH ${LOC} LOC) SET (LIB_LOCATIONS ${LIB_LOCATIONS} ${LOC}) @@ -129,7 +129,8 @@ ENDIF() SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX}) -TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_STATIC_PLUGIN_LIBS} ${MYSQLD_CORE_LIBS} ${LIBWRAP_LIBRARY}) +TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_STATIC_PLUGIN_LIBS} sql mysys dbug strings vio regex ${MYSQLD_CORE_LIBS} + ${LIBWRAP_LIBRARY} ${ZLIB_LIBRARY} ${SSL_LIBRARIES}) INSTALL(TARGETS mysqld DESTINATION bin) INSTALL_DEBUG_SYMBOLS(mysqld) -- cgit v1.2.1 From 1407b6f1ec1e4cf86423744e6fd7657a1a541ec8 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 1 Dec 2009 18:28:13 +0000 Subject: fix build errors --- sql/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 158f0cbc884..8e2fbc0cac3 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -96,8 +96,7 @@ IF(MSVC) OUTPUT mysqld_dummy.cc COMMAND cmake ARGS -E touch mysqld_dummy.cc VERBATIM) - SET(MYSQLD_CORE_LIBS ${MYSQLD_CORE_LIBS} sql) - + SET(SQL_LIB sql) ELSE() ADD_EXECUTABLE(mysqld ${SQL_SOURCE}) DTRACE_INSTRUMENT(mysqld) @@ -129,7 +128,8 @@ ENDIF() SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX}) -TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_STATIC_PLUGIN_LIBS} sql mysys dbug strings vio regex ${MYSQLD_CORE_LIBS} +TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_STATIC_PLUGIN_LIBS} + mysys dbug strings vio regex ${SQL_LIB} ${LIBWRAP_LIBRARY} ${ZLIB_LIBRARY} ${SSL_LIBRARIES}) INSTALL(TARGETS mysqld DESTINATION bin) INSTALL_DEBUG_SYMBOLS(mysqld) -- cgit v1.2.1 From 9fcef3c45bd936b7da20679a1bb160c22f4945ff Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 7 Dec 2009 02:16:05 +0100 Subject: On Linux, support -Wl,--no-undefined (only client shared library) and --Wl,--as-needed (all shared modules). The later will remove unused dependencies (also from gcc and C++ runtime) --- sql/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 8e2fbc0cac3..a496b5c6f7c 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -130,7 +130,8 @@ SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX}) TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_STATIC_PLUGIN_LIBS} mysys dbug strings vio regex ${SQL_LIB} - ${LIBWRAP_LIBRARY} ${ZLIB_LIBRARY} ${SSL_LIBRARIES}) + ${LIBWRAP} ${LIBCRYPT} ${LIBDL} + ${ZLIB_LIBRARY} ${SSL_LIBRARIES}) INSTALL(TARGETS mysqld DESTINATION bin) INSTALL_DEBUG_SYMBOLS(mysqld) -- cgit v1.2.1 From ef482374e556a2a022ad2668bf386a30023c05b6 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 8 Dec 2009 03:12:23 +0100 Subject: couple of tweaks for solaris on sparc, link with librt, as it defines sched_yield --- sql/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index a496b5c6f7c..d086149831e 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -132,14 +132,18 @@ TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_STATIC_PLUGIN_LIBS} mysys dbug strings vio regex ${SQL_LIB} ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${ZLIB_LIBRARY} ${SSL_LIBRARIES}) + +# Provide plugins with minimal set of libraries +SET(INTERFACE_LIBS ${LIBRT}) +IF(INTERFACE_LIBS) + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_INTERFACE_LIBRARIES + "${INTERFACE_LIBS}") +ENDIF() + INSTALL(TARGETS mysqld DESTINATION bin) INSTALL_DEBUG_SYMBOLS(mysqld) -FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable") -MARK_AS_ADVANCED(BISON_EXECUTABLE "") - - # Handle out-of-source build from source package with possibly broken # bison. Copy bison output to from source to build directory, if not already # there -- cgit v1.2.1 From 55ccb35ba66e4e9168c412c95ebbb85106db8b2c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 11 Dec 2009 15:51:39 +0100 Subject: Introduce a workaround for Solaris' inability to deal with dtrace in static libraries. Rerun dtrace -G on all objects that can contan dtrace probes (also objects that are part of static libs) before linking mysqld to produce dtrace_probes_all.o and link dtrace_probes_all.o with mysqld This ugly workaround was inspired by handling dtrace using autotools. --- sql/CMakeLists.txt | 66 ++++++++++++++++++++++++++++++++++++++---------------- sql/Makefile.am | 2 +- sql/main.cc | 25 +++++++++++++++++++++ sql/mysqld.cc | 4 ++-- 4 files changed, 75 insertions(+), 22 deletions(-) create mode 100644 sql/main.cc (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index d086149831e..92cf55aa4ff 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -43,7 +43,6 @@ IF(SSL_DEFINES) ENDIF() - SET (SQL_SOURCE ../sql-common/client.c derror.cc des_key_file.cc discover.cc ../libmysql/errmsg.c field.cc field_conv.cc @@ -85,22 +84,55 @@ SET (SQL_SOURCE MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY) +ADD_LIBRARY(sql STATIC ${SQL_SOURCE}) +DTRACE_INSTRUMENT(sql) +TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} + mysys dbug strings vio regex + ${LIBWRAP} ${LIBCRYPT} ${LIBDL} + ${SSL_LIBRARIES}) + + + +# Ugly workaround for Solaris' DTrace inability to use probes +# from static libraries currently, discussed e.g in this thread +# (http://opensolaris.org/jive/thread.jspa?messageID=432454) +# We have to collect all object files that may be instrumented +# and go into the mysqld (also those that come from in static libs) +# run them again through dtrace -G to generate an ELF file that links +# to mysqld. +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE) + SET(DTRACE_PROBES_ALL ${CMAKE_CURRENT_BINARY_DIR}/dtrace_probes_all.o) + SET(DTRACED_LIBS sql ${MYSQLD_STATIC_PLUGIN_LIBS} mysys) + FOREACH(lib ${DTRACED_LIBS}) + SET(DTRACE_DIRS ${DTRACE_DIRS} ${TARGET_OBJECT_DIRECTORY_${lib}}) + ENDFOREACH() + + MESSAGE("DTRACE_DIRS=${DTRACE_DIRS}") + ADD_CUSTOM_COMMAND( + OUTPUT ${DTRACE_PROBES_ALL} + DEPENDS ${DTRACED_LIBS} + COMMAND ${CMAKE_COMMAND} + -DDTRACE=${DTRACE} + -DOUTFILE=${DTRACE_PROBES_ALL} + -DDFILE=${CMAKE_BINARY_DIR}/include/probes_mysql.d + -DDTRACE_FLAGS=${DTRACE_FLAGS} + "-DDIRS=${DTRACE_DIRS}" + -P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake + VERBATIM + ) +ELSE() + SET(DTRACE_PROBES_ALL) +ENDIF() + IF(WIN32) - SET(SQL_SOURCE ${SQL_SOURCE} nt_servc.cc nt_servc.h) -ENDIF() -IF(MSVC) - ADD_LIBRARY(sql ${SQL_SOURCE}) - ADD_EXECUTABLE(mysqld mysqld_dummy.cc) - ADD_CUSTOM_COMMAND( - OUTPUT mysqld_dummy.cc - COMMAND cmake ARGS -E touch mysqld_dummy.cc - VERBATIM) - SET(SQL_LIB sql) + SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h) ELSE() - ADD_EXECUTABLE(mysqld ${SQL_SOURCE}) - DTRACE_INSTRUMENT(mysqld) -ENDIF() + SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL}) +ENDIF() + +ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE}) + IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) @@ -128,11 +160,7 @@ ENDIF() SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX}) -TARGET_LINK_LIBRARIES(mysqld ${MYSQLD_STATIC_PLUGIN_LIBS} - mysys dbug strings vio regex ${SQL_LIB} - ${LIBWRAP} ${LIBCRYPT} ${LIBDL} - ${ZLIB_LIBRARY} ${SSL_LIBRARIES}) - +TARGET_LINK_LIBRARIES(mysqld sql) # Provide plugins with minimal set of libraries SET(INTERFACE_LIBS ${LIBRT}) IF(INTERFACE_LIBS) diff --git a/sql/Makefile.am b/sql/Makefile.am index 15ee0d588c4..5f5b8de97be 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -123,7 +123,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ net_serv.cc protocol.cc sql_state.c \ lock.cc my_lock.c \ sql_string.cc sql_manager.cc sql_map.cc \ - mysqld.cc password.c hash_filo.cc hostname.cc \ + main.cc mysqld.cc password.c hash_filo.cc hostname.cc \ sql_connect.cc scheduler.cc sql_parse.cc \ set_var.cc sql_yacc.yy \ sql_base.cc table.cc sql_select.cc sql_insert.cc \ diff --git a/sql/main.cc b/sql/main.cc new file mode 100644 index 00000000000..249a2a883fe --- /dev/null +++ b/sql/main.cc @@ -0,0 +1,25 @@ +/* Copyright (C) 2009 Sun Microsystems, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/* + main() for mysqld. + Calls mysqld_main() entry point exported by sql library. +*/ +extern int mysqld_main(int argc, char **argv); + +int main(int argc, char **argv) +{ + return mysqld_main(argc, argv); +} diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 30ea646d2fd..e871d46d6a1 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4309,7 +4309,7 @@ static void test_lc_time_sz() #ifdef __WIN__ int win_main(int argc, char **argv) #else -int main(int argc, char **argv) +int mysqld_main(int argc, char **argv) #endif { MY_INIT(argv[0]); // init my_sys library & pthreads @@ -4699,7 +4699,7 @@ default_service_handling(char **argv, } -int main(int argc, char **argv) +int mysqld_main(int argc, char **argv) { /* When several instances are running on the same machine, we -- cgit v1.2.1 From 3a6b75949c44709fec9841a3b216dec2f46826e1 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 11 Dec 2009 18:33:00 +0000 Subject: Introduce macro DTRACE_INSTRUMENT_STATIC_LIBS,to hide the ugly Solaris dtrace workarounds --- sql/CMakeLists.txt | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 92cf55aa4ff..8062fd62c1a 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -91,39 +91,7 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} ${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${SSL_LIBRARIES}) - - -# Ugly workaround for Solaris' DTrace inability to use probes -# from static libraries currently, discussed e.g in this thread -# (http://opensolaris.org/jive/thread.jspa?messageID=432454) -# We have to collect all object files that may be instrumented -# and go into the mysqld (also those that come from in static libs) -# run them again through dtrace -G to generate an ELF file that links -# to mysqld. -IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND ENABLE_DTRACE) - SET(DTRACE_PROBES_ALL ${CMAKE_CURRENT_BINARY_DIR}/dtrace_probes_all.o) - SET(DTRACED_LIBS sql ${MYSQLD_STATIC_PLUGIN_LIBS} mysys) - FOREACH(lib ${DTRACED_LIBS}) - SET(DTRACE_DIRS ${DTRACE_DIRS} ${TARGET_OBJECT_DIRECTORY_${lib}}) - ENDFOREACH() - MESSAGE("DTRACE_DIRS=${DTRACE_DIRS}") - ADD_CUSTOM_COMMAND( - OUTPUT ${DTRACE_PROBES_ALL} - DEPENDS ${DTRACED_LIBS} - COMMAND ${CMAKE_COMMAND} - -DDTRACE=${DTRACE} - -DOUTFILE=${DTRACE_PROBES_ALL} - -DDFILE=${CMAKE_BINARY_DIR}/include/probes_mysql.d - -DDTRACE_FLAGS=${DTRACE_FLAGS} - "-DDIRS=${DTRACE_DIRS}" - -P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake - VERBATIM - ) -ELSE() - SET(DTRACE_PROBES_ALL) -ENDIF() - IF(WIN32) SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h) @@ -132,7 +100,6 @@ ELSE() ENDIF() ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE}) - IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) @@ -168,6 +135,11 @@ IF(INTERFACE_LIBS) "${INTERFACE_LIBS}") ENDIF() +# On Solaris, some extra effort is required in order to get dtrace probes +# from static libraries +DTRACE_INSTRUMENT_STATIC_LIBS(mysqld + "sql;mysys;${MYSQLD_STATIC_PLUGIN_LIBS}") + INSTALL(TARGETS mysqld DESTINATION bin) INSTALL_DEBUG_SYMBOLS(mysqld) -- cgit v1.2.1 From cedb6101db403430d593431478fddd3c3da9b267 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 12 Dec 2009 02:03:05 +0100 Subject: Cleanup, use MYSQL_INSTALL_TARGETS macro instead of INSTALL(TARGETS) combined with INSTALL_DEBUG_SYMBOLS --- sql/CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 8062fd62c1a..6adad10a2e0 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -140,9 +140,8 @@ ENDIF() DTRACE_INSTRUMENT_STATIC_LIBS(mysqld "sql;mysys;${MYSQLD_STATIC_PLUGIN_LIBS}") -INSTALL(TARGETS mysqld DESTINATION bin) -INSTALL_DEBUG_SYMBOLS(mysqld) - +MYSQL_INSTALL_TARGETS(mysqld DESTINATION bin) + # Handle out-of-source build from source package with possibly broken # bison. Copy bison output to from source to build directory, if not already -- cgit v1.2.1 From 04d1596d643cc4789c63c0c4f4598fe04564f65f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 16 Dec 2009 13:25:41 +0100 Subject: fix windows errors with version resource --- sql/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 6adad10a2e0..9438fd8479d 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -95,6 +95,7 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} IF(WIN32) SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h) + WIN32_ADD_VERSION_INFO(MYSQLD_SOURCE) ELSE() SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL}) ENDIF() -- cgit v1.2.1 From eb3c44030bf398ddaf033be1a3b1b163faa9bce3 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 17 Dec 2009 14:41:50 +0100 Subject: Replace ADD_EXECUTABLE with MYSQL_ADD_EXECUTABLE for binaries that are installed. MYSQL_ADD_EXECUTABLE will instructs CPack where to install the exe. On Windows, it also adds version resource and if -DSIGNCODE was given, will sign the exe in packaging step. --- sql/CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 9438fd8479d..b6f33236675 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -95,12 +95,11 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS} IF(WIN32) SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h) - WIN32_ADD_VERSION_INFO(MYSQLD_SOURCE) ELSE() SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL}) ENDIF() -ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE}) +MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE}) IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) @@ -127,7 +126,6 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS) ENDIF() SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) -SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX}) TARGET_LINK_LIBRARIES(mysqld sql) # Provide plugins with minimal set of libraries SET(INTERFACE_LIBS ${LIBRT}) @@ -140,8 +138,6 @@ ENDIF() # from static libraries DTRACE_INSTRUMENT_STATIC_LIBS(mysqld "sql;mysys;${MYSQLD_STATIC_PLUGIN_LIBS}") - -MYSQL_INSTALL_TARGETS(mysqld DESTINATION bin) # Handle out-of-source build from source package with possibly broken -- cgit v1.2.1 From 27c0d595e9e3a35232672209219ecc9b74004ab4 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 18 Dec 2009 23:53:30 +0100 Subject: Simplify embedding version info into executables with ADD_VERSION_INFO --- sql/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index b6f33236675..43f22903aef 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -103,13 +103,14 @@ MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE}) IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) + GET_TARGET_PROPERTY(mysqld_link_flags mysqld LINK_FLAGS) IF (MINGW OR CYGWIN) - SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "-Wl,--export-all-symbols") + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "{mysqld_link_flags} -Wl,--export-all-symbols") ENDIF() IF(MSVC) # Set module definition file. Also use non-incremental linker, # incremental appears to crash from time to time,if used with /DEF option - SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "/DEF:mysqld.def /INCREMENTAL:NO") + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${mysqld_link_flags} /DEF:mysqld.def /INCREMENTAL:NO") FOREACH (CORELIB sql mysys dbug strings) GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION) -- cgit v1.2.1 From b53528c678869f0e8fdd196ce58885e5a1cb2ef8 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 23 Dec 2009 16:37:22 +0100 Subject: recompile partition plugin for embedded server, its behavior depends on WITH_EMBEDDED_SERVER preprocessor definition --- sql/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 43f22903aef..b32a66a6c92 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -82,7 +82,8 @@ SET (SQL_SOURCE ${GEN_SOURCES} ${MYSYS_LIBWRAP_SOURCE}) -MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY) +MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY +RECOMPILE_FOR_EMBEDDED) ADD_LIBRARY(sql STATIC ${SQL_SOURCE}) DTRACE_INSTRUMENT(sql) @@ -242,8 +243,7 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/data/mysql/user.frm COMMAND ${CMAKE_COMMAND} - ${CONFIG_PARAM} - -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake + ${CONFIG_PARAM} -P ${CMAKE_CURRENT_BINARY_DIR}/create_initial_db.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data DEPENDS mysqld ) -- cgit v1.2.1 From f2d4808fbb5fefe94c0e91274e786e07670e847c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 25 Dec 2009 03:22:23 +0100 Subject: enable Cygwin build again --- sql/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index b32a66a6c92..28424bd3e50 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -105,8 +105,11 @@ MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE}) IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) GET_TARGET_PROPERTY(mysqld_link_flags mysqld LINK_FLAGS) + IF(NOT mysqld_link_flags) + SET(mysqld_link_flags) + ENDIF() IF (MINGW OR CYGWIN) - SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "{mysqld_link_flags} -Wl,--export-all-symbols") + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${mysqld_link_flags} -Wl,--export-all-symbols") ENDIF() IF(MSVC) # Set module definition file. Also use non-incremental linker, -- cgit v1.2.1 From 3940981757f9c33c90448aef46f0e209ab9b0131 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 13 Jan 2010 21:56:51 +0100 Subject: Do not link with mtmalloc on Solaris. add WITH_MYSQLD_LIBS for extra linker flags for mysqld --- sql/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 389b1a8766b..eaf8a45b25d 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -132,6 +132,7 @@ ENDIF() SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) TARGET_LINK_LIBRARIES(mysqld sql) + # Provide plugins with minimal set of libraries SET(INTERFACE_LIBS ${LIBRT}) IF(INTERFACE_LIBS) @@ -145,6 +146,17 @@ DTRACE_INSTRUMENT_STATIC_LIBS(mysqld "sql;mysys;${MYSQLD_STATIC_PLUGIN_LIBS}") +SET(WITH_MYSQLD_LIBS "" CACHE STRING "Additional linker flags for mysqld") +MARK_AS_ADVANCED(WITH_MYSQLD_LIBS) +IF(WITH_MYSQLD_LIBS) + GET_TARGET_PROPERTY(mysqld LINK_FLAGS MYSQLD_LINK_FLAGS) + IF(NOT MYSQLD_LINK_FLAGS) + SET(MYSQLD_LINK_FLAGS) + ENDIF() + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS + "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LIBS}") +ENDIF() + # Handle out-of-source build from source package with possibly broken # bison. Copy bison output to from source to build directory, if not already # there -- cgit v1.2.1 From bcb73f8c75843627fd9b26d4d8e5ae67e4003987 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 14 Jan 2010 00:09:40 +0100 Subject: WITH_MYSQLD_LIBS=>WITH_MYSQLD_LDFLAGS --- sql/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index eaf8a45b25d..6fab01596b9 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -146,15 +146,15 @@ DTRACE_INSTRUMENT_STATIC_LIBS(mysqld "sql;mysys;${MYSQLD_STATIC_PLUGIN_LIBS}") -SET(WITH_MYSQLD_LIBS "" CACHE STRING "Additional linker flags for mysqld") -MARK_AS_ADVANCED(WITH_MYSQLD_LIBS) -IF(WITH_MYSQLD_LIBS) +SET(WITH_MYSQLD_LDFLAGS "" CACHE STRING "Additional linker flags for mysqld") +MARK_AS_ADVANCED(WITH_MYSQLD_LDFLAGS) +IF(WITH_MYSQLD_LDFLAGS) GET_TARGET_PROPERTY(mysqld LINK_FLAGS MYSQLD_LINK_FLAGS) IF(NOT MYSQLD_LINK_FLAGS) SET(MYSQLD_LINK_FLAGS) ENDIF() SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS - "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LIBS}") + "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}") ENDIF() # Handle out-of-source build from source package with possibly broken -- cgit v1.2.1 From ab9d822350c90fe43cb2da5a4bea30e7dbaf083d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 15 Jan 2010 00:54:43 +0100 Subject: fix for 32 bit Linux problem reported by Timothy --- sql/mysqld.cc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e0ccab7872b..70b33be7c59 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -176,6 +176,9 @@ typedef fp_except fp_except_t; /* for IRIX to use set_fpc_csr() */ #include #endif +#ifdef HAVE_FPU_CONTROL_H +#include +#endif #if defined(__i386__) && !defined(HAVE_FPU_CONTROL_H) # define fpu_control_t unsigned int # define _FPU_EXTENDED 0x300 -- cgit v1.2.1 From 8d9f3d76154cb52137eb8eb1adc46ee794087ce1 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 18 Jan 2010 23:42:22 +0100 Subject: In DBUG_EXECUTE_IF, change abort() to DBUG_ABORT() to avoid popups on windows --- sql/handler.cc | 10 +++++----- sql/log.cc | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'sql') diff --git a/sql/handler.cc b/sql/handler.cc index d9bed4ec557..40a7bb5c14a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1151,7 +1151,7 @@ int ha_commit_trans(THD *thd, bool all) uint rw_ha_count; bool rw_trans; - DBUG_EXECUTE_IF("crash_commit_before", abort();); + DBUG_EXECUTE_IF("crash_commit_before", DBUG_ABORT();); /* Close all cursors that can not survive COMMIT */ if (is_real_trans) /* not a statement commit */ @@ -1203,7 +1203,7 @@ int ha_commit_trans(THD *thd, bool all) } status_var_increment(thd->status_var.ha_prepare_count); } - DBUG_EXECUTE_IF("crash_commit_after_prepare", abort();); + DBUG_EXECUTE_IF("crash_commit_after_prepare", DBUG_ABORT();); if (error || (is_real_trans && xid && (error= !(cookie= tc_log->log_xid(thd, xid))))) { @@ -1211,13 +1211,13 @@ int ha_commit_trans(THD *thd, bool all) error= 1; goto end; } - DBUG_EXECUTE_IF("crash_commit_after_log", abort();); + DBUG_EXECUTE_IF("crash_commit_after_log", DBUG_ABORT();); } error=ha_commit_one_phase(thd, all) ? (cookie ? 2 : 1) : 0; - DBUG_EXECUTE_IF("crash_commit_before_unlog", abort();); + DBUG_EXECUTE_IF("crash_commit_before_unlog", DBUG_ABORT();); if (cookie) tc_log->unlog(cookie, xid); - DBUG_EXECUTE_IF("crash_commit_after", abort();); + DBUG_EXECUTE_IF("crash_commit_after", DBUG_ABORT();); RUN_HOOK(transaction, after_commit, (thd, FALSE)); end: if (rw_trans) diff --git a/sql/log.cc b/sql/log.cc index 72d0ed43463..385b067d663 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2826,7 +2826,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, sql_print_error("MSYQL_BIN_LOG::open failed to sync the index file."); DBUG_RETURN(1); } - DBUG_EXECUTE_IF("crash_create_non_critical_before_update_index", abort();); + DBUG_EXECUTE_IF("crash_create_non_critical_before_update_index", DBUG_ABORT();); #endif write_error= 0; @@ -2923,7 +2923,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, if (write_file_name_to_index_file) { #ifdef HAVE_REPLICATION - DBUG_EXECUTE_IF("crash_create_critical_before_update_index", abort();); + DBUG_EXECUTE_IF("crash_create_critical_before_update_index", DBUG_ABORT();); #endif DBUG_ASSERT(my_b_inited(&index_file) != 0); @@ -2942,7 +2942,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, goto err; #ifdef HAVE_REPLICATION - DBUG_EXECUTE_IF("crash_create_after_update_index", abort();); + DBUG_EXECUTE_IF("crash_create_after_update_index", DBUG_ABORT();); #endif } } @@ -3404,7 +3404,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay_log_info* rli, bool included) /* Store where we are in the new file for the execution thread */ flush_relay_log_info(rli); - DBUG_EXECUTE_IF("crash_before_purge_logs", abort();); + DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_ABORT();); mysql_mutex_lock(&rli->log_space_lock); rli->relay_log.purge_logs(to_purge_if_included, included, @@ -3547,7 +3547,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, goto err; } - DBUG_EXECUTE_IF("crash_purge_critical_after_update_index", abort();); + DBUG_EXECUTE_IF("crash_purge_critical_after_update_index", DBUG_ABORT();); err: /* Read each entry from purge_index_file and delete the file. */ @@ -3557,7 +3557,7 @@ err: " that would be purged."); close_purge_index_file(); - DBUG_EXECUTE_IF("crash_purge_non_critical_after_update_index", abort();); + DBUG_EXECUTE_IF("crash_purge_non_critical_after_update_index", DBUG_ABORT();); if (need_mutex) mysql_mutex_unlock(&LOCK_index); @@ -5101,7 +5101,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event, DBUG_PRINT("info", ("error writing binlog cache: %d", write_error)); DBUG_PRINT("info", ("crashing before writing xid")); - abort(); + DBUG_ABORT(); }); if ((write_error= write_cache(cache, false, false))) @@ -5116,7 +5116,7 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event, bool synced= 0; if (flush_and_sync(&synced)) goto err; - DBUG_EXECUTE_IF("half_binlogged_transaction", abort();); + DBUG_EXECUTE_IF("half_binlogged_transaction", DBUG_ABORT();); if (cache->error) // Error on read { sql_print_error(ER(ER_ERROR_ON_READ), cache->file_name, errno); -- cgit v1.2.1 From e4687956c10cdf73d00f34e07a59d84603bf4500 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 21 Jan 2010 19:41:01 +0100 Subject: Cherrypick fix for -DWITH_SSL=system by Marc Alff (Bug#50513) --- sql/mysqld.cc | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 31af7ac9fd7..5826bfb925c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -319,6 +319,10 @@ static PSI_thread_key key_thread_handle_con_sockets; #ifdef __WIN__ static PSI_thread_key key_thread_handle_shutdown; #endif /* __WIN__ */ + +#if defined (HAVE_OPENSSL) && !defined(HAVE_YASSL) +static PSI_rwlock_key key_rwlock_openssl; +#endif #endif /* HAVE_PSI_INTERFACE */ /* the default log output is log tables */ @@ -1541,7 +1545,7 @@ static void clean_up_mutexes() mysql_mutex_destroy(&LOCK_des_key_file); #ifndef HAVE_YASSL for (int i= 0; i < CRYPTO_num_locks(); ++i) - rwlock_destroy(&openssl_stdlocks[i].lock); + mysql_rwlock_destroy(&openssl_stdlocks[i].lock); OPENSSL_free(openssl_stdlocks); #endif #endif @@ -3730,7 +3734,7 @@ static int init_thread_environment() openssl_stdlocks= (openssl_lock_t*) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(openssl_lock_t)); for (int i= 0; i < CRYPTO_num_locks(); ++i) - my_rwlock_init(&openssl_stdlocks[i].lock, NULL); + mysql_rwlock_init(key_rwlock_openssl, &openssl_stdlocks[i].lock); CRYPTO_set_dynlock_create_callback(openssl_dynlock_create); CRYPTO_set_dynlock_destroy_callback(openssl_dynlock_destroy); CRYPTO_set_dynlock_lock_callback(openssl_lock); @@ -3784,7 +3788,7 @@ static unsigned long openssl_id_function() static openssl_lock_t *openssl_dynlock_create(const char *file, int line) { openssl_lock_t *lock= new openssl_lock_t; - my_rwlock_init(&lock->lock, NULL); + mysql_rwlock_init(key_rwlock_openssl, &lock->lock); return lock; } @@ -3792,7 +3796,7 @@ static openssl_lock_t *openssl_dynlock_create(const char *file, int line) static void openssl_dynlock_destroy(openssl_lock_t *lock, const char *file, int line) { - rwlock_destroy(&lock->lock); + mysql_rwlock_destroy(&lock->lock); delete lock; } @@ -3818,16 +3822,16 @@ static void openssl_lock(int mode, openssl_lock_t *lock, const char *file, switch (mode) { case CRYPTO_LOCK|CRYPTO_READ: what = "read lock"; - err = rw_rdlock(&lock->lock); + err= mysql_rwlock_rdlock(&lock->lock); break; case CRYPTO_LOCK|CRYPTO_WRITE: what = "write lock"; - err = rw_wrlock(&lock->lock); + err= mysql_rwlock_wrlock(&lock->lock); break; case CRYPTO_UNLOCK|CRYPTO_READ: case CRYPTO_UNLOCK|CRYPTO_WRITE: what = "unlock"; - err = rw_unlock(&lock->lock); + err= mysql_rwlock_unlock(&lock->lock); break; default: /* Unknown locking mode. */ @@ -7965,6 +7969,9 @@ PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger, static PSI_rwlock_info all_server_rwlocks[]= { +#if defined (HAVE_OPENSSL) && !defined(HAVE_YASSL) + { &key_rwlock_openssl, "CRYPTO_dynlock_value::lock", 0}, +#endif { &key_rwlock_LOCK_grant, "LOCK_grant", PSI_FLAG_GLOBAL}, { &key_rwlock_LOCK_logger, "LOGGER::LOCK_logger", 0}, { &key_rwlock_LOCK_sys_init_connect, "LOCK_sys_init_connect", PSI_FLAG_GLOBAL}, -- cgit v1.2.1 From df9f68e9730d5d1f00ad82536c27352b9915c018 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 22 Jan 2010 20:23:45 +0100 Subject: Replace another abort() under DBUG_EXECUTE_IF with DBUG_ABORT to avoid popups on Windows. --- sql/log.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/log.cc b/sql/log.cc index 385b067d663..fdc763df0de 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3532,7 +3532,7 @@ int MYSQL_BIN_LOG::purge_logs(const char *to_log, break; } - DBUG_EXECUTE_IF("crash_purge_before_update_index", abort();); + DBUG_EXECUTE_IF("crash_purge_before_update_index", DBUG_ABORT();); if ((error= sync_purge_index_file())) { -- cgit v1.2.1 From c514d75ebb0651dcc65ca9e09cf8458dc904f242 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sun, 24 Jan 2010 16:23:16 +0100 Subject: Handle different installation layouts. using cmake option INSTALL_LAYOUT=STANDALONE would produce the layout as in tar.gz or zip packages. INSTALL_LAYOUT=UNIX will produce unixish install layout (with mysqld being in sbin subdirectory , libs in lib/mysql etc). This layout is used for RPM packages. Subtle differences in both packages unfortunately lead to the need to recompile MySQL to use with other package type - as otherwise for example default plugins or data directories would be wrong set. There are numerous other variables that allow fine-tuning packaging layout. (INSTALL_BINDIR, INSTALL_LIBDIR , INSTALL_PLUGINDIR etc). This options are different from autotools as they do not expect full paths to directories, but only subdirectory of CMAKE_INSTALL_PREFIX. There are 2 special options that expect full directory paths - MYSQL_DATADIR that defines default MYSQL data directory (autotools equivalent is --localstatedir) - SYSCONFDIR can be added to search my.cnf search path (autotools equivalent is --sysconfdir) --- sql/CMakeLists.txt | 6 ++++-- sql/share/CMakeLists.txt | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 6fab01596b9..a5a925b8dc2 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -100,7 +100,7 @@ ELSE() SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL}) ENDIF() -MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE}) +MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR}) IF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) @@ -231,11 +231,11 @@ ADD_CUSTOM_TARGET(dist +IF(INSTALL_LAYOUT STREQUAL "STANDALONE") # We need to create empty directories (data/test) the installation. # This does not work with current CPack due to http://www.cmake.org/Bug/view.php?id=8767 # Avoid completely empty directories and install dummy file instead. - SET(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.empty ) FILE(WRITE ${DUMMY_FILE} "") INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test) @@ -271,3 +271,5 @@ ELSE() # Not windows or cross compiling, just install an empty directory INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql) ENDIF() +ENDIF() + diff --git a/sql/share/CMakeLists.txt b/sql/share/CMakeLists.txt index 7a67833f9e3..944120cfc24 100644 --- a/sql/share/CMakeLists.txt +++ b/sql/share/CMakeLists.txt @@ -45,8 +45,8 @@ SET(files FOREACH (dir ${dirs}) INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dir} - DESTINATION share) + DESTINATION ${INSTALL_MYSQLSHAREDIR}) ENDFOREACH() -INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION share) +INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION ${INSTALL_MYSQLSHAREDIR}) -INSTALL(FILES ${files} DESTINATION share) +INSTALL(FILES ${files} DESTINATION ${INSTALL_MYSQLSHAREDIR}) -- cgit v1.2.1 From b4d6a13510dbd5bc2eebdd44e5eaec02d8f3725b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sun, 24 Jan 2010 20:03:10 +0100 Subject: Fix failing sys_vars.plugin_dir_basic - treat both '/' and '\' as path separators in get_relative_path() on Windows --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 276ec02a042..12bd1ec7c47 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7681,7 +7681,7 @@ static char *get_relative_path(const char *path) strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR)) { path+=(uint) strlen(DEFAULT_MYSQL_HOME); - while (*path == FN_LIBCHAR) + while (*path == FN_LIBCHAR || *path == FN_LIBCHAR2) path++; } return (char*) path; -- cgit v1.2.1 From 9cabc9fd8ac4d249d95ff7140371533070dedd4e Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 28 Jan 2010 11:09:05 +0100 Subject: prettification of package names and fix compile bug on OSX/ppc --- sql/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 4c7e16b802d..ee58c33c6f7 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -121,10 +121,13 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS) FILE(TO_NATIVE_PATH ${LOC} LOC) SET (LIB_LOCATIONS ${LIB_LOCATIONS} ${LOC}) ENDFOREACH (CORELIB ${MYSQLD_CORE_LIBS}) - + SET(_PLATFORM x86) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(_PLATFORM x64) + ENDIF() ADD_CUSTOM_COMMAND(TARGET mysqld PRE_LINK - COMMAND echo ${PLATFORM} && cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js - ${PLATFORM} ${LIB_LOCATIONS} > mysqld.def + COMMAND echo ${_PLATFORM} && cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js + ${_PLATFORM} ${LIB_LOCATIONS} > mysqld.def WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) ADD_DEPENDENCIES(sql GenError) ENDIF() -- cgit v1.2.1 From a52ea360b37389465113fce4834bb7f6c6a04c0c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 4 Feb 2010 02:17:18 +0100 Subject: - Optionally, copy mysqld renamed to mysqld-debug from debug build directory into resulting package - Fix to mysql_install_db.pl to the correct place on Windows ( under scripts directory) --- sql/CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index ee58c33c6f7..3215194eca9 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -276,3 +276,39 @@ ELSE() ENDIF() ENDIF() +# Optionally install mysqld from debug build run. outside of the current build dir +# (unless multi-config generator is used# like Visual Studio or Xcode). +# For Makefile generators we default Debug build directory to ${buildroot}/../debug. + +GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH) +SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug") + +IF(WIN32) + SET(EXE ".exe") +ELSE() + SET(EXE) +ENDIF() + +IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MYSQLD_DEBUG_EXE ${DEBUGBUILDDIR}/sql/mysqld${EXE}) +ELSE() + # Visual Studio and Xcode + SET(MYSQLD_DEBUG_EXE ${CMAKE_BINARY_DIR}/sql/Debug/mysqld${EXE}) +ENDIF() + +INSTALL(FILES ${MYSQLD_DEBUG_EXE} + DESTINATION ${INSTALL_SBINDIR} + RENAME mysqld-debug${EXE} + CONFIGURATIONS Release RelWithDebInfo + OPTIONAL) + +IF(WIN32) + STRING(REPLACE ".exe" ".pdb" MYSQLD_DEBUG_PDB ${MYSQLD_DEBUG_EXE}) + INSTALL(FILES ${MYSQLD_DEBUG_PDB} + CONFIGURATIONS Release RelWithDebInfo + DESTINATION ${INSTALL_SBINDIR} + RENAME mysqld-debug.pdb + OPTIONAL) +ENDIF() + + -- cgit v1.2.1 From 4d0b901a55e1f27cb7e5caedced1ebbb923d366b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 4 Feb 2010 13:46:56 +0100 Subject: Make DEBUGBUILDDIR cached variable, so it can be overriden with cmake -D --- sql/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 3215194eca9..85970ff5c0a 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -281,7 +281,7 @@ ENDIF() # For Makefile generators we default Debug build directory to ${buildroot}/../debug. GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH) -SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug") +SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug build") IF(WIN32) SET(EXE ".exe") -- cgit v1.2.1 From cb31d4ccfeae5db50f46bf965cf561222696df02 Mon Sep 17 00:00:00 2001 From: vvaintroub Date: Tue, 9 Feb 2010 12:38:12 +0100 Subject: remove /MAP option for good.Noone needs it --- sql/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 85970ff5c0a..9a7c8391712 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -13,11 +13,6 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -IF(MSVC) - #Innodb plugin needs linker-generated map file to locate server exports - #see bug#42001 - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /MAP /MAPINFO:EXPORTS") -ENDIF(MSVC) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include -- cgit v1.2.1 From 2d4687d03b1a25b68de197837b6e51524d3a5b8a Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Sun, 14 Feb 2010 19:12:58 +0100 Subject: Bug#48929 Error in Accept() if using many file descriptors In POSIX systems, the file descriptor set used in the select(2) system call is represented by a bit vector of size FD_SETSIZE. When select(2) is used on file/socket descriptors with a value that is beyond this size, unpredictable errors may occur. In this case, the error happens when there are a large number of tables that need repair. These tables are opened before the sockets for incoming connections are acquired, resulting in these sockets getting descriptor id which is higher than FD_SETSIZE. Replacing the call to select(2) with poll(2) fixes the problem, as poll takes an array of the wanted descriptors, instead of a bit vector. MS Windows has a different implementation of 'select', and is not affected by this bug. configure.in: Added a test for the file sql/mysqld.cc: Restructured some of the code to reduce the number of #ifdef's. Removed some HP/UX 10-specific code. --- sql/mysqld.cc | 64 +++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 10 deletions(-) (limited to 'sql') diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 983f1750a38..5a88ad1970a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -52,6 +52,10 @@ #include "sp_rcontext.h" #include "sp_cache.h" +#ifdef HAVE_POLL_H +#include +#endif + #define mysqld_charset &my_charset_latin1 /* stack traces are only supported on linux intel */ @@ -5343,26 +5347,47 @@ void handle_connections_sockets() { my_socket sock,new_sock; uint error_count=0; - uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1); - fd_set readFDs,clientFDs; THD *thd; struct sockaddr_storage cAddr; - int ip_flags=0,socket_flags=0,flags; + int ip_flags=0,socket_flags=0,flags,retval; st_vio *vio_tmp; +#ifdef HAVE_POLL + int socket_count= 0; + struct pollfd fds[2]; // for ip_sock and unix_sock +#else + fd_set readFDs,clientFDs; + uint max_used_connection= (uint) (max(ip_sock,unix_sock)+1); +#endif + DBUG_ENTER("handle_connections_sockets"); LINT_INIT(new_sock); +#ifndef HAVE_POLL FD_ZERO(&clientFDs); +#endif + if (ip_sock != INVALID_SOCKET) { +#ifdef HAVE_POLL + fds[socket_count].fd= ip_sock; + fds[socket_count].events= POLLIN; + socket_count++; +#else FD_SET(ip_sock,&clientFDs); +#endif #ifdef HAVE_FCNTL ip_flags = fcntl(ip_sock, F_GETFL, 0); #endif } #ifdef HAVE_SYS_UN_H +#ifdef HAVE_POLL + fds[socket_count].fd= unix_sock; + fds[socket_count].events= POLLIN; + socket_count++; +#else FD_SET(unix_sock,&clientFDs); +#endif #ifdef HAVE_FCNTL socket_flags=fcntl(unix_sock, F_GETFL, 0); #endif @@ -5372,12 +5397,15 @@ void handle_connections_sockets() MAYBE_BROKEN_SYSCALL; while (!abort_loop) { - readFDs=clientFDs; -#ifdef HPUX10 - if (select(max_used_connection,(int*) &readFDs,0,0,0) < 0) - continue; +#ifdef HAVE_POLL + retval= poll(fds, socket_count, -1); #else - if (select((int) max_used_connection,&readFDs,0,0,0) < 0) + readFDs=clientFDs; + + retval= select((int) max_used_connection,&readFDs,0,0,0); +#endif + + if (retval < 0) { if (socket_errno != SOCKET_EINTR) { @@ -5387,7 +5415,7 @@ void handle_connections_sockets() MAYBE_BROKEN_SYSCALL continue; } -#endif /* HPUX10 */ + if (abort_loop) { MAYBE_BROKEN_SYSCALL; @@ -5395,6 +5423,21 @@ void handle_connections_sockets() } /* Is this a new connection request ? */ +#ifdef HAVE_POLL + for (int i= 0; i < socket_count; ++i) + { + if (fds[i].revents & POLLIN) + { + sock= fds[i].fd; +#ifdef HAVE_FCNTL + flags= fcntl(sock, F_GETFL, 0); +#else + flags= 0; +#endif // HAVE_FCNTL + break; + } + } +#else // HAVE_POLL #ifdef HAVE_SYS_UN_H if (FD_ISSET(unix_sock,&readFDs)) { @@ -5402,11 +5445,12 @@ void handle_connections_sockets() flags= socket_flags; } else -#endif +#endif // HAVE_SYS_UN_H { sock = ip_sock; flags= ip_flags; } +#endif // HAVE_POLL #if !defined(NO_FCNTL_NONBLOCK) if (!(test_flags & TEST_BLOCKING)) -- cgit v1.2.1 From 0e2ee37a8df49b2ba47710972e7d3ab76c765acf Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 16 Feb 2010 23:58:15 +0100 Subject: postmerge fix --- sql/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 1a8d8586ce0..1da41e53b92 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -52,7 +52,7 @@ SET (SQL_SOURCE log_event_old.cc rpl_record_old.cc message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c mysqld.cc net_serv.cc keycaches.cc - nt_servc.cc nt_servc.h opt_range.cc opt_range.h opt_sum.cc + opt_range.cc opt_range.h opt_sum.cc ../sql-common/pack.c parse_file.cc password.c procedure.cc protocol.cc records.cc repl_failsafe.cc rpl_filter.cc set_var.cc slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc -- cgit v1.2.1 From 7178879c8036277075ef2c83265e5cbb01e0cf22 Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Wed, 17 Feb 2010 10:18:17 +0100 Subject: WL#5154 Remove deprecated 4.1 features A set of program options and variables was deprecated in MySQL 5.1, and is hereby removed. client/mysql.cc: --no-auto-rehash (-A) is no longer deprecated --no-named-commands (-g) is now removed --skip-line-numbers (-L) is no longer deprecated --set-variable (-O) is now removed --no-pager is now removed client/mysqlbinlog.cc: --position is now removed (use --start-position) -j is now equivalent with --start-position client/mysqldump.c: --first-slave is now removed --no-set-names (-N) is now removed --set-variable (-O) is now removed mysql-test/include/default_mysqld.cnf: default-character-set is removed as an option character-set-server is equivalent. mysql-test/t/bug47671-master.opt: default-character-set option is removed character-set-server is equivalent mysql-test/t/ctype_latin1_de-master.opt: default-character-set option is removed character-set-server is equivalent mysql-test/t/ctype_ucs2_def-master.opt: default-collation is removed collation-server is equicalent scripts/mysqld_multi.sh: --config-file has been superseded by --defaults-extra-file sql/mysql_priv.h: Removed the version number in the deprecation warning text, as decided by ServerPT. sql/mysqld.cc: --default-character-set (-C) is removed --default-collation is removed --log-long-format (-0) is removed --safe-show-database is removed --set-variable (-O) is removed sql/sql_yacc.yy: The FRAC_SECOND keyword is removed sql/sys_vars.cc: The sql_log_update system variable is removed --- sql/lex.h | 2 -- sql/mysql_priv.h | 10 +++++----- sql/mysqld.cc | 17 ----------------- sql/share/errmsg-utf8.txt | 4 +--- sql/sql_yacc.yy | 27 +-------------------------- sql/sys_vars.cc | 24 ------------------------ 6 files changed, 7 insertions(+), 77 deletions(-) (limited to 'sql') diff --git a/sql/lex.h b/sql/lex.h index 7961339c4f3..463c251fa24 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -226,7 +226,6 @@ static SYMBOL symbols[] = { { "FORCE", SYM(FORCE_SYM)}, { "FOREIGN", SYM(FOREIGN)}, { "FOUND", SYM(FOUND_SYM)}, - { "FRAC_SECOND", SYM(FRAC_SECOND_SYM)}, { "FROM", SYM(FROM)}, { "FULL", SYM(FULL)}, { "FULLTEXT", SYM(FULLTEXT_SYM)}, @@ -517,7 +516,6 @@ static SYMBOL symbols[] = { { "SQL_NO_CACHE", SYM(SQL_NO_CACHE_SYM)}, { "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT)}, { "SQL_THREAD", SYM(SQL_THREAD)}, - { "SQL_TSI_FRAC_SECOND", SYM(FRAC_SECOND_SYM)}, { "SQL_TSI_SECOND", SYM(SECOND_SYM)}, { "SQL_TSI_MINUTE", SYM(MINUTE_SYM)}, { "SQL_TSI_HOUR", SYM(HOUR_SYM)}, diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 8daf8f5ecb3..7ef8517ad13 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -198,12 +198,12 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); if (((THD *) Thd) != NULL) \ push_warning_printf(((THD *) Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \ ER_WARN_DEPRECATED_SYNTAX, \ - ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER), \ - (Old), #VerHi "." #VerLo, (New)); \ + ER(ER_WARN_DEPRECATED_SYNTAX), \ + (Old), (New)); \ else \ sql_print_warning("The syntax '%s' is deprecated and will be removed " \ - "in MySQL %s. Please use %s instead.", \ - (Old), #VerHi "." #VerLo, (New)); \ + "in a future release. Please use %s instead.", \ + (Old), (New)); \ } while(0) extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *system_charset_info; @@ -2032,7 +2032,7 @@ extern bool in_bootstrap; extern uint volatile thread_count, global_read_lock; extern uint connection_count; extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types; -extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap; +extern my_bool opt_local_infile, opt_myisam_use_mmap; extern my_bool opt_slave_compressed_protocol, use_temp_pool; extern uint slave_exec_mode_options; extern ulonglong slave_type_conversions_options; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 5a88ad1970a..7b59a8a61ef 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6014,12 +6014,6 @@ struct my_option my_long_options[]= 0, 0, 0}, {"core-file", OPT_WANT_CORE, "Write core on errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"default-character-set", 'C', "Set the default character set (deprecated option, use --character-set-server instead).", - (uchar**) &default_character_set_name, (uchar**) &default_character_set_name, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"default-collation", 0, "Set the default collation (deprecated option, use --collation-server instead).", - (uchar**) &default_collation_name, (uchar**) &default_collation_name, - 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, /* default-storage-engine should have "MyISAM" as def_value. Instead of initializing it here it is done in init_common_variables() due to a compiler bug in Sun Studio compiler. */ @@ -6101,9 +6095,6 @@ struct my_option my_long_options[]= {"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.", (uchar**) &myisam_log_filename, (uchar**) &myisam_log_filename, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, - {"log-long-format", '0', - "Log some extra information to update log. Please note that this option is deprecated; see --log-short-format option.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-short-format", 0, "Don't log extra information to update and slow-query logs.", (uchar**) &opt_short_log_format, (uchar**) &opt_short_log_format, @@ -6204,11 +6195,6 @@ Can't be set to 1 if --log-slave-updates is used.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"safe-mode", OPT_SAFE, "Skip some optimize stages (for testing).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifndef TO_BE_DELETED - {"safe-show-database", 0, - "Deprecated option; use GRANT SHOW DATABASES instead...", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif {"safe-user-create", 0, "Don't allow new user creation by the user who has no write privileges to the mysql.user table.", (uchar**) &opt_safe_user_create, (uchar**) &opt_safe_user_create, 0, GET_BOOL, @@ -6221,9 +6207,6 @@ Can't be set to 1 if --log-slave-updates is used.", (uchar**)&sf_malloc_mem_limit, (uchar**)&sf_malloc_mem_limit, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"set-variable", 'O', - "Change the value of a variable. Please note that this option is deprecated;you can set variables directly with --variable-name=value.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"show-slave-auth-info", 0, "Show user and password in SHOW SLAVE HOSTS on this master", (uchar**) &opt_show_slave_auth_info, (uchar**) &opt_show_slave_auth_info, 0, diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 8ed5bef2046..50bd40325a0 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -5018,10 +5018,8 @@ ER_UNKNOWN_STORAGE_ENGINE 42000 ger "Unbekannte Speicher-Engine '%s'" por "Motor de tabela desconhecido '%s'" spa "Desconocido motor de tabla '%s'" -# When using this error code, use ER(ER_WARN_DEPRECATED_SYNTAX_WITH_VER) -# for the message string. See, for example, code in mysql_priv.h. ER_WARN_DEPRECATED_SYNTAX - eng "'%s' is deprecated; use '%s' instead" + eng "'%s' is deprecated and will be removed in a future release. Please use %s instead" ger "'%s' ist veraltet. Bitte benutzen Sie '%s'" por "'%s' é desatualizado. Use '%s' em seu lugar" spa "'%s' está desaprobado, use '%s' en su lugar" diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 0b0ca2e6215..f88c364b22c 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -967,7 +967,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token FOREIGN /* SQL-2003-R */ %token FOR_SYM /* SQL-2003-R */ %token FOUND_SYM /* SQL-2003-R */ -%token FRAC_SECOND_SYM %token FROM %token FULL /* SQL-2003-R */ %token FULLTEXT_SYM @@ -1493,8 +1492,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %type date_time_type; %type interval -%type interval_time_st - %type interval_time_stamp %type storage_engines known_storage_engines @@ -9487,7 +9484,7 @@ using_list: ; interval: - interval_time_st {} + interval_time_stamp {} | DAY_HOUR_SYM { $$=INTERVAL_DAY_HOUR; } | DAY_MICROSECOND_SYM { $$=INTERVAL_DAY_MICROSECOND; } | DAY_MINUTE_SYM { $$=INTERVAL_DAY_MINUTE; } @@ -9502,27 +9499,6 @@ interval: ; interval_time_stamp: - interval_time_st {} - | FRAC_SECOND_SYM - { - $$=INTERVAL_MICROSECOND; - /* - FRAC_SECOND was mistakenly implemented with - a wrong resolution. According to the ODBC - standard it should be nanoseconds, not - microseconds. Changing it to nanoseconds - in MySQL would mean making TIMESTAMPDIFF - and TIMESTAMPADD to return DECIMAL, since - the return value would be too big for BIGINT - Hence we just deprecate the incorrect - implementation without changing its - resolution. - */ - WARN_DEPRECATED(yythd, 6, 2, "FRAC_SECOND", "MICROSECOND"); - } - ; - -interval_time_st: DAY_SYM { $$=INTERVAL_DAY; } | WEEK_SYM { $$=INTERVAL_WEEK; } | HOUR_SYM { $$=INTERVAL_HOUR; } @@ -12258,7 +12234,6 @@ keyword_sp: | FILE_SYM {} | FIRST_SYM {} | FIXED_SYM {} - | FRAC_SECOND_SYM {} | GEOMETRY_SYM {} | GEOMETRYCOLLECTION {} | GET_FORMAT {} diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index eef403e1a86..8f71d27e8d4 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2203,30 +2203,6 @@ static Sys_var_bit Sys_log_binlog( DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super), ON_UPDATE(fix_sql_log_bin)); -static bool deprecated_log_update(sys_var *self, THD *thd, set_var *var) -{ - /* - The update log is not supported anymore since 5.0. - See sql/mysqld.cc/, comments in function init_server_components() for an - explaination of the different warnings we send below - */ - - if (opt_sql_bin_update) - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, - ER_UPDATE_LOG_DEPRECATED_TRANSLATED, - ER(ER_UPDATE_LOG_DEPRECATED_TRANSLATED)); - else - push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, - ER_UPDATE_LOG_DEPRECATED_IGNORED, - ER(ER_UPDATE_LOG_DEPRECATED_IGNORED)); - return check_has_super(self, thd, var); -} -static Sys_var_bit Sys_log_update( - "sql_log_update", "alias for sql_log_bin", - SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_BIN_LOG, - DEFAULT(TRUE), NO_MUTEX_GUARD, NOT_IN_BINLOG, - ON_CHECK(deprecated_log_update), ON_UPDATE(fix_sql_log_bin)); - static Sys_var_bit Sys_sql_warnings( "sql_warnings", "sql_warnings", SESSION_VAR(option_bits), NO_CMD_LINE, OPTION_WARNINGS, -- cgit v1.2.1 From 68b5c12d76ca0d0cdfd86b629dd3e604f377879a Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Wed, 17 Feb 2010 13:15:07 +0100 Subject: WL#5182 Remove more deprecated 4.1/5.0 features WL#5154 was a task for formally deprecating and removing items that were mentioned in the manual as having been deprecated since MySQL 4.1 or 5.0, but that had never been removed. Since WL#5154 was created, examination of mysqld.cc, mysql.cc, and mysqldump.c reveals additional deprecations not mentioned in the manual. (In some cases, the items are simply not mentioned in the 5.1+ manuals.) This is a follow-on task to deprecate and remove these additional items. The deprecation happened in MySQL 5.1, and the options/variables are now removed from the code. client/mysql.cc: --no-tee is now removed client/mysqldump.c: --all is now removed -a now points to --create-options sql/mysqld.cc: delay-key-write-for-all-tables is removed --enable-locking is removed --log-update is removed --skip-locking is removed --skip-symlink is removed --sql-bin-update-same is removed --warnings is removed --record-buffer is removed --- sql/mysql_priv.h | 4 ---- sql/mysqld.cc | 56 ++------------------------------------------------------ 2 files changed, 2 insertions(+), 58 deletions(-) (limited to 'sql') diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 7ef8517ad13..477b443ff88 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2629,7 +2629,6 @@ enum options_mysqld OPT_BOOTSTRAP, OPT_CONSOLE, OPT_DEBUG_SYNC_TIMEOUT, - OPT_DELAY_KEY_WRITE_ALL, OPT_ISAM_LOG, OPT_KEY_BUFFER_SIZE, OPT_KEY_CACHE_AGE_THRESHOLD, @@ -2648,19 +2647,16 @@ enum options_mysqld OPT_SAFE, OPT_SERVER_ID, OPT_SKIP_HOST_CACHE, - OPT_SKIP_LOCK, OPT_SKIP_NEW, OPT_SKIP_PRIOR, OPT_SKIP_RESOLVE, OPT_SKIP_STACK_TRACE, - OPT_SKIP_SYMLINKS, OPT_SLOW_QUERY_LOG, OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_CERT, OPT_SSL_CIPHER, OPT_SSL_KEY, - OPT_UPDATE_LOG, OPT_WANT_CORE, OPT_ENGINE_CONDITION_PUSHDOWN }; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7b59a8a61ef..39c94d4f261 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4007,21 +4007,13 @@ static int init_server_components() Implementation of the above : - If mysqld is started with --log-update and --log-bin, ignore --log-update (print a warning), push a warning when SQL_LOG_UPDATE - is used, and turn off --sql-bin-update-same. + is used, This will completely ignore SQL_LOG_UPDATE - If mysqld is started with --log-update only, change it to --log-bin (with the filename passed to log-update, plus '-bin') (print a warning), push a warning when SQL_LOG_UPDATE is - used, and turn on --sql-bin-update-same. + used. This will translate SQL_LOG_UPDATE to SQL_LOG_BIN. - - Note that we tell the user that --sql-bin-update-same is deprecated and - does nothing, and we don't take into account if he used this option or - not; but internally we give this variable a value to have the behaviour - we want (i.e. have SQL_LOG_UPDATE influence SQL_LOG_BIN or not). - As sql-bin-update-same, log-update and log-bin cannot be changed by the - user after starting the server (they are not variables), the user will - not later interfere with the settings we do here. */ if (opt_bin_log) { @@ -6023,9 +6015,6 @@ struct my_option my_long_options[]= {"default-time-zone", 0, "Set the default time zone.", (uchar**) &default_tz_name, (uchar**) &default_tz_name, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, - {"delay-key-write-for-all-tables", OPT_DELAY_KEY_WRITE_ALL, - "Don't flush key buffers between writes for any MyISAM table (Deprecated option, use --delay-key-write=all instead).", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_OPENSSL {"des-key-file", 0, "Load keys for des_encrypt() and des_encrypt from given file.", @@ -6039,10 +6028,6 @@ struct my_option my_long_options[]= (uchar**) &disconnect_slave_event_count, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"enable-locking", 0, - "Deprecated option, use --external-locking instead.", - (uchar**) &opt_external_locking, (uchar**) &opt_external_locking, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_STACK_TRACE_ON_SEGV {"enable-pstack", 0, "Print a symbolic stack trace on failure.", (uchar**) &opt_do_pstack, (uchar**) &opt_do_pstack, 0, GET_BOOL, NO_ARG, 0, 0, @@ -6127,11 +6112,6 @@ struct my_option my_long_options[]= REQUIRED_ARG, TC_LOG_MIN_SIZE, TC_LOG_MIN_SIZE, ULONG_MAX, 0, TC_LOG_PAGE_SIZE, 0}, #endif - {"log-update", OPT_UPDATE_LOG, - "The update log is deprecated since version 5.0, is replaced by the binary \ -log and this option justs turns on --log-bin instead.", - (uchar**) &opt_update_logname, (uchar**) &opt_update_logname, 0, GET_STR, - OPT_ARG, 0, 0, 0, 0, 0, 0}, {"master-info-file", 0, "The location and name of the file that remembers the master and where the I/O replication \ thread is in the master's binlogs.", @@ -6219,9 +6199,6 @@ Can't be set to 1 if --log-slave-updates is used.", #endif {"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-locking", OPT_SKIP_LOCK, - "Deprecated option, use --skip-external-locking instead.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-name-resolve", OPT_SKIP_RESOLVE, "Don't resolve hostnames. All hostnames are IP's or 'localhost'.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -6233,8 +6210,6 @@ Can't be set to 1 if --log-slave-updates is used.", {"skip-stack-trace", OPT_SKIP_STACK_TRACE, "Don't print a stack trace on failure.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-symlink", OPT_SKIP_SYMLINKS, "Don't allow symlinking of tables. Deprecated option. Use --skip-symbolic-links instead.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"skip-thread-priority", OPT_SKIP_PRIOR, "Don't give threads different priorities. This option is deprecated " "because it has no effect; the implied behavior is already the default.", @@ -6246,10 +6221,6 @@ Can't be set to 1 if --log-slave-updates is used.", (uchar**) &opt_sporadic_binlog_dump_fail, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif /* HAVE_REPLICATION */ - {"sql-bin-update-same", 0, - "The update log is deprecated since version 5.0, is replaced by the " - "binary log and this option does nothing anymore.", - 0, 0, 0, GET_DISABLED, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef HAVE_OPENSSL {"ssl", 0, "Enable SSL for connection (automatically enabled with other flags).", @@ -6308,20 +6279,12 @@ Can't be set to 1 if --log-slave-updates is used.", 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"warnings", 'W', "Deprecated; use --log-warnings instead.", - (uchar**) &global_system_variables.log_warnings, - (uchar**) &max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, - 1, 0, ULONG_MAX, 0, 0, 0}, {"plugin-load", 0, "Optional semicolon-separated list of plugins to load, where each plugin is " "identified as name=library, where name is the plugin name and library " "is the plugin library in plugin_dir.", (uchar**) &opt_plugin_load, (uchar**) &opt_plugin_load, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"record_buffer", 0, "Deprecated; use --read-buffer-size instead.", - (uchar**) &global_system_variables.read_buff_size, - (uchar**) &max_system_variables.read_buff_size,0, GET_ULONG, REQUIRED_ARG, - 128*1024L, IO_SIZE*2, INT_MAX32, 0, IO_SIZE, 0}, {"table_cache", 0, "Deprecated; use --table-open-cache instead.", (uchar**) &table_cache_size, (uchar**) &table_cache_size, 0, GET_ULONG, REQUIRED_ARG, TABLE_OPEN_CACHE_DEFAULT, 1, 512*1024L, 0, 1, 0}, @@ -7235,9 +7198,6 @@ mysqld_get_one_option(int optid, case (int) OPT_ISAM_LOG: opt_myisam_log=1; break; - case (int) OPT_UPDATE_LOG: - opt_update_log=1; - break; case (int) OPT_BIN_LOG: opt_bin_log= test(argument != disabled_my_option); break; @@ -7358,9 +7318,6 @@ mysqld_get_one_option(int optid, "and will be removed in MySQL 7.0. This option has no effect " "as the implied behavior is already the default."); break; - case (int) OPT_SKIP_LOCK: - opt_external_locking=0; - break; case (int) OPT_SKIP_HOST_CACHE: opt_specialflag|= SPECIAL_NO_HOST_CACHE; break; @@ -7373,9 +7330,6 @@ mysqld_get_one_option(int optid, case (int) OPT_SKIP_STACK_TRACE: test_flags|=TEST_NO_STACKTRACE; break; - case (int) OPT_SKIP_SYMLINKS: - my_use_symdir=0; - break; case (int) OPT_BIND_ADDRESS: { struct addrinfo *res_lst, hints; @@ -7408,12 +7362,6 @@ mysqld_get_one_option(int optid, case OPT_SERVER_ID: server_id_supplied = 1; break; - case OPT_DELAY_KEY_WRITE_ALL: - if (argument != disabled_my_option) - delay_key_write_options= DELAY_KEY_WRITE_ALL; - else - delay_key_write_options= DELAY_KEY_WRITE_NONE; - break; case OPT_ONE_THREAD: thread_handling= SCHEDULER_ONE_THREAD_PER_CONNECTION; break; -- cgit v1.2.1 From df460f4e43329fd37962fd6ff6ca2cfa1121b2c8 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 17 Feb 2010 14:19:17 +0400 Subject: Bug#38959 archive_gis fails due to rounding difference Multi_polygon::centroid() has an error in the implementation per-file messages: sql/spatial.cc Bug#38959 archive_gis fails due to rounding difference multi_polygon::centroid() implementation fixed --- sql/spatial.cc | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'sql') diff --git a/sql/spatial.cc b/sql/spatial.cc index 671b8544b8a..9a31b099e92 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -1612,9 +1612,8 @@ int Gis_multi_polygon::area(double *ar, const char **end_of_data) const int Gis_multi_polygon::centroid(String *result) const { uint32 n_polygons; - bool first_loop= 1; Gis_polygon p; - double UNINIT_VAR(res_area), UNINIT_VAR(res_cx), UNINIT_VAR(res_cy); + double res_area= 0.0, res_cx= 0.0, res_cy= 0.0; double cur_area, cur_cx, cur_cy; const char *data= m_data; @@ -1631,20 +1630,13 @@ int Gis_multi_polygon::centroid(String *result) const p.centroid_xy(&cur_cx, &cur_cy)) return 1; - if (!first_loop) - { - double sum_area= res_area + cur_area; - res_cx= (res_area * res_cx + cur_area * cur_cx) / sum_area; - res_cy= (res_area * res_cy + cur_area * cur_cy) / sum_area; - } - else - { - first_loop= 0; - res_area= cur_area; - res_cx= cur_cx; - res_cy= cur_cy; - } + res_area+= cur_area; + res_cx+= cur_area * cur_cx; + res_cy+= cur_area * cur_cy; } + + res_cx/= res_area; + res_cy/= res_area; return create_point(result, res_cx, res_cy); } -- cgit v1.2.1 From d1ad316a59b6bd48dec94433ffe982ddfc376e35 Mon Sep 17 00:00:00 2001 From: Alexander Nozdrin Date: Sat, 20 Feb 2010 13:07:32 +0300 Subject: Patch for WL#3736: Extended Table, Column and Index Comments. The task is to (a) add a comment on indexes and (b) increase the maximum length of column, table and the new index comments. The patch committed on behalf of Yoshinori Matsunobu (Yoshinori.Matsunobu@Sun.COM). --- sql/handler.h | 1 + sql/mysql_priv.h | 3 +- sql/share/errmsg-utf8.txt | 2 + sql/sql_show.cc | 22 ++++++-- sql/sql_table.cc | 51 ++++++++++++++++++ sql/sql_yacc.yy | 1 + sql/structs.h | 1 + sql/table.cc | 88 ++++++++++++++++++++++++------- sql/unireg.cc | 129 +++++++++++++++++++++++++++++++--------------- 9 files changed, 234 insertions(+), 64 deletions(-) (limited to 'sql') diff --git a/sql/handler.h b/sql/handler.h index a9b81d8373f..1734e5727dc 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1011,6 +1011,7 @@ typedef struct st_key_create_information enum ha_key_alg algorithm; ulong block_size; LEX_STRING parser_name; + LEX_STRING comment; } KEY_CREATE_INFO; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index b27a7ea5078..22217f1b405 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -2317,7 +2317,7 @@ ulong next_io_size(ulong pos); void append_unescaped(String *res, const char *pos, uint length); int create_frm(THD *thd, const char *name, const char *db, const char *table, uint reclength, uchar *fileinfo, - HA_CREATE_INFO *create_info, uint keys); + HA_CREATE_INFO *create_info, uint keys, KEY *key_info); void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); int rename_file_ext(const char * from,const char * to,const char * ext); bool check_db_name(LEX_STRING *db); @@ -2327,6 +2327,7 @@ char *get_field(MEM_ROOT *mem, Field *field); bool get_field(MEM_ROOT *mem, Field *field, class String *res); int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr); char *fn_rext(char *name); +bool check_duplicate_warning(THD *thd, char *msg, ulong length); /* Conversion functions */ #endif /* MYSQL_SERVER */ diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index a49aab0a9ab..40b842c813e 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6321,3 +6321,5 @@ ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT ER_SPATIAL_MUST_HAVE_GEOM_COL 42000 eng "A SPATIAL index may only contain a geometrical type column" +ER_TOO_LONG_INDEX_COMMENT + eng "Comment for index '%-.64s' is too long (max = %lu)" diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 2e1827f9a35..8b8e223ad02 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1375,7 +1375,6 @@ int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, end= longlong10_to_str(create_info.auto_increment_value, buff,10); packet->append(buff, (uint) (end - buff)); } - if (share->table_charset && !(thd->variables.sql_mode & MODE_MYSQL323) && @@ -1520,6 +1519,14 @@ static void store_key_options(THD *thd, String *packet, TABLE *table, end= longlong10_to_str(key_info->block_size, buff, 10); packet->append(buff, (uint) (end - buff)); } + DBUG_ASSERT(test(key_info->flags & HA_USES_COMMENT) == + (key_info->comment.length > 0)); + if (key_info->flags & HA_USES_COMMENT) + { + packet->append(STRING_WITH_LEN(" COMMENT ")); + append_unescaped(packet, key_info->comment.str, + key_info->comment.length); + } } } @@ -4767,6 +4774,11 @@ static int get_schema_stat_record(THD *thd, TABLE_LIST *tables, else table->field[14]->store("", 0, cs); table->field[14]->set_notnull(); + DBUG_ASSERT(test(key_info->flags & HA_USES_COMMENT) == + (key_info->comment.length > 0)); + if (key_info->flags & HA_USES_COMMENT) + table->field[15]->store(key_info->comment.str, + key_info->comment.length, cs); if (schema_table_store_record(thd, table)) DBUG_RETURN(1); } @@ -6725,7 +6737,8 @@ ST_FIELD_INFO tables_fields_info[]= (MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", OPEN_FULL_TABLE}, {"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options", OPEN_FRM_ONLY}, - {"TABLE_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY}, + {"TABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, + "Comment", OPEN_FRM_ONLY}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; @@ -6759,7 +6772,8 @@ ST_FIELD_INFO columns_fields_info[]= {"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY}, {"EXTRA", 27, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY}, {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY}, - {"COLUMN_COMMENT", 255, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY}, + {"COLUMN_COMMENT", COLUMN_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, + "Comment", OPEN_FRM_ONLY}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; @@ -6917,6 +6931,8 @@ ST_FIELD_INFO stat_fields_info[]= {"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY}, {"INDEX_TYPE", 16, MYSQL_TYPE_STRING, 0, 0, "Index_type", OPEN_FULL_TABLE}, {"COMMENT", 16, MYSQL_TYPE_STRING, 0, 1, "Comment", OPEN_FRM_ONLY}, + {"INDEX_COMMENT", INDEX_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0, + "Index_comment", OPEN_FRM_ONLY}, {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE} }; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2e057d6a731..9acbc37fd9a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2646,6 +2646,21 @@ CHARSET_INFO* get_sql_field_charset(Create_field *sql_field, } +bool check_duplicate_warning(THD *thd, char *msg, ulong length) +{ + List_iterator_fast it(thd->warning_info->warn_list()); + MYSQL_ERROR *err; + while ((err= it++)) + { + if (strncmp(msg, err->get_message_text(), length) == 0) + { + return true; + } + } + return false; +} + + /* Preparation for table creation @@ -3486,6 +3501,40 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, my_error(ER_TOO_LONG_KEY,MYF(0),max_key_length); DBUG_RETURN(TRUE); } + + uint tmp_len= system_charset_info->cset->charpos(system_charset_info, + key->key_create_info.comment.str, + key->key_create_info.comment.str + + key->key_create_info.comment.length, + INDEX_COMMENT_MAXLEN); + + if (tmp_len < key->key_create_info.comment.length) + { + if ((thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) + { + my_error(ER_TOO_LONG_INDEX_COMMENT, MYF(0), + key_info->name, (uint) INDEX_COMMENT_MAXLEN); + DBUG_RETURN(-1); + } + char warn_buff[MYSQL_ERRMSG_SIZE]; + my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_INDEX_COMMENT), + key_info->name, (uint) INDEX_COMMENT_MAXLEN); + /* do not push duplicate warnings */ + if (!check_duplicate_warning(thd, warn_buff, strlen(warn_buff))) + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TOO_LONG_INDEX_COMMENT, warn_buff); + + key->key_create_info.comment.length= tmp_len; + } + + key_info->comment.length= key->key_create_info.comment.length; + if (key_info->comment.length > 0) + { + key_info->flags|= HA_USES_COMMENT; + key_info->comment.str= key->key_create_info.comment.str; + } + key_info++; } if (!unique_key && !primary_key && @@ -6196,6 +6245,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, key_create_info.block_size= key_info->block_size; if (key_info->flags & HA_USES_PARSER) key_create_info.parser_name= *plugin_name(key_info->parser); + if (key_info->flags & HA_USES_COMMENT) + key_create_info.comment= key_info->comment; if (key_info->flags & HA_SPATIAL) key_type= Key::SPATIAL; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 34361ab3f99..61f3d3b50ee 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6063,6 +6063,7 @@ key_using_alg: all_key_opt: KEY_BLOCK_SIZE opt_equal ulong_num { Lex->key_create_info.block_size= $3; } + | COMMENT_SYM TEXT_STRING_sys { Lex->key_create_info.comment= $2; } ; normal_key_opt: diff --git a/sql/structs.h b/sql/structs.h index 041a6809804..6d2cf54d693 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -102,6 +102,7 @@ typedef struct st_key { int bdb_return_if_eq; } handler; TABLE *table; + LEX_STRING comment; } KEY; diff --git a/sql/table.cc b/sql/table.cc index 514ea865e8c..0e66ff9da94 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -517,7 +517,7 @@ int open_table_def(THD *thd, TABLE_SHARE *share, uint db_flags) int error, table_type; bool error_given; File file; - uchar head[288], *disk_buff; + uchar head[64], *disk_buff; char path[FN_REFLEN]; MEM_ROOT **root_ptr, *old_root; DBUG_ENTER("open_table_def"); @@ -660,6 +660,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, uint i,j; bool use_hash; char *keynames, *names, *comment_pos; + uchar forminfo[288]; uchar *record; uchar *disk_buff, *strpos, *null_flags, *null_pos; ulong pos, record_offset, *rec_per_key, rec_buff_length; @@ -682,6 +683,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, if (!(pos=get_form_pos(file,head,(TYPELIB*) 0))) goto err; /* purecov: inspected */ + mysql_file_seek(file,pos,MY_SEEK_SET,MYF(0)); + if (mysql_file_read(file, forminfo,288,MYF(MY_NABP))) + goto err; share->frm_version= head[2]; /* Check if .frm file created by MySQL 5.0. In this case we want to @@ -827,6 +831,20 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, keynames=(char*) key_part; strpos+= (strmov(keynames, (char *) strpos) - keynames)+1; + //reading index comments + for (keyinfo= share->key_info, i=0; i < keys; i++, keyinfo++) + { + if (keyinfo->flags & HA_USES_COMMENT) + { + keyinfo->comment.length= uint2korr(strpos); + keyinfo->comment.str= strmake_root(&share->mem_root, (char*) strpos+2, + keyinfo->comment.length); + strpos+= 2 + keyinfo->comment.length; + } + DBUG_ASSERT(test(keyinfo->flags & HA_USES_COMMENT) == + (keyinfo->comment.length > 0)); + } + share->reclength = uint2korr((head+16)); if (*(head+26) == 1) share->system= 1; /* one-record-database */ @@ -1007,6 +1025,25 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, } } } + if (forminfo[46] == (uchar)255) + { + //reading long table comment + if (next_chunk + 2 > buff_end) + { + DBUG_PRINT("error", + ("long table comment is not defined in .frm")); + my_free(buff, MYF(0)); + goto err; + } + share->comment.length = uint2korr(next_chunk); + if (! (share->comment.str= strmake_root(&share->mem_root, + (char*)next_chunk + 2, share->comment.length))) + { + my_free(buff, MYF(0)); + goto err; + } + next_chunk+= 2 + share->comment.length; + } my_free(buff, MYF(0)); } share->key_block_size= uint2korr(head+62); @@ -1023,29 +1060,30 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head, record_offset, MYF(MY_NABP))) goto err; /* purecov: inspected */ - mysql_file_seek(file, pos, MY_SEEK_SET, MYF(0)); - if (mysql_file_read(file, head, 288, MYF(MY_NABP))) - goto err; + mysql_file_seek(file, pos+288, MY_SEEK_SET, MYF(0)); #ifdef HAVE_CRYPTED_FRM if (crypted) { - crypted->decode((char*) head+256,288-256); - if (sint2korr(head+284) != 0) // Should be 0 + crypted->decode((char*) forminfo+256,288-256); + if (sint2korr(forminfo+284) != 0) // Should be 0 goto err; // Wrong password } #endif - share->fields= uint2korr(head+258); - pos= uint2korr(head+260); /* Length of all screens */ - n_length= uint2korr(head+268); - interval_count= uint2korr(head+270); - interval_parts= uint2korr(head+272); - int_length= uint2korr(head+274); - share->null_fields= uint2korr(head+282); - com_length= uint2korr(head+284); - share->comment.length= (int) (head[46]); - share->comment.str= strmake_root(&share->mem_root, (char*) head+47, - share->comment.length); + share->fields= uint2korr(forminfo+258); + pos= uint2korr(forminfo+260); /* Length of all screens */ + n_length= uint2korr(forminfo+268); + interval_count= uint2korr(forminfo+270); + interval_parts= uint2korr(forminfo+272); + int_length= uint2korr(forminfo+274); + share->null_fields= uint2korr(forminfo+282); + com_length= uint2korr(forminfo+284); + if (forminfo[46] != (uchar)255) + { + share->comment.length= (int) (forminfo[46]); + share->comment.str= strmake_root(&share->mem_root, (char*) forminfo+47, + share->comment.length); + } DBUG_PRINT("info",("i_count: %d i_parts: %d index: %d n_length: %d int_length: %d com_length: %d", interval_count,interval_parts, share->keys,n_length,int_length, com_length)); @@ -2437,12 +2475,14 @@ void append_unescaped(String *res, const char *pos, uint length) File create_frm(THD *thd, const char *name, const char *db, const char *table, uint reclength, uchar *fileinfo, - HA_CREATE_INFO *create_info, uint keys) + HA_CREATE_INFO *create_info, uint keys, KEY *key_info) { register File file; ulong length; uchar fill[IO_SIZE]; int create_flags= O_RDWR | O_TRUNC; + ulong key_comment_total_bytes= 0; + uint i; if (create_info->options & HA_LEX_CREATE_TMP_TABLE) create_flags|= O_EXCL | O_NOFOLLOW; @@ -2479,7 +2519,17 @@ File create_frm(THD *thd, const char *name, const char *db, 1 byte for the NAMES_SEP_CHAR (after the last name) 9 extra bytes (padding for safety? alignment?) */ - key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16; + for (i= 0; i < keys; i++) + { + DBUG_ASSERT(test(key_info[i].flags & HA_USES_COMMENT) == + (key_info[i].comment.length > 0)); + if (key_info[i].flags & HA_USES_COMMENT) + key_comment_total_bytes += 2 + key_info[i].comment.length; + } + + key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16 + + key_comment_total_bytes; + length= next_io_size((ulong) (IO_SIZE+key_length+reclength+ create_info->extra_size)); int4store(fileinfo+10,length); diff --git a/sql/unireg.cc b/sql/unireg.cc index b20e759efbb..c7d2f2f5b5b 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -188,27 +188,6 @@ bool mysql_create_frm(THD *thd, const char *file_name, if (key_info[i].parser_name) create_info->extra_size+= key_info[i].parser_name->length + 1; } - - if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo, - create_info, keys)) < 0) - { - my_free(screen_buff, MYF(0)); - DBUG_RETURN(1); - } - - key_buff_length= uint4korr(fileinfo+47); - keybuff=(uchar*) my_malloc(key_buff_length, MYF(0)); - key_info_length= pack_keys(keybuff, keys, key_info, data_offset); - (void) get_form_pos(file,fileinfo,&formnames); - if (!(filepos=make_new_entry(file,fileinfo,&formnames,""))) - goto err; - maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000)); - int2store(forminfo+2,maxlength); - int4store(fileinfo+10,(ulong) (filepos+maxlength)); - fileinfo[26]= (uchar) test((create_info->max_rows == 1) && - (create_info->min_rows == 1) && (keys == 0)); - int2store(fileinfo+28,key_info_length); - /* This gives us the byte-position of the character at (character-position, not byte-position) TABLE_COMMENT_MAXLEN. @@ -222,33 +201,78 @@ bool mysql_create_frm(THD *thd, const char *file_name, string), the string is too long. For additional credit, realise that UTF-8 has 1-3 bytes before 6.0, - and 1-4 bytes in 6.0 (6.0 also has UTF-32). This means that the - inlined COMMENT supposedly does not exceed 60 character plus - terminator, vulgo, 181 bytes. + and 1-4 bytes in 6.0 (6.0 also has UTF-32). */ - tmp_len= system_charset_info->cset->charpos(system_charset_info, create_info->comment.str, create_info->comment.str + - create_info->comment.length, 60); + create_info->comment.length, + TABLE_COMMENT_MAXLEN); + if (tmp_len < create_info->comment.length) { + char *real_table_name= (char*) table; + List_iterator it(create_fields); + Create_field *field; + while ((field=it++)) + { + if (field->field && field->field->table && + (real_table_name= field->field->table->s->table_name.str)) + break; + } if ((thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) { - my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), table, tmp_len); - goto err; + my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), + real_table_name, (uint) TABLE_COMMENT_MAXLEN); + my_free(screen_buff,MYF(0)); + DBUG_RETURN(1); } - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TOO_LONG_TABLE_COMMENT, - ER(ER_TOO_LONG_TABLE_COMMENT), - table, tmp_len); + char warn_buff[MYSQL_ERRMSG_SIZE]; + my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_TABLE_COMMENT), + real_table_name, (uint) TABLE_COMMENT_MAXLEN); + /* do not push duplicate warnings */ + if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff))) + push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TOO_LONG_TABLE_COMMENT, warn_buff); create_info->comment.length= tmp_len; } + /* + If table comment is longer than TABLE_COMMENT_INLINE_MAXLEN bytes, + store the comment in an extra segment (up to TABLE_COMMENT_MAXLEN bytes). + Pre 6.0, the limit was 60 characters, with no extra segment-handling. + */ + if (create_info->comment.length > TABLE_COMMENT_INLINE_MAXLEN) + { + forminfo[46]=255; + create_info->extra_size+= 2 + create_info->comment.length; + } + else{ + strmake((char*) forminfo+47, create_info->comment.str ? + create_info->comment.str : "", create_info->comment.length); + forminfo[46]=(uchar) create_info->comment.length; + } + + if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo, + create_info, keys, key_info)) < 0) + { + my_free(screen_buff, MYF(0)); + DBUG_RETURN(1); + } + + key_buff_length= uint4korr(fileinfo+47); + keybuff=(uchar*) my_malloc(key_buff_length, MYF(0)); + key_info_length= pack_keys(keybuff, keys, key_info, data_offset); + (void) get_form_pos(file,fileinfo,&formnames); + if (!(filepos=make_new_entry(file,fileinfo,&formnames,""))) + goto err; + maxlength=(uint) next_io_size((ulong) (uint2korr(forminfo)+1000)); + int2store(forminfo+2,maxlength); + int4store(fileinfo+10,(ulong) (filepos+maxlength)); + fileinfo[26]= (uchar) test((create_info->max_rows == 1) && + (create_info->min_rows == 1) && (keys == 0)); + int2store(fileinfo+28,key_info_length); - strmake((char*) forminfo+47, create_info->comment.str ? - create_info->comment.str : "", create_info->comment.length); - forminfo[46]=(uchar) create_info->comment.length; #ifdef WITH_PARTITION_STORAGE_ENGINE if (part_info) { @@ -309,6 +333,15 @@ bool mysql_create_frm(THD *thd, const char *file_name, goto err; } } + if (forminfo[46] == (uchar)255) + { + uchar comment_length_buff[2]; + int2store(comment_length_buff,create_info->comment.length); + if (mysql_file_write(file, comment_length_buff, 2, MYF(MY_NABP)) || + mysql_file_write(file, (uchar*) create_info->comment.str, + create_info->comment.length, MYF(MY_NABP))) + goto err; + } mysql_file_seek(file, filepos, MY_SEEK_SET, MYF(0)); if (mysql_file_write(file, forminfo, 288, MYF_RW) || @@ -561,6 +594,16 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo, pos=tmp; } *(pos++)=0; + for (key=keyinfo,end=keyinfo+key_count ; key != end ; key++) + { + if (key->flags & HA_USES_COMMENT) + { + int2store(pos, key->comment.length); + uchar *tmp= (uchar*)strnmov((char*) pos+2,key->comment.str, + key->comment.length); + pos= tmp; + } + } if (key_count > 127 || key_parts > 127) { @@ -614,19 +657,23 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type, field->comment.str, field->comment.str + field->comment.length, - 255); + COLUMN_COMMENT_MAXLEN); if (tmp_len < field->comment.length) { if ((current_thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) { - my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name, tmp_len); + my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), + field->field_name, (uint) COLUMN_COMMENT_MAXLEN); DBUG_RETURN(1); } - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_TOO_LONG_FIELD_COMMENT, - ER(ER_TOO_LONG_FIELD_COMMENT), - field->field_name, tmp_len); + char warn_buff[MYSQL_ERRMSG_SIZE]; + my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_FIELD_COMMENT), + field->field_name, (uint) COLUMN_COMMENT_MAXLEN); + /* do not push duplicate warnings */ + if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff))) + push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TOO_LONG_FIELD_COMMENT, warn_buff); field->comment.length= tmp_len; } -- cgit v1.2.1 From 740c7cf4fa29ccfce60f6c30dc8a14bd302cfed2 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 20 Feb 2010 20:40:03 +0100 Subject: Install static client and embedded debug libraries --- sql/CMakeLists.txt | 39 ++------------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 1da41e53b92..28a9d321455 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -156,6 +156,7 @@ IF(WITH_MYSQLD_LDFLAGS) SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}") ENDIF() +INSTALL_DEBUG_TARGET(mysqld DESTINATION ${INSTALL_SBINDIR} RENAME mysqld-debug) # Handle out-of-source build from source package with possibly broken # bison. Copy bison output to from source to build directory, if not already @@ -189,7 +190,7 @@ ADD_CUSTOM_COMMAND( ${CMAKE_COMMAND} -E copy_if_different lex_hash.h.tmp lex_hash.h COMMAND ${CMAKE_COMMAND} -E remove -f lex_hash.h.tmp WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS gen_lex_hash) + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gen_lex_hash.cc) ADD_CUSTOM_TARGET( GenServerSource @@ -275,39 +276,3 @@ ELSE() ENDIF() ENDIF() -# Optionally install mysqld from debug build run. outside of the current build dir -# (unless multi-config generator is used# like Visual Studio or Xcode). -# For Makefile generators we default Debug build directory to ${buildroot}/../debug. - -GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH) -SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug build") - -IF(WIN32) - SET(EXE ".exe") -ELSE() - SET(EXE) -ENDIF() - -IF(CMAKE_GENERATOR MATCHES "Makefiles") - SET(MYSQLD_DEBUG_EXE ${DEBUGBUILDDIR}/sql/mysqld${EXE}) -ELSE() - # Visual Studio and Xcode - SET(MYSQLD_DEBUG_EXE ${CMAKE_BINARY_DIR}/sql/Debug/mysqld${EXE}) -ENDIF() - -INSTALL(FILES ${MYSQLD_DEBUG_EXE} - DESTINATION ${INSTALL_SBINDIR} - RENAME mysqld-debug${EXE} - CONFIGURATIONS Release RelWithDebInfo - OPTIONAL) - -IF(WIN32) - STRING(REPLACE ".exe" ".pdb" MYSQLD_DEBUG_PDB ${MYSQLD_DEBUG_EXE}) - INSTALL(FILES ${MYSQLD_DEBUG_PDB} - CONFIGURATIONS Release RelWithDebInfo - DESTINATION ${INSTALL_SBINDIR} - RENAME mysqld-debug.pdb - OPTIONAL) -ENDIF() - - -- cgit v1.2.1 From e210d409d92658c73fcc9eae50ba0c87d360f19e Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Mon, 22 Feb 2010 00:26:29 +0000 Subject: Post-push fix for BUG#50364. There was an erroneous parameter when calling flush_master_info from write_ignored_events_info_to_relay_log which could lead to a server crash. This happens because the I/O thread releases the log_lock before calling the flush_master_info. Set the function to call flush_master_info with third parameter to true, so that the mutex is properly taken. --- sql/slave.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/slave.cc b/sql/slave.cc index 3678c2497de..f88a961815f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1726,7 +1726,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi) " to the relay log, SHOW SLAVE STATUS may be" " inaccurate"); rli->relay_log.harvest_bytes_written(&rli->log_space_total); - if (flush_master_info(mi, TRUE, FALSE)) + if (flush_master_info(mi, TRUE, TRUE)) sql_print_error("Failed to flush master info file"); delete ev; } -- cgit v1.2.1 From e451c5023d3b264be1694f1fe85a71756eed4bb5 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 23 Feb 2010 12:48:26 +0100 Subject: Bug#43201 : Stack overrun when running sp-error test. It appears that stack overflow checks for recusrive stored procedure calls, that run in the normal server, did not work in embedded and were dummified with preprocessor magic( #ifndef EMBEDDED_SERVER ). The fix is to remove ifdefs, there is no reason not to run overflow checks and crash in deeply recursive calls. Note: Start of the stack (thd->thread_stack variable) in embedded is not necessarily exact but stil provides the best guess. Unless the caller of mysql_read_connect() is already deep in the stack, thd->thread_stack variable should approximate stack start address well. --- sql/item_cmpfunc.cc | 4 ---- sql/item_func.cc | 4 ---- sql/opt_range.cc | 2 -- sql/sql_parse.cc | 3 +-- sql/sql_select.cc | 2 -- 5 files changed, 1 insertion(+), 14 deletions(-) (limited to 'sql') diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 1da383ce3e9..ed465cbe280 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2865,9 +2865,7 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref) buff should match stack usage from Item_func_case::val_int() -> Item_func_case::find_item() */ -#ifndef EMBEDDED_LIBRARY uchar buff[MAX_FIELD_WIDTH*2+sizeof(String)*2+sizeof(String*)*2+sizeof(double)*2+sizeof(longlong)*2]; -#endif bool res= Item_func::fix_fields(thd, ref); /* Call check_stack_overrun after fix_fields to be sure that stack variable @@ -4081,9 +4079,7 @@ Item_cond::fix_fields(THD *thd, Item **ref) DBUG_ASSERT(fixed == 0); List_iterator li(list); Item *item; -#ifndef EMBEDDED_LIBRARY uchar buff[sizeof(char*)]; // Max local vars in function -#endif not_null_tables_cache= used_tables_cache= 0; const_item_cache= 1; /* diff --git a/sql/item_func.cc b/sql/item_func.cc index 75f8b2045b5..e49ee4346b1 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -151,9 +151,7 @@ Item_func::fix_fields(THD *thd, Item **ref) { DBUG_ASSERT(fixed == 0); Item **arg,**arg_end; -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; // Max argument in function -#endif used_tables_cache= not_null_tables_cache= 0; const_item_cache=1; @@ -2839,9 +2837,7 @@ bool udf_handler::fix_fields(THD *thd, Item_result_field *func, uint arg_count, Item **arguments) { -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; // Max argument in function -#endif DBUG_ENTER("Item_udf_func::fix_fields"); if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index b9ea8c7c991..68285563239 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2266,9 +2266,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, keys_to_use.intersect(head->keys_in_use_for_query); if (!keys_to_use.is_clear_all()) { -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; -#endif MEM_ROOT alloc; SEL_TREE *tree= NULL; KEY_PART *key_parts; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index b0d8614dc84..c7e1be2237b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5171,7 +5171,6 @@ bool check_global_access(THD *thd, ulong want_access) Check stack size; Send error if there isn't enough stack to continue ****************************************************************************/ -#ifndef EMBEDDED_LIBRARY #if STACK_DIRECTION < 0 #define used_stack(A,B) (long) (A - B) @@ -5209,7 +5208,7 @@ bool check_stack_overrun(THD *thd, long margin, #endif return 0; } -#endif /* EMBEDDED_LIBRARY */ + #define MY_YACC_INIT 1000 // Start with big alloc #define MY_YACC_MAX 32000 // Because of 'short' diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c37aeb39f6c..468f81a7d87 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2516,9 +2516,7 @@ static ha_rows get_quick_record_count(THD *thd, SQL_SELECT *select, { int error; DBUG_ENTER("get_quick_record_count"); -#ifndef EMBEDDED_LIBRARY // Avoid compiler warning uchar buff[STACK_BUFF_ALLOC]; -#endif if (check_stack_overrun(thd, STACK_MIN_SIZE, buff)) DBUG_RETURN(0); // Fatal error flag is set if (select) -- cgit v1.2.1