diff options
author | Alexander Barkov <bar@mariadb.org> | 2017-04-13 05:52:44 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2017-04-13 05:52:44 +0400 |
commit | 949faa2ec24999ce35c558433d5932805542e278 (patch) | |
tree | 252877067ef28138a8e29d9b582433ffb5298710 /sql | |
parent | 012fbc15cfbd34c218ae50f553d2e2e32301da01 (diff) | |
parent | eecce3d7c8a6374342ed7d0cd8844420d8957682 (diff) | |
download | mariadb-git-949faa2ec24999ce35c558433d5932805542e278.tar.gz |
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'sql')
-rw-r--r-- | sql/CMakeLists.txt | 83 | ||||
-rw-r--r-- | sql/item.cc | 12 | ||||
-rw-r--r-- | sql/log.cc | 17 | ||||
-rw-r--r-- | sql/log.h | 1 | ||||
-rw-r--r-- | sql/log_event.cc | 6 | ||||
-rw-r--r-- | sql/log_event.h | 1 | ||||
-rw-r--r-- | sql/rpl_rli.h | 2 | ||||
-rw-r--r-- | sql/sql_cte.cc | 1 | ||||
-rw-r--r-- | sql/sql_partition.cc | 3 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/wsrep_binlog.cc | 6 |
12 files changed, 77 insertions, 59 deletions
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 1dfa313a70c..c84867e1c4f 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -70,7 +70,6 @@ ENDIF() ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h COMMAND gen_lex_token > lex_token.h - DEPENDS gen_lex_token ) ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER) @@ -188,6 +187,63 @@ ELSE() SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL}) ENDIF() + +IF(MSVC AND NOT WITHOUT_DYNAMIC_PLUGINS) + + # mysqld.exe must to export symbols from some specific libs. + # These symbols are used by dynamic plugins, that "link" to mysqld. + # + # To do that, we + # + # 1. Generate mysqld_lib.def text file with all symbols from static + # libraries mysys, dbug, strings, sql. + # 2. Then we call + # lib.exe /DEF:mysqld_lib.def ... + # to create import library mysqld_lib.lib and export library mysqld_lib.exp + # 3. mysqld.exe links with mysqld_lib.exp (exporting symbols) + # 4. plugins link with mysqld_lib.lib (importing symbols) + # + # We do not not regenerate .def, .lib and .exp + # without necessity.E.g source modifications, that do not + # change list of exported symbols, will not result in a relink for plugins. + + SET(MYSQLD_DEF ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.def) + SET(MYSQLD_EXP ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.exp) + SET(MYSQLD_LIB ${CMAKE_CURRENT_BINARY_DIR}/mysqld_lib.lib) + SET(MYSQLD_CORELIBS sql mysys mysys_ssl dbug strings) + FOREACH (CORELIB ${MYSQLD_CORELIBS}) + GET_TARGET_PROPERTY(LOC ${CORELIB} LOCATION) + FILE(TO_NATIVE_PATH ${LOC} LOC) + SET (LIB_LOCATIONS ${LIB_LOCATIONS} ${LOC}) + ENDFOREACH (CORELIB) + + SET(_PLATFORM x86) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(_PLATFORM x64) + ENDIF() + + ADD_CUSTOM_COMMAND( + OUTPUT ${MYSQLD_DEF} + COMMAND cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js + ${_PLATFORM} /forLib ${LIB_LOCATIONS} > mysqld_lib.def.tmp + COMMAND ${CMAKE_COMMAND} -E copy_if_different mysqld_lib.def.tmp mysqld_lib.def + COMMAND ${CMAKE_COMMAND} -E remove mysqld_lib.def.tmp + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${MYSQLD_CORELIBS} + ) + + ADD_CUSTOM_COMMAND( + OUTPUT ${MYSQLD_LIB} + COMMAND lib + ARGS /NAME:mysqld.exe "/DEF:${MYSQLD_DEF}" "/MACHINE:${_PLATFORM}" + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS ${MYSQLD_DEF} + ) + ADD_CUSTOM_TARGET(gen_mysqld_lib DEPENDS ${MYSQLD_LIB}) + ADD_LIBRARY(mysqld_import_lib UNKNOWN IMPORTED GLOBAL) + SET_TARGET_PROPERTIES(mysqld_import_lib PROPERTIES IMPORTED_LOCATION ${MYSQLD_LIB}) +ENDIF() + MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server) IF(APPLE) @@ -208,25 +264,9 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS) 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 "${mysqld_link_flags} /DEF:mysqld.def /INCREMENTAL:NO") - - FOREACH (CORELIB sql mysys mysys_ssl 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}) - 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 - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - ADD_DEPENDENCIES(sql GenError) - ENDIF(MSVC) + SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS "${mysqld_link_flags} \"${MYSQLD_EXP}\"") + ADD_DEPENDENCIES(mysqld gen_mysqld_lib) + ENDIF() ENDIF(NOT WITHOUT_DYNAMIC_PLUGINS) SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE) @@ -300,7 +340,6 @@ ENDIF() ADD_CUSTOM_COMMAND( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h COMMAND gen_lex_hash > lex_hash.h - DEPENDS gen_lex_hash ) MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc COMPONENT Server) @@ -419,7 +458,7 @@ IF(WIN32) ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql mysql_bootstrap_sql.c WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS comp_sql ${my_bootstrap_sql} + DEPENDS ${my_bootstrap_sql} ) MYSQL_ADD_EXECUTABLE(mysql_install_db diff --git a/sql/item.cc b/sql/item.cc index fe51b2966ad..6ebea475af4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7806,18 +7806,6 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) last_checked_context->select_lex->nest_level); } } - else if (ref_type() != VIEW_REF) - { - /* - It could be that we're referring to something that's in ancestor selects. - We must make an appropriate mark_as_dependent() call for each such - outside reference. - */ - Dependency_marker dep_marker; - dep_marker.current_select= current_sel; - dep_marker.thd= thd; - (*ref)->walk(&Item::enumerate_field_refs_processor, FALSE, &dep_marker); - } DBUG_ASSERT(*ref); /* diff --git a/sql/log.cc b/sql/log.cc index 1f55b283a13..ab6d9031004 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1233,23 +1233,6 @@ void LOGGER::init_log_tables() } -bool LOGGER::flush_logs(THD *thd) -{ - /* - Now we lock logger, as nobody should be able to use logging routines while - log tables are closed - */ - logger.lock_exclusive(); - - /* reopen log files */ - file_log_handler->flush(); - - /* end of log flush */ - logger.unlock(); - return 0; -} - - /** Close and reopen the slow log (with locks). diff --git a/sql/log.h b/sql/log.h index ae8f8170a98..eaa63d4072d 100644 --- a/sql/log.h +++ b/sql/log.h @@ -1018,7 +1018,6 @@ public: */ void init_base(); void init_log_tables(); - bool flush_logs(THD *thd); bool flush_slow_log(); bool flush_general_log(); /* Perform basic logger cleanup. this will leave e.g. error log open. */ diff --git a/sql/log_event.cc b/sql/log_event.cc index c7cbff9c615..f1f9e65098d 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -11326,6 +11326,7 @@ Annotate_rows_log_event::Annotate_rows_log_event(THD *thd, : Log_event(thd, 0, using_trans), m_save_thd_query_txt(0), m_save_thd_query_len(0), + m_saved_thd_query(false), m_used_query_txt(0) { m_query_txt= thd->query(); @@ -11341,6 +11342,7 @@ Annotate_rows_log_event::Annotate_rows_log_event(const char *buf, : Log_event(buf, desc), m_save_thd_query_txt(0), m_save_thd_query_len(0), + m_saved_thd_query(false), m_used_query_txt(0) { m_query_len= event_len - desc->common_header_len; @@ -11351,7 +11353,7 @@ Annotate_rows_log_event::~Annotate_rows_log_event() { DBUG_ENTER("Annotate_rows_log_event::~Annotate_rows_log_event"); #ifndef MYSQL_CLIENT - if (m_save_thd_query_txt) + if (m_saved_thd_query) thd->set_query(m_save_thd_query_txt, m_save_thd_query_len); else if (m_used_query_txt) thd->reset_query(); @@ -11438,8 +11440,10 @@ void Annotate_rows_log_event::print(FILE *file, PRINT_EVENT_INFO *pinfo) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) int Annotate_rows_log_event::do_apply_event(rpl_group_info *rgi) { + rgi->free_annotate_event(); m_save_thd_query_txt= thd->query(); m_save_thd_query_len= thd->query_length(); + m_saved_thd_query= true; m_used_query_txt= 1; thd->set_query(m_query_txt, m_query_len); return 0; diff --git a/sql/log_event.h b/sql/log_event.h index e45151c8564..ccbc0527bd2 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3908,6 +3908,7 @@ private: uint m_query_len; char *m_save_thd_query_txt; uint m_save_thd_query_len; + bool m_saved_thd_query; bool m_used_query_txt; }; diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 93e7b869be0..448fc231b2b 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -835,7 +835,7 @@ struct rpl_group_info */ inline void set_annotate_event(Annotate_rows_log_event *event) { - free_annotate_event(); + DBUG_ASSERT(m_annotate_event == NULL); m_annotate_event= event; this->thd->variables.binlog_annotate_row_events= 1; } diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc index 1dded86c824..d76ee13a010 100644 --- a/sql/sql_cte.cc +++ b/sql/sql_cte.cc @@ -780,6 +780,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd, with_table->next_global= spec_tables; } res= &lex->unit; + res->set_with_clause(owner); lex->unit.include_down(with_table->select_lex); lex->unit.set_slave(with_select); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 4e71e792a08..0a146aeb12b 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -4842,8 +4842,7 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, my_error(ER_PARTITION_FUNCTION_FAILURE, MYF(0)); goto err; } - if ((flags & (HA_FAST_CHANGE_PARTITION | HA_PARTITION_ONE_PHASE)) != 0 && - !tab_part_info->has_default_partititon()) + if ((flags & (HA_FAST_CHANGE_PARTITION | HA_PARTITION_ONE_PHASE)) != 0) { /* "Fast" change of partitioning is supported in this case. diff --git a/sql/sql_select.cc b/sql/sql_select.cc index e6cfd923d05..47c03023faa 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -25044,7 +25044,7 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str, } else if (derived) { - if (!derived->derived->is_with_table()) + if (!is_with_table()) { // A derived table str->append('('); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 5bd423b6ac7..ddf3f4d1b07 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3856,7 +3856,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, if (key->type == Key::MULTIPLE) { /* not a critical problem */ - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_TOO_LONG_KEY, ER_THD(thd, ER_TOO_LONG_KEY), key_part_length); diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc index 9820bf983ca..42b7bc81261 100644 --- a/sql/wsrep_binlog.cc +++ b/sql/wsrep_binlog.cc @@ -329,9 +329,13 @@ void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len) } FILE *of= fopen(filename, "wb"); + if (of) { - fwrite (rbr_buf, buf_len, 1, of); + if (fwrite(rbr_buf, buf_len, 1, of) == 0) + WSREP_ERROR("Failed to write buffer of length %llu to '%s'", + (unsigned long long)buf_len, filename); + fclose(of); } else |