From 1337c429fb559242bcafb3ca29de65dfa48a89d5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 6 Aug 2007 23:16:01 +0200 Subject: CMakeLists.txt (many), win/README, mysql_manifest.cmake, configure.js: Additional changes for bug#29903 - Changed to do embedded build part as normal build, when WITH_EMBEDDED_SERVER is set. - Allow both normal and debug build with embedded. - Build static embedded library by pointing out all source and compile it all, i.e. not building libraries from libraries, not portable. - Let embedded use generated files from the "sql" directory, added dependencies to make sure built before embedded. - Mark library "dbug" in TARGET_LINK_LIBRARIES() with "debug", so only linked in when debug target is used. - Removed change of target name with "mysqld${MYSQLD_EXE_SUFFIX}", as others can't depend on it, not defined at configure time. Instead set the output file name. - Created work around for bug in CMake 2.4.6 and output names, to set the "mysqld.pdb" name to the same base name. - Set the correct manifest "name" (patch by iggy) CMakeLists.txt: Changes for embedded and Windows libmysql/CMakeLists.txt: Changes for embedded and Windows libmysqld/CMakeLists.txt: Changes for embedded and Windows libmysqld/examples/CMakeLists.txt: Changes for embedded and Windows mysys/CMakeLists.txt: Changes for embedded and Windows regex/CMakeLists.txt: Changes for embedded and Windows server-tools/instance-manager/CMakeLists.txt: Changes for embedded and Windows sql/CMakeLists.txt: Changes for embedded and Windows storage/archive/CMakeLists.txt: Changes for embedded and Windows storage/blackhole/CMakeLists.txt: Changes for embedded and Windows storage/csv/CMakeLists.txt: Changes for embedded and Windows storage/example/CMakeLists.txt: Changes for embedded and Windows storage/federated/CMakeLists.txt: Changes for embedded and Windows storage/heap/CMakeLists.txt: Changes for embedded and Windows storage/innobase/CMakeLists.txt: Changes for embedded and Windows storage/myisam/CMakeLists.txt: Changes for embedded and Windows storage/myisammrg/CMakeLists.txt: Changes for embedded and Windows strings/CMakeLists.txt: Changes for embedded and Windows vio/CMakeLists.txt: Changes for embedded and Windows win/README: Changes for embedded and Windows win/configure.js: Changes for embedded and Windows win/mysql_manifest.cmake: Changes for embedded and Windows --- sql/CMakeLists.txt | 107 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 45 deletions(-) (limited to 'sql') diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 1400c1487d0..a0c00e868e5 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -28,9 +28,9 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ) SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc - ${CMAKE_SOURCE_DIR}/sql/message.h - ${CMAKE_SOURCE_DIR}/sql/sql_yacc.h - ${CMAKE_SOURCE_DIR}/sql/sql_yacc.cc + ${CMAKE_SOURCE_DIR}/sql/message.h + ${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 @@ -41,8 +41,8 @@ SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc ADD_DEFINITIONS(-DMYSQL_SERVER -D_CONSOLE -DHAVE_DLOPEN) -ADD_EXECUTABLE(mysqld${MYSQLD_EXE_SUFFIX} - ../sql-common/client.c derror.cc des_key_file.cc +ADD_EXECUTABLE(mysqld + ../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 @@ -74,74 +74,91 @@ ADD_EXECUTABLE(mysqld${MYSQLD_EXE_SUFFIX} sql_tablespace.cc events.cc ../sql-common/my_user.c partition_info.cc rpl_utility.cc rpl_injector.cc sql_locale.cc rpl_rli.cc rpl_mi.cc sql_servers.cc - sql_connect.cc scheduler.cc + sql_connect.cc scheduler.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) -TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} - heap myisam myisammrg mysys yassl zlib debug dbug yassl + ${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) + +TARGET_LINK_LIBRARIES(mysqld + heap myisam myisammrg mysys yassl zlib debug dbug yassl taocrypt strings vio regex wsock32 ws2_32) +SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX}) + +# Work around for 2.4.6 bug, OUTPUT_NAME will not set the right .PDB +# file name. Note that COMPILE_FLAGS set some temporary pdb during build, +# LINK_FLAGS sets the real one. +SET_TARGET_PROPERTIES(mysqld PROPERTIES + COMPILE_FLAGS "/Fd${CMAKE_CFG_INTDIR}/mysqld${MYSQLD_EXE_SUFFIX}.pdb" + LINK_FLAGS "/PDB:${CMAKE_CFG_INTDIR}/mysqld${MYSQLD_EXE_SUFFIX}.pdb") + IF(EMBED_MANIFESTS) MYSQL_EMBED_MANIFEST("mysqld" "asInvoker") ENDIF(EMBED_MANIFESTS) IF(WITH_ARCHIVE_STORAGE_ENGINE) - TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} archive) + TARGET_LINK_LIBRARIES(mysqld archive) ENDIF(WITH_ARCHIVE_STORAGE_ENGINE) IF(WITH_BLACKHOLE_STORAGE_ENGINE) - TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} blackhole) + TARGET_LINK_LIBRARIES(mysqld blackhole) ENDIF(WITH_BLACKHOLE_STORAGE_ENGINE) IF(WITH_CSV_STORAGE_ENGINE) - TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} csv) + TARGET_LINK_LIBRARIES(mysqld csv) ENDIF(WITH_CSV_STORAGE_ENGINE) IF(WITH_EXAMPLE_STORAGE_ENGINE) - TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} example) + TARGET_LINK_LIBRARIES(mysqld example) ENDIF(WITH_EXAMPLE_STORAGE_ENGINE) IF(WITH_FEDERATED_STORAGE_ENGINE) - TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} federated) + TARGET_LINK_LIBRARIES(mysqld federated) ENDIF(WITH_FEDERATED_STORAGE_ENGINE) IF(WITH_INNOBASE_STORAGE_ENGINE) - TARGET_LINK_LIBRARIES(mysqld${MYSQLD_EXE_SUFFIX} innobase) + TARGET_LINK_LIBRARIES(mysqld innobase) ENDIF(WITH_INNOBASE_STORAGE_ENGINE) -ADD_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} GenError) +ADD_DEPENDENCIES(mysqld GenError) + +# NOTE CMake 2.4.6 creates strange dependencies between files in OUTPUT, +# so for now we only list one if more than one # Sql Parser custom command ADD_CUSTOM_COMMAND( - SOURCE ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy - OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc - COMMAND bison.exe ARGS -y -p MYSQL --defines=sql_yacc.h - --output=sql_yacc.cc sql_yacc.yy - DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy) + OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h +# ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc + COMMAND bison.exe ARGS -y -p MYSQL --defines=sql_yacc.h + --output=sql_yacc.cc sql_yacc.yy + DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.yy) -ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h - COMMAND echo - DEPENDS ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc -) - -# Windows message file -ADD_CUSTOM_COMMAND( - SOURCE message.mc - OUTPUT message.rc message.h - COMMAND mc ARGS message.mc - DEPENDS message.mc) +IF(WIN32) + # Windows message file + ADD_CUSTOM_COMMAND( + OUTPUT ${PROJECT_SOURCE_DIR}/sql/message.h +# ${PROJECT_SOURCE_DIR}/sql/message.rc + COMMAND mc ARGS message.mc + DEPENDS ${PROJECT_SOURCE_DIR}/sql/message.mc) +ENDIF(WIN32) # Gen_lex_hash ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc) -TARGET_LINK_LIBRARIES(gen_lex_hash dbug mysqlclient wsock32) +TARGET_LINK_LIBRARIES(gen_lex_hash debug dbug mysqlclient wsock32) 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_DEPENDENCIES(mysqld${MYSQLD_EXE_SUFFIX} gen_lex_hash) + 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 -- cgit v1.2.1 From 5d1e3bfa44d4f1c0101e3e575a60b4a7c53b0eb3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Aug 2007 23:20:21 +0300 Subject: Removed wrong call to my_time(), before my_init() has been called. --- sql/log_event.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/log_event.cc b/sql/log_event.cc index a65d759efa7..ef41443d173 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -456,7 +456,11 @@ Log_event::Log_event() thd(0) { server_id= ::server_id; - when= my_time(0); + /* + We can't call my_time() here as this would cause a call before + my_init() is called + */ + when= 0; log_pos= 0; } #endif /* !MYSQL_CLIENT */ @@ -687,6 +691,9 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length) log_pos= my_b_safe_tell(file)+data_written; } + /* Set time of we this isn't a query */ + if (!when) + when= current_thd->start_time; /* Header will be of size LOG_EVENT_HEADER_LEN for all events, except for FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT, where it will be -- cgit v1.2.1 From 3f8a904fad73d7e39a16d1f6fb0ccf0d0cfc6b9d Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Aug 2007 16:50:43 +0300 Subject: BUG#30274 (Debug server crashes because mutex isn't initialized): Completion patch, since it is possible that Log_event::write_header() is called with no current thread. When starting the server, there is no thread available, but MYSQL_BIN_LOG::open() is called to initialize the binary log. The function writes a format description log event to the binary log, which means that Log_event::write_header() can be called with no current thread object available. sql/log_event.cc: Since Log_event::write_header() can be called from inside init_server_components(), it is possible that thd is NULL. In this case, we set the time of the event to the current time instead of the start time of the query. --- sql/log_event.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'sql') diff --git a/sql/log_event.cc b/sql/log_event.cc index ef41443d173..e3b47f35162 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -691,9 +691,19 @@ bool Log_event::write_header(IO_CACHE* file, ulong event_data_length) log_pos= my_b_safe_tell(file)+data_written; } - /* Set time of we this isn't a query */ + /* + Set time of when to when the query started. Since this function is + called from init_server_components() as well, it might be that the + current thread is not defined. In that case, we take the current + time instead. It is safe to call my_time() here since the first + time this line is reached is through the init_server_components() + call, which is after the my_init() call in the main() function (or + it's replacement, for some platforms). + */ + THD *thd= current_thd; if (!when) - when= current_thd->start_time; + when= thd ? thd->start_time : my_time(0); + /* Header will be of size LOG_EVENT_HEADER_LEN for all events, except for FORMAT_DESCRIPTION_EVENT and ROTATE_EVENT, where it will be -- cgit v1.2.1 From fb3d3bd56da17fee4c6b525f0a2f2a884ae3ce1f Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Aug 2007 19:57:14 +0500 Subject: fill_schema_table_from_frm() function uses get_table_share() function which is faster than open_table_def() func. This patch fixes the porblem with information_schema test timeout. sql/unireg.h: added description of flags --- sql/sql_show.cc | 89 +++++++++++++++++++++++++++++++++++---------------------- sql/unireg.h | 39 +++++++++++++++++++++---- 2 files changed, 89 insertions(+), 39 deletions(-) (limited to 'sql') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 5a1619aa5cf..76146dc61ae 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2952,49 +2952,70 @@ static int fill_schema_table_from_frm(THD *thd,TABLE *table, LEX_STRING *table_name, enum enum_schema_tables schema_table_idx) { - TABLE_SHARE share; + TABLE_SHARE *share; TABLE tbl; TABLE_LIST table_list; - char path[FN_REFLEN]; - uint res; + uint res= 0; + int error; + char key[MAX_DBKEY_LENGTH]; + uint key_length; + bzero((char*) &table_list, sizeof(TABLE_LIST)); bzero((char*) &tbl, sizeof(TABLE)); - (void) build_table_filename(path, sizeof(path), db_name->str, - table_name->str, "", 0); - init_tmp_table_share(&share, "", 0, "", path); - if (!(res= open_table_def(thd, &share, OPEN_VIEW))) + + table_list.table_name= table_name->str; + table_list.db= db_name->str; + key_length= create_table_def_key(thd, key, &table_list, 0); + pthread_mutex_lock(&LOCK_open); + share= get_table_share(thd, &table_list, key, + key_length, OPEN_VIEW, &error); + if (!share) { - share.tmp_table= NO_TMP_TABLE; - tbl.s= &share; - table_list.table= &tbl; - if (schema_table->i_s_requested_object & OPEN_TABLE_FROM_SHARE) + res= 0; + goto err; + } + + if (share->is_view) + { + if (schema_table->i_s_requested_object & OPEN_TABLE_ONLY) { - if (share.is_view || - open_table_from_share(thd, &share, table_name->str, 0, - (READ_KEYINFO | COMPUTE_TYPES | - EXTRA_RECORD | OPEN_FRM_FILE_ONLY), - thd->open_options, &tbl, FALSE)) - { - share.tmp_table= INTERNAL_TMP_TABLE; - free_table_share(&share); - return (share.is_view && - !(schema_table->i_s_requested_object & - ~(OPEN_TABLE_FROM_SHARE|OPTIMIZE_I_S_TABLE))); - } + /* skip view processing */ + res= 0; + goto err1; + } + else if (schema_table->i_s_requested_object & OPEN_VIEW_FULL) + { + /* + tell get_all_tables() to fall back to + open_normal_and_derived_tables() + */ + res= 1; + goto err1; } - table_list.view= (st_lex*) share.is_view; + } + + if (share->is_view || + !open_table_from_share(thd, share, table_name->str, 0, + (READ_KEYINFO | COMPUTE_TYPES | + EXTRA_RECORD | OPEN_FRM_FILE_ONLY), + thd->open_options, &tbl, FALSE)) + { + tbl.s= share; + table_list.table= &tbl; + table_list.view= (st_lex*) share->is_view; res= schema_table->process_table(thd, &table_list, table, res, db_name, table_name); - share.tmp_table= INTERNAL_TMP_TABLE; - if (schema_table->i_s_requested_object & OPEN_TABLE_FROM_SHARE) - closefrm(&tbl, true); - else - free_table_share(&share); + closefrm(&tbl, true); + goto err; } - if (res) - thd->clear_error(); - return 0; +err1: + release_table_share(share, RELEASE_NORMAL); + +err: + pthread_mutex_unlock(&LOCK_open); + thd->clear_error(); + return res; } @@ -6398,7 +6419,7 @@ ST_SCHEMA_TABLE schema_tables[]= create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1, 0, 0}, {"COLUMNS", columns_fields_info, create_schema_table, get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0, - OPEN_TABLE_FROM_SHARE|OPTIMIZE_I_S_TABLE}, + OPTIMIZE_I_S_TABLE|OPEN_VIEW_FULL}, {"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table, fill_schema_column_privileges, 0, 0, -1, -1, 0, 0}, {"ENGINES", engines_fields_info, create_schema_table, @@ -6437,7 +6458,7 @@ ST_SCHEMA_TABLE schema_tables[]= fill_variables, make_old_format, 0, -1, -1, 0, 0}, {"STATISTICS", stat_fields_info, create_schema_table, get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0, - OPEN_TABLE_ONLY|OPEN_TABLE_FROM_SHARE|OPTIMIZE_I_S_TABLE}, + OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE}, {"STATUS", variables_fields_info, create_schema_table, fill_status, make_old_format, 0, -1, -1, 1, 0}, {"TABLES", tables_fields_info, create_schema_table, diff --git a/sql/unireg.h b/sql/unireg.h index 232ea5e70e7..c4e53160d74 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -153,11 +153,40 @@ #define OPEN_VIEW 8192 /* Allow open on view */ #define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view, but do not parse view itself */ -#define OPEN_FRM_FILE_ONLY 32768 /* Open frm file only */ -#define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2 /* Open view only */ -#define OPEN_VIEW_ONLY OPEN_TABLE_ONLY*2 /* Open table only */ -#define OPEN_TABLE_FROM_SHARE OPEN_VIEW_ONLY*2 /* For I_S tables*/ -#define OPTIMIZE_I_S_TABLE OPEN_TABLE_FROM_SHARE*2 /* For I_S tables*/ +/* + This flag is used in function get_all_tables() which fills + I_S tables with data which are retrieved from frm files and storage engine + The flag means that we need to open FRM file only to get necessary data. +*/ +#define OPEN_FRM_FILE_ONLY 32768 +/* + This flag is used in function get_all_tables() which fills + I_S tables with data which are retrieved from frm files and storage engine + The flag means that we need to process tables only to get necessary data. + Views are not processed. +*/ +#define OPEN_TABLE_ONLY OPEN_FRM_FILE_ONLY*2 +/* + This flag is used in function get_all_tables() which fills + I_S tables with data which are retrieved from frm files and storage engine + The flag means that we need to process views only to get necessary data. + Tables are not processed. +*/ +#define OPEN_VIEW_ONLY OPEN_TABLE_ONLY*2 +/* + This flag is used in function get_all_tables() which fills + I_S tables with data which are retrieved from frm files and storage engine. + The flag means that we need to open a view using + open_normal_and_derived_tables() function. +*/ +#define OPEN_VIEW_FULL OPEN_VIEW_ONLY*2 +/* + This flag is used in function get_all_tables() which fills + I_S tables with data which are retrieved from frm files and storage engine. + The flag means that I_S table uses optimization algorithm. +*/ +#define OPTIMIZE_I_S_TABLE OPEN_VIEW_FULL*2 + #define SC_INFO_LENGTH 4 /* Form format constant */ #define TE_INFO_LENGTH 3 #define MTYP_NOEMPTY_BIT 128 -- cgit v1.2.1 From 4144c0322d4dbb56a1a20176690226bfdd6c7cdb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Aug 2007 20:41:26 +0500 Subject: Bug#30310 wrong result on SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE .. 1. added check to fill_schema_schemata() func. if we have db lookup value we should check that db exists 2. added check to get_all_tables() func if we have lookup db name or tables name values we shoud check that these values are not empty strings 3. fixed typo mysql-test/r/information_schema.result: test result mysql-test/t/information_schema.test: test case --- sql/sql_show.cc | 54 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 43 insertions(+), 11 deletions(-) (limited to 'sql') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 76146dc61ae..79e83884a3c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3054,7 +3054,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) enum enum_schema_tables schema_table_idx; List db_names; List_iterator_fast it(db_names); - COND *partial_cond; + COND *partial_cond= 0; uint derived_tables= lex->derived_tables; int error= 1; Open_tables_state open_tables_state_backup; @@ -3093,20 +3093,35 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'", lookup_field_vals.db_value.str, lookup_field_vals.table_value.str)); - if (lookup_field_vals.db_value.length && - !lookup_field_vals.wild_db_value && - lookup_field_vals.table_value.length && - !lookup_field_vals.wild_table_value) - partial_cond= 0; - else - partial_cond= make_cond_for_info_schema(cond, tables); - if (lookup_field_vals.db_value.length && !lookup_field_vals.wild_db_value) + if (!lookup_field_vals.wild_db_value && !lookup_field_vals.wild_table_value) + { + /* + if lookup value is empty string then + it's impossible table name or db name + */ + if (lookup_field_vals.db_value.str && + !lookup_field_vals.db_value.str[0] || + lookup_field_vals.table_value.str && + !lookup_field_vals.table_value.str[0]) + { + error= 0; + goto err; + } + } + + if (lookup_field_vals.db_value.length && + !lookup_field_vals.wild_db_value) tables->has_db_lookup_value= TRUE; if (lookup_field_vals.table_value.length && !lookup_field_vals.wild_table_value) tables->has_table_lookup_value= TRUE; + if (tables->has_db_lookup_value && tables->has_table_lookup_value) + partial_cond= 0; + else + partial_cond= make_cond_for_info_schema(cond, tables); + tables->table_open_method= table_open_method= get_table_open_method(tables, schema_table, schema_table_idx); @@ -3271,7 +3286,7 @@ bool store_schema_shemata(THD* thd, TABLE *table, LEX_STRING *db_name, } -int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond) +int fill_schema_schemata(THD *thd, TABLE_LIST *tables, COND *cond) { /* TODO: fill_schema_shemata() is called when new client is connected. @@ -3297,6 +3312,23 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond) &with_i_schema)) DBUG_RETURN(1); + /* + If we have lookup db value we should check that the database exists + */ + if(lookup_field_vals.db_value.str && !lookup_field_vals.wild_db_value) + { + char path[FN_REFLEN+16]; + uint path_len; + MY_STAT stat_info; + if (!lookup_field_vals.db_value.str[0]) + DBUG_RETURN(0); + path_len= build_table_filename(path, sizeof(path), + lookup_field_vals.db_value.str, "", "", 0); + path[path_len-1]= 0; + if (!my_stat(path,&stat_info,MYF(0))) + DBUG_RETURN(0); + } + List_iterator_fast it(db_names); while ((db_name=it++)) { @@ -6449,7 +6481,7 @@ ST_SCHEMA_TABLE schema_tables[]= {"ROUTINES", proc_fields_info, create_schema_table, fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, 0}, {"SCHEMATA", schema_fields_info, create_schema_table, - fill_schema_shemata, make_schemata_old_format, 0, 1, -1, 0, 0}, + fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0}, {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table, fill_schema_schema_privileges, 0, 0, -1, -1, 0, 0}, {"SESSION_STATUS", variables_fields_info, create_schema_table, -- cgit v1.2.1 From 1c47af79da738cbba009d2801da0cfb8ee45a3da Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Aug 2007 22:05:56 +0500 Subject: Bug#30322 Server crashes on selecting from i_s.columns when cluster is running -regression disable partition processing if we open frm file only mysql-test/suite/ndb/r/ndb_dd_basic.result: test result mysql-test/suite/ndb/t/ndb_dd_basic.test: test case sql/table.cc: disable partition processing if we open frm file only --- sql/table.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql') diff --git a/sql/table.cc b/sql/table.cc index 12fffe1dde7..53f32355923 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1750,7 +1750,7 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias, } #ifdef WITH_PARTITION_STORAGE_ENGINE - if (share->partition_info_len) + if (share->partition_info_len && outparam->file) { /* In this execution we must avoid calling thd->change_item_tree since -- cgit v1.2.1 From 57e4f87d4a4033e91b60fb0dea3422aa571eb894 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 22 Aug 2007 17:25:31 +0200 Subject: Correct an erroneous manual merge. sql/sql_yacc.yy: Correct an erroneous manual merge, which had brought a duplicate line - remove one. --- sql/sql_yacc.yy | 1 - 1 file changed, 1 deletion(-) (limited to 'sql') diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8c3ad9a6300..88d8c4346ec 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4581,7 +4581,6 @@ row_types: | DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; } | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; } | REDUNDANT_SYM { $$= ROW_TYPE_REDUNDANT; } - | COMPACT_SYM { $$= ROW_TYPE_COMPACT; } | COMPACT_SYM { $$= ROW_TYPE_COMPACT; } | PAGE_SYM { $$= ROW_TYPE_PAGE; } ; -- cgit v1.2.1 From 9e72aacf10de9831b16a3361f5c15146a32171e9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 23 Aug 2007 16:13:21 +0200 Subject: BUG#30017 log-slave-updates incorrect behavior for cluster - let the receiving injector thread decide what to do (recommit for 5.1.22 target) sql/ha_ndbcluster.cc: BUG#30017 log-slave-updates incorrect behavior for cluster - let the receiving injector thread decide what to do sql/ha_ndbcluster_binlog.cc: BUG#30017 log-slave-updates incorrect behavior for cluster - let the receiving injector thread decide what to do --- sql/ha_ndbcluster.cc | 50 +++++++++++++++++++++++++++++++++------------ sql/ha_ndbcluster_binlog.cc | 13 ++++++++++++ 2 files changed, 50 insertions(+), 13 deletions(-) (limited to 'sql') diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 3b68b3828d2..be19e891e57 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -2812,11 +2812,17 @@ int ha_ndbcluster::write_row(uchar *record) if (unlikely(m_slow_path)) { + /* + ignore TNTO_NO_LOGGING for slave thd. It is used to indicate + log-slave-updates option. This is instead handled in the + injector thread, by looking explicitly at the + opt_log_slave_updates flag. + */ Thd_ndb *thd_ndb= get_thd_ndb(thd); - if (thd_ndb->trans_options & TNTO_NO_LOGGING) - op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); - else if (thd->slave_thread) + if (thd->slave_thread) op->setAnyValue(thd->server_id); + else if (thd_ndb->trans_options & TNTO_NO_LOGGING) + op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); } m_rows_changed++; @@ -3102,11 +3108,17 @@ int ha_ndbcluster::update_row(const uchar *old_data, uchar *new_data) if (unlikely(m_slow_path)) { + /* + ignore TNTO_NO_LOGGING for slave thd. It is used to indicate + log-slave-updates option. This is instead handled in the + injector thread, by looking explicitly at the + opt_log_slave_updates flag. + */ Thd_ndb *thd_ndb= get_thd_ndb(thd); - if (thd_ndb->trans_options & TNTO_NO_LOGGING) - op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); - else if (thd->slave_thread) + if (thd->slave_thread) op->setAnyValue(thd->server_id); + else if (thd_ndb->trans_options & TNTO_NO_LOGGING) + op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); } /* Execute update operation if we are not doing a scan for update @@ -3170,13 +3182,19 @@ int ha_ndbcluster::delete_row(const uchar *record) if (unlikely(m_slow_path)) { + /* + ignore TNTO_NO_LOGGING for slave thd. It is used to indicate + log-slave-updates option. This is instead handled in the + injector thread, by looking explicitly at the + opt_log_slave_updates flag. + */ Thd_ndb *thd_ndb= get_thd_ndb(thd); - if (thd_ndb->trans_options & TNTO_NO_LOGGING) - ((NdbOperation *)trans->getLastDefinedOperation())-> - setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); - else if (thd->slave_thread) + if (thd->slave_thread) ((NdbOperation *)trans->getLastDefinedOperation())-> setAnyValue(thd->server_id); + else if (thd_ndb->trans_options & TNTO_NO_LOGGING) + ((NdbOperation *)trans->getLastDefinedOperation())-> + setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); } if (!(m_primary_key_update || m_delete_cannot_batch)) // If deleting from cursor, NoCommit will be handled in next_result @@ -3210,11 +3228,17 @@ int ha_ndbcluster::delete_row(const uchar *record) if (unlikely(m_slow_path)) { + /* + ignore TNTO_NO_LOGGING for slave thd. It is used to indicate + log-slave-updates option. This is instead handled in the + injector thread, by looking explicitly at the + opt_log_slave_updates flag. + */ Thd_ndb *thd_ndb= get_thd_ndb(thd); - if (thd_ndb->trans_options & TNTO_NO_LOGGING) - op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); - else if (thd->slave_thread) + if (thd->slave_thread) op->setAnyValue(thd->server_id); + else if (thd_ndb->trans_options & TNTO_NO_LOGGING) + op->setAnyValue(NDB_ANYVALUE_FOR_NOLOGGING); } } diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index c91faac388f..468adba0aa0 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -114,6 +114,9 @@ NDB_SHARE *ndb_apply_status_share= 0; NDB_SHARE *ndb_schema_share= 0; pthread_mutex_t ndb_schema_share_mutex; +extern my_bool opt_log_slave_updates; +static my_bool g_ndb_log_slave_updates; + /* Schema object distribution handling */ HASH ndb_schema_objects; typedef struct st_ndb_schema_object { @@ -3296,6 +3299,14 @@ ndb_binlog_thread_handle_data_event(Ndb *ndb, NdbEventOperation *pOp, originating_server_id); return 0; } + else if (!g_ndb_log_slave_updates) + { + /* + This event comes from a slave applier since it has an originating + server id set. Since option to log slave updates is not set, skip it. + */ + return 0; + } TABLE *table= share->table; DBUG_ASSERT(trans.good()); @@ -3942,6 +3953,8 @@ restart: ! IS_NDB_BLOB_PREFIX(pOp->getEvent()->getTable()->getName())); DBUG_ASSERT(gci <= ndb_latest_received_binlog_epoch); + /* initialize some variables for this epoch */ + g_ndb_log_slave_updates= opt_log_slave_updates; i_ndb-> setReportThreshEventGCISlip(ndb_report_thresh_binlog_epoch_slip); i_ndb->setReportThreshEventFreeMem(ndb_report_thresh_binlog_mem_usage); -- cgit v1.2.1